feat: USP WiFi settings, network diagnostics & codegen updates - #689
feat: USP WiFi settings, network diagnostics & codegen updates#689AustinChangLinksys wants to merge 2 commits into
Conversation
- WiFi settings: channel bonding service, network card UI improvements, quick setup model, preservable notifier dirty-check integration - Network diagnostics: YAML definition + codegen output - WiFi radios: added SupportedOperatingChannelBandwidths field - WAN operations: updated codegen output - Dashboard notifier: bridge port map fetch, firmware images - SSE operation awaiter & UspService: minor refinements - Test console: updated for new client API - Preservable notifier mixin: added generic save callback support - Added unit tests for WiFi settings service and channel bonding Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoWiFi channel bonding, network diagnostics codegen, and USP response simplification
WalkthroughsDescription• Add WiFi channel bonding service with IEEE 802.11 bonding rules for 2.4GHz/5GHz/6GHz bands • Integrate SupportedOperatingChannelBandwidths field into WiFi radio model and UI • Add network diagnostics YAML definition and generated code for ping/traceroute operations • Simplify USP Operate response to flat map instead of wrapper class • Enhance WiFi settings provider with auto-reset channel when bandwidth invalidates current selection • Add comprehensive unit tests for channel bonding (268 lines) and WiFi settings service (577 lines) Diagramflowchart LR
A["WiFi Radio Data<br/>PossibleChannels<br/>SupportedBandwidths"] -->|IEEE 802.11 Rules| B["Channel Bonding<br/>Utility"]
B -->|Compute Map| C["ChannelsPerBandwidth<br/>Auto/20MHz/40MHz/80MHz"]
C -->|Populate Model| D["WifiNetworkUIModel<br/>availableChannelsPerBandwidth"]
D -->|Filter Options| E["WiFi Network Card<br/>Channel Selector"]
F["Network Diagnostics<br/>YAML Definition"] -->|Codegen| G["NetworkDiagnostics<br/>Class"]
G -->|Ping/Traceroute| H["USP Service<br/>Operate Command"]
I["UspResponse Wrapper"] -->|Flatten| J["Map<String, dynamic><br/>commandKey + outputs"]
File Changes1. lib/generated/network_diagnostics.g.dart
|
Code Review by Qodo
1. Missing braces in ping()
|
| if (numberOfRepetitions != null) | ||
| inputs['NumberOfRepetitions'] = numberOfRepetitions; |
There was a problem hiding this comment.
1. Missing braces in ping() 📘 Rule violation ✓ Correctness
The generated NetworkDiagnostics.ping() uses an if statement without curly braces, which is likely to violate flutter_lints (e.g., curly_braces_in_flow_control_structures). This can cause flutter analyze to fail for the PR.
Agent Prompt
## Issue description
The generated file `lib/generated/network_diagnostics.g.dart` contains an `if` statement without curly braces, which is likely to fail `flutter analyze` under `flutter_lints`.
## Issue Context
This file is marked as auto-generated, so fixing the generator/template is preferable to manual edits (otherwise the issue will return on the next codegen run).
## Fix Focus Areas
- lib/generated/network_diagnostics.g.dart[15-20]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| /// IEEE 802.11 channel bonding rules for computing valid primary channels | ||
| /// per bandwidth. | ||
| /// | ||
| /// This is a pure utility with no Flutter or provider dependencies. | ||
| /// All group tables are IEEE 802.11 standard constants. | ||
|
|
There was a problem hiding this comment.
2. Feature code under lib/usp_page 📘 Rule violation ⛯ Reliability
New feature implementation files were added under lib/usp_page/... instead of the required feature organization under lib/page/[feature_name]/. This violates the repository feature structure requirement and makes navigation/ownership inconsistent with the documented layout.
Agent Prompt
## Issue description
New feature logic was added under `lib/usp_page/...`, but the compliance checklist requires new features to follow the documented structure under `lib/page/[feature_name]/` (with providers under `lib/providers/` and routes under `lib/route/`).
## Issue Context
This PR adds new feature behavior via a new bonding utility and associated model/provider changes; the placement should align with the repository’s documented organization (or the rule/docs need an explicit exception for `usp_page`).
## Fix Focus Areas
- lib/usp_page/wifi_settings/services/wifi_channel_bonding.dart[1-203]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| static Future<Map<String, dynamic>> renewDhcpLease(UspService client) async { | ||
| return await client.operate('Device.DHCPv4.Client.1.Renew()'); | ||
| } | ||
|
|
||
| /// Renew DHCPv6 WAN lease | ||
| static Future<void> renewDhcpv6Lease(UspService client) async { | ||
| await client.operate('Device.DHCPv6.Client.1.Renew()'); | ||
| static Future<Map<String, dynamic>> renewDhcpv6Lease( | ||
| UspService client) async { | ||
| return await client.operate('Device.DHCPv6.Client.1.Renew()'); | ||
| } |
There was a problem hiding this comment.
3. Renew return type mismatch 🐞 Bug ✓ Correctness
UspInternetSettingsService.renewDhcpLease() / renewDhcpv6Lease() are declared as Future<void> but directly return WanOperations.renewDhcpLease() / renewDhcpv6Lease(), which now return Future<Map<String,dynamic>>. This introduces a Dart static type error and will fail compilation for USP Internet Settings.
Agent Prompt
### Issue description
`WanOperations.renewDhcpLease()` and `renewDhcpv6Lease()` now return `Future<Map<String,dynamic>>`, but `UspInternetSettingsService.renewDhcpLease()` / `renewDhcpv6Lease()` still declare `Future<void>` and return the generated futures directly, which is a compile-time type error.
### Issue Context
Internet Settings UI/notifier code expects `Future<void>` semantics for renew operations.
### Fix Focus Areas
- lib/usp_page/internet_settings/services/usp_internet_settings_service.dart[89-93]
### Suggested change
Convert the wrappers to `async` and `await` the generated operations, ignoring the returned map:
```dart
Future<void> renewDhcpLease() async {
await WanOperations.renewDhcpLease(_usp);
}
Future<void> renewDhcpv6Lease() async {
await WanOperations.renewDhcpv6Lease(_usp);
}
```
(Alternatively, change wrapper + all callers to return/handle the `Map`.)
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Remove obsolete UspResponse import and use Map<String, dynamic> to match the current UspService.operate() signature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Close and re-create again with other changes |
Summary
PreservableNotifierMixinfor state preservation across provider rebuildsChanges
definitions/network/network_diagnostics.yaml— ping/traceroute operate definitionslib/usp_page/wifi_settings/services/wifi_channel_bonding.dart— band-aware channel width/DFS logiclib/usp_page/wifi_settings/models/wifi_network_ui_model.dart— UI model for WiFi networkswi_fi_radios.yaml— added subscribe blockwifi_channel_bonding_test.dart,usp_wifi_settings_service_test.dartTest plan
🤖 Generated with Claude Code