fix(kbdb): 三元組版標庫批次補存量+對外通道(Arcrun#87 二次收尾) #114
Open
Leo
wants to merge 1 commits from
fix/triplet-library-batch-backfill-87 into main
pull from: fix/triplet-library-batch-backfill-87
merge into: Leo:main
Leo:main
Leo:fix/instructions-knowledge-entrypoint
Leo:feat/91-hash-component
Leo:fix/library-map-triplet-vs-entry-honesty-87
Leo:fix/library-map-108
Leo:fix/adopt-rule-shared
Leo:fix/version-label-106
Leo:fix/mcp-owner-identity
Leo:feat/kv-retire-recipes-16-17
Leo:fix/error-message-truth-92
Leo:fix/wait-not-in-wasm-101
Leo:fix/portal-onboarding-drop-gemini-key-81
Leo:fix/graph-stats-honesty-100
Leo:fix/adopt-live-bindings-97
Leo:fix/like-escape-94
Leo:fix/semantic-search-zero-hit
Leo:pending/89-90-91-artifacts
Leo:fix/cypher-search-runtime-native-88
Leo:fix/embed-backfill-d68
Leo:fix/triplet-library-backfill-map-visibility
Leo:feat/tier2-worker-artifacts-arcrun-80-clean
Leo:fix/portal-mail-relay-not-configured-38-69-25
Leo:feat/portal-password-unified-d62
Leo:fix/portal-session-not-destroyed-66
Leo:fix/arcrun-rag-46-delete-vector-visibility
Leo:feat/d61-auth-data-separation
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
179dd60571 |
fix(kbdb): 三元組版標庫批次補存量+對外通道(Arcrun#87 二次收尾)
藏書地圖(library-map.ts)讀的是三元組 record 自己的 'library' slot(entry_values), 不是 entries.metadata_json.library——Arcrun#85 建的 POST /entries/backfill-library 補的是後者,補了地圖依然是 0。既有能補三元組 library 值的通道只有單筆 PATCH /kbdb/records/:id(b6ef0f0,已在 main),母體上千筆時逐筆呼叫不現實,也沒有 節流/冪等保護。 新增: - kbdb/src/actions/library-backfill.ts:backfillTripletLibraryTags + tripletLibraryBackfillStatus,安全原則與既有 entries 版逐條對齊——呼叫端決定 library 值+source_prefix 篩選(base 不猜語意)、冪等(NOT EXISTS 找缺 library 的 那半)、與 entries 版/embed reconcile 共用同一顆 D69 每日 D1 寫入額度、owner_id 必填、 寫入沿用既有 updateRecord(不手刻第二套 entry_values UPSERT SQL)。 - kbdb/src/routes/records.ts:POST /records/backfill-library + GET .../status。 - cypher-executor/src/routes/kbdb-proxy.ts:對外通道,owner_id 強制用租戶身份(同本檔 既有 POST /kbdb/records 慣例,不信任 caller 自帶 owner_id)。 測試:kbdb 新增 5 案(含跨租戶隔離/冪等/D69 共用額度截斷/status 統計),全套 218/218 綠燈;cypher-executor 新增 5 案(租戶閘/參數驗證/轉發/owner_id 覆蓋), 兩份既有失敗(auth.test.ts ExecutionContext 型別缺陷、portal-data/portal-admin/ console-library-map-page/executor.test.ts 訊息措辭)複驗與本次改動無關(stash 前後 一致,pre-existing)。 紅線:未併 main、未部署、未對 leo21c 執行任何實際 backfill(缺安全的寫入通道—— MCP 工具集無 update/patch record 能力,CLI 全域設定指著 leo21c 不可裸跑)。 批次執行是下一步,需總管/leo 決定執行方式與時機。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> |