Skip to content

Extract status, topic and category crud modules - #2597

Merged
akwasigroch merged 1 commit into
mainfrom
refactor/extract-status-topic-category-crud
Aug 25, 2026
Merged

Extract status, topic and category crud modules#2597
akwasigroch merged 1 commit into
mainfrom
refactor/extract-status-topic-category-crud

Conversation

@akwasigroch

Copy link
Copy Markdown
Collaborator

Purpose

app/crud/__init__.py is the crud monolith that apps/backend/AGENTS.md says should only shrink from here. This continues the incremental split started in #2588, #2590, #2591 and #2592, taking three of the small self-contained blocks out.

What Changed

  • New crud/status.py, crud/topic.py and crud/category.py, each holding the five CRUD functions for its entity, moved verbatim from crud/__init__.py.
  • 169 lines removed from crud/__init__.py. No re-exports left behind — the old names are gone from the monolith.
  • Callers switched to direct submodule imports (from rhesis.backend.app.crud import status as status_crud): routers/status.py, routers/topic.py, routers/category.py, and services/task_notification.py.
  • Patch target updated in tests/backend/security/test_organization_filtering.py.

This is a pure move: no logic, signature or behaviour changes.

Additional Context

  • services/task_notification.py was reached through a direct name import (from rhesis.backend.app.crud import get_status, get_type_lookup) rather than attribute access, so it does not show up in a crud.get_status grep. It keeps get_type_lookup on the monolith for now.
  • Two sibling PRs split other blocks of the same file in parallel. They touch different line ranges, but the one that lands second will need a trivial conflict resolution on the task_notification.py import line.

Testing

uv run pytest tests/backend/security/test_organization_filtering.py tests/backend/routes/test_status.py tests/backend/routes/test_topic.py tests/backend/routes/test_category.py → 138 passed, 6 skipped (pre-existing skips).

uv run pytest tests/backend/services/test_task_notification.py → 4 passed.

Ruff check and format on all touched files are at the pre-change baseline.

Continues the incremental split of the crud monolith. Status, Topic and
Category each move to their own module; callers switch to direct
submodule imports. Pure move -- no logic changes.
@akwasigroch
akwasigroch merged commit 04bf346 into main Aug 25, 2026
15 of 17 checks passed
@akwasigroch
akwasigroch deleted the refactor/extract-status-topic-category-crud branch August 25, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant