feat(net)!: simplify origin scoping - #3804
Conversation
09784a2 to
b4ae2b7
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review. WalkthroughThe pull request refactors the origin API. Default origin creation now mints a hop, explicit configurations use Priority: ➖ Normal 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Verdict: request changes |
b4ae2b7 to
baef13a
Compare
|
Addressed the prior review findings on the rebased head:
The PR remains on (written by GPT-5) |
Verdict: request changes |
baef13a to
84545f7
Compare
|
Co-Authored-By: GPT-5 <noreply@openai.com>
Co-Authored-By: GPT-5 <noreply@openai.com>
Co-authored-by: Luke Curley <kixelated@gmail.com>
84545f7 to
15f6a22
Compare
Verdict: request changes |
|
Merged after rebasing onto #3819 and validating the release interaction. Changes completed:
Validation on head
Squash merge: (written by GPT-5) |




Problem
Origin construction and scoping require repetitive setup, expose the hop through deref, and collapse authorization and routing failures into ambiguous
Option/Unroutableresults. Broadcast metadata also carries an origin identity it does not use.Approach
scope(root, patterns)operationImpact
Public Rust API in
moq-net:origin::Config::idishop;Config::default()now mints a nonzero random hop; originProducer/Consumerexposehop()instead of dereferencing toHop.origin::{Producer,Consumer}::scope(root, patterns) -> Result<_, Error>replacesscope(patterns) -> Option<_>pluswith_root. Empty/disjoint grants returnUnauthorized; excessive rooting returnsBoundsExceeded.Unauthorized. A path allowed by that scope but excluded by the available server route remainsUnroutable.origin::Pendingisorigin::Requesting.broadcast::Infono longer containsorigin::Config; it directly exposespool,cache_duration, andpath.origin::Producer::publish(path, route)creates and advertises a broadcast together.Public Rust API in
moq-tokio:origin::spawn(config_or_hop)becomes zero-argumentorigin::spawn(); explicit configuration usesorigin::spawn_config(config).Client::with_originandServer::with_originuse one shared origin for publishing and subscribing.The FFI ABI is unchanged; its Rust implementation is migrated to the new origin API. The native-JavaScript smoke-client edit only migrates an in-repository consumer to the already-released
@moq/netobject-style connection/origin API.Wire encoding and message schemas are unchanged. Random Rust hop IDs now use the full legal 62-bit wire range. Current supported
@moq/netclients decode hops asbigint/u62 and interoperate. Retired u53-only@moq/liteclients can reject a hop aboveNumber.MAX_SAFE_INTEGERand close the session; those clients must upgrade.This final prerelease pass intentionally lands the breaking API cleanup on
mainper maintainer direction.Validation
nix develop --command just check: passednix develop --command just test: JavaScript passed; Rust 4,211 passed; Python 64 passedSMOKE_PORT=4590 nix develop --command just test smoke-full: all 32 Rust/Python/Go/JavaScript/C/GStreamer publisher-subscriber combinations passednix develop --command bunx biome check test/smoke/clients/js-native/subscribe.ts: passedAlternatives
Compatibility shims would preserve two construction and scoping idioms immediately before the release. The old shapes are removed directly so authorization failures and rooted scopes have one representation.
Follow-ups
@moq/litemust upgrade before consuming full-width random Rust hops(written by GPT-5)