fix(network): reject WiFi reconfiguration over a WiFi/TCP transport (closes #352) - #376
fix(network): reject WiFi reconfiguration over a WiFi/TCP transport (closes #352)#376tylerkron wants to merge 2 commits into
Conversation
…loses #352) UpdateNetworkConfigurationAsync applies the LAN settings with SYSTem:COMMunicate:LAN:APPLY (and later re-enables the interface), which restarts the WiFi module. Over a WiFi/TCP control connection that restart tears down the very channel carrying the command stream before the trailing SYSTem:COMMunicate:LAN:SAVE can be delivered, leaving the device with the new settings applied-but-not-persisted (lost on the next power cycle) or the tail of the sequence undelivered. Gate the operation to USB up front: throw the new typed NetworkReconfigurationRequiresUsbException before any command is dispatched so nothing is half-applied, and the caller is told to reconfigure over USB. Over USB (where a WiFi-module restart cannot drop the control connection) the full sequence runs unchanged. The exception derives from InvalidOperationException so existing broad handlers still catch it while callers can special-case the USB requirement. Replaced the now-obsolete _OverWifi_StillReEnablesLan regression (which asserted the old proceed-over-WiFi behavior) with tests covering the WiFi reject path and the unchanged USB path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
/agentic_review |
PR Summary by QodoFix network reconfiguration by requiring USB transport (avoid WiFi/TCP drop)
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
… the USB path The numbered step sequence started with 'Stops any active streaming', but the USB-only guard throws NetworkReconfigurationRequiresUsbException before that step. Reorder the remarks so the transport-check note comes first and the step list is explicitly scoped to 'once the USB precondition is met', making clear that over a non-USB transport the method throws before stopping streaming or dispatching any command. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 13edece |
|
Closing as superseded by #391, which fixes #352 by reordering two commands instead of gating reconfiguration to USB. The problem this PR identified is real — a save that can be lost to the WiFi module restart leaves the device applied-but-not-persisted. What's changed is that the firmware semantic this PR treated as unverified has now been checked, and it doesn't support the USB-only conclusion. The premise. This PR treats the dropped control connection as the defect to prevent. But moving a device onto a different network necessarily kills the connection carrying the command stream — that's the operation succeeding, not a race. Gating to USB doesn't avoid the drop; it just makes the workflow (switching hotspots in the field, no cable to hand) unreachable. The narrower defect is that Core saved last, so the save was what got lost. Firmware. Bench, on an Nq1 (WINC1500 fw 19.7.7):
So the reorder is: Worth noting #391 keeps One incidental finding for anyone testing |
Summary
UpdateNetworkConfigurationAsyncapplies LAN settings withSYSTem:COMMunicate:LAN:APPLY(and later re-enables the interface), which restarts the WiFi module. Over a WiFi/TCP control connection that restart tears down the very channel carrying the command stream before the trailingSYSTem:COMMunicate:LAN:SAVEis delivered — leaving the device with the new config applied-but-not-persisted (lost on the next power cycle), or the tail of the sequence undelivered. (Follow-up from #347, Qodo thread atDaqifiStreamingDevice.cs.)This was latent:
UpdateNetworkConfigurationAsyncis a publicINetworkConfigurablemethod with no production callers today.Approach — Option B from #352 (gate to USB)
Rather than the persist-first reorder (Option A), which depends on unverified firmware semantics for persisting applied-but-not-yet-enabled settings and still leaves the first
APPLYrestart racing theSAVEover the same link, this rejects reconfiguration over WiFi/TCP up front:NetworkReconfigurationRequiresUsbException(derives fromInvalidOperationException, so existing broad handlers keep working while callers can special-case the "reconnect over USB" guidance).This inverts the deliberate "reconfig re-enables LAN even over WiFi" decision from #347; the obsolete
_OverWifi_StillReEnablesLanregression test is replaced with tests for the new reject path and the unchanged USB path.Tests
UpdateNetworkConfigurationAsync_OverWifi_ThrowsRequiresUsbAndSendsNothing— WiFi transport throws and emits zero commands.UpdateNetworkConfigurationAsync_OverUsb_DoesNotThrowRequiresUsb— USB transport still sendsAPPLY/SAVE.Bench
Not bench-validated: the method rewrites the device's WiFi SSID/password and restarts the module (disruptive), and the guard only affects the WiFi-transport path — fully covered by unit tests over a USB bench.
Not merging — opened for your review.