You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
check: MDL047 and the reference check read Assoc.Attr in an access-rule XPath as one association name and suggest a wrong fix #1916
An access rule constraint that joins an association and an attribute with a dot instead of a path step:
grant read *on entity Repro.Car to Repro.Rwhere [Car_Assignment.ReturnedOn= empty];
mxcli check (v0.32.0, -p on a Mendix 11.16.0 project) reports MDL047 and suggests:
✗ access rule on Repro.Car: the constraint tests association `Car_Assignment.ReturnedOn = empty`, which Mendix XPath does not support (CE0161 "Error(s) in XPath constraint") — `empty` compares attributes, not associations [MDL047]
→ Test for the absence of the associated object with negation: `[not(Car_Assignment.ReturnedOn/<Module.TargetEntity>)]`.
and the reference check says:
statement 6: grant on entity Repro.Car to Repro.R: the access rule's constraint names association "Car_Assignment.ReturnedOn", which is neither an attribute nor an association of Repro.Car
Both read Car_Assignment.ReturnedOn as one association name. The suggested fix keeps the dotted name and adds a target-entity step after it, so it is still wrong: ReturnedOn is an attribute of Repro.Assignment, and what is missing is the entity step between the association and the attribute.
The working forms (both pass check):
where [Repro.Car_Assignment/Repro.Assignment/ReturnedOn = empty]
where [Repro.Car_Assignment/Repro.Assignment[ReturnedOn = empty]]
Why it matters
An agent writing MDL followed the MDL047 suggestion and the reference error for about 40 minutes (about ten throwaway scratch modules, the same two messages each time) without finding the missing entity step. Neither message says that a path needs association/Entity/attribute.
Expected
When a constraint step is <association>.<name> where <association> exists on the entity and <name> is an attribute of the association's other end, report that a path step is missing and suggest [<Module.Association>/<Module.OtherEntity>/<attribute> ...], rather than the not(...) absence form, which fits only [Association = empty].
Activity