Repository navigation
test(recall): pin the prepare_context statement ceiling - #2087
Merged
hidb4ai merged 1 commit intoOct 20, 2026
Merged
Conversation
A recall must not cost one authority read per candidate. Count statements issued by the default text-recall path and assert the count stays flat once the candidate pool is saturated and below a pinned ceiling. Refs oceanbase#2075
hidb4ai
pushed a commit
that referenced
this pull request
Oct 21, 2026
The ceiling was pinned to 48 against a measurement of 47. The recall path has since dropped to 40, so 48 no longer rejects anything until a regression of eight statements. Pin it to the current measurement plus one. Refs #2087
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.
Which issue or RFC does this PR close?
Refs #2075 — this does not close it; #2079 is the implementation and already claims it.
Rationale for this change
#2075 measured that a single
prepare_contextissued one authority read per candidate. #2060 and#2079 remove that amplification, and #2079's own description states "No SQL-count assertions added".
Nothing in the suite pins the result, so the consolidation can silently regress: the failure mode is
one extra statement per candidate, which is invisible to content, token-statistics, and authorization
tests. This adds the missing guard, in the same style as the existing budget test for the statistics
selection path ("A selection must not cost one query per Scope; see issue #1599",
tests/builtin/runtime/test_statistics.py:553), which uses the samebefore_cursor_executecounterharness.
What changes are included in this PR?
One appended test in
tests/builtin/runtime/test_statistics.py, no production changes:prepare_contexton the default text-recall path (in-memorySQLite, no embedding model, no reranker), for 8 and 40 Atomic Memories in one Scope.
reads.
The ceiling is
48, which is the value measured on currentmasterplus one statement of slack. It isdeliberately not tighter so this PR lands green on
mastertoday and stays green when #2079 merges(which lowers the observed value to 16). Once #2079 is in, the ceiling can be tightened — happy to do
that in a follow-up commit here, or leave it to a separate change, whichever reviewers prefer.
Are there any user-facing changes?
No. Test-only: no production module, no contract, no schema, no configuration change.
How was this change tested?
The same test file was run unchanged against three source trees, which is what makes it a guard rather
than a tautology:
counted(8)vscounted(40)b388a18(the revision #2075 measured)assert pool == beyonde4efb39b(currentmaster, this PR's base)91293e5(#2079 head)So it rejects the pre-#2060 behaviour and accepts both the current baseline and #2079's consolidation —
it composes with that PR instead of competing with it.
pytest tests/builtin/runtime/test_statistics.pyonmaster: 10 passed.ruff checkandruff format --checkwith the lockedruff==0.15.20: clean.mode="vector", andmulti-Scope
prepare. The ceiling is therefore a SQLite-path number; on another backend thestatement count should be identical (it is the same code path) but this PR does not claim to have
measured it.