name = "arcrun-cypher-executor"
main = "src/index.ts"
compatibility_date = "2025-02-19"
compatibility_flags = ["nodejs_compat"]

# 測試環境不啟用 Service Binding（Miniflare 無法解析外部服務）

# 2026-06-04：移除 WASM_BUCKET R2 mock。R2 wasm 路徑已 dead，不再需要測試 mock。

# KV mock（BUILD-006）
[[kv_namespaces]]
binding = "EXEC_CONTEXT"
id = "test-exec-context"

[[kv_namespaces]]
binding = "WEBHOOKS"
id = "test-webhooks"

[[kv_namespaces]]
binding = "CREDENTIALS_KV"
id = "test-credentials-kv"

[[kv_namespaces]]
binding = "RECIPES"
id = "test-recipes"

# console session mock（分流台勾掉 route 測試；console-auth.ts 的 session 真身存這個 KV）
[[kv_namespaces]]
binding = "SESSIONS_KV"
id = "test-sessions-kv"

# portal-auth P3：/portal/data/workflows 讀最近執行（stats:{name}:{ts}）
[[kv_namespaces]]
binding = "ANALYTICS_KV"
id = "test-analytics-kv"

# credential-store-migration T8/T9 測試用 D1 mock（Miniflare 本地 SQLite，非真實 leo21c D1；
# schema 由 tests/setup.ts 在測試啟動時建表，不用 migrations_dir——0002_credentials.sql 就一張表，
# 直接 exec 比接 migrations 機制簡單）
[[d1_databases]]
binding = "CREDENTIALS_DB"
database_name = "test-credentials-db"
database_id = "test-credentials-db-id"

[vars]
ENVIRONMENT = "test"
# 分流台勾掉 route 測試：KBDB 指到假 host（fetchMock 攔截，絕不外連——尤其不打官方 uncle6 fallback）
KBDB_BASE_URL = "https://kbdb.test"
CONSOLE_TENANT = "leo"
# portal-auth P3：graph 粗閘放行後的轉發目標也指假 host（fetchMock 攔截，絕不外連）
KBDB_GRAPH_URL = "https://graph.test"
