Skip to content

Fix Bluetooth motor disconnect recovery - #60

Merged
mcroomp merged 6 commits into
mainfrom
fix/bluetooth-motor-disconnect-recovery
Nov 18, 2026
Merged

mcroomp merged 6 commits into
mainfrom
fix/bluetooth-motor-disconnect-recovery

Conversation

@mcroomp

@mcroomp mcroomp commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Release Bluetooth peripheral and adapter handles after motor link/write failure while retaining the unconfirmed motor state and asynchronous error journaling.
  • Allow scanning and explicit reconnection after disconnect; initialize the motor off without resuming the previous command.
  • Revoke browser lease ownership on Bluetooth loss, show the unconfirmed state, and keep recovery controls available.
  • Add backend/UI regression coverage and update motor recovery documentation.

Validation

  • cargo test -p linkhub motor::tests — 20 passed.
  • npm test -- tests/motor-panel.test.ts — 20 passed.
  • npm run build — passed (existing bundle-size warning).

Offline motor-session analysis changes are intentionally excluded.

Launcher follow-up

  • Preflight launcher arguments with serve --help and rebuild incompatible binaries through setup.cmd before connecting.
  • Fail explicitly if a rebuild does not restore argument compatibility.
  • Add stale-binary regression coverage and use the approved 60-second timeout for Windows integration tests, retaining existing subprocess limits.

Validation: all 35 Windows bootstrap tests pass; Ruff and Pyright pass. A real run_linkhub_ui.cmd auto launch served HTTP 200; no serial device was available.

Opt-in firewall configuration

  • Add --configure-firewall to request administrator approval for a persistent LinkHub-only TCP allow rule, scoped to the selected HTTP/HTTPS ports, Private networks, and LocalSubnet.
  • Keep normal launches and Public-network policy unchanged; configuration failure/cancellation prevents startup.
  • Document scope, limitations, and rule removal.

Validation: all 39 Windows bootstrap/firewall tests pass; Ruff and Pyright pass. Native Windows PowerShell firewall helper dry-run passes. No live firewall rules were changed; the initial read-only inspection was incomplete due to access denial.

No-hardware experiment shutdown

  • Fix initial MAVLink status inheriting the generated SAFETY_ARMED flag despite zero received messages. Initial status now has an empty mode mask, so stopping a no-hardware experiment does not enter vehicle safe-off commands.
  • Add backend flag-initialization and frontend no-hardware shutdown regressions; preserve observed armed-state behavior.

Validation: 14 MAVLink tests and 25 experiment/motor UI tests pass; UI type-check/build and release executable build pass. End-to-end release-server + production CLI test saved a no-hardware experiment in 4.11 seconds, with a real mavlog.json and zero transmitted MAVLink messages. The workstation release executable has been rebuilt; the user's server was not restarted.

Default hostname HTTPS identity

  • Use the lowercase short OS computer name plus .local for wildcard-listener certificate SANs and camera/QR URLs, avoiding certificate regeneration on DHCP IP changes.
  • Preserve explicit IP listeners; validate DNS labels and surface hostname lookup errors.
  • Update launcher LAN links and document client .local resolution and one-time certificate replacement.

Validation: all 91 backend library tests and 10 focused Windows launcher tests pass; release executable rebuilt. A real request using OS .local resolution and curl with the generated certificate as its explicit trust anchor validated hostname and HTTPS successfully, without disabling certificate verification.

mcroomp and others added 6 commits November 18, 2026 12:25
Preserve unconfirmed motor state while releasing failed Bluetooth connections and allowing explicit recovery. Revoke browser lease ownership on disconnect and cover reconnect behavior with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preflight the exact serve arguments without opening connections, rebuild stale artifacts through setup.cmd, and fail explicitly if rebuilt arguments remain incompatible. Cover launcher recovery and align Windows integration test timeouts with their bounded subprocesses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Show the existing 0.0.0.0 bind in startup output, document LAN access and firewall requirements, and assert the launcher passes the all-interface listen address.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Request administrator approval only for the firewall helper, persist an application-scoped TCP rule for the selected HTTP/HTTPS ports on Private local-subnet networks, and stop startup on configuration failure. Cover opt-in argument forwarding and scoped rule creation/update without modifying the host firewall in tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use an empty mode mask before any heartbeat instead of the generated SAFETY_ARMED default, preventing no-hardware experiment stops from entering vehicle safe-off. Add backend and no-hardware shutdown regressions and document initial unknown state semantics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Derive a validated local DNS hostname from the OS computer name for wildcard listeners, keeping certificate identity stable across DHCP address changes. Use the same hostname for phone-camera URLs and QR codes while retaining explicit IP listeners. Add hostname-verified TLS and URL regressions, update launcher output, and document local-name resolution requirements.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mcroomp
mcroomp merged commit 79e56bb into main Nov 18, 2026
13 checks passed
@mcroomp
mcroomp deleted the fix/bluetooth-motor-disconnect-recovery branch November 18, 2026 17:58
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