Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Openjuliusmarmingewants to merge 1 commit intofactory/pr-25807-a1794597635-2-label-sync fromrefs/pull/36312/headopened View on GitHub

juliusmarmingecommented

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 pingdotgg/t3code#15683

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

Layer 3 of 3, on top of #36311.

    1. juliusmarminge linked this to fix #15802

    2. tanstack-source added labelsbug

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    4. 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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).

Sign in to join this conversation.