Trust and Ownership Boundaries
Trust and Ownership Boundaries
หัวข้อที่มีชื่อว่า “Trust and Ownership Boundaries”Boundary Diagram
หัวข้อที่มีชื่อว่า “Boundary Diagram”flowchart LR
subgraph Browser[Browser UI]
UI1[Route + Components]
UI2[Local UI State]
end
subgraph ClientRuntime[Client Runtime]
C1[Context Providers]
C2[Zustand Stores]
C3[Service Adapters]
end
subgraph BFF[Next.js API Trust Boundary]
B1["/api/ai/(all)"]
B2["/api/chat/(all)"]
B3["/api/canvas/(all)"]
B4["/api/maps/(all)"]
B5["/api/dashboard/(all)"]
B6["/api/internal/(all)"]
end
subgraph External[Engine / Realtime / DB]
E1[AI Engine]
E2[Realtime Infra]
E3[Persistence]
end
UI1 --> C1
UI2 --> C2
C1 --> C3
C2 --> C3
C3 --> B1
C3 --> B2
C3 --> B3
C3 --> B4
C3 --> B5
B1 --> E1
B4 --> E2
B2 --> E3
B3 --> E3
B5 --> E3
B6 --> E3
Ownership Matrix
หัวข้อที่มีชื่อว่า “Ownership Matrix”| Layer | Owner | ต้องรับผิดชอบ |
|---|---|---|
| Route + View | UI team | parse params, render state, UX feedback |
| Orchestration hooks | Frontend platform | canonicalization, bootstrap guards, race prevention |
| Client services | Frontend platform | request shaping, scope propagation |
BFF /api/ai/* | Backend/BFF | auth, allowlist, scope-context resolution, normalization |
BFF /api/chat/* | Backend/BFF | thread/message/history schema + scope enforcement |
| BFF workspace APIs | Backend/BFF | workspace reads/mutations + idempotency + decision telemetry |
Hard Rules
หัวข้อที่มีชื่อว่า “Hard Rules”- Browser ต้องไม่ข้าม BFF ไปเรียก inference โดยตรง
- Scope validation ต้องจบที่ BFF ทุกครั้งก่อน call downstream
- Internal routes ต้องมี trusted claims และ deny เมื่อ claim-scope mismatch
- UI state ต้องถือว่า response อาจ stale ได้ และมี guard ป้องกัน overwrite