Commit Graph

1 Commits

Author SHA1 Message Date
Claude 39e6f59178 feat(workflow-store): workflow 真相源 KV → KBDB API(entry_type=workflow)
SDD kbdb-base §8.3/§8.4 P2+P3。總管裁定 2026-07-06:
① upsert 走 KBDB base PUT /entries(by owner_id+page_name+entry_type)
② cron 掃 KBDB、不保留 KV cron-idx
③ 一 workflow=一筆 entry_type=workflow;content=description(保 embed)、
   graph+config+cron_expr 進 metadata_json

KBDB:
- entry-crud.ts 加 upsertEntry(read-then-write,無 UNIQUE、表不變)
- entries.ts 加 PUT /entries(upsert,回 created 旗標,content 變動時 embed-on-write)

cypher-executor:
- 新增 lib/workflow-store.ts(走 kbdbBase,禁直連 D1)
- webhooks-named register/trigger/list/delete 切雙軌(讀先 KBDB miss fallback KV、
  寫 KBDB 為主+暫雙寫 KV);writeWorkflowSearchEntry 上收進 putWorkflow(修重複 entry bug);
  backfill 升級為 KV→KBDB 遷移入口;移除 migrate-cron-index 端點
- scheduled 改掃 KBDB(listCronWorkflows);刪除 lib/cron-index.ts
- component-loader(trigger_workflow)、executions 擁有權檢查切雙軌讀

tsc 0 error;kbdb vitest 6/6;cypher vitest 41/42(1 失敗為 pre-existing,與本 PR 無關)。
不 merge、不部署、不動 production KV workflow。搬遷步驟見 MIGRATION.md。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HJiLCRUU2o3aSpPEzVCt2o
2026-07-06 13:55:16 +00:00