[Debt] Split large campaign router into focused route modules #52

Closed
opened 2026-07-11 11:39:44 +02:00 by zemion · 3 comments
Owner

govoplan-campaign has a large backend router covering campaign CRUD, versions, recipient import profiles, jobs, review/send, reports, shares, and execution actions. This increases regression risk and makes route ownership harder to reason about.

Hotspot: src/govoplan_campaign/backend/router.py is close to 3,000 lines.

Acceptance: split routes by workflow area while preserving API paths, move shared query/response helpers into focused service modules, and add smoke tests for route registration/key endpoints.

`govoplan-campaign` has a large backend router covering campaign CRUD, versions, recipient import profiles, jobs, review/send, reports, shares, and execution actions. This increases regression risk and makes route ownership harder to reason about. Hotspot: `src/govoplan_campaign/backend/router.py` is close to 3,000 lines. Acceptance: split routes by workflow area while preserving API paths, move shared query/response helpers into focused service modules, and add smoke tests for route registration/key endpoints. <!-- codex-audit-2026-07-11:campaign-router-split -->
Author
Owner

Codex State: progress

The audit still identifies route-level orchestration in _campaign_jobs_page_response, build_campaign_version, update_campaign_version, and fork_campaign_version_for_edit. Keep this issue open for the route ownership split. Delivery/report decision complexity outside the router is tracked separately in the new audit debt issue.

## Codex State: progress The audit still identifies route-level orchestration in `_campaign_jobs_page_response`, `build_campaign_version`, `update_campaign_version`, and `fork_campaign_version_for_edit`. Keep this issue open for the route ownership split. Delivery/report decision complexity outside the router is tracked separately in the new audit debt issue.
zemion added the area/apicodex/readymodule/campaign
priority
p2
status
ready
type
debt
labels 2026-07-29 14:15:08 +02:00
Author
Owner

Codex State: reviewed

Reviewed against published main (5240749). This remains open: backend/router.py is 4,312 lines and campaign CRUD/version/jobs/review/report/share responsibilities are not yet physically split into focused route modules.

## Codex State: reviewed Reviewed against published `main` (`5240749`). This remains open: `backend/router.py` is 4,312 lines and campaign CRUD/version/jobs/review/report/share responsibilities are not yet physically split into focused route modules.
Author
Owner

Codex State: complete

Implemented and published in 2199187.

  • Replaced the 4,394-line catch-all router with focused campaign/workspace, version, job, report, sharing, delivery, and attachment route modules.
  • Moved shared ACL/version response behavior into route_support.py and job filtering/pagination/response assembly into services/job_queries.py.
  • Preserved all 62 baseline method/path operations with no additions, omissions, or duplicates.
  • Added focused route-composition and ownership regression tests.
  • Verified with Ruff and the full campaign suite: 264 tests plus 16 subtests passed.
## Codex State: complete Implemented and published in `2199187`. - Replaced the 4,394-line catch-all router with focused campaign/workspace, version, job, report, sharing, delivery, and attachment route modules. - Moved shared ACL/version response behavior into `route_support.py` and job filtering/pagination/response assembly into `services/job_queries.py`. - Preserved all 62 baseline method/path operations with no additions, omissions, or duplicates. - Added focused route-composition and ownership regression tests. - Verified with Ruff and the full campaign suite: 264 tests plus 16 subtests passed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GovOPlaN/govoplan-campaign#52