Skip to content

quest: import #5052 and #5101 as no-stitch and fresh TS export restarts - #5108

Merged
kixelated merged 4 commits into
mainfrom
quest/import-5052-5101
Oct 9, 2026
Merged

kixelated merged 4 commits into
mainfrom
quest/import-5052-5101

Conversation

@kixelated

@kixelated kixelated commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Imports the two open issues without the quest label.

Quests

Decisions

5052 goal: I don't get the export-side guard, does moq-net 5087 just fix this? (Answer after tracing: no. The redispatch arm in front.rs is untouched, and #5087's held END/START arrives after the 2 ms re-subscribe.)

Stitch fix

  • ✅ Resume only in an epoch (Recommended)
  • Terminal error from relay
  • Accept it

Placement

Export guard

  • ✅ No, source fix only (Recommended)
  • Yes, add it

5101 home

  • ✅ Extend ts-hitless (Recommended)
  • New m1 quest
  • Won't fix

Cutover rule (for --sync legs across a republish): "I don't really want to cut over? Like maybe we can guarantee identical output for the same epoch, but really we should restart the TS export if there's a new epoch instead of trying to stitch. Can you make sure we're not doing something dumb and trying to make TS export survive across epoch/route changes? It needs to be a new TS broadcast with its own new epoch."

TS restart

  • ✅ Fresh Export in-process (Recommended)
  • Delete --linger
  • Keep resume() as is

New epoch (meaning of "its own new epoch")

  • ✅ Just the TS stream (Recommended)
  • Re-import mints an epoch

Hitless guarantee: "I don't think we can support byte identical across restarts?" Recorded as: within one epoch only.

TS placement

  • ✅ m0 broadcast-epoch (Recommended)
  • m1

SRT egress

  • ✅ Same quest (Recommended)
  • Separate quest
  • Not needed

Follow-up (plan an audit of in-broadcast marker restarts?)

  • ✅ Plan audit quest (Recommended)
  • Skip

