Skip to content

refactor(arch): core/ and shared/ no longer import features/ (#1239) - #1258

Merged
ZhuchkaTriplesix merged 4 commits into
devfrom
issue/1239-core-reverse-imports
Oct 10, 2026
Merged

ZhuchkaTriplesix merged 4 commits into
devfrom
issue/1239-core-reverse-imports

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

lib/core/ imported lib/features/ in four places. Now git grep "package:querya_desktop/features/" lib/core lib/shared is empty, and a guard test keeps it that way.

  • MCP and the schema catalog read SQL through SqlQueryRunner (core/database/sql_query_runner.dart: execute, explain, dispose). SqlExecutionResult moves with it. SqlExecutionDelegate implements the interface and re-exports the file, so its users are unchanged. ErdCatalog, ErdSchema and ErdTableNames move to core/erd/, since the catalog only runs queries.
  • Feature hooks installed by the app. installAppWiring() (app/app_wiring.dart) sets three hooks in main(), QueryaApp and test/flutter_test_config.dart:
    • QueryaCommandRegistry.coreCommands builds the palette's built-in commands, which moved to app/querya_core_commands.dart.
    • ExtensionCommandSync.connectionPicker shows the ambiguous-target picker.
    • McpServerController.delegateFactory opens MCP's read-only sessions; createReadOnlyMcpDelegate moved to app/mcp_sql_delegates.dart.
  • The SDUI tree builder moves to features/connections/, where its only user, the connections panel, lives. The SDUI schema stays in core.
  • Guard and docs. test/guards/core_does_not_import_features_test.dart fails if anything in core/ or shared/ imports features/ or app/. docs/architecture.md lists the hooks.

No behaviour change is intended. Without installAppWiring(), the registry has no built-in commands, the extension picker returns null and MCP refuses calls with "MCP SQL sessions are not installed".

Closes #1239

Test plan

  • CI: analysis and all test sections pass (no local runs, per team rule)

…lQueryRunner

SqlQueryRunner (core/database) is the read side of a SQL session: execute,
explain, dispose; SqlExecutionResult moves with it. The workspace's
SqlExecutionDelegate implements it and re-exports the file, so its users
are unchanged.

ErdCatalog, ErdSchema and ErdTableNames move to core/erd: the catalog only
runs queries, and MCP needs it without depending on the SQL workspace.
core/ no longer imports the dialogs and SQL drivers it calls:
- the palette's built-in commands move to app/querya_core_commands.dart;
  QueryaCommandRegistry.coreCommands builds them
- ExtensionCommandSync.connectionPicker shows the ambiguous-target picker
- McpServerController.delegateFactory opens MCP's read-only sessions;
  createReadOnlyMcpDelegate moves to app/mcp_sql_delegates.dart

installAppWiring() (app/app_wiring.dart) sets them in main(), QueryaApp and
test/flutter_test_config.dart.
It builds connection tree rows, a connections widget, and the panel is its
only user; the SDUI schema stays in core.
… app/

docs/architecture.md describes the hooks app/app_wiring.dart installs.
@github-actions github-actions Bot added core Core library logic and services P2 Medium priority / Parity & Refactoring labels Oct 10, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit b834226 into dev Oct 10, 2026
15 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/1239-core-reverse-imports branch October 11, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core library logic and services P2 Medium priority / Parity & Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant