Files
kbdb-graph-plugin/docs/3-specs/ingest-contract/tasks.md
T
Leo 98b221b435 docs(sdd): 立 ingest-contract SDD + 搬入 ingest-candidate 契約 (T3.1+T3.8)
對應 issue #1(頂層 mira-dissolve T3)。

- contracts/ingest-candidate.json:ingest→graph 邊界契約(自頂層搬入)
- contracts/README.md:標明候選(輸入)≠已存(triplet)
- docs/3-specs/ingest-contract/design.md + tasks.md:
  - ensureTemplate 改 slot-diff 補丁(取代 early-return,免遷移腳本)
  - 補 KbdbClient.updateRecord(base PATCH /records/:id)
  - ingest 流程:驗證(422)→idempotency(uri+hash)→先 append 後 deprecate
  - triplet template 增 source_uri+content_hash slot 承載 idempotency
  - 跨 repo 協調點(3.6 圖工具併 KBDB MCP)明列需 arcrun 配合

總管已認可四個設計決定(issue #1 comment)。鐵律:零建表/零 SQL/零 migration。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 18:07:12 +08:00

2.4 KiB
Raw Blame History

ingest-contract — tasks

唯一進度來源,不靠對話記憶。對應 issue #1(頂層 mira-dissolve T3)。 完成一項即時打勾 + 註記證據。端到端需 leo21c 部署的,標「待部署驗」,不假綠。

A. 契約 + template slot

  • 3.1contracts/ingest-candidate.json 進本 repo + contracts/README.md 標明候選≠已存(2026-06-26
  • 3.2 ensureTemplate 改 slot-diff 補丁(命中既有 → base PATCH /templates/:id 補缺 slot,不再 early-return);TRIPLET_SLOTSstatus + superseded_by + source_uri + content_hash
  • 3.2b ENTITY_SLOTSgloss(已核實現無)
  • 3.2c normalize 分層 fallback 接口:exact-only 先做;semantic 留接口(待 base embedArcrun #7

B. 寫入端 + 取代(核心)

  • 3.3a KbdbClient.updateRecord(id, values) → base PATCH /records/:id(已核實現無)
  • 3.3b src/actions/triplet-ingest.ts:驗證 envelope422 擋禁送欄位)→ idempotencyuri+hash)→ deprecate-then-append(先 append 後翻舊批 status)。<100 行純函式
  • 3.3c POST /triplets/ingest route(只驗證 + 呼叫 action
  • 3.4 測試(mock,不打真網路):正常 envelope / 同 hash no-op / 新 hash deprecate / 污染 envelope(帶 bridge_score) 422 / rollback(翻回 status)
  • 3.5 查詢 active-onlytraverse/search/neighbors 組圖前 filter status==='active'(缺省視為 active,相容舊資料)

C. MCP⚠️ 跨 repo,需 arcrun 配合 → issue 標清)

  • 3.6 圖查詢 + refresh HTTP API/邏輯備好(graph 端);MCP 註冊薄殼併入 arcrun KBDB MCP(協調後接,不另起 graph MCP
  • 3.6b refresh 紅線:只人發起 MCP 觸發,禁排程/webhook 自動
  • 3.6d 移除 search-query.ts 代理 base 關鍵字那條(重複,歸 KBDB MCP)
  • 3.7 get_source 端點(指回 source.uri + anchor
  • 3.7b graph CLI 延後不做(人少用、AI 用不到 → 不誤導)

完成準則

  • 全程 zero SQL / zero migration / 無 D1·Vectorize·AI 綁定(wrangler deploy --dry-run bundle 乾淨)
  • 所有 action ≤100 行;vitest run 全綠(mock client
  • 端到端 ingest→graph 走通需 base 上線 + ingest repoT4)就緒 → 標「待部署驗」
  • issue #1 留 open,待實證綠燈才結案