Repository navigation
Conversation
Remove the doctransform service (Zerox pdf->markdown), the /documents/transformation endpoints, the transformation options on document upload, the Celery task and starter, pending-job monitoring for doc_transformation_job and its config/env settings, docs and tests. The extension-to-format map moves to services/documents/formats.py. Migration 096 drops doc_transformation_job and its enum type. document.source_document_id is kept so existing transformed documents stay listable.
|
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 41 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. |
| ) | ||
| async def upload_doc( | ||
| session: SessionDep, | ||
| current_user: AuthContextDep, | ||
| src: UploadFile = File(...), |
There was a problem hiding this comment.
🟡 (optional) API clients that still send target_format, transformer or callback_url now get a 200 with no transformation and no error. They are not told the feature is gone. The form fields were removed from upload_doc, and FastAPI silently ignores unknown multipart fields. A caller waiting on the callback or on transformation_job hangs or misreads the response. Fix: reject uploads that still carry target_format, transformer or callback_url with a clear 400/410, for example by keeping the fields as optional Form params that raise when set.
Why this was flagged
An existing integration POSTs a pdf to /api/v1/documents with target_format=markdown and callback_url set, as the old upload.md told it to. After this change upload_doc (backend/app/api/routes/documents/document.py:94-98) only declares src. FastAPI drops the extra form fields without complaint, stores the document and returns 200. DocumentUploadResponse no longer has a transformation_job key. On the base branch the same request created a job, returned transformation_job.job_id, and later POSTed to the callback URL. Now the callback never fires and nothing in the response says the request was only partly honoured, so callers waiting on the callback wait forever. Removing the feature is the stated purpose, but accepting its parameters without any signal is an avoidable cost on top of that removal.
Verification: Trigger: an existing integration keeps sending target_format to POST /documents. After the diff, upload_doc in backend/app/api/routes/documents/document.py declares only session, current_user and src: UploadFile = File(...). FastAPI does not reject undeclared multipart fields. Now there is no job and no error. Callback-driven callers are not covered.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
OpenAPI changes 🔴 12 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 |
| 🔴 | 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 · 30
| 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 |
| 🔴 | 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_OpenAIConversationPublic_ |
| 🟢 | — |
— |
removed the schema APIResponse_ResponseJobStatus_ |
| 🟢 | — |
— |
removed the schema APIResponse_list_OpenAIConversationPublic__ |
| 🟢 | — |
— |
removed the schema CallbackResponse |
| 🟢 | — |
— |
removed the schema Diagnostics |
| 🟢 | — |
— |
removed the schema DocTransformationJobPublic |
| 🟢 | — |
— |
removed the schema DocTransformationJobsPublic |
| 🟢 | — |
— |
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 ↔ d407881c · generated by oasdiff
Issue
Closes #1382
What Changed
target_format,transformer,callback_urlform fields removed fromPOST /documents.transformation_jobremoved fromDocumentUploadResponse.GET /documents/transformation/{job_id}andGET /documents/transformationroutes removed, along withDocTransformationJobCrud,DocTransformationJoband the related public models.096drops thedoc_transformation_jobtable and thetransformationstatusenum.document.source_document_idis kept, so existing transformed documents stay listable.services/doctransform/(Zerox transformer and registry), therun_doctransform_jobandstart_doctransform_jobCelery task and helper, and the doc-transformation pending-job monitor. Also removedDOC_TRANSFORMATION_PENDING_THRESHOLD_MINUTES, plusOPENAI_API_KEYfrom the.envexamples.get_file_formatmoved fromservices/doctransform/registrytoservices/documents/formats.validate_uploadnow returnsstrinstead of(source_format, transformer).Summary
Upload call tree:
File layout:
Evidence
No test run output is attached. The diff updates these assertions:
test_upload_without_transformationassertsresponse.data["transformation_job"] is None.After:
test_upload_basic,test_upload_jsonandtest_upload_response_structureassert"transformation_job" not in response.data.validate_upload(...)returns("csv", None).After:
test_valid_csv_returns_formatassertsvalidate_upload(src=...) == "csv". The newtest_unsupported_extension_raises_http_422asserts a 422 with"Unsupported file extension: .xyz".test_monitor_pending_jobs_reports_stale_pending_rowsexpectstotal_stale_pending == 4and 3 Sentry events, includingdoc_transformation_job.After: It expects
total_stale_pending == 3and 2 events (job,collection_jobs).get_file_formattests moved fromtests/services/doctransformer/test_registry.pyto the newtests/services/documents/test_formats.py.Merge Danger
Door: one-way
Migration
096runsDROP TABLE doc_transformation_jobandDROP TYPE transformationstatus. All job rows are lost on upgrade.downgrade()only recreates the empty schema so older code can boot. It does not restore the data. The code removal is revertable, but the job history is not.Blast Radius: API consumers
/documents/transformation/...will now get 404.target_formattoPOST /documentswill no longer get a transformation, and the response has notransformation_jobkey.run_doctransform_jobCelery tasks queued at deploy time will fail: the task is unregistered and its table is gone.chore/remove-openai-conversations, so it should merge after that branch.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