Skip to content

Make the seek signal's falling edge trustworthy, and publish a seek-lifecycle stream (#38) - #252

Merged
superuser404notfound merged 1 commit into
mainfrom
feat/issue38-seek-lifecycle-events
Jul 29, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
feat/issue38-seek-lifecycle-events

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Follow-up to #38, from rrgomes' production report on the shipped signal: it held up as the authority for "do not broadcast yet", but three edges needed host-side guards, and one case the signal never saw at all.

isSeeking / seekTarget are a level, and a level's falling edge cannot say whether a seek landed, gave up or was superseded, nor keep the target it belonged to (both properties clear in the same recompute, and any consumer that hops a queue sees them coalesced). The reporting host rebuilt that out of a 1.5 s landing grace, a retained last target and a 180 s unreached-target map.

Added

AetherEngine.seekEvents: AnyPublisher<SeekEvent, Never>. Every accepted seek emits .began and exactly one of .landed(renderedTime:), .stalled, .superseded under the same id; a seek that never reaches a host emits a standalone .rejected. The one asymmetry is the point of the stream: a seek that spends its recovery budget reports .stalled and leaves isSeeking, but stays alive inside AVPlayer as recovery intent, so its .landed can still arrive minutes later on a source that finally serves the target. That is the transition no level signal can carry, and the reporter's 180 s map exists exactly to approximate it.

Every event is also an EngineLog line, so a host that has not wired the stream still gets the statement on device.

Fixed

Verification

Refs #38.

🤖 Generated with Claude Code

https://claude.ai/code/session_01At1agC2qU2Y2MX2BKLdT4N

…g edge trustworthy (#38)

isSeeking/seekTarget are a level, and a level's falling edge cannot say whether a
seek landed, gave up or was superseded, nor carry the target it belonged to. The
synchronized-playback host that asked for the signal rebuilt that host-side out of
a 1.5s landing grace, a retained last target and a 180s unreached-target map.

seekEvents publishes .began, .landed(renderedTime:), .stalled, .superseded and
.rejected, each with its target and an id pairing a seek to its outcome. The one
asymmetry is the point: a seek that spends its recovery budget reports .stalled and
leaves isSeeking, but stays alive inside AVPlayer, so its .landed can still arrive
minutes later on a source that finally serves the target.

Mechanics around it:

- A native scrub's window now ends when the PICTURE reaches the restarted region
  (watched on $renderedTime, bounded at 8s), not when the coalesced producer
  restart drains. Draining means the producer is producing at the new index; the
  picture follows a fetch and a decode later, 1.4s on a WAN source. A restart that
  a programmatic seek caused is left to that seek's events, since the restart
  segment can sit below where the picture lands (seektest: restart 84.0, landing
  90.0).
- Seeks stashed before the session can take them (#127/#178) carry the seek signal.
  They published their target on currentTime with isSeeking false, which is the
  worst combination for a consumer broadcasting position. The stash hands over to
  its replay without a gap in the level.
- seekTarget follows the most authoritative in-flight source instead of the last
  non-nil target ever written, which kept a settled seek's destination published
  while a scrub was in flight toward a different one.
- stopInternal releases the #240 side-reader link gate; a stop landing mid-seek
  left it owned by the video path for the whole next session.

seektest gains a #38 event ledger (unpaired .began = a stranded in-flight window).
Verified on the real loopback path: 11 begans, 11 terminators, none unpaired.

Reported by rrgomes from production use on a 2-Apple-TV + WAN peer setup.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01At1agC2qU2Y2MX2BKLdT4N
@superuser404notfound
superuser404notfound merged commit eb4facb into main Jul 29, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the feat/issue38-seek-lifecycle-events branch July 29, 2026 20:37
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