Skip to content

fix(clients): pairing a new server at a saved address replaces the one saved there - #36312

Open
juliusmarminge wants to merge 1 commit into
factory/pr-25807-a1794597635-2-label-syncfrom
factory/pr-25807-a1794597635-3-same-address
Open

juliusmarminge wants to merge 1 commit into
factory/pr-25807-a1794597635-2-label-syncfrom
factory/pr-25807-a1794597635-3-same-address

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Rewritten rather than taken from the original, whose guard counted routes before removing dependents. After a real pairing (register with paired: true, set only by registerPairingConnection) at an HTTPS or loopback address, each other user environment with a route at that address is handled under its own lease: if routes remain after dropping the stale route and the learned routes borrowing its login, only those are dropped; if the stale route was its sole route, the environment is removed (the #15802 loopback case, reviewer finding 2); if only borrowed routes would remain, it is left untouched so no saved data is deleted (reviewer finding 1). Platform-managed environments, SSH routes, edited URLs and plain HTTP LAN addresses are never affected, and a failure in the cleanup is logged without failing the pairing. One table-style test in registry.test.ts covers all five cases and asserts the cache and owned-data clears happen for the sole-route environment only. Fixes #15802 for HTTPS and loopback addresses.

Fixes #15683

Supersedes #25807. The change is @t3dotgg's; their commits are kept.

Layer 3 of 3, on top of #36311.

…e saved there

Saved environments are keyed by the server's id, and pairing never looked
at the address. A server with fresh state at a saved address was added
beside the old entry, which stayed stuck on "does not match" until it was
removed by hand.

After a pairing at an HTTPS or loopback address, other environments drop
their route there, since that address reaches one server and it has just
confirmed its id. An environment with no other route is forgotten. One
whose only other routes borrow that address's login is left as it is:
those routes may still reach it, and removing the address would take them
and the environment's saved data with it. Only a pairing does this, never
an edited URL, and a plain HTTP LAN address is left alone because it can
be another machine on another network.

Fixes #15802

Co-authored-by: Theo Browne <me@theo.li>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 13, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Pairing now automatically removes stale saved routes and can forget the previous environment, including its associated local data. Human confirmation is needed that this automatic cleanup is the intended default behavior.

You can add or adjust custom eligibility rules. Learn more.

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

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant