Appearance
Conversation Runtime And Provider Boundary Deep Dive
Bộ tài liệu này đào sâu flow conversation-runtime-and-provider-boundary theo code thực tế hiện tại. Đây là package reverse-engineer trong docs/modules, không phải PRD/spec delivery. Trọng tâm của batch này là làm rõ 3 lớp rất dễ bị lẫn trong module conversation:
- workspace realtime ở FE hiện mới là shell một phần, nhiều hành vi list/message vẫn đang scaffold (
diva-admin/src/modules/conversation/components/Conversation/index.tsx:22,diva-admin/src/modules/conversation/components/ConversationList.tsx:188,diva-admin/src/modules/conversation/components/ConversationMessages.tsx:92), - provider runtime tách thành Stringee và Twilio, nhưng conference/token contract không hoàn toàn đồng bộ giữa FE và backend (
diva-admin/src/modules/conversation/vendors/twilio/components/TwilioVideo/TwilioVideoPreview.tsx:69,diva-backend/services/conversation-api/action/conference.go:60), - read/write permission thật lại nằm ở Hasura tables/functions
conversation*, không nằm tronguseConversation.tsvì composition này hiện gần như rỗng (diva-admin/src/modules/conversation/compositions/useConversation.ts:1).
Đọc file nào?
| Bạn là ai? | Nên đọc trước | Mục tiêu |
|---|---|---|
| PO / BA | shared-rules.md | Chốt mental model giữa shell FE, provider runtime và DB permission/search |
| FE Dev | type-runtime-workspace-and-unread.md, type-provider-token-and-conference-runtime.md | Hiểu list/message shell, route drift, token flow và Twilio/Stringee mismatches |
| BE Dev | type-provider-token-and-conference-runtime.md, type-message-permission-and-search-boundary.md | Hiểu action layer, provider config, Hasura permission contract và read models |
| QA | shared-rules.md, type-message-permission-and-search-boundary.md | Thiết kế test theo unread/search, permission và conference failure modes |
| Người mới vào hệ thống | module-overview.md | Có bản đồ tổng trước khi đi sâu |
Files
| File | Vai trò |
|---|---|
| module-overview.md | Bản đồ tổng: workspace shell, providers, action layer, read models, findings ưu tiên cao |
| shared-rules.md | Thuật ngữ chuẩn, runtime matrix, provider matrix, invariants, findings |
| type-runtime-workspace-and-unread.md | Deep dive cho route shell, conversation list, read state, message composer và store |
| type-provider-token-and-conference-runtime.md | Deep dive cho Stringee/Twilio token flow, conference create, overlay runtime và provider mismatch |
| type-message-permission-and-search-boundary.md | Deep dive cho tables/functions, permission contract, unread/search read models và mention boundary |
Kết luận ngắn
conversationhiện là runtime phân mảnh: FE workspace shell, provider wrappers và Hasura read/write model chưa được nối thành một orchestration layer duy nhất.- Có drift thật ở route/conference:
ConversationDetailpush sangROUTE_CONVERSATION_CONFERENCE,- nhưng module route tree không có route record nào cho
/conversation/:id/conference(module.ts:12,ConversationDetail.tsx:13).
- Có drift thật ở FE shell:
- nút video trong
Conversationchưa emit event, ConversationListdùng mutation stub sẽ throw ngay khi click item,- composer hiện không gửi message thật.
- nút video trong
- Có drift mạnh ở provider/backend boundary:
- Twilio preview emit
audioEnabled, trong khi parent đọcmicrophoneEnabled, createConferenceupdateexternal_call_idthay vìvideo_room_id/video_room_provider, lại swallow error nếu mutate conversation fail.
- Twilio preview emit
Liên kết tài liệu liên quan
- docs/modules/conversation/overview.md
- docs/modules/conversation/conversation.md
- docs/modules/conversation/conversation.technical.md
- docs/modules/user/overview.md
- docs/modules/notification/overview.md
- docs/modules/crm/overview.md
- docs/modules/phase-2-backlog.md
Phạm vi của bộ docs này
- Bám theo code hiện tại của
diva-admin,conversation-apivà Hasura metadata domainconversation. - Ưu tiên mô tả hệ thống đang chạy như thế nào thay vì flow lý tưởng.
- Chủ động ghi drift, scaffold chưa hoàn tất và contract mismatch giữa FE, backend action và DB permission layer.