Repository navigation
feat(analytics): list_datasets offers candidates for a term that matched nothing - #34904
objectstack-fleet[bot] merged 6 commits into
Conversation
…ed nothing The near-term finder beside matchDatasetTerms (containment either way after normalization, both sides at least two code points), over admitted members only, run only for terms with no hit in any listed entry; the list_datasets description and the MCP initialize selection rule learn the candidates row. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…single-source change Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…ep; changeset Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
📓 Docs Drift Check12 anchor(s) derived from 2 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 19 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 97c0e57e0497256db6f36da3c55bb6c5bbc33c6f && git checkout 97c0e57e0497256db6f36da3c55bb6c5bbc33c6f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c81f498b5f0614157864d9586da718dbe02121b1 883af46685e88741f55ac36c67cad2c8159dcbd6 && git checkout -B drift-repro c81f498b5f0614157864d9586da718dbe02121b1 && git merge --no-ff 883af46685e88741f55ac36c67cad2c8159dcbd6
node scripts/docs-audit/affected-docs.mjs --json c81f498b5f0614157864d9586da718dbe02121b1 |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfWpJ96QY9T7d8DvFg L1: ACCEPT · 2026-11-17T16:13ZHead-sha: 14bb661 席位核对PR shape. Draft, base Scope vs claim. Every path sits inside the claim:
Declaration. Governed / size. NOT governed, 494 lines. Check-runs at 14bb661. 59 runs, every one Against ADR-0149 D3 and its note (#34828).
#34828 N2's four executor invariants. All four are pinned:
Tests and live run. 6 matcher, 4 tools and 3 MCP cases ( Docblock. The Tool text sizes. Must-fixNone. Should-fixNone. Notes
Next: o3-E folds the MCP pin into |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
…s harness; the rule's docblock names candidates Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfR33NbV51QQU6R6bm
|
repo:objectstack#3 · os-support-ai · session_01WGufzfWpJ96QY9T7d8DvFg L1: ACCEPT (delta, final head) · 2026-11-17T19:03ZHead-sha: 883af46 席位核对Delta. Two first-parent commits:
Gates. Not governed, 468 lines. CI at the report: 40 success, none failed, with two re-runs pending after a body edit. This verdict holds on the condition that My earlier notes. N1 to N3 stand as they were (none were owed). N4, the window in which the served skill text says "one near form selects nothing" while the tool texts ask on any candidate, is now open on Must-fixNone. Should-fixNone. NotesNone new. Next: o3-E lands once the three aggregates are green. #34868 follows to close the skill-versus-tool window. No seat L2 is owed. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzfR33NbV51QQU6R6bm Landing · 2026-11-17T19:04Z
State: ready + auto-merge armed. Fixes #34763. |
Requested by Yibo Wang · project thread
Fixes #34763
Clause-②: no
Metadata-protocol: none
维护者速读
list_datasets在某个词一个成员都没精确命中时,服务器填candidates:拿这个词和成员的名字、各语言显示名、同义词比"互相包含"(两边都至少 2 个字符),只从这个调用者能看到的数据集和成员里挑,每个词最多 5 个。list_datasets工具说明和 MCPinitialize里的选择规则同步写上:有候选就反问用户,不替用户选,也不把候选当命中;没命中也没候选才回退到对象查询。candidateslist, never selected; ADR-0149 D3 gains the amendment note #34761 落地,本 PR 是执行器和说明文字那一半。matches一字不改;只在有词零命中且有相近成员时多一个可选键,规范早已声明。说明文字变长:工具说明 1095 → 1414 字节,initialize规则 453 → 741 字节。回滚就是 revert 本 PR。packages/services/service-analytics/src/dataset-term-matcher.ts(findDatasetTermCandidates,"相近"规则、命中压制、顺序和上限都在这里)、packages/services/service-analytics/src/dataset-tools.ts(只从已准入成员取候选的那几行,以及LIST_DATASETS_DESCRIPTION)、packages/mcp/src/mcp-server-runtime.ts(DATASET_SELECTION_RULE)。pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/dataset-term-matcher.test.ts src/__tests__/dataset-tools.test.ts,预期 2 个文件 58 个测试全绿。What changes
The near-term finder (
packages/services/service-analytics/src/dataset-term-matcher.ts, newfindDatasetTermCandidatesbesidematchDatasetTerms). For each term with no hit in any listed dataset, it returns the members near it as{ term, dataset, member }, to the shape, order and cap ofListDatasetsOutputSchema.candidatesand the ADR-0149 D3 amendment note.normalizeDatasetTerm, one of the member's targets (itsname, itslabelin every locale of an inline map, each stringsynonym) contains the term, or the term contains the target, with both sides at least two code points long (DATASET_TERM_NEAR_MIN_CODE_POINTS = 2). No edit distance, stem or embedding. I measured nothing that argued for another rule: on the showcase it gives exactly the card'sinvoiceanswer (below).matchedOnequality thatmatchDatasetTermsreports asmatches, over the same members, so a term with amatchesentry anywhere in the answer has no candidate. What counts as a match is unchanged, and the existing equality test (no hit on a substring) is untouched.LIST_DATASETS_MAX_CANDIDATES_PER_TERM(5) per term, taken from the front, with no marker for the cut. A term sent twice is offered once, since the second copy adds nothing. The spec is silent on repeated terms; this is my choice, and it is pinned.The fill (
packages/services/service-analytics/src/dataset-tools.ts,listDatasets). The finder runs over the per-datasetdimensions/measureslists that the catalogue entry is built from. Those are already filtered byadmitDatasetCatalogEntry, so a withheld member, aninternal-field member and an unadmitted dataset can never be offered, and every pointer names a member listed in the same answer.candidatesis set only when the list is non-empty, so the key is absent rather than an empty list.Selection text, route A (seat amendment 6951344053 on mcp: the open door's initialize instructions carry the ask-data selection rule and the skills install line; /mcp/skill renders from the published skill #34686).
LIST_DATASETS_DESCRIPTIONandDATASET_SELECTION_RULEnow carry the rows of step 2 inskills/objectstack-ask/SKILL.md, each in its own sentences:candidatesis the same question, listing each candidate's label, dataset label and description; a candidate is never picked and never treated as a match;The dimension-alone,
membersWithheld,provenance, 非指标口径 and "name the dataset of the fallback object" sentences of the tool description stay.LIST_DATASETS_DESCRIPTIONDATASET_SELECTION_RULEMeasured by evaluating each string's source expression at base
d947a93cand at this branch. The rule's docblock aboveDATASET_SELECTION_RULEnow names the candidates row too (follow-up round, after fix(mcp): render the /mcp/skill data loop from the published objectstack-ask skill #34881 landed; see below).Docs that quote the rule:
packages/mcp/README.md(theinitializeinstructions section) andcontent/docs/ai/connect-mcp.mdx(Governed metrics and theinitializeinstructions) carry the same four rows.Checklist:
docs/qa/platform-checklist/areas/ai.jsonai.mcp-dataset-toolsmoves to revision 3. It gains a near-miss step (terms: ['invoice'], then['invoices']) and a matching clause. The description clause now names the candidates row, theqa_no_wordclause adds "nocandidateskey", andautomated.refnames the candidate pins. New step and clause are appended, so earlier indices do not move. The checklist README names no generator;pnpm check:platform-checklistis green and wrote nothing.Changeset:
.changeset/34763-list-datasets-candidates-fill.md.@objectstack/service-analyticsand@objectstack/mcpare bothpatch, becauseMetadata-protocol: nonetakespatch(AGENTS.md Post-Task Checklist step 3).Clause-②: no.Outside the claimed surface: none. Every file is inside the claim's file surface.
Tests
src/__tests__/dataset-term-matcher.test.ts: a new top-leveldescribe('findDatasetTermCandidates')with 6 tests. They cover:金额near合同金额,合同金额near金额), with name, label locale and synonym targets after normalization;{ dataset, member, term }pointer;src/__tests__/dataset-tools.test.ts: a new top-leveldescribe('[#34763] …')with 4 tests over the plugin-wired service and the security double. They cover:u_me: onlyrev→pipeline.measures.revenueis offered. Nothing is offered forsecret(an internal-field member),rateormarg(members over the unreadablemargin), ortot(inlocked_ds, whichu_memay not query, and inclosed_ds, which is not API-exposed). Nothing is offered for营收either, because it matched.closed_dsandsecret_sumnever appear;margin, which equalsmargin_total's label, gets no candidate althoughmargin_ratecontains it; the controlmargis offered both;Every candidate is checked to resolve to a member listed in the same answer, and the answer parses under
ListDatasetsOutputSchema.packages/mcp/src/mcp-dataset-tools.test.ts: a new top-leveldescribe('[#34763] list_datasets candidates pass through MCP unchanged')with 3 tests (folded in during the follow-up round; first landed as a separate file):candidatespasses throughtools/call list_datasetsunchanged, with the same entries in the same order and nothing added;packages/mcp/src/initialize-selection-rule-34686.test.tspins only that the rule names both tools, not its wording, so it needed no change and is untouched.Test and typecheck runs
Run at
2926ce23under the shared verify lock. Each part's exit code was echoed separately.pnpm --filter @objectstack/service-analytics typecheckexit 0. Itstsconfig.jsonincludessrc, so__tests__is compiled.pnpm --filter @objectstack/mcp typecheckexit 0. This runstsc --noEmit && pnpm check:test-typecheck:check:test-typecheck: OK — @objectstack/mcp's test layer compiles under packages/mcp/tsconfig.test.json; 6 file(s) / 53 error(s) / 8 pinned signature(s) held(debt unchanged).pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2:Test Files 218 passed (218),Tests 5558 passed | 335 skipped (5893), exit 0.pnpm --filter @objectstack/mcp exec vitest run --maxWorkers=2:Test Files 70 passed (70),Tests 1244 passed (1244), exit 0.origin/main(14bb6615; the incoming commits touch one unrelated mcp test file and nothing in service-analytics), under the lock: the whole mcp suite gaveTest Files 70 passed (70),Tests 1244 passed (1244), and the two service-analytics files gaveTest Files 2 passed (2),Tests 58 passed (58);VERDICT command-exit 0.Ablations (one-time; no permanent test file)
Both ran through
scripts/ablation-replace.mjsat2926ce23. The tests import the subject relatively fromsrc/(../dataset-term-matcher.js,../dataset-tools.js), so nodist/is involved.if (++offered >= LIST_DATASETS_MAX_CANDIDATES_PER_TERM) break scan;replaced by++offered;. On-disk proof: anchor x1 → x0, replacement x0 → x1, blob85170dd7→85f8238f. Result:Tests 1 failed | 57 passed (58), and the failing test wasfindDatasetTermCandidates > offers at most 5 per term, the first in listing order, with no cut marker. Restored: blob equals HEAD (85170dd7) andgit diff HEADis empty.if (hit) continue;replaced byvoid hit;. On-disk proof: anchor x1 → x0, blob85170dd7→e597fc91. Result:Tests 5 failed | 53 passed (58). The failing tests were the matcher's "offers nothing for a term with a hit in ANY dataset" and all four[#34763]tests indataset-tools.test.ts. Restored: blob equals HEAD,git diff HEADis empty, andgit status --porcelainis empty.Acceptance notes
Live reading on the showcase (the card's acceptance), taken at
2926ce23. The server was booted withpnpm -C examples/app-showcase exec objectstack dev --fresh -p 38763 --no-watch, against the showcase closure built under the lock. The rootpnpm devrefused because its prerequisite check wants every package built. Anosk_key was minted withPOST /api/v1/keysas the seeded admin, thentools/call list_datasetswas sent over HTTP MCP. Eight datasets were listed in each answer, and no answer waspartial.paid_count("Paid Invoices") is offered besideinvoice_countbecause its label containsinvoice. The same boot served the newinitializerule and the newlist_datasetsdescription overtools/list, verbatim as in the source.One candidate vs the skill's last row. The ADR-0149 D3 amendment note and the seat's route A say a term with candidates is asked about. The published skill's row "Nothing matches, and the listed measures do not offer several readings of the word" sends one near form to step 4 ("One near form is not a match either: it selects nothing"). For a term with exactly one candidate, the tool texts here say ask, and that row says fall back. Both texts agree that the candidate is never acted on; they differ only on whether to ask first.
skills/**is outside this card. Seat 3 has since ruled that one candidate asks (see the ruling note below).How broad near is, measured. Containment at two code points is wide on short ASCII terms. In the unit fixture,
totreachesmargin_total("margin total"), and a two-letter term reaches every target that contains it. The per-term cap of 5 bounds the list. I add no ranking because the spec forbids one.The tool-table row for
list_datasetsincontent/docs/ai/connect-mcp.mdxdoes not quote the rule, so it is left as it is (claim: those docs change only where they quote the rule).Verification
Targeted gates (local), derived by dispatch-gates
node scripts/pm/dispatch-gates.mjs --commands(no paths) derived 100 families from the tree at2926ce23. All 100 were run.pnpm --filter @objectstack/spec run check:skill-examplesandpnpm check:dual-build-cjs-loadsfirst exited 3 (PREREQUISITE NOT MET, no full build yet, so nothing was measured). After a fullturbo run buildunder the lock, both exited 0 (347 prose examples type-check across 3 surface(s); dual-build floors held).node scripts/pm/dispatch-gates.mjs --ran(with:: exit Nrecords):✓ 100 derived famil(ies) accounted for — 100 run, 0 NOT-MEASURED (a DERIVED zero — all 100 recorded an exit code and none of them is 3).pnpm check:platform-checklist:check-platform-checklist: OK — 16 areas, 433 items.node scripts/check-nul-bytes.mjs: OK.node scripts/pm/check-governed-merges.mjs --branch:NOT governed, 494 changed lines (+466 / -28), under 3000.dispatch-gates --tier: no path-derived mandate.node scripts/pm/overlap-check.mjsbefore every push. The first run was exit 1 against fix(mcp): render the /mcp/skill data loop from the published objectstack-ask skill #34881 on the docblock (see What changes). After the docblock was left alone, every run was exit 0, the last one at14bb6615.pnpm lint),test:repo, the integration layers and dogfood. The title carries no!and there is no(narrowing)arm, so no full dogfood run is owed.Ruling note: one candidate asks
With a single candidate for a term, the tool description and the
initializerule say to ask, as the ADR-0149 D3 amendment note does ("With candidates, the AI asks in rule 3's form and acts on none"). This departs from seat 3's earlier ruling on #34792 (Q1 A, record 6945986942: one loose candidate falls back, labelled), which predatescandidates. Seat 3 ruled on this PR that the ADR note outranks it. The published skill's row "One near form is not a match either: it selects nothing" is amended under #34868 to ask whenlist_datasetsreturns a candidate. The MCP pin is now folded intopackages/mcp/src/mcp-dataset-tools.test.tsas a top-level describe (AGENTS.md ruling 6583487846); the separate file is deleted.Follow-up round
After #34881 landed (
c6ecd1fab8), this round did four things:origin/main(c81f498b5f) as merge762b721b, with the trailers on the merge commit. It merged cleanly. fix(mcp): render the /mcp/skill data loop from the published objectstack-ask skill #34881's changes tomcp-dataset-tools.test.ts,skill-md.tsand theDATASET_SELECTION_RULEdocblock all came in as written.packages/mcp/src/mcp-dataset-tools.test.tsas a top-level describe with the same 3 tests. It reuses the harness'smakeBridgeandcallTool.packages/mcp/src/list-datasets-candidates-34763.test.tsis deleted, and the checklist'sautomated.refno longer names it.DATASET_SELECTION_RULEnow also says:candidatesis the same question, listing label, dataset label and description, never a pick and never a match, even for a single candidate;The rule string itself is unchanged from the first round.
near form,selects nothing,loose formandsingle candidateacrosspackages/mcp, service-analytics,skills/objectstack-askand the docs. The only text that differs is the skill's row "One near form is not a match either: it selects nothing" inskills/objectstack-ask/SKILL.mdand in the generatedpackages/mcp/src/ask-skill.generated.ts. Since fix(mcp): render the /mcp/skill data loop from the published objectstack-ask skill #34881, that generated file is what the served/mcp/skilltext is rendered from. This difference is expected until skills: the ask-data skill's zero-match row reads thecandidateslist once list_datasets fills it #34868 amends the skill. The tool description, theinitializerule,packages/mcp/README.mdandcontent/docs/ai/connect-mcp.mdxall say to ask.Follow-up runs at 883af46
turbo run buildunder the lock:VERDICT command-exit 0.pnpm --filter @objectstack/service-analytics typecheck: exit 0.pnpm --filter @objectstack/mcp typecheck: exit 0 (check:test-typecheck: OK — 6 file(s) / 53 error(s) / 8 pinned signature(s) held).Test Files 218 passed (218),Tests 5558 passed | 335 skipped (5893).Test Files 71 passed (71),Tests 1252 passed (1252).mcp-dataset-tools.test.tswith the verbose reporter:Tests 25 passed (25), including the three[#34763]tests.dispatch-gates --commands(no paths) at883af46685derived the same 100 families, and all 100 exited 0.--ran:100 run, 0 NOT-MEASURED (a DERIVED zero).check:platform-checklist: OK.check-governed-merges --branch: NOT governed, 468 changed lines (+436 / -32).overlap-check: exit 0 againstorigin/mainc81f498b5f. It also checked docs(adr-0149): D3 rule 1 note — a member label matches as resolved along the caller's locale chain #34928, which sharesdataset-term-matcher.ts, and merges cleanly.Generated by Claude Code