Skip to content

test(recall): pin the prepare_context statement ceiling - #2087

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
Inference1:test/recall-statement-ceiling
Oct 20, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
Inference1:test/recall-statement-ceiling

Conversation

@Inference1

@Inference1 Inference1 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

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_context issued 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 same before_cursor_execute counter
harness.

What changes are included in this PR?

One appended test in tests/builtin/runtime/test_statistics.py, no production changes:

  • Count every statement issued by one prepare_context on the default text-recall path (in-memory
    SQLite, no embedding model, no reranker), for 8 and 40 Atomic Memories in one Scope.
  • Assert the two counts are equal: past candidate-pool saturation, a larger corpus must not cost more
    reads.
  • Assert the count stays at or below a pinned ceiling.

The ceiling is 48, which is the value measured on current master plus one statement of slack. It is
deliberately not tighter so this PR lands green on master today 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:

tree counted(8) vs counted(40) result
b388a18 (the revision #2075 measured) 130 vs 178 fails on assert pool == beyond
e4efb39b (current master, this PR's base) 47 vs 47 passes
91293e5 (#2079 head) 16 vs 16 passes

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.py on master: 10 passed.
  • ruff check and ruff format --check with the locked ruff==0.15.20: clean.
  • Not evaluated: MySQL/OceanBase and seekdb backends, the reranker-on path, mode="vector", and
    multi-Scope prepare. The ceiling is therefore a SQLite-path number; on another backend the
    statement count should be identical (it is the same code path) but this PR does not claim to have
    measured it.

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

@hireview001 hireview001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hidb4ai
hidb4ai merged commit be7f3f5 into oceanbase:master Oct 20, 2026
39 checks passed
@hidb4ai hidb4ai added the 1.4.1 v1.4.1 release tracking label Oct 20, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.4.1 v1.4.1 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants