1.2 KiB
1.2 KiB
The user wants to refactor a backend project following DRY and KISS, keeping it developer-readable without hidden abstractions.
The user explicitly rejected a plan that did "in-place cleanup" of cpv3/modules/tasks/service.py and instead wants a different approach.
Currently, tasks/service.py is a 1600+ line monolith that:
- Defines Dramatiq actors
- Orchestrates job creation and duplication-checks
- Has
submit_Xmethods (e.g.submit_media_probe,submit_transcription_generate) - Has a giant
record_webhook_eventthat updates theJobstate - Contains domain-specific artifact saving (e.g.
_save_transcription_artifacts,_save_convert_artifacts) - Handles cancellation logic.
Constraints:
- Must use the exact module structure:
models.py,schemas.py,repository.py,service.py,router.py(no subdirectories within modules). - Explicit, local helpers over hidden abstractions (no generic handler registries).
What is the best architectural approach to distribute these responsibilities across jobs, tasks, and domain modules (media, transcription, captions)?
Provide a concrete file-by-file blueprint on where each responsibility belongs and how the cross-module calls would look like, avoiding circular dependencies.