Skip to content

test(backends): give the transfer-phase assertion room to breathe - #290

Merged
kurok merged 1 commit into
mainfrom
test/breakdown-transfer-margin
Sep 19, 2026
Merged

kurok merged 1 commit into
mainfrom
test/breakdown-transfer-margin

Conversation

@kurok

@kurok kurok commented Sep 19, 2026 •

Copy link
Copy Markdown
Owner

Third CI flake this session, and this one is mine — I introduced it in #277 (issue #228). It turned PR #289 red on macos-latest 3.10.

Root cause

test_breakdown_transfer_covers_body_read asserted transfer >= 0.15 against a 0.2 s gap between headers and body. That is a 25% margin, and the client does not parse the response headers the instant the server sends them — on a loaded runner that slack comes out of the measured gap:

AssertionError: 0.14370337500008645 not greater than or equal to 0.15

The measurement was right; the bound was too tight for the machine.

The fix

The gap is 0.4 s, and the assertions now lead with the relational one:

self.assertGreater(bd.transfer, bd.ttfb)
self.assertGreaterEqual(bd.transfer, self.BODY_DELAY / 2)
self.assertLess(bd.ttfb, bd.transfer / 2)

Pre-fix transfer was exactly 0.0 while ttfb held the headers time, so transfer > ttfb catches the original bug on any runner at any speed — it does not depend on a number I picked. The absolute bound is now half the delay rather than three quarters of it.

Verified the test still fails against the unpatched backends.py (with finalize_breakdown removed from send): both tests fail.

Ran three times locally, stable. 1913 passed.

test_breakdown_transfer_covers_body_read asserted transfer >= 0.15
against a 0.2s gap between headers and body -- a 25% margin. The client
does not parse the response headers the instant the server sends them,
and on a loaded macos-latest 3.10 runner that slack came out of the
measured gap: 0.1437s, and the build went red.

The gap is 0.4s now, and the assertions lead with the relational one:
transfer > ttfb. Pre-fix transfer was exactly 0.0 while ttfb held the
headers time, so that comparison catches the bug on any runner, at any
speed. The absolute bound is half the delay rather than three quarters
of it.

Signed-off-by: Yurii Riabikov <22548029+kurok@users.noreply.github.com>

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@kurok
kurok merged commit cfbcc29 into main Sep 19, 2026
17 checks passed
@kurok
kurok deleted the test/breakdown-transfer-margin branch September 19, 2026 12:34
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