Repository navigation
fix(analytics): list_datasets offers a measure for a phrase whose head word it carries - #39017
Conversation
A list_datasets term near no member by itself is read a second time, word by word: a member near one of its non-generic words is a candidate for the phrase, never a hit. booking total now offers Booked amount through its synonym bookings; a phrase near any member keeps exactly its first-reading candidates. Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ Co-authored-by: Claude <noreply@anthropic.com>
Any non-generic word offered Sales amount for "sales orders" and a count for "deal value". The second reading now takes the phrase's head: the last word before by/per/... that is not a total word, an unspaced total word cut off. Kind words (amount, value, count) stay the head. Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check6 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. What this run could not see
Coarse fallback — 10 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 e15ed0140de08d47b1fd61a6b899df9ed520e8ec && git checkout e15ed0140de08d47b1fd61a6b899df9ed520e8ec
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 2f9a68cfa184eaa7e77616df03654233ddd9f9f9 bd0821d8c2ad0d12183d4d0d2256c5cf052df5b3 && git checkout -B drift-repro 2f9a68cfa184eaa7e77616df03654233ddd9f9f9 && git merge --no-ff bd0821d8c2ad0d12183d4d0d2256c5cf052df5b3
node scripts/docs-audit/affected-docs.mjs --json 2f9a68cfa184eaa7e77616df03654233ddd9f9f9 |
The pins join dataset-term-matcher.test.ts as one top-level describe, as AGENTS.md asks of a component that already has a test file, and the separate file is removed. One pin is added: a filtered measure found through the head of "hours total" is asked about, while "hours" alone is still answered from the field it names. Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzeatqKfTRUzTJVa9jQ
Readings at
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzeatqKfTRUzTJVa9jQ Final green head · 2026-12-02T01:53Z · zone osa-ai
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head bf875b3 · 2026-12-02T01:56Z |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract reviewServed-tier: PR #39017, card #38953, rendered 2026-12-02T02:02Z. Read: the card and its three comments (triage 7315392885, claim 7330351836, os-dev-report 7331571455), the PR body and file list, the net diff against Check-runs on the head: every run concluded ① Derived judgments
② Semver level
Clause-②: no — right. The line is present and identical in the PR body and the changeset body, with no arm, and none is owed: the answer keeps its shape and nothing an author or a caller could write is refused. One sentence of the changeset describes behaviour S1 asks to change in part ("A member near the head word is offered in ③ Boundary flags
④ Design judgment
Holds, sentence by sentence:
Findings: S1 (should-fix) — the second reading offers DIMENSIONS near the head, and a phrase for a thing measured is then answered as a grouping word. Nits (no effect on the contract; none blocks):
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 review · PR #39017 (Part of #38953) · head bf875b3 · 2026-12-02T02:03ZVERDICT: NOT ACCEPTED on this head, for one should-fix. I adopt the contract-tier record 7332412283. Its verdict is PASS, but S1 (should-fix) is open, and the queue guard reads it as open on this head. A fix head, an L2 delta naming
Next: the fix head, then the L2 delta and the L1 delta. |
A head names the thing measured, so a dimension near it is no reading of the phrase: "balance due", whose head "due" is near only a dimension, was answered as a grouping word and asked which number is meant. The second reading now skips dimensions, and a head near no measure leaves the term with no candidate, the labelled fallback as before. The first reading keeps both kinds. Claude-Session: https://claude.ai/code/session_01WGufzeatqKfTRUzTJVa9jQ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzeatqKfTRUzTJVa9jQ
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head bd0821d · 2026-12-02T02:14Z |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm Contract reviewServed-tier: Delta record for PR #39017, card #38953, rendered 2026-12-02T02:32Z. It follows this session's record on head Check-runs on the head: all 61 concluded, 41 S1: closed ① Derived judgments
② Semver levelUnchanged: Clause-②: no — right, present and identical in the PR body and the changeset body. ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Nits from the earlier record:
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 delta · PR #39017 (#38953) · head bd0821d · 2026-12-02T02:33ZACCEPT, on head
Landing rule B: Next: zone landing. |
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzeatqKfTRUzTJVa9jQ 落地
State change: ready for review + auto-merge, by zone osa-ai (2026-12-02T02:34Z). |
Requested by Yibo Wang · project thread
Part of #38953
Claim for this branch: #38953 comment 7330351836
Clause-②: no
Metadata-protocol: none
What remains: the eval seat's daily round measures
dq_booking_totalon both arms (the card's acceptance: two consecutive days, or 4/5 or better at 5 reps on both arms). This PR is route P's executor half only.维护者速读
What changes
list_datasetsterm matching (dataset-term-matcher.ts), executor side of ADR-0149 D3's candidate rule. Rule 1 (equality after normalization is the only hit) is untouched;matches, thecandidatesshape, its order and its cap are untouched.A term that is near no member of any listed dataset (today's containment test, either way, two code points) is now read a second time, by its head word, and a measure near the head is offered as a candidate for the phrase. The second reading offers no dimension: the head names the thing measured, so a head near no measure leaves the term with no candidate and rule 4's labelled fallback, as on
main(balance due, whose headdueis near only the dimension labelled "Days past due", staysno_measure). The first reading keeps both kinds, untouched. The head word is:by,per,for,in,at,on,from,to,during,over,across,vs,versus;total,totals,subtotal,sum,sums,overall,grand) or a short joining word (of,the,our,so,far,this, ...);合计,合計,总计,總計,総計,总额,總額,総額) cut once from its end, or else its start;Kind words (
amount,value,count,number,金额,数量) are deliberately not skipped: "deal value" and "deal count" are different numbers.The second reading never adds to the first: a term near any member by itself keeps exactly today's candidates. The 2026-12-01 take-out (a filtered measure whose field the term names) still tests the whole term, as the amendment note defines "named by the term".
isNearDatasetTerm(the host's narrowing of which field labels to read) answers for the term or its head, a superset, so no offered measure goes unread.Design points answered (claim route P)
docs/qa/scenarios/builds/order_to_cash.json(blob7cb264d4),order_book.booked_amountis label "Booked amount", synonymsbookings,revenue,营收,订单金额,成交额, fieldtotal_amount, no filter. Today "booking total" misses because neither side contains the other for any target: no target contains "booking total", and the phrase contains no whole target (it holds "booking", not "bookings"). The single word "booking" is near only because the target "bookings" contains it.isNearon the head. "booking" reaches "Booked amount" through the synonym "bookings" the fixture already carries: no stem, prefix rule, edit distance or embedding. The file's own sentence ("No edit distance, stem or embedding") stays true.dataset-tools.test.tswent red on two real false positives: "sales orders" offered a sales amount (the modifier "sales"), and "deal value" offered a count once "value" was skipped. The head (last word before a cutting word, total words skipped) removes both, and kind words stay heads. Per-term gains over the two committed scenario builds (115 terms: every member name, label and synonym, plus 50 phrases): 12 terms gain candidates, each from zero, all of them measures, at most 3; the other 103 are unchanged.dataset-term-names-field-38551.test.ts, green, unedited. The 2026-11-19 note (dimension-only candidates are a possible grouping) and the 2026-11-24 note: the grouping-word, precedence and app-crm blocks ofdataset-tools.test.ts, green, unedited. NonextStepsentence became false, so no runtime sentence ofdataset-next-step.tschanges; one doc comment there now names the head-word reading of measures (review nit N5, comments only).金额near合同金额and back stay as pinned. The second reading cuts one total word:成交合计gives成交, inside成交额.订单合计gives订单(two candidates: booked amount, order count). A one-code-point total prefix (总) is not cut;总营收-style phrases are already near through the whole-term test.Per-term gains on the scenario builds (12 of 115 terms change, all from 0, measures only)
Unchanged and still falling back:
balance due(its head is near only a dimension),number of payments,payments,付款笔数,employees,number of employees(the card's twofallback_labelledquestions).Tests
New pins as one top-level
describe('[#38953] …')in the matcher's existing test filepackages/services/service-analytics/src/__tests__/dataset-term-matcher.test.ts(9 tests), on the scenario build's three datasets copied member by member: the card's case at thelist_datasetsdoor (candidates_only, the one candidate, emptymatches, the schema parse), the matcher, head-not-any-word, preservation of the first reading, total-only phrases falling back, CJK, the cap, the measures-only head reading (balance dueisno_measurewith nocandidates;order totalkeepsorder_count, loses only theorder_statusdimension and stayscandidates_only), and the 2026-12-01 cell: a filtered "Billable hours" over fieldhoursis asked about for "hours total" (candidates_only) while "hours" alone is still answered from the field (no_measure, the field named).Red-first ablation (matcher at the merge base, then restored)
Committed head
bf875b3f87(matcher blob0ca02122); mutation:git restore --source=571b4947b1of the matcher, on-disk blobb67074bf= base blob. Run ofdataset-term-matcher.test.ts:Tests 6 failed | 13 passed (19). The six red are the card's case at the door (expected 'no_measure' to be 'candidates_only'), the matcher case, head word, CJK, cap, and the "hours total" cell (expected 'no_measure' to be 'candidates_only'); the two preservation pins and the 11 older matcher pins stay green on both trees, as they should. Restored withgit checkout HEAD --: blob0ca02122,git diff HEAD0 bytes,git status --porcelainempty.The S1 guard, test first and then ablated. The
balance duepin was written first and run against thebf875b3f87matcher:Tests 1 failed | 19 passed (20)(expected 'candidates_only' to be 'no_measure'), green after the change. At headbd0821d8c2(matcher blob4ac6f758),node scripts/ablation-replace.mjsturned the head pass's dimensions flag from false to true; the anchor went from 1 to 0, blob2c0ac008. Result:Tests 2 failed | 18 passed (20), failing the measures-only pin and thebooking countpin. Restored: blob4ac6f758,git diff HEADempty.Package suite and typecheck
bd0821d8c2: the same three files:Tests 131 passed | 10 skipped (141); typecheck exit 0. Diff vs main: 4 files, +375 / -22 (the fourth is a comment-only update todataset-next-step.ts, review nit N5).bf875b3f87:dataset-term-matcher.test.ts,dataset-term-names-field-38551.test.tsanddataset-tools.test.ts:Tests 130 passed | 10 skipped (140); typecheck exit 0. Diff vs main: 3 files, +348 / -21.pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2:Test Files 230 passed (230),Tests 5942 passed | 345 skipped.pnpm --filter @objectstack/service-analytics typecheck: exit 0; the pin file is in the program.Acceptance notes
no_measurewith no candidate. "hours" alone is still answered from the field. Both halves are pinned. Testing the head in the take-out (option B) would change that note's definition and is not built.open_invoice_countexactly as the single word "count" already is. "balance due" has the head "due", which is near only the dimension labelled "Days past due"; the head reading offers measures only, so the phrase has no candidate and takes rule 4's labelled fallback, as onmain(contract review S1).packages/mcp's suites send single-word terms only.Verification
Read first:
dataset-term-matcher.ts,phraseHeadand the three word lists: the risk is a word in the wrong list.dataset-term-matcher.ts, the second-reading hunk inreadDatasetTerms: it must run only when the first near set is empty.[#38953]describe indataset-term-matcher.test.ts, itsthe head word, not any wordand "hours total" tests.Two-minute check:
pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/dataset-term-matcher.test.ts, expectTests 20 passed (20).Local gates (head 9132572, after merging origin/main ce0d0da; fix rounds at bf875b3 and bd0821d re-ran the affected test files and typecheck only)
node scripts/pm/dispatch-gates.mjs --commandsderived 66 families for this diff;--ranreconciliation: "66 derived, 64 run, 2 NOT-MEASURED, 0 UNRUN", every line carrying its exit code. 64 exited 0, among thempnpm check:nul-bytes,pnpm check:cross-package-test-inputs,pnpm check:test-source-alias,pnpm check:doc-authoring,pnpm check:issue-citations,pnpm check:engine-double-contractandnode scripts/check-empty-changeset.mjs --base origin/main.node scripts/check-plugin-teardown-shape.mjs --self-test, reason: PREREQUISITE NOT MET (exit 3), the shallow clone cannot reach the pinned positive-control commit. CI runs it.pnpm check:dual-build-cjs-loads, reason: PREREQUISITE NOT MET (exit 3), it reads every package's dist and only the service-analytics closure is built here. CI runs it.Lint & Repo Gates,Test Coreand the rest) is CI's.Generated by Claude Code