Skip to content

Say why home-network sync can't find a linked machine - #218

Merged
bfieser merged 3 commits into
mainfrom
sync/216-lan-diagnosis
Nov 7, 2026
Merged

bfieser merged 3 commits into
mainfrom
sync/216-lan-diagnosis

Conversation

@bfieser

@bfieser bfieser commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #216. Decision #123 (amends #94), marked Proposed for you to accept or change.

Why

I linked my desktop and laptop and picked Home network. The laptop was on another Wi-Fi and a VPN, so the machines never heard each other's beacons. Linking had worked (relay only) and the top bar said "Machines linked", but the Sync & backup line showed "Looking for your other machines on this network…" forever (or a green "In sync…"), with no reason. Send errors and other-rig beacons were silently dropped.

What the user sees now

  • First 30 s: "Looking for Brian's Laptop on this network…"
  • Then, with a detected cause: "Can't find Brian's Laptop on this network: a VPN (NordLynx) is on, so Patch Pilot's messages go through it instead of your home network. Turn it off, or let it allow local network access."
  • No cause detected: "Can't find Brian's Laptop on this network. Show what to check."
  • Machine left: "Brian's Laptop isn't on this network now (seen 2 h ago)." This replaces the green "In sync" line.
  • One here, one missing: the usual line, plus " · Laptop isn't on this network now."
  • Details: each machine (on this network / last on it / not found), the full reason, and a checklist (same network, VPN, Windows Private + firewall, macOS Local Network, Patch Pilot open with Home network on the other machine, same version).

Causes this machine can actually tell, surest first: other Patch Pilot version · no Wi-Fi/Ethernet address · broadcasts leaving via a VPN or virtual adapter · macOS Local Network denied (strong guess) · Windows network set to Public · another rig's Patch Pilot on the network · VPN holding the internet route (guess). Anything on the other machine's side stays on the checklist; comparing both machines over the relay is a later PR.

How

  • crates/local/src/lan_diagnosis.rs (new): pure diagnose(Facts) -> Diagnosis, adapter classification by name and Windows description (GlobalProtect calls its adapter "Ethernet 4"), egress kind (a "virtual" adapter carrying the internet route counts as home network, for Hyper-V external switches), bind error wording (10013 = Windows reserved port, not "another app").
  • crates/local/src/netinfo.rs (new, read-only, sends nothing): UDP connect + local_addr for the broadcast and default-route source addresses; sysinfo network feature for interfaces (unsafe stays inside sysinfo); PowerShell Get-NetAdapter/Get-NetConnectionProfile with exact name match, env-var input, no window, below-normal priority, 5 s deadline.
  • lan::read tells this rig / other version / other rig / noise apart (minimum sealed length so junk is noise).
  • sync.rs keeps the relay's machine/ listing ids (no extra relay reads, Release 0.4.2, with "Bring over all Reaper scripts" #113), recorded before pulling.
  • lan.rs: facts gathered on the existing 10 s beacon thread. The network is looked at only while a machine is missing, nobody is here and the grace is over (at most every 30 s; PowerShell cached 10 min per adapter). The UI is told only when the diagnosis changes. view() only reads caches. Nothing happens while unlinked. Only the broadcast's send result counts. A pull error clears (atomically) once its machine is gone.
  • UI: syncLine / new LanMachines in Backup.tsx; types in api.ts (optional fields per Bring over: scripts and packages travel with every file they need; whole folders from Compare #112).

Changelog: added under Unreleased since #215 is cutting 0.4.57; rename it when releasing.

Testing

  • cargo fmt --check, cargo clippy -D warnings (workspace and app), cargo test --workspace (463 pass, new tests for every diagnosis case, beacon classes, adapters, egress, external switch, bind errors, PowerShell output parsing), app cargo test, npm run build.
  • On my Windows laptop the probes report Wi-Fi as home network (Private), the WSL vEthernet as virtual and the disabled GlobalProtect adapter by its description; the PowerShell call takes about 1 s.
  • A pre-PR review (4 reviewers, each finding checked by a skeptic) found 19 issues, all fixed here: unlinked machine, removed machines, Hyper-V external switch, PowerShell hang and priority, probing while someone is here, UI suffix and truncation, a check-then-clear race.
  • Not tested yet: the full two-machine flow by hand (needs the laptop on this build), and anything on a Mac. The Local Network path is unit-tested only; a dev build's Local Network grant belongs to the terminal, so it needs a bundled build on a Mac.

🤖 Generated with Claude Code

When Home network sync can't find a linked machine, the Sync & backup
line now names it and, when this machine can tell, why: a VPN or virtual
adapter carrying the broadcasts, no network, Windows calling the network
Public, macOS Local Network access off, another Patch Pilot version, or
another rig's Patch Pilot on the network. It no longer says "In sync"
while nobody is here. The details list each machine and a checklist.

- patchpilot_local::lan_diagnosis: pure diagnose() over gathered facts,
  adapter classification (name and Windows description), egress kind,
  bind error wording; tested with hand-built facts.
- patchpilot_local::netinfo: read-only probes (UDP connect + local_addr,
  sysinfo interfaces, PowerShell adapter description and profile with a
  5 s deadline at below-normal priority).
- lan::read tells this rig, another version, another rig and noise apart.
- sync.rs keeps the relay's list of linked machines, so machines added
  from an export file or removed never show as missing.
- lan.rs gathers facts on the existing 10 s beacon thread, looks at the
  network only while a machine is missing and none is here, and tells
  the UI only when the diagnosis changes.

Decision #123 (amends #94).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bfieser bfieser added enhancement New feature or request area:ui Tauri app and interface labels Nov 6, 2026
@bfieser
bfieser requested a review from joshuadav86 November 6, 2026 16:47
bfieser and others added 2 commits November 6, 2026 10:48
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bfieser
bfieser merged commit f2ea7dd into main Nov 7, 2026
5 checks passed
@bfieser
bfieser deleted the sync/216-lan-diagnosis branch November 7, 2026 02:55
@bfieser
bfieser restored the sync/216-lan-diagnosis branch November 7, 2026 02:56
@bfieser
bfieser deleted the sync/216-lan-diagnosis branch November 7, 2026 02:56
joshuadav86 pushed a commit that referenced this pull request Nov 9, 2026
Brings in the home-network PRs (#218, #221, #223), which took decisions
#123-#125; this change is now decision #126.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Se1kg5gSsJs5yj2HeacfG
joshuadav86 added a commit that referenced this pull request Nov 9, 2026
Version bump and CHANGELOG entry for the Primary machine fix (#220,
decision #126) and the home-network PRs #218, #221 and #223 (decisions
#123-#125).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013Se1kg5gSsJs5yj2HeacfG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ui Tauri app and interface enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Home network: say why a linked machine can't be found

1 participant