A swap carries on from the same moment of the game (#168) #172

Merged
cmoriarty merged 3 commits from aim-the-swap into main 2026-11-15 18:48:24 -05:00
Owner

Step 2 of the milestone "Swaps keep your place" (#168). Step 1 (#167, live since 2026-11-15) taught the app how far apart two streams' clocks are. This uses it: a change of stream carries on from the same moment of the game. Not merged, not deployed.

What it does

  • A change of stream is joined on one moment. The stream left ends on it and the stream taken starts on it, on one of the new stream's full pictures. Both are cut on their packets (backend/app/tscut.py); nothing is re-encoded. Only segments no player was sent are cut or dropped. The join is a discontinuity, as before, and the channel's clock runs on.
  • Out of reach, only the shortfall moves. A stream further ahead than it keeps skips the difference. One further behind than the channel holds repeats the difference plus what that stream needs in hand. On the live pair of 2026-11-15 (30 s behind, 15 s held) that is about 20 s back where it was 40 to 50.
  • It never catches up. After a move to a faster stream the channel plays on from where it was and holds more.
  • The same stream on another site carries on after the last segment taken, with no discontinuity and nothing repeated (3 to 9 s before).
  • Every change of stream records aimed (yes, unconfirmed, no), aim_why and in_hand_seconds, beside moved_seconds. The game page says it in the tag that leads the Log row ("Same place", "Back 4.2 s", "Not confirmed", "Not aimed") and behind the hover of the Link row's band.
  • Settings gains "Swaps keep your place", on by default. Off, every swap lands as before.

The owner's two cases

  • A wrong stream is never aimed at. No relation, no aim: the swap lands as before, its event says "not aimed: no match", and no request is made for it. The same for Wrong game.
  • Different commercials. The join is checked against the old stream's sound before it is listed. With no match there (a break), it is joined only on a trusted relation whose stream has not restarted, recorded as "not confirmed" with no seconds, and gets its seconds when the two streams match again.

Found on a real recording: two streams taken for one

This changes something step 1 does on the live app, so it is worth a look before merging.

  • What happened. Run offline on the research's recording of Gonzaga vs. LSU (2026-11-14), the join took thetvapp's stream and the embedsports player's for one stream and joined them on the same timestamps: 23.6 s from the same moment, recorded as "Same place".
  • Why. Since #91 two links are one stream when their clocks are within 20 s. Both encoders had started with the game, so their clocks read about 16 s apart. Step 1 shows such a pair as "Same stream", never compares it, and measures a swap between them by timestamps.
  • At a join now. A pair that is one stream by its clock alone has its timestamps taken only when both links carry the same frames on them: the same timestamp and the same first bytes of the frame, over the three seconds the two overlap. No sound is decoded for that. Frames that differ make the pair two streams, joined where the sound puts the new one, or not aimed.
  • In the watch now. Such a pair is compared like any standby until its sound is heard on the same timestamps (one stream, compared no more) or on others (two streams). A true copy costs one comparison.
  • On the page. "Same stream" is no longer said of a pair heard or seen to be two; its row says where it is.
  • The same recording after the fix: joined by the sound, the picture moves 0.00 s, nothing repeated, 19.9 s in hand. A swap before the pair's first comparison is not aimed and lands as it does today.

Found by an independent review, and fixed

A second reader ran the join on the test harness before this pull request. It reproduced four faults and read a fifth. Each has a test now.

  • Filler in front of a join. A join puts its segments on the clock at once, and their sound is made one by one. Filler that came due in between was listed before them and stamped after them: 17 s forward and 21 s back for a media server. One landed segment could do the same before this change. No filler goes in now while game on the clock waits for its sound.
  • The wrong stream measured from. After a stream that landed nothing, the join measured from the stream before it with the dead stream's relation: 6 s of held video dropped and a 5 s skip, recorded as "not confirmed". Such a swap is not aimed now ("the stream left had not landed"), and gets no seconds.
  • A restart inside the new stream's window was joined across the restart: up to 13 s skipped, recorded as aimed. It lands as before now.
  • A cut could leave the old stream's last segment with no picture and its full length. The stream ends with the segment before it now.
  • The playlist's media sequence went back when a join dropped more held segments than it appended. It no longer does.

The same reader ran 96 ordinary swaps between two matched streams with the audio step on, both directions, ahead and behind: no timestamp went back, every sequence number was sent once, and the record matched the decoded picture within 0.15 s.

What it costs

  • Requests: an aimed swap downloads the new stream from the join to its end, where a swap before downloaded its last three segments. To a faster stream that is more segments, all of them played. A wrong first guess at the join's segment costs one more. A join that is to be checked starts three seconds inside what is held, so its first segment can be one whose moment the channel already had. Nothing is asked for a pair with no relation, and a join that is given up hands its downloads to the landing that follows.
  • One key request more, in one case: an encrypted standby that is the stream playing by its clock alone is now compared until settled, so its key is asked for at its first comparison. Step 1 asked for none.
  • Processor: the check decodes a few seconds of the old stream's sound, one ffmpeg run per segment in a worker thread. The cuts take 1 to 4 ms on a 6.6 MB segment.
  • Further behind live: a channel that moved to a faster stream stays that much further back until it closes.

Found on the way, and fixed here

  • A playlist that carried a stream on from another host took its whole window again when its first read listed nothing new (Timeline.append_upstream numbered it only once it appended). A renewed link on another host (#136) had the same fault.

Decisions taken without the owner

  • The join sits three seconds before the end of what is held when it is to be checked, so the new stream's first segment has sound, and frames, in common with the old one.
  • What a slower stream "needs in hand" is its watch's figure, at least one of its segments, at most the buffer's depth.
  • The buffer's depth is no longer set below what the channel holds at a change of stream, and rises to what a join leaves, up to 17 segments.
  • The help line for "Start behind live" does not say "at 30 s, none of the pairs measured would repeat anything", as the ticket drafted it: the live pair of 2026-11-15 was 30 s apart.
  • A swap to a stream further ahead than it keeps is "Not confirmed" unless the two matched in the last minute: nothing that stream still keeps is in the old one's sound yet.
  • A stream with no IDR picture in reach is not aimed ("no full picture to start on").
  • A link carried on by its segments' names must be named as the stream playing (its address, or the stream id both playlists state). A copy known only by its clock is joined on a full picture instead, with a discontinuity and nothing repeated.
  • A link named as the stream playing whose frames differ is not aimed at ("another stream under the same name").

How it was checked

  • make test: 1,475 passed, 1 skipped, 34 s (about 27 s before this change).
  • npm --prefix frontend test: 287 passed. The frontend builds.
  • make e2e: every part passed on the final code, run with its try of a real source page turned off, as CI runs it. An earlier run of the plain target in this work did make that try: see "Not checked".
  • openspec validate aim-the-swap --strict: valid.
  • The tests use streams generated in the test: a picture that counts the programme, and the programme's sound. A channel plays them from a scripted source with the buffer on and 15 s behind live, and what a player is served across the join is decoded as one stream, every frame read (backend/tests/test_channel_join.py). Every case of the ticket's "Done when" is there.
  • ffmpeg -f hls -c copy -copyts across an aimed join: no timestamp goes backwards and no frame is lost. hls.js in headless Chromium plays through it with one unbroken buffer. The research had not read a head-cut segment inside a playlist.
  • The cuts and the join's clock were run, offline, on seven of the research's real recordings of 2026-11-14 (local files). The full pictures were where the research found them (one at the start of each 3 s segment on the embedsports player's streams, one every 0.35 s on edgestream's).
  • A whole channel's join was run, offline, on two of them. A college football game, thetvapp to an edgestream link: joined by the sound, 0.0 s, the new stream found where the research measured it, to the millisecond. Gonzaga vs. LSU: above. ffmpeg's copy of both has no timestamp going backwards.
  • The Settings page and a game's Log were looked at in a browser with the live app's answers, read only. No row moves when the switch is pressed, and nothing scrolls sideways.

Not checked

  • Nothing ran against a live stream. The ticket's live check is the owner's, after a deploy he asks for: a Swap by hand between two matched streams should record 0.0 s, with no jump on the web player and on Emby. Then a swap to a slower stream out of reach, a recovery after a stall, and a swap during a break.
  • One real page was read, once. The first run of make e2e tried the first listed game's real source page before its local fake source: one read of the hub, answered by a Cloudflare challenge. The later runs had that try turned off.
  • With the audio step off (not production's setting) the sound has a gap of up to one of the new stream's sound packets at a join. The review's 96 swaps did not cover it.
  • The last two pieces had no second reader. The rule for links whose clocks agree, and the five fixes above, were written while or after the review ran. They have their tests, and the three lanes pass with them.
  • How often two streams share a clock on live games is not known: one of the two recorded pairs run through a channel did.

Left for later

  • Two encoders started together are still "one stream" to recovery. resolution.same_stream also decides which standby is "a copy" when a stream fails and which standby is kept (#74, #91, #95, #101). It still goes by the clock alone there.
  • zkotaa.cfd's stream uses other packet ids (0xd3 and 0xdd, where every other stream measured uses 0x100 and 0x101). ffmpeg's copy across a change between the two reports new streams and drops the new one. It is so today, without this change.

🤖 Generated with Claude Code

Step 2 of the milestone "Swaps keep your place" (#168). Step 1 (#167, live since 2026-11-15) taught the app how far apart two streams' clocks are. This uses it: a change of stream carries on from the same moment of the game. Not merged, not deployed. ## What it does - **A change of stream is joined on one moment.** The stream left ends on it and the stream taken starts on it, on one of the new stream's full pictures. Both are cut on their packets (`backend/app/tscut.py`); nothing is re-encoded. Only segments no player was sent are cut or dropped. The join is a discontinuity, as before, and the channel's clock runs on. - **Out of reach, only the shortfall moves.** A stream further ahead than it keeps skips the difference. One further behind than the channel holds repeats the difference plus what that stream needs in hand. On the live pair of 2026-11-15 (30 s behind, 15 s held) that is about 20 s back where it was 40 to 50. - **It never catches up.** After a move to a faster stream the channel plays on from where it was and holds more. - **The same stream on another site carries on** after the last segment taken, with no discontinuity and nothing repeated (3 to 9 s before). - **Every change of stream records** `aimed` (`yes`, `unconfirmed`, `no`), `aim_why` and `in_hand_seconds`, beside `moved_seconds`. The game page says it in the tag that leads the Log row ("Same place", "Back 4.2 s", "Not confirmed", "Not aimed") and behind the hover of the Link row's band. - **Settings gains "Swaps keep your place"**, on by default. Off, every swap lands as before. ## The owner's two cases - **A wrong stream is never aimed at.** No relation, no aim: the swap lands as before, its event says "not aimed: no match", and no request is made for it. The same for Wrong game. - **Different commercials.** The join is checked against the old stream's sound before it is listed. With no match there (a break), it is joined only on a trusted relation whose stream has not restarted, recorded as "not confirmed" with no seconds, and gets its seconds when the two streams match again. ## Found on a real recording: two streams taken for one This changes something step 1 does on the live app, so it is worth a look before merging. - **What happened.** Run offline on the research's recording of Gonzaga vs. LSU (2026-11-14), the join took thetvapp's stream and the embedsports player's for one stream and joined them on the same timestamps: 23.6 s from the same moment, recorded as "Same place". - **Why.** Since #91 two links are one stream when their clocks are within 20 s. Both encoders had started with the game, so their clocks read about 16 s apart. Step 1 shows such a pair as "Same stream", never compares it, and measures a swap between them by timestamps. - **At a join now.** A pair that is one stream by its clock alone has its timestamps taken only when both links carry the same frames on them: the same timestamp and the same first bytes of the frame, over the three seconds the two overlap. No sound is decoded for that. Frames that differ make the pair two streams, joined where the sound puts the new one, or not aimed. - **In the watch now.** Such a pair is compared like any standby until its sound is heard on the same timestamps (one stream, compared no more) or on others (two streams). A true copy costs one comparison. - **On the page.** "Same stream" is no longer said of a pair heard or seen to be two; its row says where it is. - **The same recording after the fix:** joined by the sound, the picture moves 0.00 s, nothing repeated, 19.9 s in hand. A swap before the pair's first comparison is not aimed and lands as it does today. ## Found by an independent review, and fixed A second reader ran the join on the test harness before this pull request. It reproduced four faults and read a fifth. Each has a test now. - **Filler in front of a join.** A join puts its segments on the clock at once, and their sound is made one by one. Filler that came due in between was listed before them and stamped after them: 17 s forward and 21 s back for a media server. One landed segment could do the same before this change. No filler goes in now while game on the clock waits for its sound. - **The wrong stream measured from.** After a stream that landed nothing, the join measured from the stream before it with the dead stream's relation: 6 s of held video dropped and a 5 s skip, recorded as "not confirmed". Such a swap is not aimed now ("the stream left had not landed"), and gets no seconds. - **A restart inside the new stream's window** was joined across the restart: up to 13 s skipped, recorded as aimed. It lands as before now. - **A cut could leave the old stream's last segment with no picture** and its full length. The stream ends with the segment before it now. - **The playlist's media sequence went back** when a join dropped more held segments than it appended. It no longer does. The same reader ran 96 ordinary swaps between two matched streams with the audio step on, both directions, ahead and behind: no timestamp went back, every sequence number was sent once, and the record matched the decoded picture within 0.15 s. ## What it costs - **Requests:** an aimed swap downloads the new stream from the join to its end, where a swap before downloaded its last three segments. To a faster stream that is more segments, all of them played. A wrong first guess at the join's segment costs one more. A join that is to be checked starts three seconds inside what is held, so its first segment can be one whose moment the channel already had. Nothing is asked for a pair with no relation, and a join that is given up hands its downloads to the landing that follows. - **One key request more, in one case:** an encrypted standby that is the stream playing by its clock alone is now compared until settled, so its key is asked for at its first comparison. Step 1 asked for none. - **Processor:** the check decodes a few seconds of the old stream's sound, one ffmpeg run per segment in a worker thread. The cuts take 1 to 4 ms on a 6.6 MB segment. - **Further behind live:** a channel that moved to a faster stream stays that much further back until it closes. ## Found on the way, and fixed here - A playlist that carried a stream on from another host took its whole window again when its first read listed nothing new (`Timeline.append_upstream` numbered it only once it appended). A renewed link on another host (#136) had the same fault. ## Decisions taken without the owner - The join sits three seconds before the end of what is held when it is to be checked, so the new stream's first segment has sound, and frames, in common with the old one. - What a slower stream "needs in hand" is its watch's figure, at least one of its segments, at most the buffer's depth. - The buffer's depth is no longer set below what the channel holds at a change of stream, and rises to what a join leaves, up to 17 segments. - The help line for "Start behind live" does not say "at 30 s, none of the pairs measured would repeat anything", as the ticket drafted it: the live pair of 2026-11-15 was 30 s apart. - A swap to a stream further ahead than it keeps is "Not confirmed" unless the two matched in the last minute: nothing that stream still keeps is in the old one's sound yet. - A stream with no IDR picture in reach is not aimed ("no full picture to start on"). - A link carried on by its segments' names must be named as the stream playing (its address, or the stream id both playlists state). A copy known only by its clock is joined on a full picture instead, with a discontinuity and nothing repeated. - A link named as the stream playing whose frames differ is not aimed at ("another stream under the same name"). ## How it was checked - `make test`: 1,475 passed, 1 skipped, 34 s (about 27 s before this change). - `npm --prefix frontend test`: 287 passed. The frontend builds. - `make e2e`: every part passed on the final code, run with its try of a real source page turned off, as CI runs it. An earlier run of the plain target in this work did make that try: see "Not checked". - `openspec validate aim-the-swap --strict`: valid. - The tests use streams generated in the test: a picture that counts the programme, and the programme's sound. A channel plays them from a scripted source with the buffer on and 15 s behind live, and what a player is served across the join is decoded as one stream, every frame read (`backend/tests/test_channel_join.py`). Every case of the ticket's "Done when" is there. - `ffmpeg -f hls -c copy -copyts` across an aimed join: no timestamp goes backwards and no frame is lost. hls.js in headless Chromium plays through it with one unbroken buffer. The research had not read a head-cut segment inside a playlist. - The cuts and the join's clock were run, offline, on seven of the research's real recordings of 2026-11-14 (local files). The full pictures were where the research found them (one at the start of each 3 s segment on the embedsports player's streams, one every 0.35 s on edgestream's). - A whole channel's join was run, offline, on two of them. A college football game, thetvapp to an edgestream link: joined by the sound, 0.0 s, the new stream found where the research measured it, to the millisecond. Gonzaga vs. LSU: above. ffmpeg's copy of both has no timestamp going backwards. - The Settings page and a game's Log were looked at in a browser with the live app's answers, read only. No row moves when the switch is pressed, and nothing scrolls sideways. ## Not checked - **Nothing ran against a live stream.** The ticket's live check is the owner's, after a deploy he asks for: a Swap by hand between two matched streams should record 0.0 s, with no jump on the web player and on Emby. Then a swap to a slower stream out of reach, a recovery after a stall, and a swap during a break. - **One real page was read, once.** The first run of `make e2e` tried the first listed game's real source page before its local fake source: one read of the hub, answered by a Cloudflare challenge. The later runs had that try turned off. - **With the audio step off** (not production's setting) the sound has a gap of up to one of the new stream's sound packets at a join. The review's 96 swaps did not cover it. - **The last two pieces had no second reader.** The rule for links whose clocks agree, and the five fixes above, were written while or after the review ran. They have their tests, and the three lanes pass with them. - **How often two streams share a clock on live games** is not known: one of the two recorded pairs run through a channel did. ## Left for later - **Two encoders started together are still "one stream" to recovery.** `resolution.same_stream` also decides which standby is "a copy" when a stream fails and which standby is kept (#74, #91, #95, #101). It still goes by the clock alone there. - **zkotaa.cfd's stream uses other packet ids** (0xd3 and 0xdd, where every other stream measured uses 0x100 and 0x101). ffmpeg's copy across a change between the two reports new streams and drops the new one. It is so today, without this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
When the channel changes stream, the new one started three segments
from its end, wherever that fell in the game. On recordings of
2026-11-14 the same swap went forward 7.3 s on one game and back 19.9 s
on another; on the first live game after step 1 the stream playing ran
30 s ahead of its standby, and a swap would have gone back 40 to 50 s.
This is step 2 of the milestone "Swaps keep your place". Step 1 (#167)
taught the app the relation between two streams' clocks; this uses it.

A change of stream is now joined on one moment. The stream left ends on
it and the stream taken starts on it, on one of the new stream's full
pictures. Both are cut on their packets (tscut.py: whole 188-byte
packets dropped, every packet kept byte for byte), nothing re-encoded.
Only segments no player's playlist has listed are cut or dropped, and
their numbers go to the new stream's. The join is a discontinuity as
before, and the moment keeps its time on the channel's clock: a stream
that reorders its frames gets its first decode timestamps raised past
the old stream's last, so a reader that copies timestamps sees them
rise.

Where the join goes is aim.choose: as late as the old stream reaches,
inside what the channel holds; on the full picture nearest the old
stream's end when nothing is held (the buffer off, or played out during
a stall); and, out of reach, only the shortfall moves. A stream further
ahead than it keeps starts on its first full picture. One further
behind than is held starts early enough to leave in hand what it needs
(what its watch measured, at least one segment, at most the buffer's
depth). After a move to a faster stream the channel holds more and
never catches up: the depth rises to what it holds, up to 17 segments,
and is no longer set below what is held at a change of stream.

It aims only when it can tell where the new stream is. No relation, no
aim: the swap lands as before and its event says "not aimed: no match".
The same for Wrong game, a stream that cannot be cut, and the setting
off. The join is checked: the first segment downloaded of the new
stream is looked for in the old stream's kept sound, around the
expected place first (offsets.confirm); a match in the last minute
counts as that check. Found, where expected or elsewhere, it is joined
there. Not found, it is joined only on a trusted relation whose stream
has not restarted, recorded as "unconfirmed" with no seconds, and the
pair's next match gives the event its seconds. Segments downloaded for
a join that is then not made are used by the landing that follows.

The same stream on another site carries on after the last segment
taken, by the segment's name, with no discontinuity, when the link is
named as the stream playing (its address, or the stream id both
playlists state); with other names it is joined by the timestamps, with
no listening. A playlist that carries a stream on is now numbered from
the segment that matched: before, a first read that listed nothing new
was followed by one that took the whole window again (a renewed link on
another host, #136, had the same fault).

Two links whose clocks agree are no longer one stream on that alone.
Run on the research's recording of Gonzaga vs. LSU, the join took
thetvapp's stream and the embedsports player's for one (their clocks
about 16 s apart: both encoders had started with the game) and joined
them 23.6 s from the same moment, recorded as "Same place". A join now
takes such a pair's timestamps only when both links carry the same
frames on them: the same timestamp and the same first bytes
(tscut.Picture.mark; the timestamp alone passed two encoders that
count their frames from a round number). Frames that differ make the
pair two streams, joined where the sound puts the new one or not
aimed. The watch, which skipped such a pair, compares it until its
sound is heard on the same timestamps (one stream, compared no more)
or on others (two streams). "Same stream" on Admin and a figure "by
the timestamps" are given only while nothing says otherwise
(offsets.one_stream). A link named as the stream playing whose frames
differ is not aimed at.

Every change of stream records aimed (yes, unconfirmed, no), aim_why
and in_hand_seconds beside moved_seconds. The game page says it in the
one tag that leads the change's Log row ("Same place", "Back 4.2 s",
"Not confirmed", "Not aimed") and behind the hover of the Link row's
band. Settings gains "Swaps keep your place", on by default
(playback.aim; CHANNEL_AIM_SWAPS is its starting value), and "Start
behind live" says it is also the room a swap has for meeting a slower
stream.

Tested with streams generated in the test, whose picture counts the
programme and whose sound is the programme's: a channel plays them from
a scripted source, and what a player is served across the join is
decoded frame by frame. ffmpeg's copy with timestamps kept and hls.js
in headless Chromium read an aimed join there. The cuts and the join's
clock were also run, offline, on the real recordings of 2026-11-14, and
a channel's whole join on two of them. Not yet run against a live
stream.

OpenSpec change: aim-the-swap.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
An independent read of the join, run on the test harness before the
pull request, reproduced four faults and read a fifth.

Filler in front of a join. A join puts every segment it took on the
clock at once, and their sound is then made one by one. Filler that
came due in between went in front of the first segment not listed yet
(Timeline.insert_filler) and was stamped after all of them: 17 s
forward and 21 s back for a reader that copies timestamps. One landed
segment could do the same before this change. No filler goes in now
while game on the clock is waiting for its sound; the audio step is
run instead.

The stream measured from. After a stream that landed nothing (its
segments did not come) the timeline still ends on the stream before
it, while the relation at hand is the dead stream's. The join mixed
the two: the 6 s still held were dropped and the picture skipped 5 s,
recorded as unconfirmed. A join is now made only from the stream that
was left ("not aimed: the stream left had not landed"), and the
record's seconds are not worked out across such a gap
(offsets._splice).

A restart inside the new stream's window. A window holding two clocks
was joined across the restart with one relation: up to 13 s skipped,
recorded as aimed. What a join downloads must now run on one clock
with no discontinuity listed between, or the swap lands as before.

A cut that leaves no picture. In a stream that reorders its frames, a
cut among a segment's first decoded frames dropped all of its video
and kept its listed length. The stream now ends with the segment
before it (Channel._old_end).

The playlist's media sequence. A join that dropped more held segments
than it appended, on a timeline longer than the window, moved
EXT-X-MEDIA-SEQUENCE back and listed scrolled-out segments again. The
window no longer starts before one already shown
(Timeline.window_floor).

A test for each. make test: 1,475 passed, 1 skipped, 34 s.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A second reader went over the rule for links whose clocks agree and the
fixes of the first review.

A frame's mark was a checksum of its bytes up to the end of the packet
that holds its first slice. Where that packet ends depends on the
muxer, not the frame: a copy re-muxed with ffmpeg kept 63 or 120 of 180
marks (clock references placed otherwise, a constant bitrate), below
the 0.75 the frame test wants, so a true copy was taken for another
stream, and a link named as the stream playing was refused. The mark is
now the first 256 bytes of the frame's first slice, read across
packets: 180 of 180 on every layout tried.

What was heard decides over what a join saw of the frames: sound on
the same timestamps is one stream, which is all a join by timestamps
needs. A pair once seen with other frames no longer stays two streams
for good.

A discontinuity tag alone is no restart. A stream that marks its breaks
with one runs on one clock across them; only timestamps that do not
follow make a window two clocks.

A test for each. Also run for this stage, outside the repository:
96 swaps with the audio step off and 96 between streams whose clocks
agree, all clean, and the join on all 19 recordings with both streams
(38 joins, no timestamp going backwards in any copy).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Stage 1 of the test plan: done, before merge

All offline, on this machine. Nothing touched the live app or a streaming site.

A second, independent review of the parts the first review had not seen: the rule for streams whose clocks agree, and the five fixes in 17628e4. It found two faults, both fixed in 27b8031 with a test each.

  • A true copy could be taken for another stream. A frame's mark depended on where its packets ended, which differs between muxers: a re-muxed copy kept only 63 or 120 of 180 marks. The mark is now the frame's own slice bytes: 180 of 180 on every layout tried. Heard sound now also decides over frames, so a pair heard on the same timestamps is one stream.
  • A discontinuity tag was taken for a restart. A stream that tags its breaks would never have been aimed, and Admin would have said "restarted". Only timestamps that jump count now.

The rest it checked held up. That covers the filler hold (it cannot stick), the playlist window floor, where the old stream ends, and the "stream left had not landed" check.

Sweeps of random swaps on generated streams

Sweep Swaps Result
Audio step off, both directions, ahead and behind, checked and unchecked 96 All clean
Streams whose clocks agree (two encoders started together) 96 80 aimed and landed where they recorded. 12 not aimed (the new stream ahead and nothing heard yet), landing as before and claiming no figure. 4 setups did not apply
Audio step on (the first reviewer's sweep, earlier) 96 All clean

The join on every research recording that holds both streams

There are 19 recordings, each joined with the audio step on and off: 38 joins.

  • 28 joins (14 recordings): aimed on the same moment, 0.0 s. Each relation found at the join is the research's to the millisecond. One recording is the same stream on two sites, joined by its timestamps.
  • 2 joins (the NFL recording): "Not confirmed", by design. The standby ran 16.4 s ahead and kept only 9 s, so it skipped about 1.35 s.
  • 8 joins (4 recordings the research could not measure confidently): not aimed, landing as before.
  • ffmpeg's copy: no timestamp went backwards in any of the 76 copies, and nothing was repeated.

Lanes on 27b8031: make test 1,480 passed, 1 skipped, 34 s. npm --prefix frontend test 287 passed. The e2e lane passed with its real-page try turned off. openspec validate aim-the-swap --strict is valid.

Still the owner's: reading this pull request and its "Decisions taken without the owner", then the merge. Stage 2 (deploy checks) and stage 3 (the live presses) follow from that.

## Stage 1 of the test plan: done, before merge All offline, on this machine. Nothing touched the live app or a streaming site. **A second, independent review** of the parts the first review had not seen: the rule for streams whose clocks agree, and the five fixes in 17628e4. It found two faults, both fixed in 27b8031 with a test each. - **A true copy could be taken for another stream.** A frame's mark depended on where its packets ended, which differs between muxers: a re-muxed copy kept only 63 or 120 of 180 marks. The mark is now the frame's own slice bytes: 180 of 180 on every layout tried. Heard sound now also decides over frames, so a pair heard on the same timestamps is one stream. - **A discontinuity tag was taken for a restart.** A stream that tags its breaks would never have been aimed, and Admin would have said "restarted". Only timestamps that jump count now. The rest it checked held up. That covers the filler hold (it cannot stick), the playlist window floor, where the old stream ends, and the "stream left had not landed" check. **Sweeps of random swaps on generated streams** | Sweep | Swaps | Result | | --- | --- | --- | | Audio step off, both directions, ahead and behind, checked and unchecked | 96 | All clean | | Streams whose clocks agree (two encoders started together) | 96 | 80 aimed and landed where they recorded. 12 not aimed (the new stream ahead and nothing heard yet), landing as before and claiming no figure. 4 setups did not apply | | Audio step on (the first reviewer's sweep, earlier) | 96 | All clean | **The join on every research recording that holds both streams** There are 19 recordings, each joined with the audio step on and off: 38 joins. - **28 joins** (14 recordings): aimed on the same moment, 0.0 s. Each relation found at the join is the research's to the millisecond. One recording is the same stream on two sites, joined by its timestamps. - **2 joins** (the NFL recording): "Not confirmed", by design. The standby ran 16.4 s ahead and kept only 9 s, so it skipped about 1.35 s. - **8 joins** (4 recordings the research could not measure confidently): not aimed, landing as before. - **ffmpeg's copy:** no timestamp went backwards in any of the 76 copies, and nothing was repeated. **Lanes on 27b8031:** `make test` 1,480 passed, 1 skipped, 34 s. `npm --prefix frontend test` 287 passed. The e2e lane passed with its real-page try turned off. `openspec validate aim-the-swap --strict` is valid. **Still the owner's:** reading this pull request and its "Decisions taken without the owner", then the merge. Stage 2 (deploy checks) and stage 3 (the live presses) follow from that.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
cmoriarty/sports-breaker!172
No description provided.