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
A pseudo-attribute in a rule body reads the rule evaluator's copy of the fact #661
A per-fact pseudo-attribute (:db/valid-from, :db/valid-to, :db/tx-count, :db/tx-id) in the body of a rule without not / not-join / or / or-join returns the metadata of the rule evaluator's working copy of the fact, not the stored fact:
The same pattern outside a rule ([?x :edge ?y] [?x :db/valid-from ?vf]) returns the stored values. A rule with a not (or another mixed clause) in its body also returns the stored values.
Affected: every release from v0.15.0 (temporal metadata bindings) through v2.0.8, and v3.
Cause:RecursiveEvaluator::evaluate_recursive_rules copies the base facts into a new FactStorage with transact, one fact per call, so every copy gets a new tx_id and tx_count, valid_from = the evaluation time and valid_to = forever. Positive rule bodies are matched against that copy. StratifiedEvaluator's mixed-rule pass matches against load_fact copies, which keep the metadata.
Workaround: put the pseudo-attribute in the query body instead of a rule body, or add a mixed clause that never excludes a row.
Fix
Rule bodies read the stored fact's metadata, on v3 (as part of moving rule queries to the streaming engine, #548, with an executor fix so the oracle agrees) and on main for a v2.0.x patch.
Activity
fix(rules): a pseudo-attribute in a rule body reads the stored fact (#…
adityamukho commentedon Oct 20, 2026
Fixed on
mainby #666 (squash); v3 fix in #665. Stays open until the v2.0.x patch is released.Merge pull request #665 from project-minigraf/fix/661-rule-pseudo-attrs
adityamukho commentedon Oct 20, 2026
v3 fix merged in #665. Stays open until the v2.0.x patch with #666 is released.
release: v2.0.9
adityamukho commentedon Oct 21, 2026
Fixed in v2.0.9 (released 2026-10-21, on crates.io) and in v3.0.0. Listed under "Fixed in v2.0.9" in #421.