Skip to content

refactor(arch): eliminate reverse imports from lib/core into lib/features #1239

Closed

Description

@ZhuchkaTriplesix

Problem

docs/architecture.md specifies a strict layering rule:

The dependency direction is features → core/shared, never the reverse.
core/ and shared/ must not import from features/.

Currently, lib/core/ contains several reverse dependencies into lib/features/:

  1. Commands & Dialogs:
    lib/core/actions/querya_core_commands.dart imports dialogs from features:

    • features/connections/connection_creation_flow.dart
    • features/connections/team_profile_actions.dart
    • features/extensions/presentation/pages/extension_manager_dialog.dart
    • features/help/about_dialog.dart
    • features/onboarding/welcome_tour_dialog.dart
    • features/settings/preferences_dialog.dart
    • features/updater/update_dialog.dart
  2. Extensions Command Sync:
    lib/core/extensions/extension_command_sync.dart imports:

    • features/extensions/extension_connection_picker_dialog.dart
  3. MCP Query Service & Delegates:
    lib/core/mcp/mcp_query_service.dart and lib/core/mcp/mcp_sql_delegates.dart import:

    • features/erd/erd_catalog.dart
    • features/erd/erd_model.dart
    • features/workspace/sql_execution_delegate.dart
    • features/mysql/mysql_sql_workspace.dart
    • features/postgresql/postgres_sql_workspace.dart
    • features/sqlite/sqlite_sql_workspace.dart
  4. SDUI Tree Builder:
    lib/core/sdui/sdui_tree_builder.dart imports:

    • features/connections/querya_connection_tree_row.dart

Scope

  • Move top-level app action/command wiring (querya_core_commands.dart) to lib/app/ or introduce an action registration pattern where features register their own command handlers.
  • Decouple MCP SQL execution delegates and ERD catalog models so that MCP in core/ does not depend on UI workspace classes.
  • Move querya_connection_tree_row.dart model or interface to core/ or shared/ if needed by SDUI.
  • Add an architectural check (or test) ensuring no features/ imports exist in lib/core/ and lib/shared/.

Acceptance

  • git grep "import 'package:querya_desktop/features/" lib/core/ lib/shared/ returns 0 results.
  • Existing functionality and tests remain green.

Activity

  1. added
    coreCore library logic and services
    P2Medium priority / Parity & Refactoring
    on Oct 9, 2026
  2. added a commit that references this issue on Oct 10, 2026
  3. ZhuchkaTriplesix commented on Oct 10, 2026

    @ZhuchkaTriplesix
    MemberAuthor

    Resolved and merged in PR #1258.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium priority / Parity & RefactoringcoreCore library logic and services

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions