controller: address hotspot protocol review findings
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

- Reset a saved protocol the newly probed device does not support
  instead of offering it (both UIs); a successful probe is
  authoritative, the saved value is only kept when probing fails.
- Ignore out-of-order protocol probe responses when switching devices
  quickly (both UIs).
- Verify the WPA2 rollback after a failed WPA3 activation; report that
  the hotspot may be down instead of claiming the revert succeeded.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-28 20:59:10 -06:00
parent 8687816b84
commit 2baa9cbd2e
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
5 changed files with 67 additions and 12 deletions

View file

@ -730,6 +730,19 @@ class TestEnableHotspot:
modify_calls = [c[0][0] for c in calls if 'modify' in c[0][0]]
assert len(modify_calls) == 2 and "wpa-psk" in modify_calls[1]
def test_wpa3_failed_revert_is_reported(self):
"""If reverting to WPA2 also fails, the error must not claim the hotspot was reverted."""
ok = mock.Mock(returncode=0, stdout="", stderr="")
device_ready = mock.Mock(returncode=0, stdout="wlan0:disconnected\n", stderr="")
sae_failed = mock.Mock(returncode=1, stdout="", stderr="Error: SAE not supported")
revert_failed = mock.Mock(returncode=1, stdout="", stderr="Error: connection not found")
# radio, poll, hotspot, modify(sae) fails, revert modify fails.
result, _ = self._run_enable('wpa3', [ok, device_ready, ok, sae_failed, revert_failed])
assert result["success"] is False
assert "reverted" not in result["error"].lower()
assert "wpa3" in result["error"].lower()
def test_wpa2_modify_failure_still_succeeds(self):
"""A failure setting WPA2 explicitly is not fatal; nmcli already created a WPA2 hotspot."""
ok = mock.Mock(returncode=0, stdout="", stderr="")