Skip to content

fix(remote): fixes and trims from the RC review - #491

Open
Lokesh7025 wants to merge 2 commits into
RCfrom
chore/rc-trim
Open

Lokesh7025 wants to merge 2 commits into
RCfrom
chore/rc-trim

Conversation

@Lokesh7025

Copy link
Copy Markdown
Contributor

Fixes and trims from a review of the whole RC diff (#394).

Fixes

  • A failed /remote no longer leaves a broken pairing behind. /remote revokes the previous device and prunes its session before it builds the new pairing. If a later step failed (device invite, witness, relay, or the endpoint itself), host.json still said paired for the deleted session. The next daemon start then retried a restore that could never succeed, and remote.status showed paired. The host now drops host.json as soon as the previous device is retired. Opening the new session also moved inside the error handling, so an endpoint failure (for example an unavailable key helper) gets the usual /remote message and a log line instead of a raw error.
  • A Welcome whose publication fails is published again, not recreated. The daemon recorded the accepted claim only after publishWelcome succeeded. After a transient failure, the phone's repeated notice re-reserved the claim (hitting reservation_busy for a minute) and re-submitted it to an endpoint that already held a Welcome. The created Welcome is now kept on the session, and a repeated notice only retries the publication.
  • Malformed control-plane requests are 400, not 503. Ticket, installation and device bodies were parsed inside the services, so a parser's TypeError fell through to 503 service_unavailable, which clients retry as an outage. Every body is now read and checked through one readRequest path.

Trims

  • The control-plane handler repeated the same authenticate-then-401 block for every route. Routes now live in one table behind principalFor, and response codes and bodies are unchanged.
  • The relay's per-window byte budget was max_frame_bytes * max_frames_per_window. Every frame is already capped at max_frame_bytes, so that budget could never trip before the frame count did. Removed the dead rate_bytes bookkeeping.
  • Removed exports nothing imports: parseAxlSessionId, parseObjectId, encodeWitnessLineage, parseWitnessHttpRequestBody, REMOTE_LOGIN_REDIRECT.
  • Fixed an orphaned doc comment in remote-host.ts.

Tests

  • New: remote-host.test.ts checks that a /remote failing after replacement leaves nothing to restore. devices.test.ts checks that a malformed enrollment is a 400 and that the 401 body is unchanged.
  • pnpm lint, pnpm format:check, pnpm check, relay mix test.

…lication, answer malformed requests with 400

A /remote that failed after retiring the previous device left host.json pointing at the pruned session, so every later restore failed. The host now drops host.json once the device is retired, and an endpoint that fails to open gets the usual /remote message.

A Welcome whose publication failed was recreated on the phone's next notice against an endpoint that already held it; the created Welcome is now kept and only its publication is retried.

Control-plane bodies parsed inside services turned a parser TypeError into 503. Every body now goes through one checked reader, and the routes share one principal check instead of repeating it.

Signed-off-by: Lokesh <lokeshselvam7025@gmail.com>
… protocol exports

Signed-off-by: Lokesh <lokeshselvam7025@gmail.com>
@Lokesh7025
Lokesh7025 requested a review from Haz3-jolt as a code owner October 5, 2026 11:11
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99961d22-fe54-4f0e-9be7-db156d3b035a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · 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.

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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