Repository navigation
Conversation
Remove the /openai-conversation read and delete endpoints, their CRUD, model, docs and tests, and the Project/Organization relationships. Migration 095 drops the openai_conversation table; its downgrade recreates the empty table as it stood at 094.
|
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.
Besides the inline finding, I checked two other things and found no problems in either.
- Downgrade indexes: the indexes that 095's downgrade recreates are the same set that existed at 094. That is the
project_idindex plus the three partialdeleted_at IS NULLindexes from 058, minus the three that 059 dropped. - Leftover references: nothing outside older migrations and the updated wiki line still mentions
openai_conversationorOpenAIConversation.
Extended reasoning...
I compared the recreated index names and predicates in 095's downgrade against migrations 058 and 059. I also searched the repo for remaining references to the removed model and table, and found them only in historical migrations and the updated wiki line.
|
|
||
|
|
||
| def upgrade(): | ||
| op.drop_table("openai_conversation") |
There was a problem hiding this comment.
🟡 (optional) During a deploy, admins on still-running old tasks get 500s on every project and organization hard delete. The migration runs before the new image takes over. upgrade() drops openai_conversation while old code still maps it through cascade_delete=True relationships. Fix: split the removal across two releases. Ship the code removal now and drop the table in a later migration, after no running code references it. Otherwise, document that the drop must run only after the old tasks are drained.
Why this was flagged
deploy-staging-ecs.yml runs a one-off task with alembic upgrade head in its "Run database migrations" step. Only after that does "Deploy to ECS and verify rollout" start, with a 15-minute timeout, so base-image tasks keep serving after 095 has run. In the base code, Project.openai_conversations and Organization.openai_conversations were Relationship(..., cascade_delete=True). SQLModel turns that into an ORM delete cascade without passive_deletes. So session.delete(project) in hard_delete_project (crud/project.py:180) and the organization hard delete both SELECT from openai_conversation before deleting. Once 095 has dropped the table, those SELECTs fail with UndefinedTable. Project and org hard deletes then return 500 on old tasks until the rollout finishes. The base branch has no such window. The DB-level ON DELETE CASCADE does not help, because the ORM query runs first. This is a cost beside the PR's purpose of removing the module, not something the purpose requires. Dropping the table in a later release avoids it.
Verification: The migration drops the table outright: op.drop_table("openai_conversation") (095_drop_openai_conversation_table.py:21-22). The base image still maps that table. On an old task, the hard-delete flush issues the collection SELECT against the dropped table. It fails with UndefinedTable / ProgrammingError, so the delete request returns 500. Nothing handles old code running after the upgrade.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
OpenAPI changes 🔴 7 breaking changesCaution Downstream consumers may need an update before merging. Breaking changes ·
|
| Method | Path | Change | |
|---|---|---|---|
| 🔴 | 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 |
Full changelog · 17
| Method | Path | Change | |
|---|---|---|---|
| 🔴 | 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 |
| 🟢 | — |
— |
removed the schema APIResponse_CallbackResponse_ |
| 🟢 | — |
— |
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 OpenAIConversationPublic |
| 🟢 | — |
— |
removed the schema ResponseJobStatus |
| 🟢 | — |
— |
removed the schema ResponsesAPIRequest |
| 🟢 | — |
— |
removed the schema ResponsesSyncAPIRequest |
main ↔ dde85c0b · generated by oasdiff
Issue
Closes #1382
What Changed
/api/v1/openai-conversationrouter and all 5 endpoints:GET /{id},GET /response/{response_id},GET /ancestor/{ancestor_response_id},GET ""(list) andDELETE /{id}.openai_conversationtable in Alembic migration095(revises094). The downgrade recreates the empty table and its 4 indexes, but not the data.OpenAIConversation,OpenAIConversationBase,OpenAIConversationCreateandOpenAIConversationPublicmodels.openai_conversationCRUD functions:create_conversation,delete_conversation,get_ancestor_id_from_responseand the otherget_conversation*lookups.openai_conversationsrelationship fromProjectand fromOrganization.hard_deletedocs and docstrings, and updated the wiki (INDEX.md,domain-map.md,modules/assistants.md).Summary
The module is no longer used, so this PR removes its whole vertical slice, from the route down to the table.
Evidence
api_router.include_router(openai_conversation.router)exposed/api/v1/openai-conversation/*, backed by theopenai_conversationtable.After: The router, models, CRUD functions and table are gone. The dedicated route and CRUD test suites were deleted along with the module.
fastapi run --reload app/main.py/docker compose up(checklist item below). No test run output is attached.Merge Danger
Door: one-way
Migration
095runsop.drop_table("openai_conversation"), which deletes every existing row. Running the downgrade restores only an empty table so that older code can boot. The data is not recoverable unless it is backed up before the upgrade.Blast Radius: API consumers
/api/v1/openai-conversation/*will now get 404s.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