Skip to content

feat(mobile): show phone tailscale guidance after route failures - #366

Merged
nixuuu merged 1 commit into
devfrom
feat/mobile-tailscale-hint
Nov 8, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/mobile-tailscale-hint

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 8, 2026

Copy link
Copy Markdown
Member

When every route fails and all Tailscale probes end in DNS errors or timeouts, Canopy now points users to Tailscale on their phone. Previously, the banner blamed an unresponsive gateway even when the phone's VPN was off or stuck.

Behavior

  • Classify the latest completed TLS race separately from changing per-route diagnostics. A successful route, a Tailscale pin mismatch/refusal, incomplete checks, and pairings without Tailscale routes suppress the hint. The previous completed result stays visible during the next recovery race.
  • Replace the banner, sidebar status, and connection sheet guidance with “Check Tailscale” and actionable phone instructions. Keep route diagnostics, Copy details, and Reconnect now.
  • Retry foreground subscriptions after a fixed 5-second pause while the pattern persists. Preserve bounded shared probes and fresh foreground/network transport resets. Include isInternetReachable in the network event key. RPCs that may have reached the computer are never replayed.
  • Add Android's Open Tailscale action using tailscale://navigate/main/devices, with instructions to open the app manually if the link fails. Add Polish phone setup and troubleshooting guidance in docs/mobile.md.

Platform evidence and limits

Installed expo-network 58.0.4 was inspected on both platforms, alongside Expo SDK 58 network documentation.

Android's getConnectionType checks cellular and Wi-Fi before TRANSPORT_VPN. A working VPN can therefore still report CELLULAR or WIFI; those values cannot prove that Tailscale is off. Android reachability uses INTERNET/VALIDATED capabilities and VPN downstream bandwidth, but it is not a Tailscale traffic check. iOS maps NWPath to interface type and connection state, without a VPN flag; isInternetReachable mirrors isConnected. Both platforms use the cautious generic message. The fixed foreground retry pause covers VPN toggles that leave all exposed fields unchanged.

Android's navigation URL is registered by Tailscale's manifest and handled by its DeepLinkNavigator. React Native 0.88.1 opens it directly with ACTION_VIEW; no canOpenURL, manifest queries, native dependency, or native configuration change is needed. An intent: string would not be parsed as an Android intent by React Native's Linking.openURL implementation. A market URL opens a store rather than the VPN controls.

The iOS action is omitted: no supported navigation URL was confirmed for its client, and adding LSApplicationQueriesSchemes is outside this OTA change. Real-phone VPN recovery and app-launch behavior were not smoke-tested. No UI/E2E tests, native builds, APKs, or OTA publication were run.

Copy audit — docs/copy.md §8

Before After Reason
Gateway unavailable Check Tailscale Name the actionable phone check when the failure pattern supports it.
The gateway is not responding… Tailscale on this phone may be off or stuck. Turn it off and on in the Tailscale app, then reconnect. State uncertainty, identify the phone, and give a concrete next action. Sentences contain 9 and 11 words.
No app action Open Tailscale A verb-first, sentence-case action using the product's proper name.
No launch error Could not open Tailscale / Open the Tailscale app, then turn it off and on. / Close Explain the failed action and offer a manual recovery step.

§8.1–8: plain active copy, sentence case, punctuation and glossary checked; no new jargon, duplicated facts, empty states, or decorative copy. Existing Details, Copy details, and Reconnect now remain. §8.9: the new text interpolates no names or addresses; source review confirms wrapping banner/sheet text and a wrapping action row. Real-device light/dark and viewport checks remain unverified. §8.10: the message and labeled actions convey the guidance without relying on color or icons.

Native fingerprint — production profile

Generated before and after with the pinned CLI from apps/mobile:

bunx [email protected] fingerprint:generate --platform ios --build-profile production --json --non-interactive
bunx [email protected] fingerprint:generate --platform android --build-profile production --json --non-interactive
Platform Before After
iOS 2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3 2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3
Android c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d

Both native fingerprints are unchanged. The diff contains only TypeScript/TSX, the focused classifier test, and Polish documentation.

Verification

  • bun install — passed; no manifest or lockfile changes.
  • bun run gen:check, bun run typecheck, bun run lint, mobile ESLint, and bun run format:check — passed. Formatting was applied with bun run format.
  • bun run check:tmp — passed: 1,833 passed, 161 skipped, 0 failed across 325 files; nothing left in the checked temp directory. Opt-in live tests remained disabled.
  • bun test tests/integration/mobile-tailscale-hint.test.ts and bun run check:tmp tests/integration/mobile-tailscale-hint.test.ts — 16 passed, 0 failed; nothing left in the temp directory. Covers DNS/timeouts, all-timeout stuck tunnel, pin/refusal, no Tailscale route, successful routes, incomplete/aborted checks, pending retries, request/probe separation, and active-route recovery.
  • bun run --filter @canopy/web build — passed. Existing mobile route integration tests also passed, including waking tunnels, shared probes, reset/cancellation, and no replay after lost headers/body.

