Repository navigation
feat(spf): publish through @caprid/moq-core's publish session - #78
Conversation
The publisher drove v10's own publish session over a draft-20 copy of network/moqt, kept only so the mmcc/moq sync would build. It now drives createMoqtPublishSession from @caprid/moq-core, the package extracted from that session, and speaks moqt-22 with a moqt-20 fallback like the player. - publish-session.ts keeps only the session actor. The default connect offers MOQT_PROTOCOL_IDS when WebTransport exposes `protocol`, so the session reads the negotiated version. - Track publishers open each group's stream for the alias bound when the group started (`openUniStream(trackAlias)`). The session counts each subscription's streams for PUBLISH_DONE, so the publisher's own per-alias count and the getStreamCount wiring are gone. - setupTrackPublishers declares the microsecond TIMESCALE track property explicitly; the package's session imposes none. - network/moqt is deleted with its tests. raw-peer and transport-pair move beside moqt-wire, which now re-exports the package's relay-side codecs for the relay hub and the raw peers. withServerRequestIds gives a subscribe session standing in for the relay odd request IDs, which the package's publish session requires (§6.4.2.1). Claude-Session: https://claude.ai/code/session_01DaH4ifX9Vb6HuB2yg6TMt5
The spec README, the publish design notes and the migration plan named the deleted network/moqt modules or said the publisher still ran its own codec. The publisher sandbox's loopback relay cited draft-20 sections; its one Location Filter (relative start, StartGroup 1) encodes the same bytes on draft-22, so it now says so and uses draft-22 numbering, as the player's loopback already does. Claude-Session: https://claude.ai/code/session_01DaH4ifX9Vb6HuB2yg6TMt5
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. |
There was a problem hiding this comment.
3 issues found across 40 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".agents/plans/moq-transport-20-migration.md">
<violation number="1" location=".agents/plans/moq-transport-20-migration.md:27">
P2: This completed migration plan remains under `.agents/plans/` even though repository guidance requires temporary plans to be deleted before merge. Remove the file instead of retaining this now-stale implementation log.</violation>
</file>
<file name="packages/spf/src/network/tests/helpers/transport-pair.ts">
<violation number="1" location="packages/spf/src/network/tests/helpers/transport-pair.ts:52">
P2: Closing this pair settles `closed` but leaves incoming stream readers and active data/request pipes open. Readers parked on either incoming queue can wait forever after transport shutdown; close the queue controllers and terminate active pipes in `closeBoth`.</violation>
</file>
<file name="internal/design/spf/features/moq-publish.md">
<violation number="1" location="internal/design/spf/features/moq-publish.md:158">
P2: This feature record still says the publisher speaks draft-19 in its overview and Transport row. Update those references to the package-backed draft-22/moqt-20 fallback so the record matches the implementation.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| runs the local codec until its own move. | ||
| carries draft-22. Section numbers below are draft-20's. The publisher moved | ||
| onto the package's publish session on `feat/moq-publisher-caprid-core` | ||
| (2026-10-28), so no local codec remains on either branch. |
There was a problem hiding this comment.
P2: This completed migration plan remains under .agents/plans/ even though repository guidance requires temporary plans to be deleted before merge. Remove the file instead of retaining this now-stale implementation log.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .agents/plans/moq-transport-20-migration.md, line 27:
<comment>This completed migration plan remains under `.agents/plans/` even though repository guidance requires temporary plans to be deleted before merge. Remove the file instead of retaining this now-stale implementation log.</comment>
<file context>
@@ -22,8 +22,9 @@ Temporary implementation notes — delete before merge per `AGENTS.md`.
-runs the local codec until its own move.
+carries draft-22. Section numbers below are draft-20's. The publisher moved
+onto the package's publish session on `feat/moq-publisher-caprid-core`
+(2026-10-28), so no local codec remains on either branch.
**Issue #45 verification (2026-09-16, moq-relay 0.14.17):** the shared codec
</file context>
| const closeBoth = (info?: { closeCode?: number; reason?: string }): void => { | ||
| if (closed) return; | ||
|
|
||
| closed = true; |
There was a problem hiding this comment.
P2: Closing this pair settles closed but leaves incoming stream readers and active data/request pipes open. Readers parked on either incoming queue can wait forever after transport shutdown; close the queue controllers and terminate active pipes in closeBoth.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/spf/src/network/tests/helpers/transport-pair.ts, line 52:
<comment>Closing this pair settles `closed` but leaves incoming stream readers and active data/request pipes open. Readers parked on either incoming queue can wait forever after transport shutdown; close the queue controllers and terminate active pipes in `closeBoth`.</comment>
<file context>
@@ -0,0 +1,162 @@
+ const closeBoth = (info?: { closeCode?: number; reason?: string }): void => {
+ if (closed) return;
+
+ closed = true;
+ a.resolveClosed?.(info);
+ b.resolveClosed?.(info);
</file context>
📦 Bundle Size Report🎨 @videojs/html
Presets (7)
Media (20)
Players (6)
Skins (32)
UI Components (73)
⚛️ @videojs/react
Presets (7)
Media (23)
Extensions (2)
Players (5)
Skins (20)
UI Components (50)
🧩 @videojs/core — no changesEntries (77)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/cdn — no changes📦 @videojs/cloudflare-video — no changes📦 @videojs/dash-video — no changes📦 @videojs/google-cast — no changes📦 @videojs/hlsjs-video — no changes📦 @videojs/media — no changesEntries (3)
📦 @videojs/mux — no changes📦 @videojs/mux-audio — no changesEntries (2)
📦 @videojs/mux-data — no changes📦 @videojs/mux-video — no changesEntries (2)
📦 @videojs/native-hls-video — no changes📦 @videojs/shaka-video — no changes📦 @videojs/spf
Entries (10)
📦 @videojs/spotify-audio — no changes📦 @videojs/tiktok-video — no changes📦 @videojs/twitch-video — no changes📦 @videojs/other
Entries (3)
📦 @videojs/vimeo-video — no changes📦 @videojs/wistia-video — no changesEntries (2)
📦 @videojs/youtube-video — no changesℹ️ 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 |
Summary
The publisher now drives
@caprid/moq-core's publish session (createMoqtPublishSession, 0.1.1) instead of v10's own session. That session ran over a draft-20 copy ofnetwork/moqt, kept on this branch only so the #75 sync would build. The publisher now speaks moqt-22 with a moqt-20 fallback, like the player, andpackages/spf/src/network/moqt/is gone, tests included.Changes
publish/session/publish-session.tskeeps only the session actor; the protocol driver is the package's. The default connect offersMOQT_PROTOCOL_IDS(moqt-22,moqt-20) when the browser'sWebTransportexposesprotocol, the same rule as the player'smoq-session.ts. The real transport, including itsprotocol, goes to the session unchanged.track-publisher.tsopens each group's stream withopenUniStream(trackAlias)for the alias bound when the group started. The session now counts each subscription's data streams for PUBLISH_DONE, so the publisher's per-aliasstreamCountandsetup-track-publishers.ts'sgetStreamCountwiring are removed.setup-track-publishers.tspasses the microsecond TIMESCALE as an explicittrackPropertiesentry, since the package imposes none. It importsCLOSE_FLUSH_TIMEOUT_MS,RegisteredTrackandTRACK_PROPERTYfrom the package.Test helpers:
raw-peer.tsandtransport-pair.tsmove tonetwork/tests/helpers/, besidemoqt-wire.ts.moqt-wire.tsnow also re-exports the package's relay-side SUBSCRIBE_NAMESPACE/SUBSCRIBE/GOAWAY encoders, deframer, object-stream readers and varint codec. The relay hub's publisher side uses them, so the whole hub speaks moqt-22. A newwithServerRequestIdswrapper gives a subscribe session standing in for the relay odd Request IDs. The package's publish session closes on a peer request with the client's (even) parity (§6.4.2.1); the wrapper offsets each request's ID by an odd constant and re-frames the message.Tests: dropped v10's driver and codec tests, which the package now owns and tests:
network/moqt/tests/*and thecreateMoqtPublishSessionblock ofpublish-session.test.ts. Kept and adapted the actor, behavior, engine, relay-hub and cross-engine tests. Added three tests:['moqt-22', 'moqt-20'].The catalog + LOC end-to-end test now runs through the session actor.
Prose: the spec README's "Implemented in" row, the publish engine doc, the cross-engine and relay-hub notes, the publish design notes (
moq-publish.md,clusters.md) and the migration plan now name the package. The publisher sandbox's loopback relay cited draft-20 sections. Its one Location Filter (relative start, StartGroup 1) encodes the same bytes on draft-22, so it now uses draft-22 numbering, as the player's loopback already does. No skill under.agents/skills/cited the deleted modules.v10-side wrappers kept
createPublishSessionActor: the reactive snapshot the behaviors consume (status, subscriber count, track bindings), plus the connect (?jwt=URL, protocol offer, implementation name@videojs/spf moqt publisher).addTrackPublisher'sopenUniStreamclosure, which adds the per-tracksendOrder(-1 - priority).endTrackandendCatalogTrack, which flush the publisher's last groups withinCLOSE_FLUSH_TIMEOUT_MS / 2beforehandle.end({ after }).PUBLISH_DONE "unknown stream count"
v10 doesn't need it. Every track
setupTrackPublishersregisters reported an exact count, so the unknown encoding was only reachable from tests that registered tracks withoutgetStreamCount. The package counts every data stream itself.Verification
pnpm -F @videojs/spf test: 163 files, 2557 tests pass (11 skipped), including thepublish-enginesChromium project; no type errors.pnpm build:packages,pnpm typecheck(stalepackages/*/typesand nested tsbuildinfo deleted first), andpnpm lint: all pass.Bundle size (esbuild bundle of
dist/default, minify + brotli):/moq/moq-publish/moq-publish-videoThe growth is the package's session: the dual-version codec, the close end-ack wait and fill handling on REQUEST_UPDATE.
Live against relay.mux.global (token root
huddle/videojs-testing): headless Chromium ran the v10 publish engine (canvas camera + oscillator mic, default H.264 + Opus), the v10 MoQ player, and a raw@caprid/moq-coreviewer.["moqt-22","moqt-20"]and negotiatedmoqt-22.{8: 1000000}).unpublish()the raw viewer got PUBLISH_DONE status 2 "track ended" for all three tracks within 8 ms, with Stream Counts audio 753, video 16 and catalog 3.codex review --base origin/mmcc/moq-publisher: no actionable findings. It also ran an in-memory round trip through the publisher sandbox's loopback relay with the package's sessions.Upstream follow-ups (
@caprid/moq-core)dist/protocol/*throughmoqt-wire.ts. A test-support entry point would remove that.withServerRequestIdsbyte rewrite. Upstream's tests use a similar transport wrapper. A config option such asrequestIdParity: 'server'would serve both.🤖 Generated with Claude Code
https://claude.ai/code/session_01DaH4ifX9Vb6HuB2yg6TMt5
Summary by cubic
Replaces the publisher's local draft-20 MOQT driver with
@caprid/moq-core's publish session, so the publisher now speaks moqt-22 with moqt-20 fallback, matching the player. Deletespackages/spf/src/network/moqt/and its tests.publish-session.tskeeps only the session actor; the protocol driver, version negotiation, and PUBLISH_DONE counting come from the package.streamCountandgetStreamCountwiring are removed.setupTrackPublishersdeclares the microsecond TIMESCALE explicitly intrackProperties.moqt-wire; a newwithServerRequestIdswrapper compensates for the package's client-parity-only request IDs in loopback tests.Written for commit ed92cbf. Summary will update on new commits.