GeezerVison is showing github.com — fix(client-runtime): persist Tailscale network flag on learned IPv6 and MagicDNS routes by saphid · Pull Request #44725 · pingdotgg/t3code
Conversation
Problem
A learned plain-HTTP Tailscale IPv6 (http://[fd7a:115c:a1e0::1]:3773/) or MagicDNS (http://box.tail1234.ts.net:3773/) route that borrows an HTTPS-paired token and lacks profile.network: "tailscale" never persists network: "tailscale" when the server reports kind: "tailnet", so usableRoutes permanently filters it out as sending the token in the clear (and clearing network: "tailscale" on such routes is likewise dropped). In mergeLearnedRoutes, the change-detection signature hashes connectionRouteKind(route)—which already returns "tailnet" for fd7a:115c:a1e0::/48 and *.ts.net via isTailnetHost regardless of profile.network—so signature(saved) === signature(next) evaluates to true and mergeLearnedRoutes returns null.
Deterministic repro on origin/main (d588352064a86bb051e93b676d1631a1c1c6f4de):
From packages/client-runtime, call mergeLearnedRoutes with an entry containing [learned('learned:environment-1:http://[fd7a:115c:a1e0::1]:3773@public', 'http://[fd7a:115c:a1e0::1]:3773/'), learned('learned:environment-1:http://box.tail1234.ts.net:3773@public', 'http://box.tail1234.ts.net:3773/'), PUBLIC, RELAY] (without network set on the learned profiles), activeRoute: PUBLIC, reported: [{ kind: 'tailnet', httpBaseUrl: 'http://[fd7a:115c:a1e0::1]:3773/' }, { kind: 'tailnet', httpBaseUrl: 'http://box.tail1234.ts.net:3773/' }], and allowInsecure: true, then evaluate usableRoutes:
- Observed on
origin/main: mergeLearnedRoutes returns null (dropping the network: "tailscale" update), and usableRoutes(entry) excludes both Tailscale routes (["public", "relay"]).
- Expected:
mergeLearnedRoutes returns the updated route list with profile.network === "tailscale" set on both routes, and usableRoutes(entryWithRoutes(entry, merged)) keeps them usable.
Change
Include profile.network ?? "" (for BearerConnectionProfile) in mergeLearnedRoutes's signature helper in packages/client-runtime/src/connection/routes.ts so setting or clearing profile.network on Tailscale IPv6 and MagicDNS routes is persisted rather than treated as a no-op. This shared packages/client-runtime module is used across Web, Desktop, and Mobile environment connection routing, with no contract, server, provider, or i18n changes needed.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
- Base failure (unmodified
origin/main d588352064a86bb051e93b676d1631a1c1c6f4de): vp test run packages/client-runtime/src/connection/routes.test.ts -t "persists Tailscale network flag updates on IPv6 and MagicDNS routes" failed with AssertionError: expected null not to be null at expect(updated).not.toBeNull().
- Head passes (2/2 consecutive runs):
vp test run packages/client-runtime/src/connection/routes.test.ts passed 25/25 tests on both consecutive runs (covering setting network: "tailscale" on learned IPv6 and MagicDNS routes, verifying usableRoutes keeps them, idempotency on repeat merge, and clearing network: "tailscale" when kind: "tailnet" is no longer reported).
vp run check:changed: Exited 0 (format pass, lint pass with 0 warnings/errors, knip 1/2 & 2/2 pass, typecheck across 7 packages pass, routes.test.ts 25/25 pass).
- Before/after runtime transcript: https://gist.github.com/saphid/5200fdd0266f67ac35f35c3c3c54424a
- Not shown: End-to-end live Tailscale network connection across a physical Tailscale IPv6/MagicDNS host and full repo-wide CI suite (owned by CI).
Authored by Gemini 4 Neon (Antigravity); reviewed by Kimi K3.1 Pro (Model Hub).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

Important
Review skipped
Review was skipped as selected files did not have any reviewable changes.
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 1bbd70a and fa79fa5.
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:
No actionable comments were generated in the recent review.
Walkthrough
-
mergeLearnedRoutes now detects changes to a route’s bearer profile network value. Tests cover setting and clearing the Tailscale network flag on learned IPv6 and MagicDNS routes, including repeated reports that produce no further update.
Changes: Learned route network updates
| Layer / File(s) |
Summary |
Compare and test learned route network values packages/client-runtime/src/connection/routes.ts, packages/client-runtime/src/connection/routes.test.ts |
The route comparison signature now includes the bearer profile network value. Tests check that learned IPv6 and MagicDNS routes gain the Tailscale network flag after a tailnet report, and that an IPv6 route loses it after a lan report. Repeating an unchanged report produces no update. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · previous review 1bbd7
-
Learned Tailscale IPv6 and MagicDNS routes now persist updates to their network flag instead of dropping them as no-ops. The change is small and covered by targeted tests, and no merge-blocking risk was identified.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: persisting the Tailscale network flag on learned IPv6 and MagicDNS routes. The raw summary, objectives, and description all match this fix in mergeLearnedRoutes' chang… |
| Description check |
 |
The description follows the repository template. It covers Problem (a clear root cause and a deterministic repro on origin/main), Change (the signature edit and why it is scoped to the shared module),… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: persisting the Tailscale network flag on learned IPv6 and MagicDNS routes. The raw summary, objectives, and description all match this fix in mergeLearnedRoutes' change-detection signature. It follows the conventional commit form. It is long (87 characters), but it stays specific and on topic.
Full details: Description check
-
Explanation
The description follows the repository template. It covers Problem (a clear root cause and a deterministic repro on origin/main), Change (the signature edit and why it is scoped to the shared module), Scope (a small obvious bug, no issue needed, with a reason), and Verification (a targeted failing-then-passing test, a repeat run, check:changed results, and a stated list of what was not checked). It also includes the model attribution the template requests. The template's Scope section asks for a linked issue or maintainer request for bug fixes; the author gives a reason for omitting one, which the template accepts for small obvious fixes. Minor gap: the Verification section cites an external gist, which reviewers must open to confirm the before/after transcript.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 4db4b82 and 1bbd70a.
Files selected for processing: 2
-
packages/client-runtime/src/connection/routes.test.ts
packages/client-runtime/src/connection/routes.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Pair through HTTPS, remove the learned IPv6 route's saved network flag, reload to receive real server discovery, stop HTTPS, then reload and wait 30 seconds. Both runs used fresh state, Chromium at 1280×800, and dark theme. The direct IPv6 server remained reachable.
Scenario source. scenarios:prove exited 0: failed on base and passed on head.
Not shown:
- MagicDNS plain-HTTP learned routes were not exercised; this real server advertised its explicitly bound Tailscale IPv6 address.
- Clearing an existing tailscale flag after a server classification change was not exercised.
- Desktop and mobile were not run; the proof covers the web client using shared client-runtime logic.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|