Repository navigation
fix(query): count only derived facts against max_results (#528, v2.x backport) - #538
Merged
Merged
Conversation
Backport of the v3 fix (#534) to v2.x. RecursiveEvaluator seeded seen_facts with every base fact and compared its size with max_results, so on a database with max_results (default 1,000,000) live facts every rule query failed with INT-020 at its first derived fact, whatever the size of its answer. The limit now counts only the facts the rules derive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 11, 2026
Merged
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.
Backport of #534 (v3) to v2.x.
RecursiveEvaluator::evaluateseededseen_factswith every base fact and compared its size withmax_results. Once a database heldmax_resultslive facts (default 1,000,000), every rule query failed withINT-020at its first derived fact, whatever the size of its answer. The limit now counts only the facts the rules derive.This is not a data-integrity fix: the query fails loudly and no data is affected. It is backported because PHILOSOPHY.md §7 lists the latest 2.0.x minor as getting all bug fixes until v3.0.0 ships.
Changes (same as the v3 commit, minus the v3-only BENCHMARKS/README envelope numbers):
src/query/datalog/evaluator.rs: compareseen_facts.len() - base_countwithmax_resultssrc/db.rs,docs/ERROR_REFERENCE.md(INT-020): document that the database's own facts do not counttests/recursive_rules_test.rs: rule queries on a database with more live facts thanmax_resultsreturn their answer, and the limit still stops a rule that derives too much (fails without the fix)Refs #528. After the release that ships this, #528 can be removed from the v2.x list in #421.
🤖 Generated with Claude Code
https://claude.ai/code/session_012wXxZguv7PgKQjMMH4yJ5h