Skip to content

Extract experiment crud module - #2601

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

Extract experiment crud module#2601
akwasigroch merged 1 commit into
mainfrom
refactor/extract-experiment-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 (#2588, #2590, #2591, #2592, #2597, #2599, #2600), taking out the smallest remaining block.

What Changed

  • New crud/experiment.py with get_experiments, moved verbatim from crud/__init__.py, importing only what it needs.
  • 23 lines removed from crud/__init__.py. No re-export left behind — the old name is gone from the monolith.
  • routers/experiments.py switched to from rhesis.backend.app.crud import experiment as experiment_crud. It keeps its from rhesis.backend.app import crud import because line 231 still uses crud.delete_item.

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

Additional Context

  • Unlike the Endpoint and TestSet blocks, this one has no _*_RELATED_FIELDS constant — the include(...) calls are inline in the query, so nothing else moved with it.
  • A repo-wide grep for get_experiments found exactly two hits: the definition and the single router call. No direct-name imports, no function-local imports, and no mock.patch string targets pointing at it.
  • After this and the sibling endpoint PR, what remains in the monolith is TestSet and Test, which have to move together — get_test_sets_for_test, get_test_set_tests, resolve_test_set and bulk_delete_tests straddle both entities.

Testing

Full backend suite from apps/backend: uv run pytest ../../tests/backend/7802 passed, 62 skipped, 1 xfailed in 5m23s.

Targeted: tests/backend/routes/test_experiments.py → 63 passed; tests/backend/services/test_experiment_service.py → 7 passed.

Ruff check and format clean on all three touched files.

Continues the incremental split of the crud monolith. Experiment moves to
its own module; the router switches to a direct submodule import. Pure
move -- no logic changes.
@akwasigroch
akwasigroch merged commit b2b04f6 into main Aug 25, 2026
15 of 17 checks passed
@akwasigroch
akwasigroch deleted the refactor/extract-experiment-crud branch August 25, 2026 15:30
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