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: magic sets rewriting rejects intermediate variables when first rule arg is bound by literal keyword #297
In v1.2.0, the magic sets rewriting introduced in #289 incorrectly rejects queries where a rule's first argument is bound by a literal keyword at the call site and the rule body contains an intermediate variable (one that appears only in the body, not in the rule head).
The error Unbound variable in rule head: ?mid is incorrect — ?mid is a valid intermediate (existential) variable in the rule body; it does not need to appear in the head.
Affected versions
Introduced in v1.2.0 (magic sets rewriting, #289). v1.1.1 is not affected.
Workaround
Look up the target entity via a fact pattern and pass the bound variable into the rule:
[?a :some/attr "value"]
(reach ?a ?y)
Impact
Breaks all recursive rule queries where the starting entity is given as a literal keyword, including the reports-to, transfer-chain, and reachable examples in minigraf-playground (steps o3-s2, o3-s3, sl3-s3, t3-s3).
Reopening. This still fails in @minigraf/browser 2.0.1.
The fix in #300 covers the repro above, where the recursive rule body uses a plain fact pattern. That case now works. It still fails when the recursive rule body calls another user-defined rule instead of a fact pattern.
minigraf-playground steps sl3-s3 (transfer-chain over transfer-link) and t3-s3 (reachable over same-line) still need the pattern-bind workaround. The org-chart steps (o3-s2, o3-s3) recurse over a plain fact pattern, and those now work with a literal keyword. See project-minigraf/minigraf-playground#40.
Activity
Merge pull request #300 from project-minigraf/worktree-fix+magic-sets…
chore: bump version to 1.2.1
adityamukho commentedon Sep 26, 2026
Reopening. This still fails in
@minigraf/browser2.0.1.The fix in #300 covers the repro above, where the recursive rule body uses a plain fact pattern. That case now works. It still fails when the recursive rule body calls another user-defined rule instead of a fact pattern.
Repro (2.0.1)
I get the same error on 1.2.0 and on 2.0.1.
Impact
minigraf-playground steps sl3-s3 (
transfer-chainovertransfer-link) and t3-s3 (reachableoversame-line) still need the pattern-bind workaround. The org-chart steps (o3-s2, o3-s3) recurse over a plain fact pattern, and those now work with a literal keyword. See project-minigraf/minigraf-playground#40.Generated by Claude Code
fix(magic-sets): keep preceding rule calls in magic propagation rules (…
Merge pull request #412 from project-minigraf/merge/main-into-v3
release: v2.0.2 — final planned v2.x release