Repository navigation
feat(spf): complete the moqt-20 publisher cutover (Phase 5) - #42
Conversation
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. |
📦 Bundle Size Report🎨 @videojs/html
Small changes (1, ≤ 300 B)
Presets (7)
Media (21)
Players (6)
Skins (41)
UI Components (60)
⚛️ @videojs/react
Presets (7)
Media (24)
Players (5)
Skins (29)
UI Components (50)
🧩 @videojs/core — no changesEntries (77)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/media
Entries (21)
📦 @videojs/spf
Small changes (1, ≤ 300 B)
Entries (13)
ℹ️ How to interpretEach entry is independently bundled, minified, and brotli-compressed. Initial size includes its static import graph; lazy dynamic chunks are reported separately. Entries are not additive because their dependency graphs overlap. Preset rows represent realistic combined bundles. Changes of 300 B or less across initial, lazy, and total size are collapsed, not discarded. Run |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7770e5c1d
ℹ️ 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".
| **Phase 5 complete (2026-09-03, `feat/moq-publisher-transport-20` off | ||
| `mmcc/moq-publisher`):** the three remaining items landed. |
There was a problem hiding this comment.
Remove the completed temporary migration plan
This change marks Phase 5 complete but commits the completed implementation notes under .agents/plans/. Repository guidance defines this directory as temporary and requires these notes to be deleted before merge, so retaining and expanding the file leaves stale branch-specific instructions in the repository. Remove the plan rather than recording completion in it.
AGENTS.md reference: AGENTS.md:L70-L70
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Keeping the plan on this branch deliberately, as on #41: this PR targets the long-lived mmcc/moq-publisher feature branch, which already carries .agents/plans/ notes under the same rule, and they get deleted when the feature branches merge to main.
| * Frames of the in-progress group (keyframe + deltas so far), retained for non-`groupPerFrame` tracks — bound or not | ||
| * — so a bind mid-group can replay the group from object 0. A fresh subscription (the relay's `relative-group 1` | ||
| * upstream join) needs a decodable start, and a subgroup stream that begins partway through a group is dropped by the | ||
| * peer. Reset on each keyframe; group-per-frame tracks use `replayLastGroupOnBind` instead. |
There was a problem hiding this comment.
Update the actor's binding contract
The new retained-group behavior directly contradicts the module header at lines 15–16, which still states that a fresh subscription starts at the next keyframe. That header describes this actor's lifecycle contract, so leaving it stale will mislead callers and future changes about when replay occurs; update it to describe in-progress-group replay on bind.
AGENTS.md reference: AGENTS.md:L16-L16
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rewritten in 40c22e9: the header now states that groups still never span bindings, but keyframe-grouped tracks replay the retained in-progress group from object 0 on bind, groupPerFrame tracks start at the next frame, and change-driven tracks use replayLastGroupOnBind.
| if (subscribe.parameters.fillParameters !== undefined && subscriber.forwarding) { | ||
| this.#openAndResetFill(subscribe.requestId); |
There was a problem hiding this comment.
Skip fill streams when the computed range is empty
When FILL_PARAMETERS arrives before the track has published any object, or its filter starts after Largest Object, this condition unconditionally opens and resets a fill stream. The pinned draft's §5.1.3 says an empty or post-Largest-Object fill range opens no stream; resetting is only the failure path for a nonempty fill that cannot be served. Evaluate the fill range against track.getLargestObject?.() and skip #openAndResetFill when it is empty, including on the corresponding REQUEST_UPDATE path.
AGENTS.md reference: AGENTS.md:L14-L14
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 40c22e9. isEmptyFetchRange (beside LocationFilter in control-messages.ts) evaluates the fill filter — the one inside FILL_PARAMETERS, else the subscription's, else unfiltered — with the §5.1.2 fetch rules against the track's Largest Object. Both the SUBSCRIBE and REQUEST_UPDATE paths now skip #openAndResetFill when the range is empty: no content yet, Next Object, Next Group (relative-group 0), an absolute start past Largest Object, or a bounded end before its start. Tests cover each shape plus a nonempty control, and a REQUEST_UPDATE case keyed to the update's own Request ID.
There was a problem hiding this comment.
2 issues found across 11 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/spf/src/publish/session/publish-session.ts">
<violation number="1" location="packages/spf/src/publish/session/publish-session.ts:577">
P3: `#openAndResetFill`'s catch block silently drops failures, so when `openUniStream()` rejects the FILL_PARAMETERS peer gets neither a FETCH_HEADER nor a reset — the very stalled-fill the method was written to prevent. Consider emitting some failure signal (or at least surfacing it) instead of only swallowing; on a dead transport the session teardown may cover it, but the SUBSCRIBE path also opens a fill for already-replaced (`subscriber.finished`) subscriptions that should be skipped.</violation>
</file>
<file name=".agents/plans/moq-transport-20-migration.md">
<violation number="1" location=".agents/plans/moq-transport-20-migration.md:259">
P3: This plan file is a temporary implementation note that AGENTS.md requires be deleted before merge, and the added lines are a completed task log, which the plans README says does not belong in the repository. Remove the plan (including this Phase 5 log) before landing; keep any durable rationale in internal/design or internal/decisions only if explicitly requested.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| publisher's SUBSCRIBE_OK, and open-and-reset for inbound FILL_PARAMETERS. | ||
| sandbox's loopback relay pulls upstream with `relative-group 1`. | ||
|
|
||
| **Phase 5 complete (2026-09-03, `feat/moq-publisher-transport-20` off |
There was a problem hiding this comment.
P3: This plan file is a temporary implementation note that AGENTS.md requires be deleted before merge, and the added lines are a completed task log, which the plans README says does not belong in the repository. Remove the plan (including this Phase 5 log) before landing; keep any durable rationale in internal/design or internal/decisions only if explicitly requested.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .agents/plans/moq-transport-20-migration.md, line 259:
<comment>This plan file is a temporary implementation note that AGENTS.md requires be deleted before merge, and the added lines are a completed task log, which the plans README says does not belong in the repository. Remove the plan (including this Phase 5 log) before landing; keep any durable rationale in internal/design or internal/decisions only if explicitly requested.</comment>
<file context>
@@ -254,11 +254,37 @@ ID in `publish-session.ts` (reuse is session-fatal; `onRequestUpdate` reports
-publisher's SUBSCRIBE_OK, and open-and-reset for inbound FILL_PARAMETERS.
+sandbox's loopback relay pulls upstream with `relative-group 1`.
+
+**Phase 5 complete (2026-09-03, `feat/moq-publisher-transport-20` off
+`mmcc/moq-publisher`):** the three remaining items landed.
+
</file context>
There was a problem hiding this comment.
Keeping the plan on this branch deliberately, as on #41: this PR targets the long-lived mmcc/moq-publisher feature branch, which already carries .agents/plans/ notes under the same rule, and they get deleted when the feature branches merge to main.
|
|
||
| writer = stream.getWriter(); | ||
| await writer.write(encodeFetchHeader(requestId)); | ||
| } catch { |
There was a problem hiding this comment.
P3: #openAndResetFill's catch block silently drops failures, so when openUniStream() rejects the FILL_PARAMETERS peer gets neither a FETCH_HEADER nor a reset — the very stalled-fill the method was written to prevent. Consider emitting some failure signal (or at least surfacing it) instead of only swallowing; on a dead transport the session teardown may cover it, but the SUBSCRIBE path also opens a fill for already-replaced (subscriber.finished) subscriptions that should be skipped.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/spf/src/publish/session/publish-session.ts, line 577:
<comment>`#openAndResetFill`'s catch block silently drops failures, so when `openUniStream()` rejects the FILL_PARAMETERS peer gets neither a FETCH_HEADER nor a reset — the very stalled-fill the method was written to prevent. Consider emitting some failure signal (or at least surfacing it) instead of only swallowing; on a dead transport the session teardown may cover it, but the SUBSCRIBE path also opens a fill for already-replaced (`subscriber.finished`) subscriptions that should be skipped.</comment>
<file context>
@@ -547,6 +558,30 @@ class MoqtPublishSessionImpl implements MoqtPublishSession {
+
+ writer = stream.getWriter();
+ await writer.write(encodeFetchHeader(requestId));
+ } catch {
+ // Session closing or the peer went away before the header landed.
+ } finally {
</file context>
There was a problem hiding this comment.
Partly. 40c22e9 skips the fill for a subscription already marked finished, folded into a #fillRequested guard alongside Forward State and the new empty-range check. The catch stays as is: openUniStream() only rejects when the transport is closing, at which point there is no channel left to signal the peer and session teardown covers it.
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Finishes the publisher side of the moq-transport draft-20 migration begun on mmcc/moq (PR #41). Three behaviors the relay's draft-20 upstream join needs: - In-progress-group replay. `track-publisher.ts` retains the current group (keyframe + deltas, bound or not, reset each keyframe) and, on bind, replays it from object 0 under the new alias before continuing live. A subscription joining mid-group — the relay's `relative-group 1` upstream join — now decodes instantly instead of waiting a GOP, and no subgroup stream begins partway through a group (the peer drops those). Group-per-frame tracks keep using `replayLastGroupOnBind`. - LARGEST_OBJECT in SUBSCRIBE_OK. The actor tracks the largest (group, object) it has written on its snapshot; `setup-track-publishers` passes a `getLargestObject` reader into `registerTrack`, and the session reports LARGEST_OBJECT (§10.2.17) in SUBSCRIBE_OK once content exists, omitting it before. Pulled at subscribe time, so no snapshot churn. The sandbox loopback relay's SUBSCRIBE_OK parser now skips the parameter block by parity instead of asserting it is empty. - Inbound FILL_PARAMETERS. `#openAndResetFill` opens a uni stream, writes a FETCH_HEADER carrying the initiating Request ID, and resets it — the §5.1.3.1 minimum for an origin that serves no fills (reset = failure; a FIN would falsely claim an empty range). Wired on the inbound SUBSCRIBE and REQUEST_UPDATE paths, gated on Forward State 1, with FILL_PARAMETERS pulled out of the update's unsupported-parameter set. `encodeFetchHeader` added to `object-stream.ts`. Tests: rewrote the four track-publisher/behavior tests whose documented "join at next keyframe" behavior the replay supersedes; added actor coverage for Largest Object tracking and session coverage for LARGEST_OBJECT in SUBSCRIBE_OK and the fill open-and-reset. All spf test projects pass (node 353, browser 130); typecheck, lint, and format clean. Not yet verified live against the relay fleet.
- Open no fill fetch stream for an empty fill range (§5.1.3): evaluate the fill filter — FILL_PARAMETERS' own, else the subscription's — as a fetch against the track's Largest Object on both the SUBSCRIBE and REQUEST_UPDATE paths, and skip fills for subscriptions already replaced. `isEmptyFetchRange` lives beside `LocationFilter` so the deferred subscriber-side fills can share it. - Rewrite the track-publisher header for in-progress-group replay on bind and share the counter handlers between `publishing` and `ended`. - Release the fill-observer reader in the publish-session tests so its read loop exits with the session instead of outliving the test.
Headless publisher + viewer against the anonymous relay (fleet on moq-relay 0.14.15): in-progress-group replay opens the first subgroup stream 1 ms after the relay's upstream SUBSCRIBE from object 0, the rebind's SUBSCRIBE_OK carries LARGEST_OBJECT and the relay accepts it, and the relay never forwards FILL_PARAMETERS upstream. Also notes the relay's 30 s upstream idle drop and the `anon` announce-prefix requirement.
5d2cf99 to
623d4d6
Compare
Finishes the publisher side of the moq-transport draft-20 migration begun on
mmcc/moq(#41). The merge that brought the codec cutover intommcc/moq-publisheris the base of this branch; this PR adds the three publisher behaviors the relay's draft-20 upstream join needs.Changes
In-progress-group replay (
track-publisher.ts). The actor retains the current group's frames (keyframe + deltas, bound or not, reset on each keyframe) and, on bind, replays them from object 0 under the new alias before continuing live. A subscription joining mid-group — the relay'srelative-group 1upstream join — now decodes instantly instead of waiting a full keyframe interval, and no subgroup stream ever begins partway through a group (the peer drops those). Group-per-frame tracks (catalog, audio) keep usingreplayLastGroupOnBind; the two paths are mutually exclusive.LARGEST_OBJECT in SUBSCRIBE_OK (§10.2.17). The actor tracks the largest
(group, object)it has written on its snapshot;setup-track-publisherspasses agetLargestObjectreader intoregisterTrack, and the session reports LARGEST_OBJECT in SUBSCRIBE_OK once content exists, omitting it before. Read at subscribe time, so no snapshot churn. The sandbox loopback relay's SUBSCRIBE_OK parser now skips the parameter block by parity instead of asserting it is empty.Inbound FILL_PARAMETERS (§5.1.3.1).
#openAndResetFillopens a uni stream, writes a FETCH_HEADER carrying the initiating Request ID, and resets it — the honest minimum for an origin that serves no fills (a reset is the fill-failure signal; a FIN would falsely claim an empty range). Wired on both the inbound SUBSCRIBE and REQUEST_UPDATE paths, gated on Forward State 1, with FILL_PARAMETERS pulled out of the update's unsupported-parameter set.encodeFetchHeaderadded toobject-stream.ts.Behavior change
The in-progress-group replay supersedes the old "join at the next keyframe" behavior, so four track-publisher and behavior tests that documented the old join were rewritten. Added actor coverage for Largest Object tracking and session coverage for LARGEST_OBJECT in SUBSCRIBE_OK and the fill open-and-reset.
Verification
All SPF test projects pass (node 353, browser 130). Typecheck, lint, and format clean. Not yet verified live against the relay fleet.
🤖 Generated with Claude Code
Summary by cubic
Completes the publisher side of the moq-transport draft-20 cutover: mid-group subscribers now replay the in-progress group from object 0, SUBSCRIBE_OK carries LARGEST_OBJECT once content exists, and inbound FILL_PARAMETERS is answered with an open-and-reset fill stream. Also adds configurable per-track publisher priorities.
Behavior changes
commit(); withoutcommit(), nonempty fills are rejected with NOT_SUPPORTED, and lingering fills abort when the subscription cancels or ends. Streams open only for nonempty fill ranges (§5.1.3).Verification
Written for commit 623d4d6. Summary will update on new commits.