Skip to content

feat(net): expose live origin routes and infer private connections - #3944

Open
kixelated wants to merge 3 commits into
mainfrom
quest/main/js-net-additive
Open

kixelated wants to merge 3 commits into
mainfrom
quest/main/js-net-additive

Conversation

@kixelated

@kixelated kixelated commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Problem

Apps need a live view of origin routes, dynamic serving through a borrowed Connection.origin, and private reconnect loops for connection-specific options.

Approach

  • Add Origin.Table.broadcasts(scope) and Table.dynamic(). Unscoped readers share a mutation-keyed snapshot; scoped readers retain announcement filtering semantics.
  • Infer a private loop when transport options, discovery, delay, publish, or consume are supplied. Explicit share: true still refuses those options.
  • Add a nightly route-count × observer-count benchmark for touched-path updates.
  • Complete the additive quest. Credential refresh is planned with the existing in-band AUTH quest, where tokens can be replaced through AUTH streams and accepted grants union. URL JWT remains the fallback for legacy peers.

Impact

  • Public @moq/net API: additive Origin.Table.broadcasts(scope) getter and Origin.Table.dynamic() method.
  • Behavior: connection-specific options now select a private loop by default; explicit share: true remains a refusal.
  • Wire: no change.
  • Performance: 128 routes × 32 unscoped observers took about 0.03 ms per route update locally. Thirty-two distinct scopes took about 13 ms because each scope filters the table; the nightly benchmark records both slopes.

Verification

  • just check
  • just test
  • Focused origin and connection pool regression tests, plus the nightly benchmark configuration.

(written by GPT-6 Astra)

opencode agent and others added 3 commits September 22, 2026 21:25
@kixelated
kixelated force-pushed the quest/main/js-net-additive branch from 6c989d4 to ced6377 Compare September 23, 2026 04:28
@kixelated
kixelated marked this pull request as ready for review September 23, 2026 04:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ced63775ff

ℹ️ 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".

# over independent observers of the new live broadcast map.
- name: JS origin broadcast map benchmark
if: ${{ !cancelled() }}
run: nix develop --command bun js/net/bench/broadcasts.ts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install workspace dependencies before running the benchmark

On the fresh checkout used by this nightly job, no preceding step runs bun install, so this command cannot resolve the workspace imports used by origin.ts. Running the exact command in a checkout without node_modules fails with Cannot find module '@moq/signals', making every nightly workflow red before collecting benchmark results. Install with the frozen lockfile first or invoke the benchmark through a recipe that does so.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-23T04:32:33.727432Z ced6377 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5d9c1c76-8522-4d8b-ad26-ebfc82e29c51

📥 Commits

Reviewing files that changed from the base of the PR and between 7ee2b02 and ced6377.

📒 Files selected for processing (10)
  • .github/workflows/nightly.yml
  • doc/lib/js/net.md
  • js/net/bench/broadcasts.ts
  • js/net/src/connection/pool.test.ts
  • js/net/src/connection/pool.ts
  • js/net/src/origin.test.ts
  • js/net/src/origin.ts
  • quest/next/README.md
  • quest/next/auth/token-in-band.md
  • quest/next/js-net-additive.md
💤 Files with no reviewable changes (2)
  • quest/next/README.md
  • quest/next/js-net-additive.md

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


Walkthrough

The origin API adds scoped and unscoped broadcast-map getters backed by memoized route snapshots. Connection-specific options now select a private reconnect loop by default, while explicit share: true rejects those options. The changes also add tests and a benchmark, update the network documentation, and revise quest planning documents.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to ced63

The benchmark can run from a clean checkout, and no actionable merge-blocking issue remains after normal checks.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main changes: exposing live origin routes and inferring private connections.
Description check ✅ Passed The description directly explains the new live origin-route APIs, private connection inference, benchmark, impact, and verification steps.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 5 files. (3 skipped: 3 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Verdict: MERGE

Positive improvement: yes. Origin.Table.broadcasts(scope) and Table.dynamic() give apps the live route map and on-demand serving they need on a borrowed Connection.origin, and inferring a private reconnect loop from connection-specific options (while keeping explicit share: true as a hard refuse) matches how those options actually behave.

Worth the complexity: yes. The mutation-keyed shared snapshot for unscoped readers, scoped filtering that reuses #listed, and the nightly route×observer benchmark keep the additive API honest about cost. Tests cover borrowed origins, inference vs explicit share, snapshot sharing, and local-over-remote precedence. Completing the quest and parking credential refresh with in-band AUTH is a clean split.

Alternatives (forcing every caller to pass share: false, or only exposing an async announce stream) are worse for UI “what is live” use. No wire change; CI looks healthy. Ship it.

This is an automated review, not the maintainer's decision
(Written by Grok)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant