8000 fix(query): count only derived facts against max_results (#528, v2.x backport) by adityamukho · Pull Request #538 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(query): count only derived facts against max_results (#528, v2.x backport) - #538

Merged
adityamukho merged 1 commit into
mainfrom
fix/528-backport-v2
Oct 11, 2026
Merged

adityamukho merged 1 commit into
mainfrom
fix/528-backport-v2

Conversation

@adityamukho
Copy link
Copy Markdown
Collaborator

Backport of #534 (v3) to v2.x.

RecursiveEvaluator::evaluate seeded seen_facts with every base fact and compared its size with max_results. Once a database held max_results live facts (default 1,000,000), 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.

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: compare seen_facts.len() - base_count with max_results
  • src/db.rs, docs/ERROR_REFERENCE.md (INT-020): document that the database's own facts do not count
  • tests/recursive_rules_test.rs: rule queries on a database with more live facts than max_results return their answer, and the limit still stops a rule that derives too much (fails without the fix)
  • CHANGELOG (Unreleased), test counts in CLAUDE.md, README.md, docs/TEST_COVERAGE.md (1,238 tests)

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

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
codecov Bot commented Oct 11, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0