Repository navigation
test(offload): give the summary-wait test hooks a 30 s floor - #1376
Merged
Merged
Conversation
amiddavid
commented
Nov 24, 2026
amiddavid
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 8bab7b6898ee |
approve |
Verdict: approve
Findings
None.
Non-blocking
components/offload/summarize_testhook.go:46—waitForSummarylives in a non-_test.gofile, so it ships in the production library build as dead code. The file already works this way for the exported hooks, so this follows the existing pattern. No action needed.- The floor makes a real hang cost 30 s per wait call. Tests that call a wait hook several times in sequence (for example
apply/responses_test.go, which callsWaitForAllSummariesForTestup to 4 times per test) can take 2 minutes to report one hang. The PR states this tradeoff, and a passing test returns at once. Acceptable. components/offload/cache_aware_after_stash_test.go:199still passes 1 s to the flooredWaitForSummaryForTest, with the result ignored. On the passing path it returns at once, so there is no cost today. If that commission ever hangs, the test takes 30 s to report, which is the intent of the floor.
What I checked
- The full diff (2 files, 33 insertions, 7 deletions) and both files in full, plus the code around each change.
- Every call site of
WaitForSummaryForTestandWaitForAllSummariesForTestinapply/,components/andproxy/(about 100 sites). All sites that assert a result expecttrue(a summary lands), except the three converted in this PR. Those three are the only sites that need a short limit:cache_aware_after_stash_test.go:80— 1 s wait that times out while a deferral is held, on purpose.cache_aware_after_stash_test.go:89and:131— 100 ms poll steps inside 5 s loops.cache_aware_after_stash_test.go:228— asserts the wait does NOT return in 50 ms. This is the only site that assertsfalse.
- Drain-only sites (result ignored) where a deferral could stay held by design:
summarize_thread_test.go,cache_aware_stale_replay_test.go,commitgate_summarize_test.go,cache_aware_trigger_test.go:277,components/all/reuse_test.go,proxy/summarytoken_test.go. All of them resolve the deferral or expect the summary to land before the wait, so the floor does not slow them. This matches the PR's measurement (11.3 s before, 11.5 s after for the offload set). - The gap the floor cannot hide:
waitForSummaryreturnstrueat once when nothing is pending and nothing is in flight. The take-and-start gap is covered by thedispatchingcounter indeferralPending(summarize_testhook.go:108), so a wait during that gap still blocks.TestWaitForSummaryCoversTheGapBetweenTakeAndStartpins this, and the converted 50 ms call still tests it. summaryWaitLimitand the two hooks are the only wait hooks incomponents/offloadthat take a duration. I listed every*ForTestfunction in the package. The PR's claim holds.- timingguard: the diff adds no
time.Sleep, no new poll loop and notime.After. The loops atcache_aware_after_stash_test.go:84-91and:126-133keep their existing sleep counts, so the baseline does not change. - Behavior change and data dependence: none. The changed production file holds test hooks only, and the PR records the owner's approval for that. The hooks are called from tests only; I found no production caller.
- Fail open: not affected. No production path changed.
amiddavid
commented
Nov 24, 2026
amiddavid
left a comment
Collaborator
Author
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.331 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 8bab7b6898ee |
approve |
Verdict: approve
Findings
None.
Non-blocking
components/offload/summarize_testhook.go:15— nothing pins the floor itself. If a later edit drops thesummaryWaitLimitcall fromWaitForSummaryForTestorWaitForAllSummariesForTest, no test fails. A one-line test onsummaryWaitLimitwould pin it.components/offload/cache_aware_after_stash_test.go:229— the fatal message still says "WaitForSummaryForTest returned…", but the call above it is nowwaitForSummary. The code path is the same (the exported hook delegates), so this is wording only.- Failure diagnosis gets slower. A summary that never lands now costs 30 s per wait site instead of 1 to 5 s. With about 80 wait sites, a broadly broken build can push a package past
go test's 10-minute default timeout, so it fails as a timeout panic and not as a cleant.Fatal. This is the tradeoff the change states, and a passing run is not slower.
What I checked
- The full diff (one commit, two files) and both files in full, against the base version of
summarize_testhook.go. - Every call site of
WaitForSummaryForTest,WaitForAllSummariesForTestand the newwaitForSummaryacrosscomponents,components/offload,components/all,applyandproxy(about 80 sites). For each, I checked whether it needs the wait to time out quickly, or uses it as a bounded poll step:- Three sites needed a short limit (a deliberately held deferral at
cache_aware_after_stash_test.go:80, two 100 ms poll steps at lines 89 and 131, and the 50 ms must-time-out at line 228). The PR converts all of them to the unexportedwaitForSummary, so their behavior is unchanged. - All other sites either call
ResolveDeferredCacheAwareSummarybefore the wait, drive a warm commission that lands, or assert nothing is pending. The floor cannot make a passing run slower there, because a summary that lands returns at once. - No remaining caller asserts a
falsereturn from the exported hooks. Everyif !WaitFor…treats false as a test failure, so the floor only changes time-to-failure.
- Three sites needed a short limit (a deliberately held deferral at
- Name collision:
waitForSummarydoes not collide with any identifier in packageoffload. - No production code calls the
ForTesthooks (only comments reference them), so the floor cannot reach a non-test path. - The diff adds no
time.Sleepor wall-clock assertion, sotimingguardand the timing-test gating rules are not in play. - Data dependence: none. The change touches test hooks only; no feature row applies.
- Hard boundaries: the hook file stays in the library package with its existing exported-and-test-only pattern, and the new unexported helper is same-package only.
- I did not run builds or tests: this review is code-reading only, as instructed.
WaitForSummaryForTest and WaitForAllSummariesForTest now wait for max(caller limit, 30 s). About 50 tests pass 1 to 5 s. On a loaded machine a background summary can take longer, and the test failed although the code was right. A summary that lands returns at once, so a passing test is not slower. Only a real hang takes 30 s to report. Three places need the short limit on purpose. They prove a wait does NOT return, or they poll in short steps while a deferral is held. They now call the unexported waitForSummary, which has no floor. All three are in cache_aware_after_stash_test.go. No production behavior change. The file holds test hooks only. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
force-pushed
the
test/seam-summary-floor
branch
from
November 25, 2026 08:54
8bab7b6 to
54e3b79
Compare
Collaborator
Author
|
Rebased onto main (e0a304e), after #1369. The approvals still count.
Approved head: |
amiddavid
added a commit
that referenced
this pull request
Nov 25, 2026
#1371, #1372, #1373, #1376 and #1377 fixed them. Add 2 tests found since: keepalive TestTheManualHoldTimerReleasesAndZeroisesWithoutASweep and tooldefer TestHistorySetLoadedTwice. 118 tests remain. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
This was referenced Nov 25, 2026
amiddavid
added a commit
that referenced
this pull request
Nov 25, 2026
#1378) test: gate the tests where time is the behavior behind CG_TIMING_TESTS Gate 32 tests that assert a wall-clock limit, a rate, a watchdog or a kill-at-the-limit. They run only with CG_TIMING_TESTS=1, so the integrator's heavy checks run them and a loaded laptop does not. - Go: testutil.RequireTiming(t) in 19 tests. - OpenCode: the timingOnly option in 4 tests. - pi-package and bob-plugin statusbar: a small timingOnly option in 6 tests. - bob-plugin scripts: a small timing_only skip in 3 tests. Test-only. No behavior change. No data dependence. test: run the checks that do not depend on time in every run A gated test that also checks something other than time hid that check without the variable. Fix that. - dash: move the query-plan check into TestSessionTokens_UsesTheIndexOnALargeWindow. It runs always. The time ratio stays gated. - 13 tests assert their time bound only with CG_TIMING_TESTS=1. The rest of each test runs always: strategies read, testdb open, waitAll, OpenCode versions, pi (3), bob statusbar (3), bob scripts (3). Test-only. No behavior change. test: ungate 3 tests and teach the timing detector the new switches - Ungate 3 silence tests whose result does not depend on time or load. - WaitFor test: guard only the elapsed bound. The message checks run always. - central rules test: RequireTiming after the CENTRAL_SLOW check, with a comment. - OpenCode: export timingEnabled from helpers.mjs. Use it in versions and in the failopen missing-binary bound. - timing-tests-needed.sh: match CG_TIMING_TESTS and timingEnabled, and look in *.py and *.test.ts files. Add cases to local-tests_test.sh. Test-only. No behavior change. test(bob): name CG_TIMING_TESTS in test_bob_control.py Review round 2 (#1378): the file reads TIMING from test_bob_plugin but never named the switch, so scripts/dev/timing-tests-needed.sh could not see its timing gate. One comment line names it. fix(dev): stop the timing detector losing to SIGPIPE Review round 3 (#1378): with pipefail on, `grep -q` exits at the first match, the writer (`git show` or `git diff`) then dies of SIGPIPE, and the pipeline status becomes 141, so the `if` failed and the script printed "skip" at random. On a large test file it said skip in 9 of 40 runs. Plain grep to /dev/null reads to the end. Two new self-tests, a 20,000-line file and a 20,000-line diff, each run 20 times: with `grep -q` both say run 0 of 20, with this change 20 of 20. docs(release): drop the 89 pending timing tests that merged PRs fixed #1371, #1372, #1373, #1376 and #1377 fixed them. Add 2 tests found since: keepalive TestTheManualHoldTimerReleasesAndZeroisesWithoutASweep and tooldefer TestHistorySetLoadedTwice. 118 tests remain. No behavior change (tests and test scripts only). Round 4 approved (owner granted rounds 3 and 4). Local tests waived (owner rule). Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
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.
Production file changed, no behavior change:
components/offload/summarize_testhook.goholds test hooks only.Owner approval (David Amid, flaky-tests session, 2026-11-24): "read it all seams approved". He said it after this explanation of seam 2: "WaitForSummaryForTest and WaitForAllSummariesForTest get a 30 s floor; about 50 component tests pass 1-5 s today".
Summary
WaitForSummaryForTestandWaitForAllSummariesForTestnow wait formax(caller limit, 30 s).What changed
summarize_testhook.go: constsummaryWaitFloorForTest(30 s) andsummaryWaitLimit.WaitForSummaryForTestnow calls the unexportedwaitForSummary, which has no floor.cache_aware_after_stash_test.go. They now callwaitForSummary(option c: a short-wait variant, no new export):TestWaitForSummaryCoversTheGapBetweenTakeAndStart: asserts the wait does NOT return in 50 ms.TestCacheAwareDetachedPrefixAskCommitsAfterTheTurnIsStashed: a 1 s wait that times out while a deferral is held, and a 100 ms poll step.TestAReplacedWarmDeferralIsDispatchedWithoutTheHook: a 100 ms poll step....ForTesthooks incomponents/offloadthat take a duration: none. These two are the only ones.How tested
macOS, Go 1.27.4, load average 190 to 420.
CGO_ENABLED=1 go test -race -count=5 -run <the 91 tests in files that call the hooks> ./components/offload/: pass (330 s).-count=1, back to back: before 11.3 s, after 11.5 s. (The first run showed 70 s: that was the two tests above. Fixed.)^TestCache,^Test(Summar|Wait)and^Test[A-D]pass. TheTestV*andTest[E-Z]tests do not call the hooks. The whole package does not finish in 10 minutes on this loaded laptop, so those were not run.go test -race ./apply/ ./components/all/: pass.go test -raceon the 28 proxy tests that call the hooks: pass.TestCacheAwareStalePrefixThroughARealOversizedTurntakes about 125 s with and without this change.go vet(offload, apply, proxy, components/all),gofmt,go test ./internal/timingguard/: clean.