Repository navigation
refactor(mux): lay the TS export's tables from current state - #7171
Conversation
Quest-Claim: c7756844eac9580e
The export queued an encoded PAT and PMT with each media unit it led, its version fixed at push. Now the schedule keeps the tables as they stand (`Schedule::set_psi`) and every copy not yet begun lays them, so a table change is one state update; a copy already on its way finishes as it began. A revision takes the version after the last copy to begin, so one overtaken before any copy of it began takes none. The break flag after a switch rides the first copy to go out. A static program's output is byte-identical: every moq-mux test's export output matches main's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed head 028a409fbaec6c4dfb62440cfe56a11a29276334 against base 6dbfa59b190727e39e4eb0cf2a020e30c6af7d27.
No actionable correctness bugs found in the reviewed changes. Keeping current PSI state separate from queued timing/holds is a sound direction; refreshing only unstarted table units preserves section consistency, and the begun/finished bookkeeping keeps revision versions and completed-output state distinct.
Static review covered the changes and surrounding scheduling, table admission, discontinuity handling, revision, and rewind paths, plus the new regression tests. I did not execute tests or reproduce the reported byte-identity comparisons; T-STD behavior and runtime output equivalence were not independently validated.
WalkthroughThe TS export now derives PAT and PMT packets from current PSI state and supplies them to the schedule. The schedule updates eligible queued table units when PSI changes and reports how many table units begin in each slot. The export tracks table snapshots for copies as they begin and finish, and restates tables when required. The related quest documentation now describes the table rework as landed and removes the separate quest entry. Priority: Merge Risk:
|
There was a problem hiding this comment.
🔇 Additional comments: 1
quest/m1/ts-reliability/pat-lifecycle.md-27-30: 1
27-30:Minor · Maintainability & Code Quality · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Correct the description of
Psi::current. It does not version the PAT on a PMT PID change.The text says
Psi::currentgives the PAT the next version when the PID differs from the last laid. The code does not do this.
Psi::currentinrs/moq-mux/src/container/ts/export.rscompares onlylaid.pmtandlaid.network.Laidhas nopmt_pidfield.- If only
Psi::pmt_pidchanges,currentreturnslaid.clone()and keeps the old PAT.The sentence is accurate only for the planned work. Reword it so it does not describe landed behavior. Also state that the move work must add the PMT PID to
Laidand to the comparison inPsi::current.📝 Proposed wording
-already on its way finishes as it began. A move then updates `Psi::pmt_pid`, -calls `Schedule::set_tables` for the new PID, and restates; `Psi::current` -gives the PAT the next version when the PID differs from the last laid. +already on its way finishes as it began. A move then updates `Psi::pmt_pid`, +calls `Schedule::set_tables` for the new PID, and restates. `Laid` does not +record the PMT PID yet, so this quest adds it there and to `Psi::current`'s +comparison, which then gives the PAT the next version when the PID differs +from the last laid.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3a51414b-382d-4d9c-aebe-28419500790e
Files selected for processing: 5-
quest/m1/ts-reliability/README.mdquest/m1/ts-reliability/pat-lifecycle.mdquest/m1/ts-reliability/psi-state.mdrs/moq-mux/src/container/ts/export.rsrs/moq-mux/src/container/ts/schedule.rs
Files with no reviewable changes: 2-
- quest/m1/ts-reliability/README.md
- quest/m1/ts-reliability/psi-state.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
-
|
Merge summary:
(Written by Claude Opus 5.5) |
Completes quest/m1/ts-reliability/psi-state.md, the table rework the maintainer named when closing moq-dev/moq#6301.
Problem
Since moq-dev/moq#6289,
export tsencoded a PAT and PMT into packets each time tables were due and queued them on the schedule with the media unit they led. The version was fixed at that push. A table change could not reach a copy already queued, so following a moved PMT PID (PAT changes) would have meant rewriting queued copies.Approach
Schedule::set_psitakes the current PAT+PMT packets and clock PID. Every unit of tables that has not begun to go out lays them, so a change is one state update. A unit already on its way finishes as it began, so a section never mixes two states. Table units still ride the schedule as before, keeping their deadlines, T-STD (TBsys/Bsys) admission, holds on added PIDs, and leading of the unit they precede. Only where their bytes come from changes.Psiholds the PMT as it stands.Export::restateencodes it and sets it on the schedule whenever tables are led orrevisechanges the PMT. EachSlotnow reports how many table unitsbegunin it, so the export knows which tables actually went out.Psi::flagged). It is spent once that copy begins.open,enforce, and admission still read the same units.Byte identity
To compare outputs I temporarily hooked
Export::pop(not committed) to log a digest of every frame returned, per test. I ran the wholemoq-muxsuite onmain(6dbfa59) and on this branch:import::a_splice_on_an_anchored_input_waits_for_its_media, anchors its timebase to the wall clock (its own comment says so). It differs between any two runs.One full run of the branch showed 13 revision tests differing. Three later full runs, and a raw-byte dump of those same tests on both sides, matched
mainexactly. I couldn't reproduce or explain that one run.Because every existing test is byte-identical, none of them hits a revision landing while an older copy is still queued. The new tests below cover that path.
Tests
schedule::the_tables_lay_as_they_stand_when_they_begin: two queued copies, a change before either begins, then another while the first is mid-flight (it spans slots under Bsys). The first goes out whole in the second state, the other in the third. Without the refresh it fails, and also if the refresh touches a copy already begun.schedule::only_the_first_tables_flag_the_break: padded and not, only the first of two copies carries the flagged packets.export::a_revision_takes_the_version_after_the_last_laid: the version follows the last tables laid, a revert takes the last laid's version, and a NIT change re-encodes the PAT at the next version.just rs check-test -p moq-mux: 1832 passed. Clippy--all-targets -D warnings, fmt, doc, shear, and sort are clean.Choices made without asking
--syncdoes to lay tables.--syncwas removed in moq-dev/moq#6554, after the closing comment it was quoted from, so there was no second path to reuse or avoid. The non-sync schedule is the only path, and the state lives there.addedholds stay per lead, as before. They are timing, not table content.Psi::pmt_pid, callSchedule::set_tables, restate, and give the PAT the next version inPsi::currentwhen the PID differs.Impact
No public API, wire, or output change for any existing fixture. A live export whose PMT revises while an older copy is still queued now sends that copy revised, without burning a version on the state it replaced.
Suggested follow-ups
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)