fix(kbdb): search keyword 補 source filter(#66)+semantic 曝 top_k/min_score 帶 score(#67)

#66:/entries/search keyword 路徑 source 解析後丟棄(#5.1 只接了 listEntries 那半)——
searchEntries 尾端加 source?(既有 positional caller 全不用改),conds 補與 listEntries
同款 json_extract(metadata_json,'$.source') 謂詞;route keyword 分支與 semantic 降級
分支兩處傳入。

#67:semantic 固定 topK=20、零分數閾值、低分尾硬湊數——route 曝 top_k(預設 20、封頂
100)與 min_score(預設 0=不過濾)query 參數;semanticSearch 依 min_score 截低分尾;
semantic 回應 entry 附 score 欄(加欄不改形)。壞值(非數字/非正)視同沒帶,不 400。

向後相容:不帶新參數時輸出與現況一致(semantic 僅多 score 資訊);不動表(D6)、
不動 D1 結構(API-as-Wall)。測試:新增 search-source-and-score.test.ts 13 條
(source 謂詞形狀/route 下傳/降級不洩 filter/min_score 截斷/topK 透傳封頂/壞值防呆/
不帶參數行為不變),kbdb vitest 33/33 綠、tsc 0。

關聯 #66 #67。merge 後需 gated redeploy kbdb worker(leo 閘)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JUmjwkHLVBHM3ydhT1WSW3
This commit is contained in:
Claude
2026-07-19 07:53:46 +00:00
parent 2324537165
commit 65d85eb08f
5 changed files with 269 additions and 16 deletions
+13 -1
View File
@@ -15,7 +15,19 @@ metadata:
## 📍 當前位置
> **2026-07-14 本 sessionbugfixPBKDF2 CF runtime 上限+http_request 1042 flag,分支 `fix-pbkdf2-cf-limit`PR 待總管審不 merge**
> **2026-07-19 本 sessionbugfixkbdb search 兩缺口 #66/#67,分支
> `fix/search-source-filter-and-semantic-threshold`,雲端總管交辦)**
> - **#66/#67 修復 PR 已開(雲端總管交辦),等審+gated 部署**。
> - #66`/entries/search` keyword 路徑 source 參數解析後丟棄(#5.1 只接了 listEntries 那半)→
> `searchEntries` 尾端加 `source?`positional caller 全不用改)+同款 json_extract 謂詞,
> route keyword/semantic 降級兩處傳入。
> - #67semantic 固定 topK=20 零閾值 → route 曝 `top_k`(預設 20、封頂 100/`min_score`
> (預設 0=不過濾),semanticSearch 依閾值截低分尾,回應 entry 附 `score` 欄(加欄不改形,
> 向後相容)。
> - 驗證:kbdb vitest 33/33 綠(新增 search-source-and-score.test.ts 13 條)+ tsc 0。
> 不動表(D6)、不部署——merge 後需 gated redeploy kbdb workerleo 閘)。
>
> **2026-07-14 上一 sessionbugfixPBKDF2 CF runtime 上限+http_request 1042 flag,分支 `fix-pbkdf2-cf-limit`PR 待總管審不 merge**
> - **T6-cloud 部署抓到的框架蟲**CF Workers **正式 runtime** PBKDF2 上限 100,000 iterations——
> portal-auth 設 600k → `crypto.subtle.deriveBits` 真雲直接拒絕 → `/portal/admin/bootstrap` 500
> uncle6 實撞,證據 arcrun-rag `docs/manual/uncle6-deploy-record.md`)。**miniflare 無此限制=