Skip to content

refactor(core): eliminate inverted core-to-feature imports and extract SSL and connection models to core #644

Description

@ZhuchkaTriplesix

Motivation & Problem

During the architectural audit, several layer boundary violations and circular imports were identified:

  1. Core-to-Feature Inverted Imports:
    • lib/core/database/mysql_connection.dart, lib/core/database/mongodb_connection.dart, and lib/core/database/redis_connection.dart import package:querya_desktop/features/connections/ssl_certificate_support.dart. Low-level database drivers should not depend on feature packages.
    • lib/core/extensions/extension_driver_catalog.dart imports package:querya_desktop/features/connections/connection_type_choice.dart and package:querya_desktop/features/connections/new_connection_dialog.dart.
  2. Circular Feature Imports:
    • new_connection_dialog.dart imports connection_type_choice.dart, while connection_type_choice.dart imports new_connection_dialog.dart because enum ConnectionType is defined in the dialog file.

Proposed Scope

  1. Extract SSL Support to Core:
    • Move lib/features/connections/ssl_certificate_support.dart to lib/core/security/ssl_certificate_support.dart.
    • Update imports in mysql_connection.dart, mongodb_connection.dart, redis_connection.dart, redis_connection_form.dart, and mongodb_connection_form.dart.
  2. Extract Connection Models to Core:
    • Move enum ConnectionType and ConnectionTypeChoice models from features/connections/ to lib/core/database/connection_type.dart and lib/core/database/connection_type_choice.dart.
    • Update ExtensionDriverCatalog and new_connection_dialog.dart to import from lib/core/database/.
    • Eliminate circular imports between connection dialog and choice models.
  3. Verify that zero files in lib/core/ import from lib/features/.

Acceptance Criteria

  • Zero imports of package:querya_desktop/features/ exist inside lib/core/.
  • No circular imports exist between new_connection_dialog.dart and connection choice models.
  • All existing tests and static analysis pass (flutter analyze).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfrontendTheme parser epic label: frontendstabilityTheme parser epic label: stability

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions