Skip to content

test(recall): tighten the prepare_context statement ceiling to the current measurement - #2133

Merged
hidb4ai merged 1 commit into
oceanbase:masterfrom
Inference1:test/tighten-prepare-ceiling
Oct 21, 2026
Merged

hidb4ai merged 1 commit into
oceanbase:masterfrom
Inference1:test/tighten-prepare-ceiling

Conversation

@Inference1

@Inference1 Inference1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Refs #2087, the PR that introduced this ceiling.

Rationale for this change

#2087 pinned _PREPARE_STATEMENT_CEILING to 48 against a measurement of 47 on the default text-recall
path. master has since moved: one prepare_context now issues 40 statements once the candidate
pool is saturated (32 with no memories recalled, 19 for a single-entry Scope). At 48 the assertion no
longer rejects anything until a regression of eight statements, so the guard is currently looser than the
thing it was written to protect.

This sets it to the current measurement plus one statement of slack, matching how the constant was
originally derived.

What changes are included in this PR?

One constant, no production code:

-_PREPARE_STATEMENT_CEILING = 48
+_PREPARE_STATEMENT_CEILING = 41

Measured with the in-repo before_cursor_execute counter on in-memory SQLite, one Scope, no embedding
model, no reranker:

memories 1 8 16 40
statements on 0da4436d 19 40 40 40

Are there any user-facing changes?

No. Test-only.

How was this change tested?

The point of a tightened ceiling is that it rejects what the looser one allowed, so the constant was run
against three trees:

tree counted(8) vs counted(40) result with the new ceiling
b388a18 (where the amplification was measured) 130 vs 178 fails, assert pool == beyond
e4efb39b (the value 48 was pinned against) 47 vs 47 fails, assert beyond <= _PREPARE_STATEMENT_CEILING
0da4436d (this PR's base) 40 vs 40 passes
  • pytest tests/builtin/runtime/test_statistics.py on the base tree — 10 passed.
  • ruff check and ruff format --check with the locked ruff==0.15.20 — clean.
  • Not evaluated: MySQL/OceanBase and seekdb, and the reranker-on path. The ceiling remains a
    SQLite-path number, as stated where it was introduced.

An earlier note said this would be tightened to 20 once #2079 lands. #2079 has not merged; what changed
instead is #2095, which took the path from 47 to 40. When #2079 does merge the measured value should drop
again and this constant should follow it down.

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 oceanbase#2087

@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 1cf7b98 into oceanbase:master Oct 21, 2026
40 of 41 checks passed
@hidb4ai hidb4ai added the 1.4.1 v1.4.1 release tracking label Oct 21, 2026
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.

2 participants