test(harness): deflake overlong-stream test with a deterministic truncation bound#734
Merged
Merged
Conversation
…cation bound TestJobManagerRunForegroundStreamingOverlongLineReturnsPromptly asserted the call returned within a 4s wall-clock bound. That is inherently load-sensitive: under the race detector on a busy CI runner the 2 MiB shell pipeline can take >4s even when nothing is wrong, so the test flaked intermittently. The wall-clock check proved nothing the deterministic metadata didn't already guarantee. Replace it with a byte-count assertion on what the streamer received: readStreamLine caps an overlong line at defaultMaxStreamLineBytes (1 MiB) and discards the rest, so for the 2 MiB line the streamer observes ~1 MiB (the cap) plus the short trailing "EOF" line — never the full 2 MiB. If truncation failed to short-circuit, streamed would be ~2 MiB and the bound fails. This is immune to machine load. The existing timed_out / stream_truncated / stream_error checks are kept. Verified 25x under -race. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0182aJaeQgukK1vkNjy95wt6
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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.
Problem
TestJobManagerRunForegroundStreamingOverlongLineReturnsPromptlyasserted the call returned within a 4s wall-clock bound. Under the race detector on a loaded CI runner, the 2 MiB shell pipeline can exceed 4s with nothing actually wrong — so the test flaked intermittently (observed on unrelated PRs #732/#733 CI).Fix
The wall-clock check proved nothing the deterministic metadata didn't already guarantee. Replaced it with a byte-count assertion:
readStreamLinecaps an overlong line atdefaultMaxStreamLineBytes(1 MiB) and discards the rest, so for the 2 MiB line the streamer observes ~1 MiB (the cap) plus the short trailingEOFline — never the full 2 MiB. If truncation failed to short-circuit,streamedwould be ~2 MiB and the bound fails. This is immune to machine load.The existing
timed_out/stream_truncated/stream_errorchecks are kept. Verified 25× under-racelocally; full tools package green under-race.🤖 Generated with Claude Code