Hybrid Context and Scope Resolution
Hybrid Context and Scope Resolution
หัวข้อที่มีชื่อว่า “Hybrid Context and Scope Resolution”Hybrid Context Strategy
หัวข้อที่มีชื่อว่า “Hybrid Context Strategy”ระบบใช้ทั้งสองทางพร้อมกัน:
- Push context: BFF ส่ง scope/context ไปกับ payload ตอนเรียก AI
- Pull context: internal routes ให้ระบบภายในดึง context เพิ่มเติมตาม scope claims
Push and Pull Model
หัวข้อที่มีชื่อว่า “Push and Pull Model”flowchart LR UI["Client request"] --> BFF["AI API boundary"] BFF --> P1["Push canvas context"] BFF --> P2["Push dashboard context"] BFF --> ENG["AI engine"] ENG --> INT["Internal context API"] INT --> DB["Scoped data store"] DB --> INT INT --> ENG
Scope Canonicalization Feedback Loop
หัวข้อที่มีชื่อว่า “Scope Canonicalization Feedback Loop”flowchart TB
A["Incoming route"] --> B["Resolve thread context"]
B --> C["Derive effective scope"]
C --> D{"URL is canonical?"}
D -- no --> E["Replace with canonical path"]
D -- yes --> F["Continue runtime"]
E --> F
Practical Rules
หัวข้อที่มีชื่อว่า “Practical Rules”- maps mode ต้องถือ
mapIdเป็น canonical เสมอ - analytics mode ต้องถือ
dashboardIdเป็น canonical เสมอ - board semantics ใช้กับ idea/strategy เป็นหลัก
- share flows ต้องตรวจ role/scope ก่อนเปิด read/write operations
- new chat path ควรผ่าน session start และส่งกลับ
scopeKind/scopeId/svเพื่อให้ URL canonical ตั้งแต่ต้น
Common Failure Patterns
หัวข้อที่มีชื่อว่า “Common Failure Patterns”- route มี thread แต่ขาด scope key -> ต้องเติมจาก metadata
- scope ใน URL ไม่ตรงกับ thread mapping -> ต้อง deny หรือ recover
- claim-scope mismatch ใน internal routes -> hard error
- legacy fallback hit บ่อยผิดปกติ -> สัญญาณว่าต้อง deprecate branch นั้น