fix(chat): remove non-existent status/workspace_id from conversations SELECT#47
Merged
Merged
Conversation
… SELECT The DatabaseProvider abstraction refactor (ba75732) added `status` and `workspace_id` to the `getConversation` SELECT list, but these columns were never created on `public.conversations` — the table only has `id, project_id, user_id, title, created_at, updated_at`. As a result, every chat request hit `column conversations.status does not exist` and returned a 500. No caller reads `conv.status` or `conv.workspace_id` (verified across chat.post, messages.get, conversation delete, EE conversation-api, and the ConversationSummary type consumed by ChatPanel / CommandPalette). Billing/quota scoping already lives on `agent_usage.workspace_id`; the RLS policy on `conversations` is `user_id = auth.uid()` and does not need workspace denormalisation. Adding a migration for unused columns would be speculative design, so this drops the over-selected fields and the matching `workspaceId?` filter on the provider interface (no caller passes it).
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.
Summary
getConversationSELECT'istatusveworkspace_idistiyordu ama bu kolonlarpublic.conversations'ta hiç yaratılmamış (sadeceid, project_id, user_id, title, created_at, updated_atvar —001_baseline.sql:644). Sonuç: her chat isteğicolumn conversations.status does not existile 500 dönüyordu.ba75732) EEConversationApiContext.projectshape'inden yanlışlıkla kopyalandı — bu alanlarprojectstablosuna ait,conversations'a değil.chat.post.ts:111,messages.get.ts:15, EEconversation-api.ts:243/357, frontendConversationSummary(useChat.ts:55) veChatPanel.vue— hiçbiriconv.statusveyaconv.workspace_idokumuyor. Billing/quota scoping zatenagent_usage.workspace_idüzerinde, RLS politikasıuser_id = auth.uid()— denormalize gerekmiyor. Migration eklemek speculative design olurdu (CLAUDE.md).Changes
server/providers/supabase-db/conversations.ts— SELECT'iid, title, user_id, created_at, updated_atolarak küçülttü,filters.workspaceIdbranch'ı kaldırıldı (caller yok).server/providers/database.ts—getConversationfilter tipindenworkspaceId?: stringçıkarıldı.Test plan
pnpm typecheckcleanpnpm lint— değişen dosyalarda 0 errorpnpm test:unit(conversation-routes + chat-route integration dahil) — 403 passed