Skip to content

[AUDIT] [C3] EPIC — Reconcile hexagonal arch: remove PyQt/QGIS from core/ (52 files) #40

Description

@imagodata

Context

Audit 2026-04-23 found that core/ports/qgis_port.py exists as the intended abstraction boundary but is bypassed by 52 files in core/. 37+ services and 5 domain modules import qgis.PyQt or qgis.core directly — defeating the stated hexagonal design.

Representative violations:

Consequences

  • Unit tests against core/ must load PyQGIS (slow + fragile).
  • Swapping providers requires edits across the whole core tree.
  • QGIS4/PyQt6 migrations become multi-tree diffs instead of adapter-layer diffs.

Proposed sequencing (multi-sprint)

Phase 1 — Audit & Port

  • Enumerate every QGIS import site in core/ with categorization: task / service / domain.
  • Extend core/ports/ with missing abstractions (TaskPort, SignalPort, GeometryPort, etc.).

Phase 2 — Tasks

  • Move QgsTask subclassing to adapters, core exposes pure callables.

Phase 3 — Services

  • Replace pyqtSignal/QObject in services with a port-owned event bus.

Phase 4 — Domain

  • Strip all remaining QGIS imports from core/domain/.

Phase 5 — Lint

  • Add architectural linting (e.g. import-linter contract) that fails CI on qgis.* imports inside core/.

Priority

EPIC — multi-sprint. Pair with H3/H4 refactors; they are natural entry points since they already live in the boundary.

Acceptance

  • grep -r "from qgis" core/ returns 0 results.
  • Unit tests under tests/unit/core/ run without any QGIS import.
  • CI-level lint enforces the boundary.

Part of: [AUDIT] EPIC — Audit 2026-04-23 follow-ups

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureDécisions d'architectureepicEpic - groupe de user stories liées

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions