test(heartbeat): drop the 3s waitForStarted bounds in the resume-cap case (BLO-20885) - #1380
Merged
Merged
Conversation
…case (BLO-20885) The resume-cap test carried the only hard-coded `waitForStarted` timeouts in the file; every other wait uses the 60s default or the `diagnosticRemainingMs` budget. A 3s deadline asserts how fast the runner is rather than what the dispatcher does, which is the load sensitivity BLO-22418 set out to remove — shrinking the fixture cut the seed+scan cost but left the deadline in place. Measured on a 20-run soak of the full file at master 3cbf0b6: 19 passed, iteration 14 failed with `expected 1 to be 2` at the second wait, on a runner where iterations had slowed from ~131s to ~270s under load. The bound is not load-bearing. `waitForStarted` polls every 25ms and returns as soon as the count is reached, so the happy path is unchanged; removing the deadline only stops a slow runner from failing the case. Negative control: forcing `resumeState = null` so every pass restarts at the head still fails the test, now on the property assertion itself — `expected 1 to be greater than or equal to 10` at `claimedPosition >= windowRows` — rather than on a timeout. Co-Authored-By: Claude <noreply@anthropic.com>
Author
1 similar comment
Author
This was referenced Aug 16, 2026
Merged
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.
Thinking Path
Linked Issues or Issue Description
What Changed
3_000mswaitForStartedbounds inresumes forward after a claim instead of restarting the scan at the head, so both waits take the helper's 60 s default.No production code changed; no other test touched.
Verification
The failure this fixes. 20 independent
vitest runinvocations of the full file at master3cbf0b6f, 19 passed / 1 failed:Iterations had slowed from a ~131 s baseline to ~270 s under load (
load average 11on 32 cores) — the deadline was measuring the runner, not the dispatcher. These were the only hard-codedwaitForStartedtimeouts in the file.Post-fix, full file:
Test Files 1 passed (1) / Tests 11 passed (11), 160.86 s.Negative control — the change is not vacuous. Forced
resumeState = nullinheartbeat.ts:20715so every pass restarts the scan at the head, then re-ran the case:It still fails — and now on the property assertion rather than on a timeout, which is strictly better diagnostics. Note
waitForStarted(2)succeeded under the control, confirming the count-wait was never the discriminating assertion. Control reverted (git checkout --); the diff is the test file only.Risks
Low.
waitForStartedpolls every 25 ms and returns the moment the count is reached, so the happy path is unchanged and the suite does not get slower. The only behavioural change is that a genuinely broken cursor now takes up to 60 s to fail instead of 3 s — acceptable in a file whose runtime is already 130–270 s, and the negative control shows it fails on the meaningful assertion when it does.Model Used
claude-opus-4-5), 1M context, extended thinking, with tool use and code execution.Checklist