Filters not working when using them with variables in an upsert

Hello there!, I am trying to build an upsert in which query, I assign variables to the results of filtered edges. I am still getting edges that must be avoided by the filter.

upsert {
    query {
        finPer(func: uid(0x12c568)) {
            canRead @filter(has(did)) {
                userCr as uid
            }
        }

        perspective(func:eq(xid, "zid999"))  {
            per as accessConfig.permissions
        }    
    }

    mutation {
       set {
           uid(per) <canRead> uid(userCr) .
       }
    }
}

If an edge lacks of the did index it must be ignored, yet, the filter brings all edges, despite the lack of the index.

I might be doing something wrong over here and would appreciate a lot any advice. Thanks!

if you use has func it will return nodes* that have any value on that edge. In this case, for sure the nodes returning have the “did” predicate with an empty string or some value. Has func won’t return nodes who don’t have the “did” predicate.

But anyway, I wasn’t totally able to get the whole issue.

The issue focuses on canRead @filter(has(did)), if I filter this on a simple query, which would be a transaction not an upsert, let’s suppose we have only the following:

query {
        finPer(func: uid(0x12c568)) {
            canRead @filter(has(did)) {
                uid
            }
        }
}

The filter works, but it doesn’t if I assign a variable, as shown in the previous example. I understand that it will return nodes if the did predicate still have an empty string but seems like it is doing the filtering during a simple query, I guess that there might be something wrong with my upsert.