Skip to content

test(io): keep the #309 cases off process-wide hooks (#309 follow-up) - #326

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/309-delivery-gap-watchdog
Aug 7, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/309-delivery-gap-watchdog

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Follow-up to #325. No behaviour change to the shipped path; it removes a test-side hazard and gives one unrelated test the budget it needs.

What the branch CI failure actually was

The CI run on #325 failed Issue255BodyReserveTests "the HEAD size probe does not reserve the source it declares", and the same commit was green on main on the next run. The log names the cause arithmetically: probeFileSize bounds its wait at sizeProbeStaggerSeconds + min(25, chunkRequestTimeout) + 2, which at that test's chunkRequestTimeout: 5 is 7.75 s, and the test failed after 7.806 s. The loaded runner did not get the staggered HEAD fallback's closure onto a thread inside that budget, open() broke out of the wait, the reader fell back to streaming mode, and the test read "the HEAD fallback never ran" from a request log holding only the primary probe. Its budget now has room. The wait still exits the moment a size resolves, so nothing changes when the origin behaves.

The hazard worth removing

swift-testing runs suites in parallel, and sourceThrottleKbpsForTesting / the stall-timeout hook are read by every AVIOReader at ITS OWN init. For the seconds a test held them, they applied to readers built by whatever suite happened to be running alongside it. A 2 MB/s source throttle leaking that way starves another suite's reader outright, and a shortened stall threshold makes it reconnect early.

Measured

Saturated box (10 concurrent 1080p60 encodes, ~690% of 800%): three consecutive full-suite runs green. The suite also went from ~19.5 s to ~12.8 s under the same load, which is the leaked throttle no longer slowing other suites' readers down.

The #309 cases still pass and still fail when either half of the fix is disarmed; passing at all is now also the proof that the threshold parameter is wired, since at the shipped 20 s none of them would finish in time.

🤖 Generated with Claude Code

The CI run on the branch failed one unrelated test, `Issue255BodyReserveTests`
"the HEAD size probe does not reserve the source it declares", and the same
commit was green on main immediately afterwards. The arithmetic in the log names
it: `probeFileSize` bounds its wait at `sizeProbeStaggerSeconds + min(25,
chunkRequestTimeout) + 2`, which at that test's `chunkRequestTimeout: 5` is
7.75 s, and the test failed after 7.806 s. The loaded runner did not get the
staggered HEAD fallback's closure onto a thread inside that budget, so `open()`
broke out of the wait and the test read "the HEAD fallback never ran" from a
request log holding only the primary probe. Its budget now has room; the wait
still exits as soon as a size resolves, so the healthy case is unchanged.

The reason to care from here: swift-testing runs suites in parallel, and the
#309 cases were reaching for two hooks that every AVIOReader reads at ITS OWN
init, so for the seconds they were set they applied to readers built by whatever
suite happened to be running alongside. A 2 MB/s source throttle leaking that
way starves other suites' readers outright.

- `connStallTimeout` becomes an init parameter, like `chunkRequestTimeout`, and
  the process-wide hook added with the fix is deleted. Still not a `LoadOptions`
  field (#272 unchanged).
- The runway test paces its own read loop instead of setting
  `sourceThrottleKbpsForTesting`.

Measured on a saturated box (10 concurrent 1080p60 encodes, ~690% of 800%):
three consecutive full-suite runs green, and the suite went from ~19.5 s to
~12.8 s, which is the leaked throttle no longer slowing other suites down.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
@superuser404notfound
superuser404notfound merged commit 8b6e57d into main Aug 7, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/309-delivery-gap-watchdog branch August 7, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant