Repository navigation
test: a missed held-sync arrival fails its own test instead of hanging cleanup - #421
Merged
Merged
Conversation
The raw arrival signal can leave TestLifetime waiting on bodySettled after a test timeout, before fetch and environment restoration. Register arrival as a lifetime gate and stop the late body when teardown releases it without an interception. Keep all eight successful-path assertions and the 250 ms/20 ms deadlines unchanged. The original push-CI trigger was not naturally reproduced: 40 fresh processes each for the held-sync test and full quota-sweep file on a6efa38 and 026fe85 produced no held-sync failure. Repeat those matrices with this hardening also produced none (two unrelated full-file timeouts across 320 processes). A temporary missed-arrival control reproduced the 10s hook hang and downstream fetch/environment fallout while the request had already served 200 without joining a pool write. After hardening the same control reports only its original 5s body timeout; both follower tests pass. Production behavior is unchanged. Verified with pinned Bun 1.3.14 on linux,4c: Core build, OpenCode TypeScript 7.0.2 checks, four 80-process reproduction matrices, and final ordered held-sync/network-guard/API-lastUsed check (3 pass, 17 assertions). Investigation evidence and baseline failures are recorded in the uncommitted internal investigation artifact.
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.
Main's CI on a6efa38 hit a 10-second hook timeout in
quota poll serves its reading while runtime sync is held and dispose drains publication, then two later tests reported a leaked fetch mock. The test waited on an arrival signal for the held runtime write that nothing released on teardown, so if that write never reached the spy (most plausibly the request's detached advisory quota publication being superseded or refused, which production allows), the body waited forever and cleanup couldn't finish.The arrival is now a lifetime gate: teardown opens it, and the body returns without touching the stopping plugin, so a missed arrival is reported as this test's own timeout and nothing cascades. Every assertion and deadline is unchanged; production code is unchanged.
Not reproduced naturally in 320 fresh processes on a6efa38 and 026fe85 (0 held-sync failures); a controlled missed-arrival injection reproduced the exact hook timeout and is red as a plain test timeout after the fix, with the two following tests green. Tracing showed the request served without waiting on any pool write.
Summary by cubic
Fixes a potential hang in the
quota poll serves its reading while runtime sync is held and dispose drains publicationtest by converting the held-sync arrival wait into a lifetime gate, so a missed arrival times out this test alone instead of hanging teardown and leaking a fetch mock into later tests.Written for commit 8f89c60. Summary will update on new commits.