Repository navigation
quest(m1): plan five refactors from the 2026-10-22 audit #6338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # [M] One Annex-B exporter for H.264 and H.265 | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-mux's H.264 and H.265 Annex-B exporters share one private lifecycle: | ||
| catalog updates, track selection, playhead tracking, keyframe joining, | ||
| parameter-set injection, payload conversion and completion. Only codec | ||
| configuration parsing and parameter sets stay per codec, and the public | ||
| codec wrappers keep their API. The shared lifecycle follows a rendition | ||
| whose resolved track or broadcast changes under the same ID. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found by the 2026-10-22 refactor audit (main at d44813cb7): | ||
| `rs/moq-mux/src/codec/h264/export.rs` and `h265/export.rs` are 433 and 432 | ||
| lines, their `poll_next` is identical, and only 171 diff lines differ once | ||
| the codec names are normalized. | ||
|
|
||
| Decided 2026-10-22 (maintainer): land after the rendition rebind work, | ||
| which reworks the `ExportSource` these exporters use. Then make the shared | ||
| lifecycle follow a rebound rendition too, as that quest does for fMP4, TS, | ||
| MKV and FLV: reproduce the gap first with a test, and fix it once in the | ||
| shared code. Do not build a framework covering every container and codec. | ||
|
|
||
| Tests cover configuration changes, rendition switching, parameter-set | ||
| injection, keyframe joining, completion, and the rebind. | ||
|
|
||
| Public API: none. Wire: none. | ||
|
|
||
| ## Required | ||
|
|
||
| - [Exporters follow a rendition to a new track](/quest/m1/export-rendition-rebind.md) - reworks `ExportSource` and sets the rebind pattern this follows |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # [M] Producers drop the phantom catalog type | ||
|
|
||
| ## Goal | ||
|
|
||
| Media and data producers that only reference the catalog through an erased | ||
| handle stop carrying its extension type. moq-video's and moq-audio's | ||
| `encode::Producer`, and moq-mux's `json::Snapshot`, `json::Stream`, | ||
| `binary::Snapshot` and `binary::Stream`, lose their `E: CatalogExt` | ||
| parameter, so callers with a custom catalog no longer thread a generic that | ||
| holds no data. Constructors stay generic over `E` where they take a typed | ||
| `Reserved<E>` or catalog `Producer<E>`. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found by the 2026-10-22 refactor audit (main at d44813cb7). `E` lives on | ||
| those types only as `PhantomData<fn() -> E>`: mux's `Listing` already erases | ||
| the entry type, and the encoders hold no catalog after construction. | ||
|
|
||
| Decided 2026-10-22 (maintainer): drop `E` only where it is phantom. It stays | ||
| on `Reserved<E>`, `Timebase<E>`, the catalog `Producer<E>` and capture | ||
| drivers that own a typed catalog, because those store it. JSON's `T` stays. | ||
| No dynamic dispatch is added. | ||
|
|
||
| Update every consumer in the same PR: moq-ffi (`video.rs`, `audio.rs`, | ||
| `json.rs`, `flate.rs`), moq-c, and any example or test naming the parameter. | ||
| Add `MIGRATE.md` entries under `## Unreleased` for moq-video, moq-audio and | ||
| moq-mux. Do not claim a binary size change without measuring it. | ||
|
|
||
| Public API: breaking Rust (type parameter removed). Wire: none. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # [S] One CLI duration type | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-cli, moq-bench and moq-relay parse and serialize human-readable | ||
| durations through moq-tokio's `cli::Duration`, made public, instead of their | ||
| own copies. moq-relay's hand-written serde modules for `std::time::Duration` | ||
| fields use the existing `humantime-serde` dependency. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found by the 2026-10-22 refactor audit (main at d44813cb7): moq-cli's and | ||
| moq-bench's `duration.rs` are byte-identical, moq-relay's adds serde | ||
| adapters, and moq-tokio's `cli::Duration` is `pub(crate)` but already | ||
| implements `FromStr`, `Display` and serde. All three crates depend on | ||
| moq-tokio. | ||
|
|
||
| Decided 2026-10-22 (maintainer): export moq-tokio's type over keeping | ||
| private per-crate wrappers. Preserve accepted units, zero handling, | ||
| formatting, and config file round-trips; check the CLI help and config docs | ||
| still match. | ||
|
|
||
| Public API: adds `moq_tokio::cli::Duration`. Wire: none. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # [M] Shared watch and publish UI | ||
|
|
||
| ## Goal | ||
|
|
||
| `@moq/watch` and `@moq/publish` import their identical presentation code | ||
| from a new `@moq/ui` package instead of each carrying a copy: the stats | ||
| graph, the button and settings button components, and the support element's | ||
| banner and details rendering. Capability detection stays in each product. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found by the 2026-10-22 refactor audit (main at d44813cb7): `ui/graph.ts` | ||
| (152 lines), `ui/components/button.ts` and `ui/components/settings-button.ts` | ||
| are byte-identical across `js/watch` and `js/publish`, and | ||
| `support/element.ts` differs in about 74 of its roughly 300 lines. | ||
|
|
||
| Decided 2026-10-22 (maintainer): a narrow published `@moq/ui` package over | ||
| an `@moq/signals` subpath (media widgets would blur a generic library) or | ||
| publish depending on watch (wrong relationship). It holds presentation only. | ||
| Move other shared helpers only when identical and used by both. | ||
|
|
||
| Validate both packages' independent published builds, DOM cleanup, and the | ||
| demo. The package gets a README; add it wherever the JS packages are listed | ||
| for publishing and docs. | ||
|
|
||
| Public API: new `@moq/ui` package; `@moq/watch` and `@moq/publish` exports | ||
| unchanged. Wire: none. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # [S] JSON encoder options without a downcast | ||
|
|
||
| ## Goal | ||
|
|
||
| moq-mux's `json_snapshot` gets its encoder options (after refresh, the | ||
| `deltas` switch) without downcasting the config through `Any`. A custom | ||
| catalog entry that implements `IntoRendition` can set the same options as | ||
| `json::Config`, and the `'static` bound that only served the downcast goes | ||
| away. | ||
|
|
||
| ## Plan | ||
|
|
||
| Found by the 2026-10-22 refactor audit (main at d44813cb7): | ||
| `delta_ratio_of` in `rs/moq-mux/src/json.rs` recovers the encoder ratio by | ||
| downcasting the generic config, and | ||
| [moq-dev/moq#6054](https://github.com/moq-dev/moq/pull/6054) renames it to | ||
| `deltas_of` but keeps the downcast. `IntoRendition` describes the catalog | ||
| entry, so encoder settings that are not catalog fields have no typed path. | ||
|
|
||
| Decided 2026-10-22 (maintainer): the PR proposes the API shape once refresh | ||
| lands, rather than settling it now. Candidates considered: a separate | ||
| options argument (`json_snapshot(track, entry, json::Options)`, recommended | ||
| in the interview), or a builder on the returned handle before the first | ||
| update. Whichever lands, `json::Config` becomes a catalog entry builder | ||
| only, and moq-c's `json_snapshot`, the one in-repo caller that sets | ||
| `deltas`, follows. Add `MIGRATE.md` entries for moq-mux (and moq-c if its | ||
| API changes). | ||
|
|
||
| Public API: breaking Rust (moq-mux `json_snapshot` signature, `json::Config` | ||
| fields). Wire: none. | ||
|
|
||
| ## Required | ||
|
|
||
| - [Producers drop the phantom catalog type](/quest/m1/catalog-phantom.md) - edits the same `json::Snapshot` signature |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moq_audio::encode::producer::Reserved<E>does not store a typed catalog: it contains only the erased track plus_ext: PhantomData, and its constructor consumescatalogbefore building the reservation. ExemptingReserved<E>therefore contradicts the stated “dropEonly where it is phantom” rule and leaves another instance of the same unnecessary generic behind; include this private reservation and its capture-state callers in the quest scope instead of claiming it storesE.AGENTS.md reference: AGENTS.md:L23-L25
Useful? React with 👍 / 👎.