feat(workflow-store): workflow 真相源 KV → KBDB API(entry_type=workflow) #13

Closed
Leo wants to merge 1 commits from feat/workflow-store-kbdb into main
Owner

SDD kbdb-base §8.3/§8.4 P2+P3。總管裁定 2026-07-06:① upsert 走 KBDB base PUT /entries;② cron 掃 KBDB、不保留 KV cron-idx;③ 一 workflow=一筆 entry_type=workflow,content=description(保 embed)、graph+config+cron_expr 進 metadata_json。

不 merge、不部署、不動 production 那 7 筆 KV workflow。 改點清單、部署後驗證計畫(對真端點 curl)、剩餘 data 搬遷步驟(leo 寫入閘)全在 MIGRATION.md。

tsc 0 error;kbdb vitest 6/6 綠;cypher vitest 41/42 綠(1 失敗為 pre-existing、與本 PR 無關)。

SDD kbdb-base §8.3/§8.4 P2+P3。總管裁定 2026-07-06:① upsert 走 KBDB base PUT /entries;② cron 掃 KBDB、不保留 KV cron-idx;③ 一 workflow=一筆 entry_type=workflow,content=description(保 embed)、graph+config+cron_expr 進 metadata_json。 **不 merge、不部署、不動 production 那 7 筆 KV workflow。** 改點清單、部署後驗證計畫(對真端點 curl)、剩餘 data 搬遷步驟(leo 寫入閘)全在 MIGRATION.md。 tsc 0 error;kbdb vitest 6/6 綠;cypher vitest 41/42 綠(1 失敗為 pre-existing、與本 PR 無關)。
Leo added 1 commit 2026-07-06 13:56:00 +00:00
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
Author
Owner

[總管] 關閉——路走錯了(過度工程)。
leo 點破:KV→KBDB 是 cypher binding 等級,不是平台手術。正解=① 建 workflow template(D6)② 7 個 workflow 當 entry 填進去(KBDB API)③ cypher 把 workflow 讀從 KV.get 換成 GET /entries(換一個 API 呼叫,既有能力)④ 刪 KV+ak_
沒建新零件、沒 service binding → 不需要 PR。 本 PR 加 upsert 端點+雙軌+重寫儲存層=把「換一個 API 呼叫」做成平台手術,作廢。分支保留當參考(discovery 重複 entry bug 的定位有用)。

**[總管] 關閉——路走錯了(過度工程)。** leo 點破:KV→KBDB 是 **cypher binding 等級**,不是平台手術。正解=① 建 `workflow` template(D6)② 7 個 workflow 當 entry 填進去(KBDB API)③ cypher 把 workflow 讀從 `KV.get` 換成 `GET /entries`(換一個 API 呼叫,既有能力)④ 刪 KV+`ak_`。 **沒建新零件、沒 service binding → 不需要 PR。** 本 PR 加 upsert 端點+雙軌+重寫儲存層=把「換一個 API 呼叫」做成平台手術,作廢。分支保留當參考(discovery 重複 entry bug 的定位有用)。
Leo closed this pull request 2026-07-06 14:06:27 +00:00

Pull request closed

Sign in to join this conversation.