Repository navigation
feat(net)!: rename Instance to Identity and cap it at 256 UTF-8 bytes on lite-07 - #9720
Merged
Merged
Conversation
Quest-Claim: 4150a76a4e427828
… (WIP checkpoint) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TE.md to the release cut Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ame-and-cap # Conflicts: # js/net/src/ietf/subscriber.ts # js/net/src/lite/routed.ts # js/net/src/lite/subscriber.ts
…oken, report the identity cap Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es or claims with one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
November 27, 2026 01:56
…ame-and-cap # Conflicts: # rs/moq-cli/src/hls/record.rs # rs/moq-hls/src/export/rendition.rs # rs/moq-hls/src/server/routes.rs
This was referenced Nov 27, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Claims quest/m2/identity-rename-and-cap.md and finishes it (the quest file is deleted here).
Problem
Publishers want to name a stream by a public key, so
Instancereads wrong and the lite-07 wire put no ceiling on its length, letting a peer make a relay hold arbitrarily large claim names.moq-hlsalso keyed its@{instance}URLs, itsServermap, and include lookups on the identity text alone, so a minted identity and a named identity with the same text shared URLs, and a long identity made every URL long.Approach
InstancetoIdentity(types, fields, methods, errors, files, CLI flags and output, docs, drafts) across Rust, JS,moq-ffi,libmoq, and the Go, Python, Dart, Swift, Kotlin, C, and C++ wrappers. Unrelated uses of "instance" (Vulkan/wgpu, class instances, mDNS service instances, RTMP/IETF parameter instances, test fakes) are left alone. The e2ee draft keeps "publisher instance" prose and renames only its references to the moq-lite field.Identity::from_str/TryFrom<String>and JSIdentity.parserefuse empty or over-256-byte text. The lite-07 codecs (Rust and JS) refuse non-UTF-8 or over-256-byte identities in every message that carries one. That surfaces asPROTOCOL_VIOLATION: Rust'sDecodeErrorpath, and an explicitProtocolViolationin JS. Empty withMinted = 0stays legal in request messages; empty inANNOUNCE_STARTor withMinted = 1is still refused. hang-04 catalog parsing (RustFromStr, JSIdentitySchema) applies the same ceiling, with a new parity fixture case.moq-hls: a newtoken(&Identity)is the first 64 bits of SHA-256 over theMintedflag and the text, hex-encoded. It is now the@{token}URL segment,Broadcaster's key (Broadcaster::token()),Server'sby_idkey, and the include lookup key.moq export archivekeys recordings<path>/@<token>with the same function, for the same two reasons: a 256-byte identity percent-encoded could pass a filesystem's 255-byte name limit, and a minted identity must not share a recording with a named one of its text.WireRoute.normalizeruns a string identity throughIdentity.parse, so a plain JavaScript caller bypassing the brand gets aRangeErrorfromroute()/claim()instead of a peer'sPROTOCOL_VIOLATION.identitykeys in@moq/netinternals are renamed torefso they don't collide with the new term. In the watch decoders, the playback-identity locals becomeplaybackand the broadcast-handle field becomes#stream.moq-ffiroute/claim getter isidentity()instead ofinstance_id(). The old name only dodged the C++ generator's privateinstancefield. The Kotlin rename and the Dart extension shims go away.Impact
Breaking API.
Instancewas never released, so migrating is a rename. PerAGENTS.mdandjust check, the release cut writes these notes intoMIGRATE.md, so this PR leavesMIGRATE.mdalone even though the quest asked for it, following the newer repository rule.moq_net::Instance/InvalidInstance→Identity/InvalidIdentity(now also refused above 256 UTF-8 bytes).RouteOptions::with_instance→with_identity,Route::instance()→identity(),broadcast::Info::instance→identity, and likewise inhang,moq-mux,moq-cli,moq-relay, andmoq-e2ee(Epoch::instance→Epoch::identity). Migrate: rename.@moq/netInstancenamespace →Identity,{ instance }options and fields →{ identity }.@moq/hangInstanceSchema/ReferenceInstance→IdentitySchema/ReferenceIdentity.@moq/e2eeEpoch.instance→Epoch.identity. Migrate: rename."instance"→"identity"(unreleased hang-04). Over-256-byte values refuse the catalog.moq-ffi:MoqInstance→MoqIdentity,MoqError::InvalidInstance→InvalidIdentity,MoqRoute::instance_id()/MoqClaim::instance_id()→identity().libmoq:moq_instance_*→moq_identity_*,moq_route_instance→moq_route_identity, option fieldsinstance/instance_len→identity/identity_len. The Go, Python, Dart, Swift, Kotlin, C, and C++ wrappers follow the same renames.moq-cli:--instance→--identity, and log/output fields renamed.moq-hls: URLs are@{token}(16 hex chars) instead of@{identity text}. Newmoq_hls::export::token(&Identity). Public fieldsexport::Include::identityandexport::Resource::{Media, Init, Segment}::identity→token. Migrate: rename the field. It now holds the token, so compare it withtoken(&identity).moq-cli export archive(unreleased) records under<broadcast>/@<token>instead of<broadcast>/@<identity>, logging the identity beside each key.libmoq'smoq_identity_parsenow reports why it refused an identity.moq-lite-07-wiponly, unpublished): field renamed in the draft.Identityis capped at 256 UTF-8 bytes inANNOUNCE_START,SUBSCRIBE,TRACK,TRACKS, andDATAGRAMS, and an over-long one is aPROTOCOL_VIOLATION. No byte layout change. Published versions are unaffected.Choices made
same_identity,moq_mux::Error::IdentityChanged, the hang draft's Track Identity section) beside the new streamIdentity. They are qualified and live in a different layer, so renaming them would be churn without a clear win.moq_hls::export::token(moq-clialready depends onmoq-hls) rather than a newmoq_net::Identitymethod, which would pull a SHA-256 dependency intomoq-net. The upside is that a recording's key matches its HLS URL token.init.{hash}.mp4. It only has to tell apart the identities one path ever serves.Alternatives
Per the quest's recorded decisions: a 1024-byte cap, keeping raw identity text in
moq-hlsURLs, no wire cap, and keepingInstancewere all rejected by the maintainer on 2026-11-26.Validation
All checks ran on head
35b79187f7(after mergingmain):just checkpassed. It covers Rust tests (nextest), JS checks and tests, Kotlin, Swift, Go, Dart, Python, drafts, markdown, and migrate.just test interop --allpassed, covering Rust, the JS clients, and the FFI bindings across moq-lite-05/06/07-wip and moq-transport.cargo clippy --workspace --all-targets --all-featuresis clean.moq-net:identity::tests::caps_at_256_utf8_bytesandlite::identity::test::caps_the_identity_at_256_bytes.hang: the shared catalog parity fixture, with a new over-256-byte case that both Rust and JS refuse.moq-hls:restart::a_named_identity_never_shares_urls_with_a_minted_one_of_its_text.Mintedbyte fromtoken()makes themoq-hlscollision test fail, so the test does pin the minted/named split.moq-hlsroute tests pin the token format:@82dbe9b7c7e4dd2dis the first 64 bits of SHA-256 over0x00 || "01920000-0000-7000-8000-000000000000".e7ce7f3039:just checkand workspace clippy passed again.moq-cliarchive::tests::an_identity_keys_one_segmentnow covers a 256-byte identity keying a 17-byte segment.mainat54c862e955(which brought moq-dev/moq#9695 and moq-dev/moq#9700), on heada8bb04c313:moq-hlsroute tests,rendition.rs, andmoq-clihls/record.rswere resolved to main's code with this PR's names: the route tests use the@{AT}token with main's new segment hash, and the two comments main added that said "instance" (inmoq-hlsandmoq-gst) now say "identity". Main brought no other old-name uses.just checkpassed.just test interop --allpassed on its second run (see Follow-ups for the first run's flake).Follow-ups
a8bb04c313: the python and go publishers' audio showed timestamp gaps (python -> cpp/c/gst,go -> js-native-node/bun), then the rerun passed. The branch touches no audio or publish timing, so it looks like a pre-existing load-dependent flake in the FFI publishers.MIGRATE.mdsections onmainstill nameInstance,with_instance,moq_instance_*, andinstance_id(). The release cut needs to write them with this PR's names.moq-tokiomigrate::a_replacement_does_not_check_what_its_predecessor_learnedfailed once injust checkwith a skipped group:[.., 15, 17, ..]. It passed 30/30 under--stress-count, and this branch changes only comments in that file. It looks like a pre-existing load-dependent flake.Models
Size: M
Implementer: Claude Code, claude-opus-5-5, unknown
Implementer: Claude Code, claude-opus-5-5, unknown
(Written by Claude Opus 5.5)
🤖 Generated with Claude Code
Review
Rewritten by
quest reviewafter each round.Head: a8bb04c
Base: origin/main at fc55051
Risk: high,
A published API rename: the public Rust, JS, C, Go, Python, Swift, Kotlin, and Dart surfaces are rewritten from "instance" to "identity" (for example rs/moq-net/src/instance.rs becomes identity.rs, js/net/src/instance.ts is removed, and rs/moq-ffi/src/instance.rs becomes identity.rs), and the CLI docs and integration tests change with it. Consumers and bindings built against the old names break on the next cut, and undoing it means reverting a 420-file rename across every binding, so it is hard to undo once published.Classified: high by Claude Code, claude-haiku-5-5, low effort, session
12400e76-02ad-4da7-8479-1a27b8af3ffeRisk file: bb7b1c0de60b
Reviewer: Codex, gpt-6.2-sol, high effort
Session:
01a21a85-d012-7663-86d3-ae129358994e, round 4Score: 10/10,
The JavaScript identity validation remains in place, and the merge introduced no new findings attributable to the branch.Rounds: 4; first round 2 (medium 2); findings 3 (medium 3): fixed 2, refuted 1, open 0
Findings: none
Reviewer: Claude Code, claude-opus-5-5, high effort, second
Session:
f36f6d9d-70fc-431a-a5c5-ab19f824041c, round 4Score: 10/10,
Since the last round the branch only merged origin/main: the HLS grid and playlist, QUIC, moq-gst and quest changes come from base commits, the merged hunks in files this branch also touches keep its identity naming, and no findings remain open.Rounds: 4; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none