Skip to content

CODE_SMELL: Import boundary violation in pipeline.py #120

Description

@Finfinder

Description

The file app/modules/pipeline.py (lines 29-34) violates the project's import boundaries defined in pyproject.toml and enforced by import-linter. The pipeline module imports directly from other domain modules instead of communicating through core/models.py as required by the architecture.

This is a should-fix code smell that undermines the modular architecture and makes the dependency graph harder to reason about.

Current State

  • app/modules/pipeline.py lines 29-34 import from other domain modules directly
  • The project's import-linter contracts (defined in pyproject.toml) enforce that domain modules MUST NOT import from each other
  • core/ MUST NOT import from modules/
  • api/ may import from core/ and modules/
  • These violations may currently be silent (import-linter not running in CI) or ignored

Acceptance Criteria

  • Remove direct imports from other domain modules in pipeline.py
  • Refactor to communicate through core/models.py Pydantic models only
  • Ensure import-linter passes with zero violations (lint-imports command)
  • Add import-linter check to CI pipeline if not already present
  • All existing tests pass after refactoring

References

  • Code smell: import boundary violation in pipeline.py:29-34
  • Architecture rules: backend/.github/instructions/python-backend.instructions.md

Additional Context

The import boundary rules exist to keep domain modules independent. If the pipeline needs data from other modules, it should receive that data as parameters (Pydantic models from core/models.py) rather than importing the modules directly. This refactoring may require changing the pipeline's function signatures to accept pre-fetched data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend API, domain module, or data-processing topic.technical-debtRefactoring, cleanup, or maintenance debt.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions