Skip to content

Expose a generation-fenced subtitle-resolution statement (absolute coveredFrom/resolvedThrough on the source axis) #250

Closed

Description

@cmcpherson274

What should the engine do?

Emit one diagnostic statement — an EngineLog info line is entirely sufficient — whenever the subtitle path settles a determination, stating the absolute source-time span it has decoded display state over, fenced by the engine's own generation counters:

[SubtitleResolution] loadGen= seekGen= stream= coveredFrom= resolvedThrough= reason=<reconstruction|tick|eof>
Natural emission points: a drain tick that completes a post-seek reconstruction window, steady-state cadence (the existing 30 s memprobe tick would be fine), and prefetcher EOF (or a nextEventPts= variant).

Motivating media or use case

An external conformance harness (same rig and 48 GB / 49-PGS-track asset as #240) that adjudicates seek-time subtitle correctness: after a far seek lands, it must decide from observable surfaces whether the pipeline has determined the display state at the rendered position, or merely hasn't produced anything yet. On a PGS stream with no acquisition points those two are indistinguishable from outside, and that distinction is the whole adjudication.

What I can already see, and why it falls short of that call (read at 5.28.0 38ad1b7; nothing in the 5.28.2–6.0.0 notes changes it):

the memprobe prefetch=… prefetchLead=… prefetchHarvested=… fragment is playhead-relative and carries no generation — a line from just before a seek is indistinguishable from one just after it landed;
the #151 forward prefetch started/re-anchored/exited lines are session-bracketed and explicit about EOF, but ungated by generation, and they state the harvest frontier (compressed packets read), not how far display-state determination has advanced;
the overlay drainer's decode window (playhead −15 s/+60 s) and cursor are computed inside a drain tick that currently logs nothing;
loadGeneration/seekGeneration are (reasonably) private, so none of the above can be fenced to "the seek I just issued" without counting lines — which breaks under superseded seeks.
My harness already taps EngineLog.handler and archives it, so a line with those six values is a complete answer — and it would also make the #240-style subtitle-health questions ("did cues arrive late after the seek burst?") answerable from the log alone rather than inferred from relative fragments. The counters' values only need to be stable and monotonic, not meaningful to the host. No published property, no new type, no behaviour change; nothing load-bearing for playback.

Area

Other

Host app / integration context

(tvOS Jellyfin client) — external QA/conformance harness, same integration as #240. tvOS 26.5, Apple TV 4K 3rd gen, wired.

Would you be willing to open a PR?

Maybe, with guidance

Activity

  1. added
    enhancement
    on Jul 29, 2026
  2. added a commit that references this issue on Jul 29, 2026
  3. superuser404notfound commented on Jul 29, 2026

    @superuser404notfound
    Owner

    Built and released in 6.0.2 (a216ca2), with two changes to the shape you proposed. Both come from the same place: a diagnostic that over-claims is worse than no diagnostic, because the harness would adjudicate on it.

    The line

    [AetherEngine] #250 subtitle-resolution loadGen=3 seekGen=7 stream=4 coveredFrom=1189.00 resolvedThrough=1218.00 via=prefetch decodedThrough=1204.00 reason=reconstruction
    

    Grep token is #250 subtitle-resolution, EngineLog category .engine, one line per active drain target so a dual-channel session emits two.

    Change 1: resolvedThrough needs a frontier, and the frontier needs a name

    Neither obvious candidate can carry the claim.

    The drain window's own lead edge is playhead + 60 s (subtitleDrainLeadSeconds) whether or not anyone has read that far, so reporting it would assert determination over bytes nobody fetched. That is precisely the ambiguity you are trying to remove, restated as a number.

    The drain cursor is the other candidate and fails the opposite way: it is the last actual cue, so on a sparse or forced track it stands still for minutes and every dialogue pause would read as unresolved.

    So resolvedThrough is the decode window clamped to a harvest frontier, and via names which frontier bounds it, because the three are worth different things:

    via bound what it means
    prefetch the #151 side reader's banked read position exact. Since #230 that position is the read position on the source axis (a cue PTS for a harvested packet, the monotone read DTS for a pacing one), so everything below it that is not in the store genuinely carries no subtitle packet
    eof the whole window strongest state. The reader reached end of stream, so an empty position means "no cue here", not "not yet"
    pump the drain cursor a lower bound, not a contiguity claim. The producer tap harvests as a side effect of the video path and states no read position anywhere. A via=pump line is itself the answer "not determined beyond what is already on screen"

    For your rig via=prefetch is the steady state and via=pump is the finding.

    decodedThrough (the drain cursor) is reported alongside rather than instead, so a sparse stretch stays distinguishable from a starved one: on a healthy sparse track resolvedThrough runs well ahead of it.

    Change 2: the fence had to survive #240

    The generation-fencing idea is right, but a fence captured when the prefetch session starts would have been stale for you in exactly the case you built it for. Since #240 the session survives a seek: the anchor box moves the reader's cursor in place instead of tearing the session down and rebuilding it, so a read position banked before the seek is still sitting in the gauge afterwards, under the old session's numbers.

    So the re-anchor request carries the seek generation that asked for it, and the stamp lands after the reposition, not at request time. The window between the request and the seek that serves it reads as unresolved rather than validating a position the reader has not reached yet. A frontier fenced to a superseded load or seek is not usable at all, which is the fence doing real work rather than decorating the line.

    Emission points

    Yours, plus one:

    • a drain tick that decoded a post-seek reconstruction window: reason=reconstruction
    • the 30 s memprobe cadence: reason=tick
    • prefetcher EOF: reason=eof
    • any change of frontier source: reason=frontier

    The last one is the #231 case. A prefetcher that dies mid-session collapses determination to the pump's few seconds of lookahead, and nothing else in the log says so at the moment it happens; waiting up to 30 s for the next cadence line would hide it behind whatever the harness was measuring.

    Not per drain tick: the drainer runs at 2 Hz per channel, and a span restated four times a second buries the transitions that carry the information. If your harness would rather have the raw cadence, say so and it can become an opt-in.

    Scope

    No published property, no new public type, no behaviour change, as you asked. loadGeneration and seekGeneration stay engine-internal; seekGeneration gained a read-only accessor only, since only seek(to:) may move it.

    Thank you for the writeup. Stating up front which surfaces you had already read and why each fell short is what made this a half-day change instead of a design round, and the #240 interaction above is a trap a naive implementation would have walked straight into.

    Leaving this open for your harness to read the line and confirm the field set is sufficient.

  4. cmcpherson274 commented on Jul 29, 2026

    @cmcpherson274
    Author

    Read back from a real run — 6.0.2, one of the PGS windows from the 48 GB title muxed as a standalone fixture, a single far seek into a composition that was established ~1.6 s before the target (the acquisition-point-free spanning case this whole request exists for). Four lines, and they narrate the session exactly:

    #250 subtitle-resolution loadGen=1 seekGen=0 stream=1 coveredFrom=-15.00 resolvedThrough=39.29 via=pump decodedThrough=39.29 reason=reconstruction
    #250 subtitle-resolution loadGen=1 seekGen=0 stream=1 coveredFrom=-15.00 resolvedThrough=60.12 via=prefetch decodedThrough=59.89 reason=frontier
    #250 subtitle-resolution loadGen=1 seekGen=1 stream=1 coveredFrom=30.70 resolvedThrough=68.03 via=pump decodedThrough=68.03 reason=reconstruction
    #250 subtitle-resolution loadGen=1 seekGen=1 stream=1 coveredFrom=30.70 resolvedThrough=105.95 via=eof decodedThrough=68.03 reason=eof
    The field set is sufficient, and both of your shape changes carry weight in practice:

    The seek's line is fenced (seekGen=1) and coveredFrom=30.70 is the target minus the backscan — exactly the "coverage begins at or before the checkpoint that establishes the state" claim the harness adjudicates. A fence captured at session start would indeed have been stale here; the post-reposition stamp is what makes the line usable.
    via does the honest work: my adjudicator treats via=prefetch and via=eof as carrying the determination claim and via=pump as its own answer ("not determined beyond what is already decoded") — which is precisely the distinction the ruling I work under forbids papering over. The final line's resolvedThrough=105.95 against decodedThrough=68.03 is the sparse-track case stated cleanly.
    reason=frontier firing at the handoff (line 2) rather than waiting for a cadence tick is the emission point I didn't know to ask for. The per-tick raw cadence you offered as opt-in: not needed — the transitions carry everything my harness consumes.
    Sufficient as shipped; nothing further requested. My conformance harness will adopt a 6.0.2+ candidate under its usual pre-registration and this line becomes the subtitle-liveness witness it was missing. Thanks for the turnaround — same-day twice in one day is not a cadence I expected to write down.

  5. superuser404notfound commented on Jul 30, 2026

    @superuser404notfound
    Owner

    Those four lines read exactly as intended, including the two spots where the sequence is easy to over-read. Three notes so your adjudicator does not have to infer them, then closing.

    coveredFrom=-15.00 on the first line is deliberate, not a floor bug. It is playhead - subtitleDrainBackscanSeconds with no clamp, because the source axis does not have to start at 0: on a container with a non-zero start_time a clamp to 0 would claim coverage over a span that is genuinely below the first PTS, which is the same class of over-claim the whole line exists to avoid. Below the stream's own origin there is nothing to be wrong about, so the value stays raw. Treat coveredFrom as an upper bound on where the contiguous decoded run begins, never as a position that must exist.

    via=pump on line 3, and no via=prefetch between it and line 4, is structure rather than a re-anchor that failed. The post-seek reason=reconstruction line is emitted inside the drain tick's per-channel loop, and the re-anchor request is issued once after that loop, so a reconstruction line following a jump is via=pump by construction: at the moment it is written the reader has not yet been asked to move, let alone stamped a position under the new fence. The next emission point is then whichever comes first, a frontier-change tick 500 ms later or the prefetcher's EOF, and on a standalone ~106 s fixture the re-anchor plus read-to-EOF fit inside that interval, so nothing ever observed via=prefetch under seekGen=1. Line 4 carrying via=eof at all is the proof the re-anchor landed: an end-of-file stamped under seekGen=0 fails the fence and would have read via=pump again. On the 48 GB title expect via=prefetch as the post-seek steady state, with via=eof only near the end of the track.

    6.1.0 is worth pinning over 6.0.2 for your harness specifically. It adds a seekEvents publisher (.began / .landed(renderedTime:) / .stalled / .superseded / .rejected), which answers the other half of a post-seek adjudication from outside: which seek the observation belongs to, and whether it landed, is still recovering, or was taken over. That was #38, from a synchronized-playback host with the same "a level's falling edge cannot tell a landing from a give-up" problem your PGS case has on the subtitle axis. Purely additive; isSeeking / seekTarget keep their meaning. One correlation caveat: SeekEvent.id is not seekGeneration. Both are monotonic per engine instance, but the event id also counts rejected seeks, so line up the n-th accepted seek with the n-th generation rather than comparing the numbers.

    Closing as shipped in 6.0.2. Thanks for running the fixture back and for reporting per-line what your adjudicator does with each field; that is what made the via split and the post-reposition stamp verifiable rather than plausible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions