8000 feat(rules): one total max_derived_facts limit; max_results a deprecated alias (#553) by adityamukho · Pull Request #663 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

feat(rules): one total max_derived_facts limit; max_results a deprecated alias (#553) - #663

Merged
adityamukho merged 2 commits into
v3from
feat/553-max-derived-facts
Oct 20, 2026
Merged

adityamukho merged 2 commits into
v3from
feat/553-max-derived-facts

Conversation

@adityamukho
@adityamukho adityamukho commented Oct 20, 2026 •
Copy link
Copy Markdown
Collaborator

Implements #553 on v3, ahead of #548 (the streaming engine's Recursive operator enforces this one limit; semi-naive evaluation cannot reproduce today's per-iteration count, which counts naive re-derivations).

Change

  • One limit on the total facts a rule query derives. OpenOptions::max_derived_facts / :max-derived-facts now count every fact the rules derive, across iterations, strata and the Recursion through a rule with not / not-join / or returns too few rows #633 repeated passes; base facts do not count. The per-iteration checks in RecursiveEvaluator and in StratifiedEvaluator's mixed pass are removed.
  • max_results / :max-results are deprecated aliases. #[deprecated(since = "3.0.0")] on the OpenOptions field and builder method. The lower of the two applies (OpenOptions::derived_fact_limit); OpenOptions::max_results now defaults to usize::MAX (no limit of its own), so it can lower the limit but not raise it (Codex finding: with a 1,000,000 default, max_derived_facts(2_000_000) alone stayed at 1,000,000). A per-query value still replaces the database's (lower of the two per-query values when both are given).
  • INT-020 text is now evaluator: iteration or derived-fact limit exceeded: Max derived facts (N) exceeded. …. Code and category unchanged. ERROR_REFERENCE.md updated, with the pre-v3 meaning.
  • The 1,000-iteration limit and the 1,000,000 default are unchanged. The evaluators and DatalogExecutor now carry one limit (internal API).
  • CHANGELOG.md breaking-changes entry.

Tests

  • db::tests: the limit is the total, not one iteration (15 facts derived, at most 5 new per iteration: 15 passes, 14 fails with the new text); the alias alone, and the lower of the two in either order; per-query values replace the database's, alias too, lower of two per-query values applies.
  • Evaluator unit tests moved to the single limit; the duplicate stratified max_results test is removed.
  • Integration tests that used max_results now use max_derived_facts.
  • max_derived_facts alone raises the limit above the default; the alias alone does not.
  • Counts: 1,680 tests (1,670 passing, 10 ignored). The documented counts were stale (1,672 / 1,662 against a measured 1,677 on origin/v3); all three docs now show the measured value.

Docs site

project-minigraf/minigraf-docs PR (branch v3/553-max-derived-facts): datalog-reference.md and performance-tuning.md, @since v3.0.0 / @range v2.0.5..v3.0.0.

Not changed: minigraf-playground's system prompt mentions :max-results, which still works as an alias. No binding exposes either option. No v2.x backport (per #553).

Part of #473 prep (#548). Closes nothing by keyword: #553 is closed by hand after merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT

…ted alias (#553)

max_derived_facts (OpenOptions and :max-derived-facts) now limits every
fact the rules of one query derive, across iterations, strata and
repeated passes; base facts do not count. The per-iteration check is
gone from both evaluators. max_results / :max-results become deprecated
aliases (#[deprecated] on the OpenOptions field and builder); with both,
the lower applies, and a per-query value still replaces the database's.
INT-020 text names derived facts. Test counts brought up to date
(1679 total, 1669 passing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
…ed_facts alone can raise the limit (#553)

Codex review: the alias defaulted to 1,000,000 and the lower of the two
applied, so max_derived_facts(2_000_000) alone stayed at 1,000,000.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019kY61Y11gcRD91Y6b7jbGT
@codecov
codecov Bot commented Oct 20, 2026
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/db.rs 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 9d62135 into v3 Oct 20, 2026
24 of 25 checks passed
@adityamukho
adityamukho deleted the feat/553-max-derived-facts branch October 20, 2026 16:21
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