Repository navigation
fix(video): escalate live reopen exhaustion for URL sources too - #343
Conversation
Both reopen-exhaustion sites (the barren-cycle cap in handlePumpFinished and the attempt cap at the end of performLiveReopen) halted production and published onLiveSourceReset only for the .customFactory transport superuser404notfound#199 introduced. A URL-source live session that exhausted its reopen budget hit the same terminal state with neither: the provider kept advertising blocking reloads it could never satisfy, the playlist stayed frozen, and the host was never asked to retune — the exact zombie window superuser404notfound#199 closed for engine-created ingest readers, still open on the most common transport. Extract the escalation decision as a pure function covering every reopenable transport (.none stays out: it delegates to host retune before any reopen begins, and escalating it again would double-signal liveSourceReset) and use it at both sites. Co-Authored-By: Claude Fable 5 <[email protected]>
f7e44af
into
superuser404notfound:main
…is exhaustive Follow-up to #343. The generalisation is right: a URL live source that spends its reopen budget reaches the same dead end the factory transport does, and #199 only ever escalated the transport it introduced. Two things the predicate alone does not hold. `transport != .none` classifies every transport added later by accident, and `.none` is the standing proof that "everything except one case" was already the wrong shape once: a future transport that delegates to host retune before reopening (exactly what `.none` does) would inherit the escalation and signal the host twice. Now an exhaustive switch, so the compiler asks. And the decision was never the whole fix. Both exhaustion sites carried their own copy of the two effects, and the halt is the half that is easy to lose: `onLiveSourceReset` alone (what the #65 stall ladder publishes) still leaves a dead provider advertising blocking reloads it cannot answer, which is the -15410 the halt latch exists for. Both sites now call one method that owns the decision and both effects together. Tests: the two new pins go through that method on a real engine and provider, so they fail if either effect is dropped or if `.none` starts escalating; the predicate-only tests could not see a call site regress. Verified by mutation (dropping the halt fails the URL pin, removing the guard fails the `.none` pin). CHANGELOG entry, and the em-dash. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
|
Merged. Verified onto current main (the branch was based on 6.15.3): 1689 swift-testing plus 483 XCTest green, tvOS build clean. One conflict on the way in, since #341 landed The analysis holds all the way down. A Two things pulled in on top, in 23a5065.
Both exhaustion sites also carried their own copy of the two effects, and the halt is the half that is easy to lose. One method owns the decision and both effects now, and the two new tests go through that method on a real engine and provider, so a call site that regresses fails them where the predicate-only pins could not. Checked by mutation: dropping the halt fails the URL pin, removing the guard fails the |
Problem
Both live reopen-exhaustion sites escalate only for the
.customFactorytransport that #199 introduced:handlePumpFinished("live source produced no segments across N reopen cycles; giving up"), andperformLiveReopen("live reopen FAILED after N attempts; source considered permanently lost").A URL-source live session that exhausts its reopen budget reaches the same terminal state with neither
markLiveProductionHalted()noronLiveSourceReset: the provider keeps advertising blocking reloads it can never satisfy (the -15410 shape the halt latch exists for), the playlist stays frozen, and the host is never asked to retune. That is exactly the zombie window #199 closed for engine-created ingest readers — still open on the most common transport.Found while tracing a field freeze (same session as #340/#341/#342): the incident itself died through the live-
muxerFailedhole #341 covers, but this adjacent exhaustion path has the identical failure shape for URL sources whose reopens run dry.Fix
Extract the escalation decision as a pure function,
liveReopenExhaustionEscalatesToHost(transport:), covering every reopenable transport, and use it at both sites..nonedeliberately stays out: a transport-less source delegates to host retune before any reopen begins, and escalating it again would double-signalliveSourceReset.Behavior for
.customFactoryis unchanged;.urlnow halts + signals on exhaustion instead of zombifying.Tests
Pinned in
Issue199RerouteRecoveryTestsnext to the existing transport-decision pins:.urland.customFactoryescalate on exhaustion;.nonenever reaches the escalation.🤖 Generated with Claude Code