Fix WiFi setup flow leaving the board unreachable on failure - #108
Merged
Conversation
Two real gaps, per the issue: 1. wifi-connect never restored the hotspot AP if the station-mode connection failed (bad password, AP out of range, DHCP timeout) - the board was left in station mode with no working connection and no hotspot, unreachable until physical intervention. It now falls back to the Recore hotspot on any connection failure, live-tested against a nonexistent SSID. 2. The frontend polled the pre-switch origin for the outcome indefinitely. Once the board tears down its own hotspot to switch networks, that origin is gone for good regardless of outcome, so polling it can never observe a result. Bounded to a 15s window, after which the UI shows guidance to reconnect and continue at recore.local instead of spinning forever. Also added a persistent status line so the page shows what's actually happening at each step instead of relying on toast notifications alone. Both fixes required a global axios timeout (client/src/main.js): several other polling loops (WiFi status, transfer progress, ...) had no per-call timeout, and a request against a dead origin can hang completely silently with no error ever firing (confirmed live, same root cause as #95) - enough of those piling up at once starves the browser's small same-origin connection pool, so even a request with its own timeout can't get a socket to run on. A global default bounds every request that doesn't set its own. Also fixes a related first-boot race in expand-usb found while testing this: fdisk's own in-place partition table re-read can fail with "Device or resource busy" even though the write itself succeeded - the kernel picks up the new partition via udev shortly after regardless, so wait for the device node instead of trusting fdisk's exit code. Closes #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes #90
Test plan
go test ./...andbats test/bats(16 tests, including 2 new ones for the hotspot fallback) pass🤖 Generated with Claude Code