Extract test result CRUD out of the crud/__init__.py monolith - #2588
Merged
Conversation
This was referenced Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Next step in the incremental split of the
crudmonolith, continuing the series from #2410 through #2458.crud/__init__.pyonly shrinks from here, per the crud-layout rule inapps/backend/AGENTS.md.Test Result was picked deliberately over the larger remaining blocks. Every branch currently in flight that touches
crud/__init__.py— #2446 plus the local metric-tuning branches — modifies the same three spots: the import block,get_test_sets, andget_tests. Extracting TestSet or Test next would land right on top of them. Test Result sits below all three, needs no change to the import block, and has no cross-references from anywhere else in the module, so it lifts out cleanly.git merge-treeagainst #2446's branch reports no conflicts.What Changed
app/crud/test_result.pyholdingget_test_result,get_test_results,create_test_result,update_test_result,delete_test_result, and the_TEST_RESULT_RELATED_FIELDSeager-load tuple. Bodies moved verbatim; no behaviour change.crud/__init__.pydrops the 76-line Test Result section (1412 → 1336 lines). Its import block is untouched, so the line the in-flight branches add there stays clean.from rhesis.backend.app.crud import test_result as test_result_crud:routers/test_result.py(10 sites),tasks/execution/executors/results.py(2),tasks/execution/executors/output_providers.py(1),services/test_run.py(1).cruddropped from the top-level import in the three files where every use of it was a test-result call.services/test_run.pykeeps it — it still reaches for test, prompt and test_configuration.patch()targets retargeted from...crud.get_test_resultto...test_result_crud.get_test_result, 4 direct calls updated, and 2 now-unusedcrudimports removed.Additional Context
get_session_variablesalong), Tool, Architect session/message. TestSet and Test should wait until the metric-tuning work has landed.Testing
cd apps/backend uv sync --extra all --extra ee uv run pytest ../../tests/backend/tasks/ ../../tests/backend/crud/ ../../tests/backend/routes/ ../../tests/backend/auth/ ../../tests/backend/services/ ../../tests/backend/security/ ../../tests/backend/metrics/4520 passed, 42 skipped, 1 xfailed locally — that covers every test that touches test results, including the retargeted mock patches, which would fail loudly with
AttributeErrorif a patch target had gone stale. Ruff check and format are clean on all touched files.