Skip to content

fix(io): the other two served-from-memory branches charge the ladders too (#380) - #386

Merged
superuser404notfound merged 2 commits into
mainfrom
fix/detour-progress-and-pin-visibility
Aug 17, 2026
Merged

superuser404notfound merged 2 commits into
mainfrom
fix/detour-progress-and-pin-visibility

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Follow-up to #381, found while reviewing it against main.

#381 fixed the window serve: draining read-ahead is not network progress, so it must not reset the reconnect streaks. The read loop serves from memory in three places and the other two were still clearing them.

The retained head/tail spans (#281) are the reachable one. They run FIRST, before every network path, their own log line says "no reconnect for it", and unlike the detour they are not taken out of service on a metered origin (a refusal caps the origin to one request via the #377 budget, which disables the detour but not the spans). So the parse returning to the head is exactly the "one served byte reset the whole ladder and it started over" that #380 described, and it survived the fix written for it.

The detour cache's resident-block hit (#69) is the second. DetourServe.served now carries whether the bytes crossed the network, so a block the reader fetched counts and a block it already had does not. That also replaces the >2 ms heuristic the slow-read line used to count detour fetches with the ground truth.

Both pin lines lose their #if DEBUG. Which target is pinned, and when the reader drops it, is half of every field trace about a redirecting origin (#307, #377, #380) — and with #381's bounded keep-pin grace the drop is a decision the ladder makes, not a reaction to an expiry status. A rung that only fires in the field is worth nothing if the field cannot see it. Rare by construction: a pin that does not change logs nothing.

Test

ServedFromMemoryProgressTests drives a real loopback origin that refuses the frontier with 509 while the consumer returns to the retained head. It passes here and fails on the pre-fix branch (rateLimitStreak 1 -> 0).

Full suite: 1886 tests / 273 suites green.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG

… too (#380)

#380 fixed the window serve: draining read-ahead is not network progress, so it
must not reset the reconnect streaks. The read loop serves from memory in three
places and the other two were still clearing them.

The retained head/tail spans (#281) are the reachable one. They run FIRST, before
every network path, their own log line says "no reconnect for it", and unlike the
detour they are NOT taken out of service on a metered origin (a refusal caps the
origin to one request, which disables the detour but not the spans). So the parse
returning to the head is exactly the "one served byte reset the whole ladder and
it started over" the report described, and it survived the fix for it.

The detour cache's resident-block hit (#69) is the second. `DetourServe.served`
now carries whether the bytes crossed the network, so a block the reader fetched
counts and a block it already had does not. That also replaces the `>2 ms`
heuristic the slow-read line used to count detour fetches with the ground truth.

Both pin lines lose their `#if DEBUG`. Which target is pinned and when the reader
drops it is half of every field trace about a redirecting origin, and with the
bounded keep-pin grace the drop is a decision the ladder makes, not a reaction to
an expiry status. A rung that only fires in the field is worth nothing if the
field cannot see it. Rare by construction: a pin that does not change logs nothing.

Test drives a real loopback origin that refuses the frontier while the consumer
returns to the retained head; it fails on the pre-fix branch (streak 1 -> 0).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
CI flake, not a regression: `parked` came back false with `secondGranted` still
nil, which is the state where the dispatch block never ran at all. The park
observation was spending its whole 10 s window on libdispatch handing out a
thread, so a green run and a run that measured nothing looked identical, and the
one that measured nothing reported a budget defect.

The block now announces itself and the test waits for that first. The acquire's
own 20 s timeout still bounds the park, so the assertion is unchanged; only the
part that was never about the budget is no longer counted against it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01E5UztmCZtNYPQpzdmSdmWG
@superuser404notfound
superuser404notfound merged commit 02416c2 into main Aug 17, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/detour-progress-and-pin-visibility branch August 17, 2026 03:45
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