Repository navigation
fix(rules): QRY-013 head entity, nil metadata for derived facts, UDFs in rule or branches (#548 PR 1) - #668
Merged
Merged
Conversation
… in rule or branches (#548) PR 1 of 3 for #548 (streaming engine 6/9), spec §4, so both engines give one answer for rule queries: - A rule head whose entity is not a ref or keyword fails with the new QRY-013 on every path (was INT-022 on positive rules; the not/or path dropped the row). The mixed pass propagates INT-022 for an unbound head variable too. - Derived facts are loaded with tx-count 0 (no stored fact has it), and a per-fact pseudo-attribute reading one binds nil. FactStorage::transact is now test-only. - or/or-join branches in rule bodies get the database's function registry. Adds the implementation plan docs/superpowers/plans/2026-10-20-548-recursive.md. Tests: 1687 total (1677 passing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
5 tasks
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.
PR 1 of 3 for #548 (streaming engine part 6 of 9 of #473). It makes the executor changes in spec §4 (
docs/superpowers/specs/2026-10-20-recursive-engine-design.md), so that both engines give one answer when PR 2 moves rule queries onto the engine. It also commits the implementation plan,docs/superpowers/plans/2026-10-20-548-recursive.md.Changes
QRY-013rule head entity is not an entity (newErrorCode, row and section inERROR_REFERENCE.md). A head whose entity is a string, number, boolean,nilor bare symbol fails on every path: positive rules (these raisedINT-022), magic sets, andnot/not-join/orrules (these silently dropped the row). The mixed pass now propagatesinstantiate_head's error, so an unbound head variable isINT-022there too.QRY-012stays reserved for streaming engine 7/9: memory accounting and optional cap (QRY-012) (#473) #549.load_fact(s)instead oftransact); no stored fact has tx-count 0 (the counter starts at 1 andLogWriterrejects 0).PatternMatcher::metadatabindsnilfor them.FactStorage::transacthas no non-test caller left and is now#[cfg(test)].or/or-joinbranches in rule bodies get the database'sFunctionRegistryinstead of the built-ins only.nilis decided, theQRY-013text, error propagation, the registry guard).Breaking (v3.0.0)
INT-022, or dropped rows, for a non-entity head now raisesQRY-013. Anot/orrule with an unbound head variable now raisesINT-022.nil. The old values were the evaluator's working values and had no meaning.The UniFFI bindings need regenerating for the new
ErrorCodevariant. Binding PRs follow after merge.Tests
tests/recursive_rules_test.rs: 5 new tests. 4 of them fail onorigin/v3; the keyword/ref head test guards against a regression. There is also a unit test,test_head_entity_must_be_an_entity. Total 1687 (1677 passing, 10 ignored).--features test-oraclepasses. Clippy (default, all features, wasm32) is clean. Codex review found no correctness issues; its one test-quality nit is fixed.No closing keyword: #548 is closed by hand after PR 3. A docs-site PR follows.
🤖 Generated with Claude Code
https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT