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
bug: literal keyword bound in rule call resolves as entity UUID, silently mismatches keyword values in rule body #298
In v1.2.0, when a literal keyword is used to bind a rule argument at the call site, it is resolved to its entity UUID. If that bound variable is then used in a value position within the rule body, it silently fails to match stored Value::Keyword facts — returning empty results instead of the expected matches.
Reproduction
(transact [[:bob :employee/manager :alice]])
(transact [[:carol :employee/manager :alice]])
(rule [(reports-to ?emp ?mgr) [?emp :employee/manager ?mgr]])
; Direct query — works correctly:
(query [:find ?emp :where [?emp :employee/manager :alice]])
; → returns bob and carol
; Rule with literal in body — works:
(rule [(manages ?emp) [?emp :employee/manager :alice]])
(query [:find ?emp :where (manages ?emp)])
; → returns bob and carol
; Rule with variable bound at call site — silently returns empty:
(query [:find ?emp :where (reports-to ?emp :alice)])
; → {"results":[],"variables":["?emp"]} ← BUG: should return bob and carol
Root cause hypothesis
When :alice is used in the rule call (reports-to ?emp :alice), it appears to be resolved as an entity UUID (as if it were in entity position). The rule body [?emp :employee/manager ?mgr] then tries to match against stored facts where :employee/manager values are Value::Keyword(":alice"). The UUID doesn't match the keyword — hence empty results.
Direct queries handle this correctly; the bug is specific to bound variable propagation from rule call sites into rule body value-position patterns.
Activity
Merge pull request #300 from project-minigraf/worktree-fix+magic-sets…
chore: bump version to 1.2.1