Skip to content

test: add internal/testutil.WaitFor and use it for #1110 and the hot-path polls - #1122

Merged
amiddavid merged 1 commit into
mainfrom
test/testutil-wait
Nov 12, 2026
Merged

amiddavid merged 1 commit into
mainfrom
test/testutil-wait

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Part 1 of the repo-wide flaky-test fix. Test-only, no behavior change.

  • CI data over 30 days: 35 of 1,390 runs (2.5%) needed a re-run only because of a flaky test.
  • A common cause: a fixed time limit on a wait loop, or an async result checked with no sync point. A 2-core runner with -race makes both worse.
  • This PR adds one shared wait helper and moves the hot-path polls to it.

#1110 was fixed by #1112. This PR no longer touches proxy/agentmodel_test.go. It holds the shared helpers and the hot-path migrations (keep-alive and dashemitter).

Data dependence: none. The PR changes tests only. No component or feature changes.

What changed

  • New package internal/testutil (test files only).
    • WaitFor(t, what, cond): polls every 2 ms. Safety bound is 30 s. On timeout it calls t.Fatalf with what and the elapsed time.
    • WaitForState(t, what, cond, state): same, and the failure shows what the test saw last.
    • Upstream: a fake HTTP server that records each request. WaitForCall(t, what, n, match) waits for n matching requests.
    • TestNoProductionPackageImportsTestutil fails when a non-test file imports the package.
  • Upstream and WaitForCall have no caller yet. The next migrations will use them. They have their own tests.
  • WaitFor also stops before t.Deadline() (minus 5 s), so its message shows in place of a bare "test timed out".
  • Six poll loops moved to WaitFor: proxyapp/dashemitter_{limits,savings,manual,waitcause}_test.go, proxy/keepalivehost_test.go (waitPings, waitSkipped), proxy/keepalive_billed_contract_test.go (two loops).

How it was tested

Box, -race. Load = 16 busy loops under taskset -c 0-3, with the test under the same taskset and GOMAXPROCS=4. Loops killed by pid after.

  • Migrated tests (proxy keep-alive and billed tests, proxyapp dashemitter tests), loaded, -count=20 to -count=50: 0 failures.
  • Negative tests in internal/testutil: a condition that never holds fails with its what, elapsed time and state; a nil respond; a panicking state(); the test deadline cap.
  • Full go test -race -count=1: internal/testutil, internal/boundary, proxyapp pass. go vet and gofmt -l clean.
  • Not a regression: TestHandlerKeysRowsAndKeepAliveByThread (proxy/thread_test.go) fails under load on unmodified main too. It is a flake candidate for a later PR.

Follow-ups (not in this PR)

About 50 test files still have time.Now().Add(N*time.Second) loops. Local copies of a wait helper to move to testutil:

  • modes/modes_test.go waitFor
  • proxy/modes_test.go awaitSnapshot
  • proxy/dash_test.go waitForRows
  • proxy/feedback_test.go waitForSink
  • dash/grace_test.go waitForRowCount
  • dash/reprice_test.go waitFor (best shape; 5 s bound)
  • keepalive/keeper_test.go waitPings, waitSkipped
  • internal/modelinfo/litellm/decode_test.go, internal/modelinfo/builtin_test.go
  • components/offload/summarize_testhook.go (production-side hook; leave as is)

