Skip to content

subtitle-resolution: state the retained contiguous determination span (#276) - #278

Merged
superuser404notfound merged 1 commit into
mainfrom
feat/276-retained-coverage
Aug 2, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
feat/276-retained-coverage

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Closes nothing yet: #276 stays open until the reporter's harness has retested.

The gap

The #250 statement can express every truth class the reporter's conformance harness needs except one: "empty because nothing was ever authored before this point". On a PGS track whose first display set is at 88.380, a seek to 30 correctly renders nothing, but adjudicating that as determined emptiness rather than a dead pipeline needs coverage reaching back to track start, the earliest point that could change the answer.

coveredFrom cannot carry that: it is the last reset's window start, so after a far seek it reads target - 15. The load-time line does carry coveredFrom=-15.00, but under the previous seekGen, and combining across the fence is exactly what the fence exists to forbid.

What was actually missing

Not the state, the record of it. reanchorSubtitleOverlays deliberately leaves a drained channel's cues in place across a seek and rebuilds only the decoder and the PGS stale-arrival gate. The determination survives; SubtitleDrainCursor.coverageStart just overwrites its own history at every .resetAndDecode.

The change

SubtitleDrainCursor gains a Retention (a floor plus a high-water of the run's determined end). A reset folds the fresh window into it instead of overwriting, and the line states the floor as a new retainedFrom= field, placed next to coveredFrom because they are read as a pair.

[AetherEngine] #250 subtitle-resolution loadGen=3 seekGen=8 stream=4 coveredFrom=15.00 retainedFrom=-15.00 resolvedThrough=90.00 via=prefetch decodedThrough=none reason=reconstruction

coveredFrom is untouched. The two are separate claims: coveredFrom is seek-fenced, retainedFrom deliberately outlives a seek generation because it is the engine reconciling runs it fenced itself, and it dies with the drain cursor, which every track switch and every teardown clears. So it is still load-fenced.

Two things a naive build gets wrong

  • The outgoing run's determined end cannot be fetched at the reset tick. By then seekGeneration has advanced and the prefetch frontier no longer passes its own fence, so asking for it there would be the cross-generation combination the fence forbids. It is banked on the tick that produced it, while it was live. The drain tick therefore builds one statement per decoding tick whether or not the line is printed, and reuses it for the emission.
  • The runs join only when the new window opens INSIDE the retained span. A forward seek past the determined end leaves a hole the 15 s backscan does not reach back over. A backward seek starting below the retained floor leaves two disjoint intervals until the new run climbs back up. Both restart the run rather than span the gap. An idle tick decoded nothing and banks nothing, so unobserved frontier growth is never folded in; a lagging high-water reads as a gap and under-claims, which is the safe direction.

Not built, and why

Known limit

Seek to 30 before the reader ever passed 15 and retainedFrom reads 15. That is correct rather than a miss: the span between them was genuinely never decoded, and the backscan does not fill it.

Verification

  • 1408 tests / 211 suites green (swift test), including 12 new in Issue276RetainedCoverageTests, one per way the field could lie.
  • xcodebuild -scheme AetherEngine -destination 'generic/platform=tvOS Simulator' build clean, no new warnings.
  • swift build -Xswiftc -strict-concurrency=complete clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE

The #250 statement could express every truth class its consumer needed
except one: "empty because nothing was ever authored before this point".
Adjudicating that as determined emptiness rather than a dead pipeline
needs coverage back to track start, and `coveredFrom` resets to
`target - backscan` on every discontinuity. The pre-seek line does carry
the bound, but under the previous seekGen, and combining across the fence
is what the fence exists to forbid.

The determination itself does survive the seek. `reanchorSubtitleOverlays`
leaves a drained channel's cues in place by design and rebuilds only the
decoder and the stale-arrival gate; what was missing was the record of it.
`SubtitleDrainCursor` now carries a `Retention` (floor plus a high-water
of the determined end) that a reset folds into instead of overwriting, and
the line states its floor as `retainedFrom=`.

Two things a naive build gets wrong:

- The outgoing run's determined end cannot be fetched at the reset tick.
  By then `seekGeneration` has advanced and the prefetch frontier no
  longer passes its own fence, so the value is banked on the tick that
  produced it, while it was live. The drain tick therefore builds one
  statement per decoding tick whether or not the line is printed.
- The runs join only when the new window opens INSIDE the retained span.
  A forward seek past the determined end leaves a hole the 15 s backscan
  does not reach over, and a backward seek starting below the floor leaves
  two disjoint intervals; both restart the run rather than span the gap.
  An idle tick decoded nothing and banks nothing, so unobserved frontier
  growth is never folded in.

`coveredFrom` is unchanged: the two are separate claims, seek-fenced and
load-fenced respectively, and neither substitutes for the other.

12 tests in Issue276RetainedCoverageTests, one per way the field could
lie, plus the field in the #250 line-shape contract.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
@superuser404notfound
superuser404notfound merged commit ceb216c into main Aug 2, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the feat/276-retained-coverage branch August 2, 2026 04: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