Leafref and cli-compact-sytax behavior

list a {
key a1;
leaf a1 {
type string;
container a2 {
leaf a3 {
type uint32;

leaf b {
leafref {
path “…/…/a/a1”;

Here this leafref works perfectly for ‘/a[a1=“xyz”]’ but fails for an extended version of the same list entry like “/a[a1 =“xyz”]/a2/a3”.

Perhaps I am missing something here. Should the leafref path be more definitive to make it work for both the cases?

Can you describe the expected behaviour?
See also https://tools.ietf.org/html/rfc7950#section-9.9.6