Other files with fixed-deadline loops: dash/* (about 20 files), keepalive/* (6), proxy/* (about 12), components/offload/* (2), context-guru-plugin/* (3), proxyapp/hooks_test.go.
Also: 54 time.After timeouts to review.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.322 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 e55a7f5251e0 approve

Verdict: approve

Findings

None.

Non-blocking

  • proxy/agentmodel_test.go:90 — the t.Cleanup drain ignores the bool that
    offload.WaitForAllSummariesForTest returns. A summary stuck past 10 s leaks into a later test
    with no signal. The fake upstream answers at once, so this cannot fire today. Passing on the
    return value, or logging it, would make a future hang visible.
  • internal/testutil/testutil.go:26 — bound is one process-global. SetBoundForTest is safe now
    because no test in the package runs in parallel. A future t.Parallel test in the package would
    inherit another test's 50 ms bound and fail for no reason. A one-line note on SetBoundForTest
    ("no parallel tests in this package") would pin that assumption.
  • internal/testutil/testutil_test.go (the import guard) — a file that fails to parse is skipped
    with no message. A file that does not parse cannot compile, so nothing real can hide there. The
    seen < 50 floor already guards against a broken walk.

What I checked

  • Read the full diff (10 files, one commit) and the code around each change. Test-only; no
    production file changed. No behavior change, so the human-permission rule for behavior changes
    does not apply. Data dependence: none, as the PR states; no component or feature row is due.
  • The want == 0 claim in postSummarizable ("a call still on its way cannot slip past the
    check"). Proved it holds: Summarize commissions through startAsyncSummary
    (components/offload/summarize.go:647), which calls inFlight.begin on the request's own
    goroutine (summarize_async.go:227) before the response is written. So when the client has its
    response, every commissioned summary of that request is already in inFlight.jobs, and
    WaitForAllSummariesForTest polls exactly that map. inFlight.finish is the first defer, so
    it runs after the HTTP call and the checkpoint commit. The plain summarize pipeline used here
    has no deferred-commission path (cold/warm deferrals are cache-aware only).
  • Cleanup ordering. up.Close (registered by summaryUpstream), then h.Close, then the
    drain (registered inside postSummarizable). t.Cleanup is LIFO, so the drain runs first, while
    the fake upstream is still open. A summary in flight can still complete. Correct.
  • Session-key sharing. All agentmodel_test.go tests post the same body with no session
    header, so they share one derived session key and one global inFlight. The per-test drain
    cleanup prevents a leftover summary from refusing the next test's commission. cgllm_test.go
    posts the same first user message but sets x-context-guru-session, so no cross-file key
    collision.
  • The six migrated poll loops keep their old semantics: same stop conditions, same
    error handling (a DB error stops the wait and fails the test, as before), and the failure
    messages now carry the last-seen state. waitForRow in dashemitter_waitcause_test.go changes
    from returning a timeout error to failing directly; both callers only did t.Fatal(err), so the
    outcome is the same.
  • testutil.Upstream: recording is mutex-guarded, Calls returns a copy, headers are cloned.
    WaitForCall fails through WaitForState on timeout and returns all matching calls on success.
    The client chat cannot be mistaken for a summary call: isSummaryCall keys on max_tokens,
    which summarizableOpenAIRequest does not send.
  • The import guard (TestNoProductionPackageImportsTestutil): walks the repo root, skips
    .git/.claude/node_modules/testdata and _test.go files, parses imports of every other
    .go file, and fails on any import of internal/testutil. internal/boundary treats
    internal/testutil as a core package; upstream.go uses no banned net/http selector
    (httptest.NewServer and http.HandlerFunc are not in the banned set), so the boundary rule
    holds. No non-test file in the repo imports the package (grep confirms).
  • Compile-level checks on all changed files: added imports are used, removed imports (io,
    sync in agentmodel_test.go) have no remaining uses, fmt was already imported in
    keepalivehost_test.go and dashemitter_waitcause_test.go.
  • The PR's own numbers (0 failures in 200 loaded iterations, vacuity check) are consistent with
    the code as read. Live tests were not run; this review is read-only as instructed.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.322 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 e55a7f5231e0 approve

Verdict: approve

Test-only change. No production file changed. I found no defect that produces a wrong
test result, a false pass, or a race.

Findings

None.

Non-blocking

  1. internal/testutil/testutil.go:39 — WaitFor and WaitForState ignore t.Deadline().

    • A 30 s bound can outlive a tight -timeout for the package. The failure then shows as
      "test timed out" and the helper's message is lost.
    • Not wrong today. The proxy package ran 585 s with -race, well under the 10 m default.
  2. proxy/agentmodel_test.go:109 — the want == 0 drain does not wait out deferred commissions.

    • offload.WaitForAllSummariesForTest polls only inFlight.jobs
      (components/offload/summarize_testhook.go:64). It does not wait on
      coldDeferred/warmDeferred/dispatching, unlike WaitForSummaryForTest
      (summarize_testhook.go:24).
    • This is sound for these tests: the pipeline is [summarize]
      (proxy/agentmodel_test.go:49), and plain summarize calls inFlight.begin on the
      request goroutine (components/offload/summarize_async.go:227), before the proxy returns
      the response. So every summary of these tests is in inFlight.jobs before the check,
      and a finished job means its call reached the upstream first.
    • The risk is latent: if these tests ever run a pipeline with cache_aware_summarizer,
      a deferred summary could pass the want == 0 check. Suggest one sentence in the
      postSummarizable comment that names this limit.
  3. internal/testutil/upstream.go:31 — NewUpstream calls respond with no nil check.

    • A nil respond panics on the first request. Every caller passes a func. A nil check
      with a 200 reply would make the helper safer for future callers.
  4. internal/testutil/testutil.go:62 — state() runs while the Fatalf message is built.

    • A panic inside state() would mask the timeout. The current callers are safe:
      dash.DB().Requests returns a nil page only with an error
      (dash/query.go:288-313), and err != nil short-circuits before len(page.Requests)
      in every condition closure.

What I checked

  • Read the full diff and every changed file in full: internal/testutil (3 files),
    proxy/agentmodel_test.go, proxy/keepalive_billed_contract_test.go,
    proxy/keepalivehost_test.go, and the four proxyapp/dashemitter_*_test.go files.
  • The #1110 fix is correct. For want > 0, WaitForCall waits until the summary call
    is recorded by the fake upstream. For want == 0, WaitForAllSummariesForTest waits
    until the summary job finished, and the job finishes only after its HTTP call completed,
    so the call is recorded before the check runs. No window remains where a summary call
    reaches the upstream after the test read the calls.
  • Cleanup order is correct. t.Cleanup runs LIFO: the drain registered in
    postSummarizable runs before h.Close and before the fake upstream's Close. A
    summary in flight at test end cannot hit a closed server.
  • Cross-test contamination is prevented. inFlight is package-global and keyed by a
    session derived from the request body, which is the same in all these tests. The drain
    at test end, plus the in-body drain, stop one test's summary from gating the next
    test's (summary_already_in_flight). For TestMalformedAgentModelTarget..., which
    runs 7 requests in one test function, the in-body drain after each request carries this.
  • No nil-pointer path in the migrated polls. dash.DB().Requests and Components
    return a nil result only with an error; every condition closure tests err first
    (Go || short-circuit), and the state funcs run only after a final check that
    returned false with err == nil.
  • No compile issue found by reading. All imports in the changed files are used
    (fmt in proxy/keepalivehost_test.go, time in proxyapp/dashemitter_savings_test.go,
    offload/time in proxy/agentmodel_test.go). No name collision: the package-level
    seen func does not clash with the local type seen in proxy/keepalive_wire_test.go:36
    (function scope shadows it), and testutil.Upstream is always qualified against the
    proxy's own Upstream type (proxy/tenancy.go:176).
  • internal/boundary stays green. internal/testutil is not a host package, and its
    non-test files use no banned http.* selector (NewServer, HandlerFunc, Header,
    ResponseWriter are all allowed).
  • The guard test is sound. TestNoProductionPackageImportsTestutil skips _test.go
    files, the internal/testutil dir itself, and .claude (which holds other review
    worktrees on a laptop). Files that fail to parse are skipped, but such files cannot
    compile anyway. The seen < 50 check catches a broken walk.
  • The negative tests cannot pass vacuously. runFatal returns "" when the wait does
    not fail, and the message assertions then fail.
  • Repo rules. No production behavior change, so the data-dependence statement
    ("none") and the no-human-permission rule are satisfied. No file outside test code
    changed; docs/data-dependence.md needs no rebuild.
  • I did not run builds or tests. Live tests were not approved for this review.

@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1 follow-up. New head 2826e20f, rebased on main. #1112 merged meanwhile and touched the same helper. I kept the want-count version and its drain.

Reviewer 1

  1. Deadline: fixed. WaitFor and WaitForState cut the bound to the time left before t.Deadline() minus 5 s. New test covers it.
  2. Drain limit: fixed. The postSummarizable comment says the drain covers plain summarize only, not cache_aware_summarizer deferrals.
  3. Nil respond: fixed. NewUpstream(t, nil) replies 200 with {}. New test.
  4. state() panic: real risk, safe today. Fixed. A panic in state() now shows as text in the timeout message. New test.

Reviewer 2

  1. Cleanup drain: fixed. It calls t.Errorf when a summary still runs after 10 s.
  2. t.Parallel: fixed. A note on SetBoundForTest says the bound is process-wide.
  3. Skipped unparsable file in the import guard: no change. A file that does not parse cannot compile, and the seen < 50 floor guards the walk.

Tests (box, -race): internal/testutil, internal/boundary, proxyapp, proxy pass. Agentmodel and keep-alive tests at -count=20 under 16 busy loops: 0 failures. go vet and gofmt clean.

Part 1 of the repo-wide flaky-test fix. Test-only, no behavior change.

- internal/testutil: WaitFor, WaitForState, and a recording fake
  upstream with WaitForCall. The safety bound is 30 s, cut to the
  time left before the test deadline. A passing test ends as soon as
  its condition holds.
- A guard test fails when a non-test file imports internal/testutil.
- Replace six fixed 2 s poll loops in proxy and proxyapp.

#1110 was fixed by #1112.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Plan change. #1112 fixed #1110, so head a9c441e4 takes main's proxy/agentmodel_test.go exactly (empty diff). My earlier reply on the agentmodel drain and comment (reviewer 1 point 2, reviewer 2 point 1) no longer applies.

Still in this PR, from both reviews:

  • Reviewer 1 point 1 (t.Deadline()): fixed, with a test.
  • Reviewer 1 point 3 (nil respond): fixed, with a test.
  • Reviewer 1 point 4 (state() panic): fixed, with a test.
  • Reviewer 2 point 2 (t.Parallel note on SetBoundForTest): done.
  • Reviewer 2 point 3 (unparsable file in the import guard): no change, as said before.

NewUpstream has no caller yet. The next migrations will use it.

Tests (box, -race): internal/testutil, internal/boundary, proxyapp pass. Keep-alive and billed tests at -count=20 under load: 0 failures. vet and gofmt clean. TestHandlerKeysRowsAndKeepAliveByThread fails under load on unmodified main too, so it is not from this PR.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.322 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 a9c441e4e085 approve

Verdict: approve

Findings

None.

Status of the earlier findings

Mine, round 1:

  1. Cleanup drain ignores the return value (agentmodel_test.go:90) — no longer applies. The
    PR dropped agentmodel_test.go: its diff against the new base is empty. Main's #1112 now owns
    that fix, and its version does check the return
    (if !offload.WaitForAllSummariesForTest(10 * time.Second) { t.Fatal(...) }), so the point is
    covered there.
  2. SetBoundForTest and t.Parallel — fixed. The doc on SetBoundForTest now says the bound
    is process-wide and no test in the package may call t.Parallel.
  3. Import guard skips unparsable files — rejected by the author: a file that does not parse
    cannot compile, and the seen < 50 floor guards the walk. The reason is right. I accept it.

Reviewer 1, round 1 (checked myself against the new head):

  1. t.Deadline() ignored — fixed. effectiveBound cuts the bound to the time left before the
    test deadline minus 5 s, floored at one poll interval. TestWaitForGivesUpBeforeTheTestDeadline
    covers it. I traced the test double (deadlineTB embeds recorder by value; the promoted
    pointer-receiver Fatalf panics with &d.recorder, which the test's recover swallows): the
    test fails if the wait runs long or the message is missing, so it cannot pass vacuously.
  2. Drain does not wait out deferred commissions — no longer applies, same as my point 1.
  3. Nil respond panics — fixed. NewUpstream(t, nil) replies 200 with {}, before which the
    call is still recorded. Covered by
    TestNewUpstreamWithNilRespondReplies200AndEmptyJSON.
  4. A panic in state() masks the timeout — fixed. describe recovers and turns the panic into
    text in the message. Covered by TestWaitForStateSurvivesAPanickingStateFunc.

Non-blocking

  • The final head ran internal/testutil, internal/boundary and proxyapp in full, but the
    proxy package only as targeted keep-alive and billed runs (-count=20, under load). The two
    changed proxy files are byte-identical to the round-1 head, where the full package passed
    (585 s, -race), so the risk is small. A full proxy run on the final head before merge would
    close it.
  • effectiveBound: a WaitFor that starts in the last 5 s before the package deadline gets a
    2 ms bound and fails at once. That is the intended trade — the helper's message in place of a
    bare "test timed out" — and both outcomes are failures. Noted only so the trade is on record.

What I checked

  • Last review: round 1, e55a7f5, 2026-11-12T08:18:26Z.
  • New commits read: 8 — 89c98de docs(claude-md) #1121, 245f584 fix(config) #1115,
    c8f9b67 test(proxy) #1112, 826e46f docs #1117, fff61bf feat(mod) #1096,
    cd82e95 test(proxy) #1092, b503724 fix(bob) #1111 (the new base), and a9c441e — this
    PR's rewritten commit. The seven before the base arrived by rebase from main; each went through
    its own reviewed PR (named in its commit message). I read each message and stat, and read
    #1112's agentmodel_test.go change in full because it replaces this PR's core fix.
  • Read in full: 2 reviews, 2 comments, 0 inline comments (from the three saved files).
  • New items since my last review, and what I did about each:
    • Author comment 09:11:12 (round-1 follow-up, head 2826e20f): read. Superseded by the next
      comment.
    • Author comment 09:29:46 (plan change, head a9c441e4): read. Verified the claim:
      git diff b5037247..HEAD -- proxy/agentmodel_test.go is empty, so the PR takes main's #1112
      version exactly. Main's version covers my round-1 point 1 by checking the drain's return.
    • The rewritten commit a9c441e4: read the full diff (9 files) and each changed file around
      the changes. Details below.
    • Updated PR body: read. It matches the new state (no agentmodel claim, no-caller note for
      Upstream, the deadline cap, and the proxy-suite omission disclosed).
  • The six migrated poll loops (proxy/keepalive_billed_contract_test.go,
    proxy/keepalivehost_test.go, the four proxyapp/dashemitter_*_test.go) are byte-identical to
    the round-1 head (empty diff e55a7f52..a9c441e4 on those files). I approved them in round 1
    after checking stop conditions, error handling and nil-page safety; nothing to re-review.
  • The new internal/testutil code since round 1:
    • effectiveBound (testutil.go:74): type-asserts Deadline(), cuts the bound by
      deadlineMargin (5 s), floors at pollInterval via the max builtin (Go 1.21+, module is
      Go 1.26). With no deadline (-timeout 0) or a test double without Deadline, the old 30 s
      bound stands. Correct.
    • describe (testutil.go:88): named return plus recover, so a panicking state becomes
      (state func panicked: ...) in the message instead of masking the timeout. Correct.
    • NewUpstream(t, nil) (upstream.go:44): replies 200 {} after recording. Correct.
    • The three new tests: traced each for vacuous-pass paths; each fails when the behavior is
      missing (d.msg empty, message without "boom", status or body mismatch). io is the one new
      import in testutil_test.go and is used.
  • Compile-level checks on the new files: all imports used (fmt in testutil.go for describe),
    no name collisions, deadlineTB's promoted methods resolve through the embedded value.
  • Repo rules: test-only, no production behavior change, data dependence none — unchanged from
    round 1. The rebase brought main's CLAUDE.md force-push rules into this worktree; this review
    changed no file outside .review.md.
  • Live tests were not run; this review is read-only, as instructed.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.322 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 a9c441e4e085 approve

Verdict: approve

Still test-only. No production file changed. The three fixes I checked in the new
internal/testutil code are correct. I found no defect.

Findings

None.

Earlier findings

Mine (round 1):

  1. WaitFor/WaitForState ignore t.Deadline() — fixed. effectiveBound
    (internal/testutil/testutil.go:64) cuts the bound to the time left before the test
    deadline minus 5 s, never below one poll interval. TestWaitForGivesUpBeforeTheTestDeadline...
    covers it. The type assertion on interface{ Deadline() ... } is the right idiom:
    testing.TB has no Deadline method, so a fake TB (the recorder) simply skips the
    cut instead of panicking on a nil promoted method.
  2. The want == 0 drain does not wait out deferred commissions — left this PR.
    #1112 (commit c8f9b67e) took over proxy/agentmodel_test.go; this PR no longer
    touches that file (empty diff against the new base). I read #1112's change: it drains
    with WaitForAllSummariesForTest(10 s) in the body and checks the return value. My
    round-1 proof still holds there: plain summarize registers in inFlight.jobs on the
    request goroutine (summarize_async.go:227), before the response, so the drain cannot
    miss a summary of these tests.
  3. Nil respond panics in NewUpstream — fixed. A nil respond now replies 200
    with {} (internal/testutil/upstream.go:44). New test covers it.
  4. A panic in state() masks the timeout — fixed. describe
    (internal/testutil/testutil.go:87) recovers and turns the panic into text.
    TestWaitForStateSurvivesAPanickingStateFunc covers it.

Reviewer 2 (round 1), checked myself:

  1. Cleanup drain ignores the bool — moot in this PR (the agentmodel code left with
    #1112). #1112's merged version checks the return value in the body, so the substance
    is addressed there.
  2. t.Parallel risk on the process-wide bound — fixed. SetBoundForTest now says
    the bound is process-wide and no test in the package may call t.Parallel.
  3. Unparsable file skipped in the import guard — rejected by the author. The reason
    is right: a file that does not parse cannot compile, and the seen < 50 floor guards
    the walk. I verified the same in round 1.

Non-blocking

  • NewUpstream, Upstream, Matching, and WaitForCall have no caller outside their
    own tests. The PR body says so and names the reason (the next migrations will use
    them). Fine as staging.

What I checked

  • Last review: round 1, e55a7f5251e0d7cf4466dbb95ba030aacc441b2c, 2026-11-12T08:18:56Z.
  • New commits read: 8 — a9c441e4 (this PR, rewritten head), b5037247 (#1111, new
    base), cd82e95a (#1092), fff61bfb (#1096), 826e46f7 (#1117), c8f9b67e (#1112,
    the #1110 fix that left this PR), 245f584b (#1115), 89c98de6 (#1121).
  • Read in full: 2 reviews, 2 comments, 0 inline comments (from the three saved files).
  • New items since my last review: the rewritten head a9c441e4 (reviewed below), the
    author's two comments (09:11 and 09:29 — plan change: #1110 left for #1112), and the 7
    main commits from the rebase (checked for interaction; none touches the six migrated
    test files).
  • The round-2 diff (b5037247..a9c441e4), file by file. proxy/agentmodel_test.go
    is absent: the file matches main exactly, as the author's comment says.
  • effectiveBound. Read the logic: max(left, pollInterval) keeps the bound at one
    poll when the deadline is inside the margin, so the wait fails fast with its own
    message instead of hanging into "test timed out". The bound is cut once, at wait start;
    correct, since the cut only needs to hold for that wait.
  • deadlineTB test. Traced the panic path: Fatalf is promoted onto &d.recorder,
    the deferred recover matches that pointer, so the fake swallow works and the message
    assertions run. If WaitFor returned without failing, d.msg stays empty and the test
    fails — it cannot pass vacuously.
  • Nil-respond and panicking-state tests. Both reach the new code paths and assert
    on the reply body and the message text.
  • The six migrated poll loops are byte-identical to round 1 (same hunks against the
    new base). My round-1 checks stand: stop conditions, error handling, nil-page safety
    (dash.DB().Requests returns a nil page only with an error, dash/query.go:288-313),
    and err != nil short-circuit in every condition closure.
  • internal/boundary. The new testutil.go code adds only fmt (in describe);
    no banned net/http selector. The boundary rule holds.
  • Repo rules. Test-only; data dependence "none" is right; no behavior change. The
    commit carries DCO sign-off and Assisted-By: attribution per repo convention. The PR
    body matches the new state of the branch, including the "no caller yet" disclosure.
  • I did not run builds or tests. Live tests were not approved for this review.

@amiddavid
amiddavid merged commit 4a7f8d7 into main Nov 12, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 12, 2026
amiddavid added a commit that referenced this pull request Nov 12, 2026
…tests (#1132)

The agentmodel tests wait for the detached summary calls before they
count them. Since #1073 the summary call runs off the request path, and
#1112's drain waits only for summaries already in flight, so "none
started yet" passed as "none in flight". Each test that counts summary
calls now waits through testutil.WaitForState (#1122) for the wanted
call, with a 30 s bound, after first waiting for any summary an earlier
test left running. The want-0 tests keep one read after the drain.

The failures were not reproduced locally (0 in 7,000 runs before and
after), so the race is inferred from the code. CI failed on these tests
3 times on 2026-11-12, on PRs that did not touch them.

Behavior change: none (one test file). Data dependence: none.

Fixes #1110.

Reviews: 2 offload review rounds (GLM). Round 2: both approve at
3ad22bd, which is the PR head.

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant