Repository navigation
feat(service-knowledge): a search_knowledge hit carries its source's declared metadataFields values - #38353
Conversation
…declared metadataFields values Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
…e declared metadata values Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7ac23e1fe2210e608c9908502dda6ac38fc220b0 && git checkout 7ac23e1fe2210e608c9908502dda6ac38fc220b0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f38a3ca8469368dcdcca177f4b8a94ba9ac5bf1d 5282883f38580bad2195589f1628b29e38bc7ebc && git checkout -B drift-repro f38a3ca8469368dcdcca177f4b8a94ba9ac5bf1d && git merge --no-ff 5282883f38580bad2195589f1628b29e38bc7ebc
node scripts/docs-audit/affected-docs.mjs --json f38a3ca8469368dcdcca177f4b8a94ba9ac5bf1d |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 Contract reviewServed-tier: The review is owed by the declaration alone ( ① Derived judgments
② Semver level
③ Boundary flags
N1: the classification window above is worth one line in ADR-0161's K8 notes, or a follow-up card, now that a third reader serves stored values. It does not affect correctness here. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head Review summary
Next: Tier S. The area marks it ready and lands it once every check is green at this head. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Landing · area o1-C · head
State: ready + auto-merge; #38291 closes on merge via |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 46158339477 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwPhGV4g9p1BGQaZbP Re-queue · area o1-C · head Queue build 46158339477 ejected this PR only as a stack-mate: its failing case ( |
Fixes #38291
Clause-②: yes (widening) — each
search_knowledgehit gains the values of its source's declaredmetadataFieldsMetadata-protocol: none
维护者速读
What changes
packages/services/service-knowledge/src/knowledge-tools.tsSearchKnowledgeHitgains an optionalmetadatamember (an object from field name to value): for a hit of an indexed record, the values of the fields its source lists inmetadataFieldsnow, read from themetadatathe index already stores with the passage, keyed by field name in the order the source lists them (declaredMetadataOf).nullis left out; no listed value ⇒ nometadatamember (a file or web source's hit carries none).hasOwnProperty), so a listed name that is also anObject.prototypemember never answers the prototype's value; the object is built withObject.fromEntries.groupValueundergroupByis unchanged (same code path, untouched).metadataand that the parent or status it names needs no record read.content/docs/ai/knowledge-rag.mdx: the "Each hit carries" paragraph names the new member. This file is one beyond the claim's declared surface (the hit-shape paragraph would otherwise go incomplete);skills/**is untouched.Why it is safe (verified on main 600197a):
KnowledgeService.admitSourcesrunsadmitSourceFieldsfor every non-system caller before a source is searched;servedFieldsOfadds everymetadataFieldsmember to the served set, and one served field that is not QUERYABLE by the caller refuses the whole source (knowledge-source-admission.ts, ADR-0161 K8). So no value this member answers is one the caller could not query. The existing service-level pin isknowledge-source-admission.test.ts› "titleandmetadataFieldsare served fields too: either one hidden refuses the source"; this PR adds the same pin through the tool.Tests
src/__tests__/knowledge-tools.test.ts, newdescribe"a hit carries the values of the fields its source lists inmetadataFields":status, a corpus indexed under['policy', 'status']answerspolicyonly (anddeclared: []answers no member);secret) never reaches the answer, a listedconstructorwith no own stored value answers nothing;statusgets no hit and the source is never searched; a caller who may gets the values.Updated: the whitelist pin now expects
metadatabesidegroupValue; thegroupBypin no longer asserts thatstatusis absent (that was the behaviour this card changes); the description pin names`metadata`.Readings (head 1c8472c)
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2— Test Files 19 passed (19), Tests 686 passed (686);typecheck(tsc +check:test-typecheckovertsconfig.test.json) exit 0. Lock verdictcommand-exit 0.scripts/ablation-replace.mjs, on src: the tests import../knowledge-tools.js, no dist hop): anchorfor (const field of new Set(listed)) {→for (const field of Object.keys(stored)) {, landed (anchor 1 → 0, blob b07dfa562bce → cd682e3614cf).knowledge-tools.test.ts: 2 failed | 57 passed — "a field the source no longer lists is not answered…" and "a listed field whose stored value is null or absent…". Restored: blob == HEAD,git diff HEADempty.Acceptance notes
internalor credential-class after the index was built is no longer in the gate's served set, while a stale stored passage may still carry its value until the rebuild that recipe change triggers. The same holds today forgroupValue, thescopemetadata terms and the snippet text itself. This PR adds no new exposure class. Recorded as a boundary, not filed.Verification
Local gate subset (dispatch-gates --commands, head 1c8472c)
check:dual-build-cjs-loadsexit 3 (PREREQUISITE NOT MET: reads every package's dist, needs a full build) is NOT MEASURED locally, so CI owns it.check:skill-examplesfirst exit 3 (client-react dist missing); after building@objectstack/client-react...it exits 0.dispatch-gates --ran: "99 derived famil(ies) accounted for — 98 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".Clause-②line (copied verbatim from the claim); the changeset families were re-run there:check-adr-0087-registration,check-changeset-no-major,check-empty-changesetandcheck:nul-bytes, each exit 0.packages/services/service-knowledge(onlypackages/spec/src/ai/dataset-tools.zod.tsnearby).Read first (by risk):
knowledge-tools.tsdeclaredMetadataOfand its call inhitOf; the field-gate test inknowledge-tools.test.ts.Two-minute check:
pnpm --filter @objectstack/service-knowledge exec vitest run --maxWorkers=2 src/__tests__/knowledge-tools.test.ts. Expect 59 passed, including the four tests under "a hit carries the values of the fields its source lists inmetadataFields".Generated by Claude Code