Skip to content

fix(js/net): a scoped handle that closes reports its received routes offline - #8504

Merged
kixelated merged 3 commits into
mainfrom
quest/m1/offline-js-handle
Nov 11, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m1/offline-js-handle

Conversation

@kixelated

@kixelated kixelated commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A route a session received through a scoped Producer now goes offline when that scoped handle closes, instead of end. The scoped close ran the raw release #hold registered and skipped close(lost), so entry.lost stayed false. The reason now lives in the shared release transition: a received route defaults to lost, and only end() (an explicit wire end) selects withdrawal.

Test: a route received through a scoped handle goes offline when the handle closes in js/net/src/origin.test.ts (failed before the fix).

Rust

No same gap. A Rust Producer (scoped or not) never tears down routes it created; a route retracts only when its own Route drops, and RouteState::drop already picks Retract::Lost for forwarded routes. The cursor-fallback misreport is /quest/m1/offline-cursor-fallback.md, handled separately.

Impact

Public API: none. Wire: none.

Caused by

  • moq-dev/moq#8375 - a scoped handle's close skipped the lost reason for received routes

Notes

  • Expect a merge conflict with moq-dev/moq#8443 around origin.ts; small (a few lines in #serving).
  • Removed this quest's link from offline-cursor-fallback.md, which another agent is editing in parallel; a trivial conflict there is possible.

Models

Size: S
Implementer: Claude Code, Opus 5.5, low effort

🤖 Generated with Claude Code

(Written by Opus 5.5 with low)

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, medium effort
  • Session: 01a1c9e8-d239-7e81-b35d-6f7f50402650, round 1
  • Head: 3ef349b
  • Base: origin/main at 5353e4f
  • Score: 9/10, The shared release transition correctly reports scoped received-route teardown as offline while preserving explicit wire ends and idempotent cleanup, with a focused regression test covering the bug, though tests were not run as instructed.
  • Findings: none

kixelated and others added 3 commits November 11, 2026 00:55
…offline

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title A scoped JS handle that closes reports its routes offline fix(js/net): a scoped handle that closes reports its received routes offline Nov 11, 2026
@kixelated
kixelated marked this pull request as ready for review November 11, 2026 09:21
@coderabbitai

coderabbitai Bot commented Nov 11, 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 2 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b0fff4f-bdab-4146-8973-df6a2c80fb54
Commits

Reviewing files that changed from the base of the PR and between 23898b4 and 3ef349b.

Files selected for processing: 4

  • js/net/src/origin.test.ts
  • js/net/src/origin.ts
  • quest/m1/offline-cursor-fallback.md
  • quest/m1/offline-js-handle.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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

Read the complete 4-file diff, traced the route-entry lifecycle it touches, and verified the Rust counterpart before concluding.

  • js/net/src/origin.ts: the lost reason moved into the release callback registered with #hold (let lost = !originated), so every teardown path — the claim's own close() and a borrowed Producer scope closing — writes entry.lost before remove(...); only end() clears it for an explicit wire end. release keeps its if (!ended) guard, so a late end() after teardown cannot overwrite the reason.
  • js/net/src/origin.test.ts: regression test receives a route through origin.scope(...), closes the scope, and expects offline; it fails on the pre-fix code with kind: "end", so the coverage is real rather than incidental.
  • quest/m1/offline-js-handle.md, quest/m1/offline-cursor-fallback.md: quest completed by deletion with its inbound Related link dropped; grep finds no remaining references to the slug.

The change matches the documented contracts: wire.ts says closing a received route's handle means its session lost it, and announced.ts maps that to offline ("this side let go of the path"), while end is reserved for the origin withdrawing it. Rust has no gap to mirror — Producer::scope there shares state without a release registry, and a forwarded route retracts Retract::Lost when its own RouteState drops.

Verified locally: pre-fix fails / post-fix passes for the new test, and bun test js/net/src reports 3207 pass, 1 skip, 0 fail.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit c2a4749 Nov 11, 2026
14 checks passed
@kixelated
kixelated deleted the quest/m1/offline-js-handle branch November 11, 2026 19:13
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