-
Notifications
You must be signed in to change notification settings - Fork 3
refactor(auto-parent): Extract AutoParentFirstLoginService from Notifier #565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Create AddNodesService with JNAP communication logic - setAutoOnboardingSettings(): Enable auto-onboarding - getAutoOnboardingSettings(): Fetch settings as bool - pollAutoOnboardingStatus(): Stream-based status polling - startAutoOnboarding(): Initiate onboarding process - pollForNodesOnline(): Poll for nodes coming online - pollNodesBackhaulInfo(): Poll backhaul info for nodes - collectChildNodeData(): Merge backhaul info into devices - Refactor AddNodesNotifier to delegate to service - Remove JNAP imports (actions, models, result, repository) - Add service getter for dependency injection - Simplify provider to orchestration and state management only - Add comprehensive test suites - AddNodesService tests (17 tests): JNAP calls, error mapping - AddNodesProvider tests (10 tests): Service delegation - AddNodesState tests (15 tests): copyWith, equality, serialization - AddNodesTestData builder for reusable mock responses Architecture compliance: Provider no longer imports JNAP models/result
- Create AddWiredNodesService for wired auto-onboarding JNAP communication - Add BackhaulInfoUIModel to replace BackHaulInfoData in State/Provider layers - Refactor AddWiredNodesNotifier to delegate all JNAP operations to service - Update AddWiredNodesState to use BackhaulInfoUIModel instead of JNAP model Service methods implemented: - setAutoOnboardingEnabled(bool): Enable/disable wired auto-onboarding - getAutoOnboardingEnabled(): Get current setting status - pollBackhaulChanges(snapshot): Stream of BackhaulPollResult for new node detection - fetchNodes(): Get list of LinksysDevice nodes Architecture compliance achieved: - AddWiredNodesNotifier no longer imports jnap/models, jnap/actions, jnap/result - AddWiredNodesState no longer imports jnap/models (uses BackhaulInfoUIModel) - All JNAP errors mapped to ServiceError in service layer Tests added: - BackhaulInfoUIModel: 10 tests (Equatable, toMap/fromMap, toJson/fromJson) - AddWiredNodesService: 14 tests (all public methods) - AddWiredNodesState: 9 tests (BackhaulInfoUIModel integration) - AddWiredNodesProvider: 12 tests (service delegation, error propagation)
- Create AutoParentFirstLoginService with JNAP communication logic: - setUserAcknowledgedAutoConfiguration(): await JNAP response (bug fix) - setFirmwareUpdatePolicy(): await SET operation (bug fix) - checkInternetConnection(): retry logic with ExponentialBackoffRetryStrategy - Refactor AutoParentFirstLoginNotifier to delegate to Service - Remove JNAP imports from Provider layer (architecture compliance) - Add comprehensive test coverage: - Service tests: 9 tests, 96.8% coverage - Provider tests: 8 tests, 100% coverage - State tests: 3 tests, 100% coverage - Add test data builder: AutoParentFirstLoginTestData - Add spec documentation and service contract
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||||||||
Summary
AutoParentFirstLoginServicewith JNAP communication logic:setUserAcknowledgedAutoConfiguration(): await JNAP response (bug fix)setFirmwareUpdatePolicy(): await SET operation (bug fix)checkInternetConnection(): retry logic with ExponentialBackoffRetryStrategyAutoParentFirstLoginNotifierto delegate to ServiceAutoParentFirstLoginTestDataArchitecture Compliance
Follows constitution.md:
mapJnapErrorToServiceError()Bug Fixes
Original code had missing
awaiton JNAP operations:setUserAcknowledgedAutoConfiguration()- now properly awaits responsesetFirmwareUpdatePolicy()SET operation - now properly awaits responseTest Plan
flutter test)flutter analyzepassesDependencies
This PR depends on #564 (
001-add-nodes-service)