(The audit found that rewinds are already refused since #3711; markers only declare pauses and forward breaks.)

Markers

  • ✅ Fold into export-ts (Recommended)
  • Separate small quest
  • Drop it

TS switch (after asking whether --linger should switch broadcasts at all): "hmm, maybe add --stitch and have it make a fresh export with a full program switch? The default would be to not."

--stitch: "I think they can be separate? --linger would say how long to wait for a broadcast to restart (could be the same epoch), while --stitch would allow switching epochs?"

This supersedes the earlier TS restart answer (fresh Export on every Restart).

Export API (with resume() gone)

  • ✅ One follow(self, broadcast) (Recommended)
  • Two methods
  • Builder policy

SRT API

  • ✅ moq_srt::Config (Recommended)
  • Per subscribe

Public API / wire

Planning only, no code. The planned quests remove ts::Export::resume and rename restarts() (breaking), add ts::Export::follow and linger/stitch on moq_srt::Config, add --stitch to export ts and SRT egress, and change epochless subscriptions to surface upstream errors. No wire change.

Mentions #5052 and #5101 without closing keywords.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

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

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 542adec1-f43b-481f-ab17-a27b5c74c186

📥 Commits

Reviewing files that changed from the base of the PR and between a0161e6 and 29769c7.


📒 Files selected for processing (4)
  • quest/m0/broadcast-epoch/README.md
  • quest/m0/broadcast-epoch/export-ts.md
  • quest/m0/broadcast-epoch/no-stitch.md
  • quest/m2/ts-hitless.md


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T18:31:46.312095Z 890da34 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7bd56d1005

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread quest/m0/broadcast-epoch/export-ts.md Outdated
Comment on lines +32 to +33
- moq-srt's egress (`rs/moq-srt/src/ts.rs`) follows the same rule and keeps its
SRT connection across the break.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Define how SRT distinguishes a restart from a final End

On older protocol versions the only signal is End followed by Start, but a permanent publisher shutdown produces the same End, and unlike the CLI the SRT egress has no --linger bound. Keeping the connection while waiting for a possible Start can therefore leave every normally ended SRT subscription open indefinitely, while closing on End misses replacements. Specify a deterministic termination/replacement policy for SRT and cover the unreplaced-End case in its tests.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 890da34. SRT egress gets the same --linger as the CLI, defaulting to 0, so an End that nothing replaces within the linger closes the SRT stream. The quest now tests that case alongside the stitch.

(Written by Claude Opus 5.5)

Comment thread quest/m0/broadcast-epoch/export-ts.md Outdated
- Docs: the `--linger` paragraph in `doc/bin/cli.md` and any restart
behavior in `doc/bin/srt.md`.

Public API: breaking, `ts::Export::resume` is removed. Wire: none.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Account for the API needed to seed replacement exports

The old PAT/PMT version must cross from one Export to another, but both callers named here live outside moq-mux, so carrying that value and identifying the new export as a successor requires a new or changed public constructor/builder/successor operation. Reporting only the removal of resume leaves the required public surface undecided and its impact unreported; specify that surface and include it in this section.

AGENTS.md reference: AGENTS.md:L56-L60

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed in 890da34. The successor API is now an open question to settle when the quest starts. The recommendation is a method that consumes the old export and returns its successor on a new source (such as Export::stitch(self, source)), so the PSI version never becomes a public knob. The Public API line reports it.

(Written by Claude Opus 5.5)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 7bd56d10056217dffa9dd8d0a4d9b6b71e4b0b2f.

Direction: enforcing identity in moq-net and creating a fresh TS export on replacement is simpler than extending the partial reset. Scoping hitless output to one epoch is consistent with that design.

The existing P2 SRT termination finding at quest/m0/broadcast-epoch/export-ts.md:32–33 is actionable: specify when an unreplaced End closes the SRT stream and test that alongside End/Start replacement, since SRT currently has no linger bound. No additional actionable bugs found.

Verification: GitHub-only static inspection of all four changed documents, linked plans/issues, and relevant front, exporter, CLI and SRT code. No builds or tests run; this PR is planning-only, and the proposed implementation remains unverified.

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

Copy link
Copy Markdown
Collaborator Author

Grok review at 8015e0f3 (quest/docs only)

Code references check out on main: Front::track_ended's Err(_) if delivered arm redispatches (rs/moq-net/src/model/front.rs:549), ts::Export::resume exists (rs/moq-mux/src/container/ts/export.rs:1426) and is what --linger calls (rs/moq-cli/src/subscribe.rs:466), restarts() is at container/consumer.rs:163, and rs/moq-srt/src/ts.rs, doc/bin/cli.md, doc/bin/srt.md, restart.md all exist.

Blocking

  1. export-ts.md contradicts the recorded decision and the PR body. The body says a Restart builds a fresh ts::Export in-process ("TS restart: ✅ Fresh Export in-process"), and the quoted maintainer intent is "we should restart the TS export if there's a new epoch... It needs to be a new TS broadcast." The quest instead makes the default exit 1 on a replacement and puts the fresh-Export path behind a new opt-in --stitch flag. That's a third option nobody picked, and it adds a CLI flag to export ts and SRT egress. Either rewrite the Goal/Plan so a replacement always starts a fresh Export (no --stitch), or record that decision and update the body. The README.md line and the ts-hitless.md non-goal ("starts a fresh stream with --stitch") need to follow whichever wins.

Non-blocking

  • Naming: no-stitch.md uses "stitch" for the bug (silent splice of two instances), while export-ts.md uses --stitch for the fix (a flagged program switch). If the flag survives, a name like --follow would read less like it re-enables export ts: after re-requesting onto a live route, the first video unit it fetches ends the export ("missed a decode deadline") #5052.
  • no-stitch.md's accepted consequence (any upstream error ends an epochless track on lite-06) is a behavior break for every epochless subscriber, not just TS export; worth naming in the epoch README's lite-06 default section so it isn't only in the quest.
  • ts-hitless.md: the inserted ", within one epoch" makes the first sentence run on; minor.

Verdict: ITERATE — reconcile the --stitch design in export-ts.md with the decision recorded in the body.

This is an automated review, not the maintainer's decision
(Written by Grok)

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

Copy link
Copy Markdown
Collaborator Author

Re the Grok review's blocking item: it reviewed the PR body before I updated it. After the "TS restart" answer, the maintainer asked whether --linger should switch broadcasts at all, and chose the --stitch split: --linger waits for the same epoch, --stitch allows switching epochs, and the default doesn't switch. The body's decision trail now records that, and notes that it supersedes the earlier answer. The README and ts-hitless lines already follow it.

On naming: no-stitch.md (the moq-net bug, a silent splice) and --stitch (an opt-in, flagged program switch) are both splices, one hidden and one declared. The maintainer chose the flag name, so I've left it.

@codex review

(Written by Claude Opus 5.5)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Follow-up review at 890da342 (push since 8015e0f3, one commit, quest/m0/broadcast-epoch/export-ts.md only)

What changed: SRT egress linger now defaults to 0, so an unreplaced End closes the SRT stream (and a test for that is planned). There's also a new open decision on how the PMT version carries over to the successor Export, with Export::stitch(self, source) as the recommendation. Both are sensible. Consuming the old export keeps the PSI version from becoming a public knob.

Still open from the earlier review:

  • Blocking: the fresh export is still gated behind the opt-in --stitch, and by default the export exits 1 on replacement. That contradicts the recorded "fresh Export in-process" decision. Either update the decision record or make stitching the default.

New, non-blocking:

  • Linger 0 on SRT egress changes behavior for callers that stay connected today. Flag it next to the CLI change in the Public API line.
  • The Public API paragraph has a very long line after the edit (renamed. New: the successor operation above. CLI: ...). Rewrap it.
  • If Export::stitch is chosen, say what happens to buffered or unflushed output from the old export when self is consumed.

Verdict: ITERATE

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed commit: 890da342c8993ae8570d146343ecd8091f558bf4 (substantive delta since 7bd56d10056217dffa9dd8d0a4d9b6b71e4b0b2f; unchanged base).

The opt-in --stitch split is clearer. The SRT linger default and unreplaced-End test address the termination issue referenced in my previous review. One remaining P2 planning gap is inline: advancing only the PMT version does not cover a changed PAT mapping.

Verification: GitHub-only static inspection of the updated plans, current exporter and relevant TSDuck receiver code. No builds or tests run; proposed behavior is not implemented by this PR.

Comment thread quest/m0/broadcast-epoch/export-ts.md Outdated
Comment on lines +48 to +49
`discontinuity_indicator`, the PMT `version_number` advances (the only value
handed from the old `Export`), and each elementary stream starts at a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve PAT-version advancement across a program switch

Please advance the PAT version as well when the new catalog changes its mapping. Export::build_psi() preserves the catalog's transport-stream ID and PMT PID but initializes the PAT version to zero. Stitching from PMT PID 0x1000 to 0x1001 under the same TSID/program therefore changes the PAT without changing its version. TSDuck's version-caching demux, used by tsp -P zap, ignores that PAT and keeps looking for the old PMT; a discontinuity flag does not clear its table cache. Seed both PSI tables from the carried version, and add a stitch regression retaining TSID while changing PMT PID.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 29769c7. The PAT and PMT versions both carry over and advance on a stitch, with a test that keeps the TSID and moves the PMT PID. Same-epoch continuation and the stitch share one decided operation, ts::Export::follow(self, broadcast). SRT policy lives on moq_srt::Config (linger, stitch). The Public API line reports both.

(Written by Claude Opus 5.5)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 890da342c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread quest/m0/broadcast-epoch/export-ts.md Outdated
- Drive both flags from announcements, as players do: `Start`, `Restart`, and
`End` with their epochs. An export that fails while its broadcast is still
announced exits 1 without lingering, as today.
- Same epoch within `--linger`: re-request it and keep the same `Export`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Define the same-epoch continuation API

Although the successor operation now covers --stitch, this path still has no callable way to rebind the retained Export after its catalog and tracks terminate: the plan deletes Export::resume(), while the CLI and SRT callers cannot replace Export's private source state. Merely keeping the object leaves subsequent next() calls terminal, so specify and report a same-epoch continuation surface or a caller-configurable internal policy for --linger.

AGENTS.md reference: AGENTS.md:L59-L60

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 29769c7. The PAT and PMT versions both carry over and advance on a stitch, with a test that keeps the TSID and moves the PMT PID. Same-epoch continuation and the stitch share one decided operation, ts::Export::follow(self, broadcast). SRT policy lives on moq_srt::Config (linger, stitch). The Public API line reports both.

(Written by Claude Opus 5.5)

Comment thread quest/m0/broadcast-epoch/export-ts.md Outdated
Comment on lines +48 to +49
`discontinuity_indicator`, the PMT `version_number` advances (the only value
handed from the old `Export`), and each elementary stream starts at a

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Advance the PAT version during a full program switch

When the replacement catalog keeps the transport-stream ID but changes the program number or PMT PID, the PAT content changes too. Carrying only the PMT version lets the fresh export reuse the old PAT version, so receivers may treat that PAT as unchanged and continue listening on the old PMT PID. Carry the PAT version across the stitch as well and test a replacement whose program mapping changes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 29769c7. The PAT and PMT versions both carry over and advance on a stitch, with a test that keeps the TSID and moves the PMT PID. Same-epoch continuation and the stitch share one decided operation, ts::Export::follow(self, broadcast). SRT policy lives on moq_srt::Config (linger, stitch). The Public API line reports both.

(Written by Claude Opus 5.5)

Comment on lines +53 to +54
- moq-srt's egress (`rs/moq-srt/src/ts.rs`) gets the same two options and keeps
its SRT connection across a stitch. Its linger defaults to 0, like the CLI:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report the SRT egress API needed for these options

The same options cannot be added to SRT egress solely as CLI flags: embedders use the exported moq_srt::Config, Server, and Subscribe::accept interfaces, none of which currently accepts a linger or stitch policy. The planned public API impact lists only the TS-export successor and CLI change, leaving library consumers no specified way to select this behavior; decide where this policy belongs and report that public surface.

AGENTS.md reference: AGENTS.md:L59-L60

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 29769c7: decided that the policy lives on moq_srt::Config as linger: Duration (default 0) and stitch: bool (default false), mirrored as CLI flags. The Public API line reports it.

(Written by Claude Opus 5.5)

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

Copy link
Copy Markdown
Collaborator Author

Follow-up review at 29769c7d (push since 890da342, one commit, quest/m0/broadcast-epoch/export-ts.md only)

What changed: the open PSI question is settled as a single ts::Export::follow(self, broadcast) -> Export used by both callers (same epoch continues with the same PSI; another instance does a full program switch carrying both PAT and PMT version_numbers, advanced). SRT policy is pinned to moq_srt::Config as linger: Duration (default 0) and stitch: bool (default false), and a test for a PAT version bump when the PMT PID moves is planned. Advancing the PAT version too is a real fix over the previous PMT-only plan, and one method instead of continue/stitch keeps the surface small.

Still open from earlier reviews:

  • Blocking: a replacement still exits 1 by default, and the fresh export stays behind opt-in --stitch. That still contradicts the "TS restart: ✅ Fresh Export in-process" decision in the PR body. Update the body/decision record, or make following the default.
  • Non-blocking: linger 0 on SRT egress is a behavior change for callers that stay connected today. The Public API line still doesn't flag it.
  • Non-blocking: the long-line wrap issue is now in the --stitch bullet ("new broadcast with a full program switch: a new PMT ... may") and the follow bullets.

New, non-blocking:

  • moq_srt::Config is defined in rs/moq-srt/src/listen.rs and drives the listener. If egress can also go through dial::Client, say how that path gets linger/stitch, or the dial side keeps today's behavior.
  • follow on the same epoch "continues the stream", but the earlier buffered/unflushed-output question still applies when self is consumed on a stitch. Say whether pending PES data from the old export is flushed or dropped before the discontinuity.

Verdict: ITERATE

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Summary before merge: imports #5052 as quest/m0/broadcast-epoch/no-stitch.md (moq-net resumes after an upstream error only within an epoch) and plans quest/m0/broadcast-epoch/export-ts.md. In that quest, --linger waits for the same epoch, and --stitch opts in to a full program switch through ts::Export::follow, with PAT and PMT versions advanced and the SRT policy on moq_srt::Config. ts-hitless is scoped to one epoch. #5101 is closed as won't fix. All review findings through 890da342c are addressed in 29769c7d5.

(Written by Claude Opus 5.5)

@kixelated
kixelated enabled auto-merge (squash) October 9, 2026 19:28
@kixelated
kixelated merged commit 8012cda into main Oct 9, 2026
5 checks passed
@kixelated
kixelated deleted the quest/import-5052-5101 branch October 9, 2026 19:53
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.

export ts: after re-requesting onto a live route, the first video unit it fetches ends the export ("missed a decode deadline")

1 participant