@nixuuu
nixuuu merged commit 002386e into dev Nov 8, 2026
9 checks passed
@nixuuu
nixuuu deleted the feat/mobile-tailscale-hint branch November 8, 2026 20:00
nixuuu added a commit that referenced this pull request Nov 10, 2026
Repeated failures against an unreachable paired gateway made the mobile
sheet alternate between “Reconnecting…” and “Gateway unavailable”. Route
probes erased their previous results, the sheet changed height, and the
sidebar banner could unmount an open sheet. Independent requests could
also start another failed route race as soon as the preceding race
finished.

Availability and retry activity now use one shared domain state machine
across mobile and web/desktop. After 3 failures or 12 seconds without
success, “Gateway unavailable” stays until a successful stream
snapshot/resynchronization. Retry activity appears in a reserved line.
Retries use 1/2/4/8/16/30-second backoff with 80–100% jitter;
network/foreground/manual reconnect reset the delay without clearing
unavailable.

- Mobile route rows retain their last result while checking, use fixed
heights and a bounded scroll area. All requests share the failed route
race’s cooldown; no sent RPC is replayed.
- The mobile sheet remains mounted through retries, manual reconnect and
recovery. The sidebar banner overlays the list. Web/desktop has a
matching status popover, manual reconnect and an overlay banner below
the header.
- Documented states, transitions, route cooldown and lifecycle resets in
`docs/mobile.md` and `docs/ui-api.md`. No native, dependency or protocol
changes.

## Validation

- Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, root
`bun run lint`, `bun run format:check`, and the production web build.
- Focused domain/transport/route tests: 32 passed, 333 assertions, 0
failed. Coverage includes sticky unavailable, hanging opens, exponential
backoff/cap/jitter, lifecycle/manual resets, late callbacks,
linked-computer outages, diagnostics retention and independent-request
cooldown.
- Browser: stopped and restarted a disposable gateway; sampled title,
open state, panel/button geometry and content positions every 200 ms. No
unavailable-to-reconnecting bounce, sheet closure or content movement;
automatic recovery succeeded. Checked light/dark and desktop/phone
widths with short and long thread names. Measured retry intervals grew
exponentially to the capped range; manual reconnect restarted
immediately without clearing unavailable.
- Both production fingerprints generated with `[email protected]` are
unchanged: iOS `6ddec9ef559ee0095ac33e94ff9418a942053b17`, Android
`5f6eae3ab278f1cd543e9ed763f923a319b65ec9`.

Limitations: native iOS/Android visual QA was unavailable. Full
`check:tmp` was not run; this task’s verification scope permits focused
tests. Additional Expo ESLint reports existing errors in unchanged
files; changed mobile UI files have no ESLint errors (the keyed recovery
memo has one dependency warning). Root oxlint and all requested checks
above pass. Evidence is kept outside the repository.

## Copy audit — docs/copy.md §8

1. “No route in use” / “Checking routes…” → “Routes”; per-route
replacement status → last result plus “Checking route” activity. These
distinguish availability from an attempt without rewriting the heading.
Added “Retrying in N s” / “Retrying…” in a reserved line; digits are
localized, units spaced, sentence case retained.
2. Glossary unchanged. “Reconnect now”, “Copy details” and “Open
Tailscale” name actions. The web popover explains the last known state
and automatic reconnect; technical failures remain in Details. Tailscale
guidance stays in the description while the availability title remains
stable.
3. No new empty states, duplicated availability heading,
optional-dependency warning or expressive sentence. Existing failure
copy retains its automatic resolution/manual reconnect action.
4. Short, typical and long thread titles checked at desktop and phone
widths in both themes; route hosts keep middle truncation and results
have a fixed row. Native text sizing/layout remains unverified as noted
above.
5. Availability and countdown have text labels; checking activity has an
accessible label. Color is supplementary and spinners respect reduced
motion.

## Regression attribution

The merged diff for #361 explicitly introduced `down && stale ===
subscriptionKey && !routes.pending`, which returns the availability
presentation to reconnecting whenever a new probe begins. This fixes
that condition and the resulting presentation instability. #366’s
Tailscale hint and fixed retry interval were checked as context; they
did not introduce that condition.

Fixes: #361
Related: #366
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