fix(test): make getRecordCount within-budget cases immune to CI timing - #2159
Open
kriszyp wants to merge 2 commits into
Open
fix(test): make getRecordCount within-budget cases immune to CI timing#2159kriszyp wants to merge 2 commits into
kriszyp wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a WITHIN_BUDGET_TIME_LIMIT constant set to Infinity in the getRecordCount unit tests. This constant is passed as the timeLimit option to getRecordCount calls in tests that expect exact counts within the budget. This change prevents slow or contended CI runners from exceeding the default 500ms budget and inadvertently triggering the estimator path. There are no review comments, and I have no additional feedback to provide.
Contributor
|
Reviewed; no blockers found. |
dawsontoth
approved these changes
Aug 14, 2026
kriszyp
marked this pull request as ready for review
August 15, 2026 00:25
Two cases in unitTests/resources/getRecordCount.test.js relied on the ambient 500ms default time budget to exercise the within-budget path (exact count, no estimator, zero entry-count-source calls). On a contended CI runner the 30-row scan can miss that window, flipping the early-exit/sampling branch on and failing assertions that expect it off. Pass an explicit, generous timeLimit (60s) in both cases instead, mirroring the existing `timeLimit: -1` idiom already used by the sibling estimator cases to force the opposite branch deterministically. Refs https://github.com/HarperFast/harper/actions/runs/31648388950 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Address pre-push review nit: the explicit timeLimit and its rationale comment were duplicated across both within-budget cases. Hoist to a single WITHIN_BUDGET_TIME_LIMIT constant (Infinity, which structurally expresses "budget never exhausts" rather than asserting a magic number is big enough) with one comment at the declaration. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kriszyp
force-pushed
the
fix/getRecordCount-flaky-timeLimit-default
branch
from
August 15, 2026 11:54
35048dd to
40e961b
Compare
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.
Summary
Two cases in
unitTests/resources/getRecordCount.test.jsasserted the within-budgetbranch of
Table.getRecordCount(exact count, noestimatedRange, zero calls to theengine's entry-count source) while relying on the ambient 500ms default budget
(
resources/Table.ts:4772) to guarantee that branch is taken. On a contended CI runner a30-row scan — which yields once per row via
await rest()— can exceed 500ms, flippinginto the estimator branch and failing assertions that were never about timing. This is a
pure test flake, confirmed by the same assertion failing on two unrelated branches within
hours of each other (main and
kris/2153-audit-only-has-record, neither of which touchesgetRecordCountor the storage layer).Both cases now pass an explicit
timeLimitthat never exhausts (Infinity, hoisted to aWITHIN_BUDGET_TIME_LIMITconstant), mirroring the existingtimeLimit: -1idiom thesibling estimator cases already use to force the opposite branch deterministically. No
production code changed.
For the human reviewer
itself — that coverage was incidental and is exactly what made them flaky. Nothing else
in the suite asserts the default's value is workable for a small table; adding that
back deliberately (e.g. a soft/warn check) is a reasonable follow-up but would
reintroduce the same flakiness if written as a hard timing assertion.
timeLimit: Infinityover a large finite value (e.g.60_000) so "budget neverexhausts" is expressed structurally rather than by asserting a number is big enough on
any runner.
default" as major. Same finding as round 1, already adjudicated there and dropped:
the pre-edit tests never caught a broken default either (
options?.timeLimit ?? 500with a corrupted default still yields exact-count assertions passing), so this is a
pre-existing, stated gap, not a regression from this diff. Domain adjudication was
auto-pruned this round (narrow low-risk delta) so the tool's receipt shows it
unresolved; the round-1 reasoning still applies unchanged.
Verification
unitTests/resources/getRecordCount.test.js— all 6 cases pass under both storageengines:
npx mocha unitTests/resources/getRecordCount.test.jsandHARPER_STORAGE_ENGINE=lmdb npx mocha unitTests/resources/getRecordCount.test.js.npm run test:unit:resources(RocksDB): 1509 passing, 3 pre-existing failuresunrelated to this change (
randomAccessFieldsDirective.test.js,replayStructures.test.js) — not touched by this diff, not present in the affectedfile.
Review coverage
Pre-push review via
prepush-review.mjs, two rounds:Adjudicated finding (nit: duplicated
timeLimit/comment across the two cases) fixed ina follow-up commit.
no findings) + gemini. Gemini's major finding is a repeat of a round-1 finding already
adjudicated and dropped there (see "For the human reviewer" above); domain adjudication
was auto-pruned this round as narrow/low-risk, so it wasn't re-adjudicated by the tool.
Refs https://github.com/HarperFast/harper/actions/runs/31648388950
🤖 Generated with Claude Code
Human-Review-Need: 4 @ 40e961b