Skip to content

[Refactor]: Consolidate ingestion routes under features/ingestion/api/ #481

Open

Description

@tomvothecoder

Is your feature request related to a problem?

Ingestion routes are split across two locations:

  • backend/app/features/ingestion/api.py: /ingestions (from-path, from-upload, from-hpc-upload, archive-checkpoints, discovery-results, state).
  • backend/app/api/: five more routers with /ingestions prefixes and the Ingestions tag:
    • ingestion_summary.py
    • job_health.py (/ingestions/jobs)
    • rejected_executions.py
    • source_directories.py
    • metadata_backfill.py (/ingestions/metadata-backfill)

The modules in app/api/ import private helpers from features/ingestion/api.py, so the split already crosses module boundaries.

The convention is also contradictory. AGENTS.md says "New endpoints go in backend/app/api/" and "API routes in backend/app/api/", but every feature (catalog, ingestion, machine, user, and others) owns its routes in features/*/api.py.

Blocked by #306, which adds public features/ingestion/access.py helpers.

Describe the solution you'd like

  1. Decide on the convention and update AGENTS.md. Recommended: feature routes live in features/<feature>/api/, and app/api/ keeps only cross-cutting routes (health.py, meta.py, version.py).
  2. Move the five ingestion routers into features/ingestion/api/ (for example, summary.py, job_health.py, rejected_executions.py, source_directories.py, metadata_backfill.py) and update main.py registration.
  3. Move the related tests to match.

Acceptance criteria

  • AGENTS.md states one route-placement convention, and it matches the code.
  • No /ingestions/* router is defined under backend/app/api/.
  • /openapi.json is identical before and after: same paths, methods, tags, and schemas.
  • make backend-test and make pre-commit-run pass.

Describe alternatives you've considered

  • Keep routes in app/api/ and move feature routes there. This conflicts with the feature-based architecture and would touch every feature.
  • Leave the routes as is and only fix AGENTS.md. This documents the inconsistency instead of fixing it.
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

    refactorRefactor existing code

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions