Repository navigation
Conversation
Remove the /fine_tuning and /model_evaluation endpoints, the core/finetune preprocessing and evaluator, their CRUD, models, docs, test fixtures and tests, and the Project relationship. Model evaluation only scored fine-tuned models, so it goes with fine-tuning. Migration 097 drops model_evaluation and fine_tuning with their enum types; the downgrade recreates both empty tables as they stood at 096.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Beyond the inline finding, I also looked for leftover references to the removed fine-tuning and model-evaluation code. Outside the alembic migrations, backend/app no longer mentions those modules, models, CRUD, routes or Celery tasks, so I don't expect import or startup errors from the removal.
Extended reasoning...
I searched backend/app (excluding alembic) for fine_tuning, finetune, model_evaluation and the related class names, and nothing matched. The one finding, about old tasks breaking during the migration rollout, is already posted inline.
| def upgrade(): | ||
| op.drop_table("model_evaluation") | ||
| op.drop_table("fine_tuning") | ||
| op.execute("DROP TYPE IF EXISTS modelevaluationstatus") | ||
| op.execute("DROP TYPE IF EXISTS finetuningstatus") |
There was a problem hiding this comment.
🟡 (optional) Admins who hard-delete a project or organization during a release rollout get a 500 with "relation fine_tuning does not exist". Migration 097 drops the tables before the ECS rollout replaces the old tasks. Those old tasks still map Project.fine_tuning with cascade_delete=True, so session.delete(project) first SELECTs from fine_tuning. Fix: remove the code in one release and drop the tables in a later one, so no running version still maps them. One way is to merge this change without 097 and add the drop migration afterwards.
Why this was flagged
In .github/workflows/create-release.yml, the "Run database migrations" step runs alembic upgrade head and waits for it to finish. Only then does "Deploy backend service" start the rollout, which has a 15-minute timeout, so old tasks keep serving traffic in that window. On base, backend/app/models/project.py maps fine_tuning: list["FineTuning"] = Relationship(back_populates="project", cascade_delete=True) without passive_deletes. So hard_delete_project (crud/project.py, session.delete(project)) loads that collection, and hard_delete_organization does the same through Organization.project (cascade_delete=True). Once 097 upgrade() has dropped fine_tuning, that load raises ProgrammingError UndefinedTable on old tasks. DELETE requests through api/routes/project.py:253 and api/routes/organization.py:166 then return 500, and the delete is rolled back. The FK ondelete="CASCADE" at the database level does not help, because the ORM issues the SELECT before any DELETE. Before this PR the tables exist, so these deletes work.
Verification: Trigger: an admin hard-deletes a project or organization while old backend tasks are still serving, after migration 097 has run. Old tasks stay in service until the new ones are healthy. In the base crud/project.py (lines 180-181), hard_delete_project calls session.delete(project). The ORM cascade SELECTs from fine_tuning, which migration 097 has dropped, so the request returns a 500.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
OpenAPI changes 🔴 18 breaking changesCaution Downstream consumers may need an update before merging. Breaking changes ·
|
| Method | Path | Change | |
|---|---|---|---|
| 🔴 | GET |
/api/v1/documents/transformation |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/documents/transformation/{job_id} |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/fine_tuning/fine_tune |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/fine_tuning/{document_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/fine_tuning/{fine_tuning_id}/refresh |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/model_evaluation/evaluate_models |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/model_evaluation/{document_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/model_evaluation/{document_id}/top_model |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/ancestor/{ancestor_response_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/response/{response_id} |
API path removed without deprecation |
| 🔴 | DELETE |
/api/v1/openai-conversation/{conversation_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/{conversation_id} |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/responses |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/responses/sync |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/documents |
removed the request property callback_url |
| 🔴 | POST |
/api/v1/documents |
removed the request property target_format |
| 🔴 | POST |
/api/v1/documents |
removed the request property transformer |
Full changelog · 45
| Method | Path | Change | |
|---|---|---|---|
| 🔴 | GET |
/api/v1/documents/transformation |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/documents/transformation/{job_id} |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/fine_tuning/fine_tune |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/fine_tuning/{document_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/fine_tuning/{fine_tuning_id}/refresh |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/model_evaluation/evaluate_models |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/model_evaluation/{document_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/model_evaluation/{document_id}/top_model |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/ancestor/{ancestor_response_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/response/{response_id} |
API path removed without deprecation |
| 🔴 | DELETE |
/api/v1/openai-conversation/{conversation_id} |
API path removed without deprecation |
| 🔴 | GET |
/api/v1/openai-conversation/{conversation_id} |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/responses |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/responses/sync |
API path removed without deprecation |
| 🔴 | POST |
/api/v1/documents |
removed the request property callback_url |
| 🔴 | POST |
/api/v1/documents |
removed the request property target_format |
| 🔴 | POST |
/api/v1/documents |
removed the request property transformer |
| 🟢 | — |
— |
removed the schema APIResponse_CallbackResponse_ |
| 🟢 | — |
— |
removed the schema APIResponse_DocTransformationJobPublic_-Input |
| 🟢 | — |
— |
removed the schema APIResponse_DocTransformationJobPublic_-Output |
| 🟢 | — |
— |
removed the schema APIResponse_DocTransformationJobsPublic_ |
| 🟢 | — |
— |
removed the schema APIResponse_FineTuningJobPublic_ |
| 🟢 | — |
— |
removed the schema APIResponse_ModelEvaluationPublic_ |
| 🟢 | — |
— |
removed the schema APIResponse_OpenAIConversationPublic_ |
| 🟢 | — |
— |
removed the schema APIResponse_ResponseJobStatus_ |
| 🟢 | — |
— |
removed the schema APIResponse_list_FineTuningJobPublic__ |
| 🟢 | — |
— |
removed the schema APIResponse_list_ModelEvaluationPublic__ |
| 🟢 | — |
— |
removed the schema APIResponse_list_OpenAIConversationPublic__ |
| 🟢 | — |
— |
removed the schema Body_Fine_Tuning-fine_tune_from_CSV |
| 🟢 | — |
— |
removed the schema CallbackResponse |
| 🟢 | — |
— |
removed the schema Diagnostics |
| 🟢 | — |
— |
removed the schema DocTransformationJobPublic |
| 🟢 | — |
— |
removed the schema DocTransformationJobsPublic |
| 🟢 | — |
— |
removed the schema FineTuningJobPublic |
| 🟢 | — |
— |
removed the schema ModelEvaluationCreate |
| 🟢 | — |
— |
removed the schema ModelEvaluationPublic |
| 🟢 | — |
— |
removed the schema ModelEvaluationStatus |
| 🟢 | — |
— |
removed the schema OpenAIConversationPublic |
| 🟢 | — |
— |
removed the schema ResponseJobStatus |
| 🟢 | — |
— |
removed the schema ResponsesAPIRequest |
| 🟢 | — |
— |
removed the schema ResponsesSyncAPIRequest |
| 🟢 | — |
— |
removed the schema TransformationJobInfo |
| 🟢 | — |
— |
removed the schema TransformationStatus |
| 🟢 | POST |
/api/v1/documents |
removed the optional property data/anyOf[subschema #1: DocumentUploadResponse]/transformation_job from the response with the 200 status |
main ↔ 9219c9e8 · generated by oasdiff
Issue
Closes #1382
What Changed
POST /fine_tuning/fine_tune,GET /fine_tuning/{fine_tuning_id}/refresh,GET /fine_tuning/{document_id},POST /model_evaluation/evaluate_models,GET /model_evaluation/{document_id}/top_modelandGET /model_evaluation/{document_id}.097, which drops themodel_evaluationandfine_tuningtables and themodelevaluationstatus/finetuningstatusenum types.FineTuning*andModelEvaluation*models, their CRUD helpers,core/finetune/(DataPreprocessor,ModelEvaluator) and theProject.fine_tuningrelationship.tests/utils/test_data.py.Summary
The whole fine-tuning and model-evaluation vertical slice is removed:
Migration
097:Evidence
api_routerincludedfine_tuning.routerandmodel_evaluation.router. Their tests (test_fine_tuning.py,test_model_evaluation.py, in both api and crud) exercised these routes.After: Both routers are unregistered and their tests are deleted. Per the checklist, the app was booted with
fastapi run --reload app/main.py/docker compose upand tested manually.No test-run output is attached.
Merge Danger
Door: one-way
The upgrade drops
fine_tuningandmodel_evaluationalong with all their rows. The downgrade recreates only empty tables, so existing jobs and evaluations are permanently lost. Back up these tables first if the data matters.Reviewers should check that the downgrade's
finetuningstatusenum haspending, running, completed, failed. The removedFineTuningStatusmodel also hadcancelled.Blast Radius: API consumers
/api/v1/fine_tuning/*or/api/v1/model_evaluation/*will stop working.domain-map.mdlisted the console UI as a consumer ofModelEvaluation. Confirm it no longer calls these routes.chore/remove-doc-transformation. Migration097revises096, so merge order matters.Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
Previous PR description
Issue
Closes #1382
Summary
Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes