Skip to content

fix(net): bind JS consumes to the serving announcement - #5254

Merged
kixelated merged 5 commits into
mainfrom
quest/m0/broadcast-epoch/js-consume-identity
Oct 11, 2026
Merged

kixelated merged 5 commits into
mainfrom
quest/m0/broadcast-epoch/js-consume-identity

Conversation

@kixelated

@kixelated kixelated commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Fresh JS consumes could share tracks from a different serving announcement, and Lite omitted the epoch of covering advertisements. Review also found blind consumes could survive an announce/withdraw lifecycle and fallback consumers were lost when another instance temporarily won.

Approach

Use the origin's prefix and route ordering to select the serving announcement. Cache each live consumer by path and explicit epoch or epochless advertisement identity. Keep every held instance available for fallback. Index blind consumers by their covering prefixes so a new announcement forgets only affected blind identities, without closing existing readers or scanning unrelated cached consumers.

Resolve the latest base conflict while preserving new sibling quests and retiring only the completed identity quest.

Impact

  • Public API: no exported shape changes; corrected fresh-consumer identity and cache reuse for Lite and IETF.
  • Wire: existing Lite-07 TRACK, SUBSCRIBE and FETCH fields carry the selected covering announcement's epoch. No framing, registry or negotiation changes. Older Lite and IETF remain epochless.
  • Shared origin lookup uses path prefixes and the same route comparison rules.

Alternatives

Recommended decisions selected during unattended iteration:

  • ✅ Keep all live instances per path. A single cache slot duplicates subscriptions when selection returns to a held fallback.
  • ✅ Invalidate blind identities through a prefix index. A process-lifetime blind identity resurrects stale caches; a global generation invalidates unrelated paths; a whole-cache scan makes unrelated consumers part of the update cost.
  • ✅ Preserve advertisement identity across metadata updates and compare explicit epochs across advertisements. Absent epochs do not prove continuity.

Validation

The original three protocol regressions reproduce missing covering epochs and stale consume reuse. Three additional review regressions fail on the previous PR head and pass after this iteration. The 206 focused cache/Lite/IETF/origin tests pass, with protocol fallback assertions requiring the original held consumer.

Existing nightly benchmark now sweeps 8/32/128 announcements x 1/8/32 held consumers through 256 route switches and blind lifecycles. Before: 255 duplicate fallback entries and 256 stale blind reuses per consumer. After: zero of either. Blind invalidation costs roughly 0.4-15.2 microseconds across the sweep, following affected consumers rather than unrelated route count. Raw paired runs were measured locally; no timing threshold is asserted.

just js fix, full just check (1,573 JS networking tests), quest validation, and just test interop --all pass, including browser refusal and finite-tail checks.

Follow-ups

Held handles opening new work after retirement remain separately implemented in draft #5294; integrate its validity ownership with these selected identities before that quest is complete. Seamless handover of existing tracks remains the JS group-handover quest. This PR completes fresh-consumer selection and cache reuse.

(Written by GPT-6 Astra)

kixelated and others added 3 commits October 10, 2026 13:53
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
Co-Authored-By: GPT-6 <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6888e2e2-9bef-4efa-b461-7caf49c886db

📥 Commits

Reviewing files that changed from the base of the PR and between 1530f1d and 82708be.


📒 Files selected for processing (13)
  • js/net/bench/broadcasts.ts
  • js/net/src/consume.test.ts
  • js/net/src/consume.ts
  • js/net/src/ietf/subscriber.test.ts
  • js/net/src/ietf/subscriber.ts
  • js/net/src/internal.ts
  • js/net/src/lite/subscriber.test.ts
  • js/net/src/lite/subscriber.ts
  • js/net/src/origin.ts
  • quest/m0/broadcast-epoch/README.md
  • quest/m0/broadcast-epoch/catalog-references.md
  • quest/m0/broadcast-epoch/js-consume-identity.md
  • quest/m0/broadcast-epoch/retired-requests.md

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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: 6b11dc1859

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

Comment thread js/net/src/consume.ts
Comment thread js/net/src/consume.ts Outdated
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

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-10-11T00:19:02.490416Z 82708be Draft marked ready
🔒 Security Review ✅ Completed 2026-10-11T00:22:40.849128Z 82708be 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.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>
@kixelated
kixelated marked this pull request as draft October 11, 2026 00:08
Co-Authored-By: GPT-6 Astra <noreply@openai.com>
@kixelated
kixelated marked this pull request as ready for review October 11, 2026 00:16
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge validation: current-head CI and Codex code/security reviews pass at 82708be. Both older review findings are implemented and covered by regressions; their threads are now resolved. The user approved merging this fresh-consumer selection and cache-reuse scope.

No exported API shapes or framing change. Existing Lite-07 TRACK, SUBSCRIBE, and FETCH fields now carry the selected covering announcement's epoch. Held handles opening new work after retirement remain separately tracked in #5294; existing-track handover remains its existing quest.

(Written by GPT-6)

@kixelated
kixelated added this pull request to the merge queue Oct 11, 2026
Merged via the queue into main with commit 2b1126e Oct 11, 2026
6 checks passed
@kixelated
kixelated deleted the quest/m0/broadcast-epoch/js-consume-identity branch October 11, 2026 01:37
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