-
Notifications
You must be signed in to change notification settings - Fork 3
refactor(pnp): Extract AutoConfigurationUIModel from JNAP layer #569
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
refactor(pnp): Extract AutoConfigurationUIModel from JNAP layer #569
Conversation
- Add AutoConfigurationUIModel and AutoConfigurationMethodUI enum to pnp_ui_models.dart - Update PnpService.autoConfigurationCheck() to return UI model instead of JNAP model - Add _convertToUIModel() and _convertMethod() conversion helpers in PnpService - Remove JNAP AutoConfigurationSettings import from Provider layer files - Update BasePnpNotifier and PnpNotifier to use AutoConfigurationUIModel - Update all mock PnP providers to use UI model - Update router_provider.dart to use UI model field names - Update demo_overrides.dart to use UI model This change enforces architectural layer separation by ensuring Provider layer does not depend on JNAP data models directly.
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:
|
||||||||||||||||
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
- Update MockPnpNotifier.autoConfigurationCheck() return type to Future<AutoConfigurationUIModel?> - Update MockPnpService.autoConfigurationCheck() return type to Future<AutoConfigurationUIModel?> - Update FakePnpNotifier.autoConfigurationCheck() return type in pnp_setup_view_test.dart - Remove unused AutoConfigurationSettings import from pnp_service_mocks.dart - Update imports to use pnp_ui_models.dart instead of auto_configuration_settings.dart
AustinChangLinksys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I confirmed that:
- Decoupling is achieved:
RouterProvidernow depends onAutoConfigurationUIModelinstead of the raw JNAP model, which is a solid improvement. - Architecture Alignment: While
PnpServicereturning a UI model might look like a layering violation in strict Clean Architecture, it aligns with our project's design decision where the Service layer handles Domain-to-Presentation mapping. - Tests: Mocks and tests have been correctly updated to match the modified Service signature.
Approved.
User description
Summary
AutoConfigurationUIModelandAutoConfigurationMethodUIenum inpnp_ui_models.dartto abstract JNAP data models from the Provider layerpnp_service.dart(_convertToUIModel,_convertMethod)pnp_provider.dartto returnAutoConfigurationUIModelinstead of JNAPAutoConfigurationSettingsmock_pnp_providers.dartto use new UI model with updated field namesrouter_provider.dartto use new UI model field names (isSupported,userAcknowledged,method)demo_overrides.dartto use new UI modelThis refactoring ensures compliance with the three-layer architecture defined in Constitution Article V Section 5.3, preventing JNAP Data Models from leaking into the Provider layer.
PR Type
Enhancement
Description
Extract auto-configuration UI model from JNAP layer
Create
AutoConfigurationUIModelandAutoConfigurationMethodUIenumAdd conversion methods in
PnpServicefor JNAP to UI modelUpdate all providers and services to use new UI model
Replace JNAP model imports with UI model imports across codebase
Diagram Walkthrough
File Walkthrough
pnp_ui_models.dart
Add AutoConfigurationUIModel and method enumlib/page/instant_setup/models/pnp_ui_models.dart
AutoConfigurationMethodUIenum withpreConfiguredandautoParentvalues
AutoConfigurationUIModelclass withisSupported,userAcknowledged, andmethodfieldscopyWith(),toMap(),fromMap(),toJson(), andfromJson()methods
layer
pnp_service.dart
Add JNAP to UI model conversion logiclib/page/instant_setup/services/pnp_service.dart
autoConfigurationCheck()return type toAutoConfigurationUIModel?_convertToUIModel()method to convert JNAP model to UI model_convertMethod()helper to map JNAP method enum to UI methodenum
pnp_provider.dart
Update provider to use UI modellib/page/instant_setup/providers/pnp_provider.dart
AutoConfigurationSettingsto UIAutoConfigurationUIModelBasePnpNotifier.autoConfigurationCheck()return type toAutoConfigurationUIModel?PnpNotifier.autoConfigurationCheck()return type toAutoConfigurationUIModel?mock_pnp_providers.dart
Update mock providers with UI modellib/page/instant_setup/providers/mock_pnp_providers.dart
AutoConfigurationSettingsimportAutoConfigurationUIModelisAutoConfigurationSupported→isSupported,userAcknowledgedAutoConfiguration→userAcknowledged,autoConfigurationMethod→methodAutoConfigurationMethodenum references toAutoConfigurationMethodUIrouter_provider.dart
Update router provider field referenceslib/route/router_provider.dart
AutoConfigurationSettingsto UIAutoConfigurationUIModelisAutoConfigurationSupported→isSupported,userAcknowledgedAutoConfiguration→userAcknowledged,autoConfigurationMethod→methodAutoConfigurationMethod.autoParenttoAutoConfigurationMethodUI.autoParentdemo_overrides.dart
Update demo overrides with UI modellib/demo/providers/demo_overrides.dart
AutoConfigurationSettingsto UIAutoConfigurationUIModel_DemoPnpNotifier.autoConfigurationCheck()return type toAutoConfigurationUIModel?isSupportedinstead ofisAutoConfigurationSupported