ข้ามไปยังเนื้อหา

Architecture Guardrails

  • Browser must call BFF for inference (/api/ai/*), never engine directly.
  • BFF payload and metadata allowlists remain strict.
  • threadId/sessionId ambiguity must fail fast (400) instead of being guessed.
  • Internal engine calls must include versioned contract headers and trusted claims.
  • BFF must never forward raw user bearer token to engine.
  • Canvas API writes require idempotency key and scope validation.
  • MCP mutating tools require approved execution context and scope IDs.
  • Scope mismatches (user/project/thread) must fail with deterministic 403.
  • Workflow config references tools that are not actually registered in MCP.
  • Any new tool added without auth/gating/mutation-context wiring.
  • Any route bypassing BFF normalization before engine call.
  • Any direct DB write path added without clear owner and scope policy.
  • New client payload key accepted without updating BFF allowlists.
  • INTERNAL_API_CONTRACT_VERSION drift between BFF and engine.
  • BFF and engine internal tokens drift (ENGINE_SERVICE_AUTH_TOKEN vs INTERNAL_ENGINE_TOKEN).
  • Engine tools called without threadId/projectId/userId context.
  • MCP returns generic success for failed persistence writes.
  • 400 rate on /api/ai/chat and /api/ai/stream (schema/contract drift).
  • 403 rate for thread/project scope denials.
  • Resume failure ratio on /api/ai/resume.
  • MCP validation errors by tool name.
  • Duplicate side-effect detection by idempotency keys.