Repository navigation
Read the quick session's trace start off the origin, not as a start (#503) - #515
Merged
Merged
Conversation
… second segment does not decide it The quick session waited for a start, and AVPlayer is ready only with two segments asked for one at a time: a loaded host asked for the second after the four-second fast stretch, met the slow one and never started (#503). No anchor moves that, so the test now holds what the anchor decides — every response through the first segment on the fast stretch's transport, the segment whole inside it — with the slow stretch on a transport of its own. ADR-0021 rule 4 gains a #503 addendum. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe
…mes, mark the slow stretch's transport, and say in testing.md how the quick session is judged Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe # Conflicts: # docs/adr/0021-test-ios-against-a-loopback-origin-and-run-its-checks-in-one-script.md
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.
Closes #503
The reported failure
It is not in any CI log. I searched every failed
ci.ymlrun since the test landed (#474, 2026-10-11), and the first attempts of the re-run runs (38349931735, 38217042037, 38214076415, 38188791871, 38185478104). None carriesMeetsTheSameStretch. The onlyTraceStartPlaybackTestsfailure in CI is the sibling's, on #474's own branch before it merged (run 38169669001). The issue's report is from local batch workers at a load of about 160. The mechanism below is reproduced with exactly the issue's message:Cause
The trace's clock already starts at the first media segment (#474). What the host does after that point is still the host's.
An instrumented run logged each request's arrival relative to the first segment:
AVPlayerasks for.videoHls()segments one at a time.readyToPlayonly once two are loaded (loadedTimeRanges0–4 s).So the session starts only if the second segment is asked for inside the four-second fast stretch. That depends on how quickly the host gets from the first segment to asking for the second, not on anything the anchor decides. A host that misses the stretch asks for segment 1 on the quarter-rate link. AVFoundation then abandons it and asks again roughly every 3–7 s (seen: 0.2, 3.2, 9.2, 11.2, 16.1 … s), and never starts.
Reproduction (before the fix)
The racing side is the request for the second segment, so I made it lose by holding its response rather than by adding host load. I added
FaultScript.Builder().addLatencyMs(5_000, kind: .mediaSegment, index: 1)to the quick test'sserve. The test then failed every time with the message above, after 62 s.A held third segment (
index: 2) still started at 0.26 s, which is what pins the second segment as the one that matters.Fix
The quick test no longer waits for a start, because no anchor can make that host-independent. It reads what the anchor decides off the origin instead:
.cellular. A trace's transport is reported per response and never switched, so no player behaves differently. That letsOriginResponse.transportsay which stretch a request arrived on.200, and its bytes are due inside the fast stretch at that stretch's rate. This is the origin's pacing as arithmetic: zero round trip, first byte at the stretch's start.With the 5 s hold on segment 1 still in place, the fixed test passed. I removed the hold before committing.
As a mutant check, I moved the origin's anchor back to its own start and held the media playlist 8 s. The new transport assertion then failed on two responses, so it does catch an anchor that paces the session's pre-segment requests on the slow stretch.
ADR-0021 rule 4 gains a #503 addendum, which is listed in the header's amendment list.
docs/testing.md's iOS replay bullet gains one clause.Decisions argued
testASessionSlowToReach…keeps its start and the iOS: a SuperPlayer on a video ladder stalls on the iOS 26.5 simulator (fetching stops; four stuck points) #474 margin. It is exposed to the same post-anchor mechanism, but it is outside this issue, and the addendum says so. If it flakes, the same reading applies.OriginResponse.transportalready exists, so there is no baseline diff.Review summary
docs/testing.mdnow says how the quick session is judged..cellularcarries a comment, so no one "fixes" it back to.wifi.firstSegmentPathpredicate is folded into one closure.ios/CLAUDE.md's harness bullet was left alone, since its claim about the anchor is unchanged.Verification
xcodebuild test -test-iterations 20 -only-testing:SuperPlayerTestkitTests/TraceStartPlaybackTests/testASessionQuickToReachItsFirstSegmentMeetsTheSameStretchon thesp-503simulator: 20 of 20 passed.TraceStartPlaybackTestsclass passed, with and without the reproduction's hold.SP_SIMULATOR=sp-503 ios/checkpassed: 710 iOS tests, 12 tvOS, 38 MoQ, the demo builds and the API baselines.🤖 Generated with Claude Code
https://claude.ai/code/session_01MJAhQmFgdRRAKUaMHibQLe