fix(wifi): show Disconnect on a connected saved network without a bound MAC#152
Merged
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
andrescera
force-pushed
the
fix/wifi-connect-button-and-reliability
branch
from
July 16, 2026 20:28
62bbc10 to
7a542f1
Compare
…nd MAC A saved WiFi profile was only recorded in an interface's `saved` map when its 802-11-wireless.mac-address matched a present adapter. Profiles created outside CeraUI (nmtui, `nmcli device wifi connect`, baked image profiles) have no bound MAC, and MAC-randomized/swapped adapters no longer match, so those profiles were dropped from `saved` entirely. The scan path still marked them active, so the UI resolved no UUID and offered "Connect" on the already-connected network. Register such profiles on every present adapter (mirroring the scan path where all interfaces see all networks); keep precise per-adapter attribution when the bound MAC matches. Extracted into the pure `registerSavedWifiConnection` helper.
andrescera
force-pushed
the
fix/wifi-connect-button-and-reliability
branch
from
July 16, 2026 21:03
7a542f1 to
a27d03b
Compare
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.
What
The currently-connected WiFi network showed a Connect button instead of Disconnect (confirmed on real hardware — SSID "SOMOS - 701": green checkmark, "Connected" status, yet a yellow "Connect" button).
Backend fix in
wifiUpdateSavedConns(apps/backend/src/modules/wifi/wifi.ts): register a saved WiFi profile in an interface'ssavedmap even when its802-11-wireless.mac-addressis unbound or no longer matches a present adapter. Extracted the keying step into the pure, unit-tested helperregisterSavedWifiConnection.Why
WifiNetworkList.svelteonly renders the Disconnect/Connect toggle inside{:else if uuid}; a falsyuuidfalls through to the "new/unsaved network" branch that always shows "Connect".getWifiUUID(frontend) is a faithful SSID→UUID lookup overiface.saved— it returnedundefinedbecause the backend had dropped the active network fromsaved.Root cause: a saved profile was added to
saved[ssid]only when its bound MAC matched a currently-present adapter. Profiles created outside CeraUI's own connect flow (nmtui,nmcli device wifi connect, baked image profiles) have no bound MAC, and MAC randomization / swapped adapters make a bound MAC stop matching — so those profiles were silently dropped. Meanwhile the scan path (wifiUpdateScanResult) marks every scanned SSIDactivefrom nmcli'sIN-USEcolumn with no MAC requirement. The asymmetry produced anactivenetwork that resolved no UUID.The fix keeps precise per-adapter attribution when the bound MAC matches (multi-adapter disambiguation unchanged), and otherwise registers the profile on every present adapter — mirroring the scan path where all interfaces already see all networks.
How to verify
apps/backend/src/tests/wifi-saved-connection.test.ts(new, 3 cases):saved[ssid]resolves the UUID (pre-fix this wasundefined— the exact bug; commented in the test);cd apps/backend && bun tsc --noEmit— clean.biome checkon the changed files — clean.bun test(wifi suites) —wifi-saved-connection+wifi-migration+wifi-mock-seam= 12 pass / 0 fail.Risks
Notes
Investigated the related "periodic MAC-randomize-then-scan cycling" report at the same time: it is stock NetworkManager background-scan behaviour (
wifi.scan-rand-mac-address), the ~35-min idle is NM autoconnect-retry policy, and there is no CeraUI boot-time station-connect code path (nmcli con upis only called from the explicitwifi.connectRPC and hotspot paths) — so the service-restart correlation was coincidental. No change made there; not a defect.