Repository navigation
feat(query): magic sets rewriting for demand-driven recursive rule evaluation (#289) - #291
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove unused EdnValue and WhereClause imports from scaffold; they will be added in Task 2 when implementing adornment classification. Keep HashMap and HashSet imports with allow(unused_imports) since they'll be used in Task 2. Add #[allow(dead_code)] to rewrite() which isn't called until integration in Task 7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…magic_guard (#289) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
) - Add debug_assert_eq! to catch adornment/arity mismatch before silent filter_map drop - Replace {:?} WhereClause debug format in test panic arms (CodeQL rust/cleartext-logging) - Add inline comment explaining i+1 offset for predicate-name-skipping in head args Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…propagation_rules (#289) - Fix 1: head now includes ALL bound args (not just first) for multi-bound adornments like bb - Fix 2: skip all-free adorned predicates to avoid emitting malformed propagation rules - Fix 3: rename inner loop variable `i` to `pos` to avoid shadowing outer loop's `i` - Fix 4: add test_propagation_rule_bb_adornment verifying 3-element head for bb adornment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements propagate_adornments() for fixed-point adornment propagation through mutually-recursive SCCs, build_rewritten_registry() to assemble the magic-transformed rule set, and replaces the rewrite() stub with the full implementation. Adds 3 new unit tests (16 total, all passing). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
#289) - Fix indexing_slicing: replace &rule.body[..i] with rule.body.iter().take(i) - Add first-writer-wins comment in propagate_adornments for multi-call-site clarity - Fix three collapsible_if warnings using let-chain syntax - Remove spurious #[allow(dead_code)] from make_rule test helper - Add test_rewritten_registry_has_magic_guard_in_rules for guard injection coverage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Also guard against all-bound (bb) adornments in rewrite() — the magic-guard encoding does not support multi-bound seed facts, and fully-bound queries gain nothing from magic sets; return None to fall through to the regular evaluator unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…289) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Five tests covering bound-start transitive closure, all-free closure, subset correctness, multi-hop recursion, and mutual recursion (even/odd distance) — asserting magic sets rewriting never changes query results. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… test (#289) Remove {:?} on Value in extract_refs (CodeQL rust/cleartext-logging); add two missing negative assertions for n2/n4 in test_mutual_recursion_even_odd_distance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/query/datalog/magic_sets.rsmoduleexecute_query_with_rulesinexecutor.rs— zero overhead for all-free queries (returnsNone, no registry copy)not/not-joinare left untouched; negation extension deferred to §9.6 in ROADMAPTest Plan
magic_sets.rscovering adornment classification, seed fact generation, guard injection, propagation rules, SCC propagation, and the fullrewrite()entry pointtests/magic_sets_test.rsasserting result correctness (transitive closure with bound start, all-free closure, bound ⊆ all-free subset check, multi-hop recursion, mutual even/odd recursion)🤖 Generated with Claude Code