Repository navigation
fix(analytics): list_datasets no longer reads a qualified phrase by its last word - #39235
objectstack-fleet[bot] wants to merge 5 commits into
Conversation
…otal and joining words
A phrase near no member is read a second time with its total words, its
joining words and what follows "by" taken off, and what remains is tested
whole. A phrase that keeps another word beside its noun ("overdue balance",
"sales orders") has no second reading and no candidate.
Claude-Session: https://claude.ai/code/session_01Utp6CbA9qe75dd65kA6whs
Co-authored-by: Claude <noreply@anthropic.com>
…ff a phrase Adds the changeset for the matcher change. Claude-Session: https://claude.ai/code/session_01Utp6CbA9qe75dd65kA6whs Co-authored-by: Claude <noreply@anthropic.com>
…cond reading Claude-Session: https://claude.ai/code/session_01Utp6CbA9qe75dd65kA6whs Co-authored-by: Claude <noreply@anthropic.com>
…-02jbze Claude-Session: https://claude.ai/code/session_01Utp6CbA9qe75dd65kA6whs Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check10 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 3304e2b0255c5732f8bf8ffe45297cb292d0bd7a && git checkout 3304e2b0255c5732f8bf8ffe45297cb292d0bd7a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1d82054a8464ab21db825c69b659135f722345aa b30e77ceb33472d361b8c1a6dc23fd6343bd21d5 && git checkout -B drift-repro 1d82054a8464ab21db825c69b659135f722345aa && git merge --no-ff b30e77ceb33472d361b8c1a6dc23fd6343bd21d5
node scripts/docs-audit/affected-docs.mjs --json 1d82054a8464ab21db825c69b659135f722345aa |
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd Contract reviewServed-tier: ① Derived judgmentsRead: Ruled terms of step 1, one by one:
Chinese: Tests pin the behaviour. Run here at the head: the file is 25 passed. Ablation (the stripped phrase cut back to its last word): 5 failed, 20 passed. The five are the re-pinned case and four of the five new ones; the "kept" case stays green, as both readings agree there. This matches the PR's claim exactly. The other dataset test files of the package: 35 files, 668 passed, 17 skipped. Findings:
② Semver level
③ Boundary flags
④ Design judgment
No must-fix. One should-fix (S1), open; three nits. Implemented-by: VERDICT: PASS |
The contract review found the note stated its principle for every
reading, while the code changes the second reading only. The first
reading still offers a measure whose own name, label or synonym is
wholly inside the phrase ("orders" for "sales orders"). The note now
says so and says the first reading is not ruled on.
Two test titles and one changeset sentence no longer speak of a
"head" the matcher no longer reads.
Claude-Session: https://claude.ai/code/session_01Utp6CbA9qe75dd65kA6whs
Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd Contract reviewServed-tier: ① Derived judgmentsThis is a delta of the contract review of head Findings of the first record, by id:
Matcher test file at this head: 25 passed. No new finding in the delta. ② Semver level
③ Boundary flags
④ Design judgment
No must-fix, no should-fix. One accepted deviation (N1). Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd 维护者速读
席位核对ACCEPT · head
|
|
repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd 维护者速读
Review requested · 2026-12-03T02:54Z · Tier H (requested by relay |
Requested by Bill · project thread
repo:objectstack@os-bill · os-bill · session_01Utp6CbA9qe75dd65kA6whs
Part of #39152
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Step 1 of ruling record 7363768737 on the card (option 「P 两步都做」). The card stays open after the merge: its acceptance is read on the daily ask rounds, and step 2 has its own card.
list_datasetsreads a phrase that is near no member a second time. That second reading read the phrase by its last word that is not a total word, so "sales orders" was read as "orders" and "overdue balance" as "balance", a measure was offered for the phrase, and the door's note ordered a question where the user had asked for a plain figure.packages/services/service-analytics/src/dataset-term-matcher.ts: the second reading now takes off only total words ("total", "sum", 合计), joining words ("of", "our", "so far") and what follows "by", "per" and the like. What remains is tested whole, by the same containment, against measures only. A phrase from which nothing is taken off has no second reading.phraseHeadbecomesstrippedPhrase; the three private word lists are renamed to say what they now are (STRIPPED_WORDS,PHRASE_ENDING_WORDS,UNSPACED_TOTAL_WORDS); their contents are unchanged.isNearDatasetTerm(the host-side narrowing) follows the same reading.packages/services/service-analytics/src/dataset-next-step.ts: one doc-comment sentence that named the head word andphraseHead. No code.docs/adr/0149-…semantic-layer.md: one add-only amendment note (2026-12-03) under D3 that states the principle for the second reading and says in so many words that the first reading is unchanged and not ruled on. No existing sentence is rewritten.@objectstack/service-analyticspatch. It also corrects what the earlier changeset for the second reading says about a "head word"; that changeset is still unreleased and is left untouched (the seat's call, claim amendment on the card).What a caller sees, on the two committed scenario builds:
mainsales orders,confirmed orders,billing ordersoverdue balance,overdue balance by owneroverdue invoicesbooking count,total booking amountpaid claims,approved claimshotel spend,hotel spend on paid claimsbooking total,total booking,booking total by status,成交合计claimed so farorder total,balance by ownerbalance,orders,claims,booked(bare)Scope: the second reading only. The first reading (containment either way between the whole phrase and a member's own name, label or synonym) is untouched. A measure one of whose own targets is wholly inside the phrase is still offered and asked about: a measure with the synonym "orders" would still be offered for "sales orders". No measure on the two scenario builds has such a target for the phrases in the table, so the table holds there; on another app the first reading can still offer one. Whether the first reading should follow the same principle is not ruled, and the ADR note says so.
With no candidate, the answer for
["sales orders", "status"]is the labelled fallback of the note of 2026-11-24, beside an Order count measure as without one.The form (ruled term 7, the dev's call): the stripped phrase tested whole. The other form, "one content word left", gives the same answer on 83 of my 85 phrases. They differ on
open invoice totalandunpaid invoice total: tested whole, "open invoice" is inside the label "Open invoices", so that measure is offered; under the other form nothing is. I chose the whole phrase because it is what an unspaced script already does:未结发票合计loses 合计 and未结发票is inside the synonym未结发票数in every state of the matcher, so one rule now covers both scripts. The qualifier is kept and must be in the measure's own words, which is the ruled principle.Tests
All in
packages/services/service-analytics/src/__tests__/dataset-term-matcher.test.ts. Run at0aaf3e8b, and the package run again at the headcf1607f7after mergingmain(5a0bb8dd).billing ordersandbooking countare offered nothing; the bareordersandcountbeside them still are.balance due(which now loses no word and has no second reading) topast due total, whose stripped phrase is near a dimension alone.sales orders,confirmed orders,overdue balance,overdue invoices,total booking amount,overdue balance by owner,hotel spend,paid claims,approved claims,hotel spend on paid claims;orders,balance,balance by owner,claims,total claims,booking total,what is our booking total,成交合计,order total,claimed so far;逾期余额,销售订单,住宿费have none;未结发票合计andopen invoice totalboth get Open invoices;open order totalgets none;["sales orders", "status"]answers with the one dimension candidate forstatus, no measure offered, and a note that names"sales orders"and the object tools and not "Order count"; control["orders", "status"]is still asked about Order count;overdue balanceisno_measurewith no candidates;balanceiscandidates_onlywith both balance measures.cf1607f7after rebuilding the package and its dependencies:pnpm --filter @objectstack/service-analytics test230 files, 5957 passed, 345 skipped;typecheckexit 0 (one locked run,VERDICT command-exit 0). Before the merge, at0aaf3e8b: 229 files, 5949 passed.ablation-replace.mjs(the stripped phrase cut back to its last word, which is the old reading): 5 red, 20 green. Red: the re-pinned case and four of the five new ones. Green: the "kept" case, as both readings agree there. Restored, blob equal to HEAD andgit diff HEADempty.Premises 1 to 4 of analysis 7361140919, re-run on `440331f1` before any edit
dataset-term-matcher.ts:273; the pinbilling ordersat test line 321.7aaced0a^,main, this change) over the datasets ofdocs/qa/scenarios/builds/order_to_cash.jsonandtravel_expense.json, 85 hand-written phrases. This change differs frommainon 15, every one back to its state before PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017:total booking amount,sales orders,overdue balance,confirmed orders,overdue invoices,billing orders,booking count,count of orders,overdue balance by owner,paid claims,hotel spend,claim amount,approved claims,trip count,hotel spend on paid claims. Every phrase that carries only total, joining or "by" words beside its noun keeps what PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017 gave it (booking total,total booking,成交合计,order total,claimed so far,balance by owner,booked by category,claim total,spend totaland others). Bare words are the same in all three.near_missexpectation in each scenario card (dq_booking_total,dq_claimed_so_far).order_bookhas the dimensionorder_statusonly.booking total,成交合计andclaimed so farkeep theirs. That holds. No fork.Live check
One question, one repetition per side,
haiku/medium, subscription login, through the runner'sHttpAppandClaudeCodeDriver.ask()againstpnpm dev:crm -- --fresh(the CRM example; its Opportunities measure has the synonym "number of deals"). Baseline is a second worktree at the merge-base440331f1.Question: "How many closed deals does each customer have?" Both sides sent
list_datasets({ terms: ["closed deals", "customer"] }).440331f1)candidates_only,closed dealsoffered Opportunities0aaf3e8btree)no_measure, no candidateThe same script also called the door directly with fixed terms on both sides.
["deals", "customer"]iscandidates_onlywith Opportunities on both, and["deal total"]offers the same three measures on both. A first run on the PR tree, before the script saved the reply text, made the same tool calls and is not counted (notional $0.0089).The card's own questions (
orders_by_status,overdue_by_owner,sales_paid_hotel,dq_booking_total) are read by the eval seat's daily round on the scenario builds; a dev does not run that round.Acceptance notes
count of ordersandclaim amountlose the candidate PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017 gave them: each keeps a kind word beside its noun.number of ordersis a declared synonym and still a hit.booked by categoryis unchanged (Booked amount offered). It is step 2's, on its own card.["sales orders", "status"]already expects the fallback with nothing asked; no skill or tool-description text names the head word, so none changes here.list_datasets(["booking total"])answersno_measure, so the agent states a non-governed figure instead of asking which booking measure — a stable loss on both arms, 4 measured runs in a row (order_to_cashdq_booking_total) #38953's reading does not move:booking totalis answered exactly as onmain(candidates_only, Booked amount).Review round (head
b30e77ce)The contract review at
cf1607f7passed with one should-fix and three nits. This commit takes three of them; it changes no code.Re-run at
b30e77ce: the matcher test file, 25 passed (VERDICT command-exit 0), and ten gates, all exit 0:check-adr-links,check:adr-anchors,check:adr-index,check:adr-symbol-anchors,check:doc-authoring,check-issue-citations,check:nul-bytes,check-empty-changeset,check-changeset-no-major,check-adr-0087-registration. The package test, typecheck, ablation and live check above were not re-run: no source line changed.Verification
Two-minute check:
pnpm --filter @objectstack/service-analytics exec vitest run src/__tests__/dataset-term-matcher.test.ts -t "no second reading". Expect 5 passed.Files to read first:
packages/services/service-analytics/src/dataset-term-matcher.ts(strippedPhrase, and the hunk inreadDatasetTermsthat calls it), then the ADR note, then the nested suite at the end of the test file.Local gates
dispatch-gates.mjs --commandsderived 72 families; all 72 ran at0aaf3e8band exited 0.--ranreconciliation: "72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN". One of them,check-plugin-teardown-shape --self-test, first exited 3 (the shallow clone could not read its pinned fixture commit) and exited 0 after that commit was fetched.After the merge of
mainatcf1607f7, which touched no file of this diff: the package and its dependencies were rebuilt, the package test and typecheck re-run (above), and these 16 re-run, all exit 0:check-adr-0087-registration,check-adr-links,check-changeset-no-major,check-empty-changeset,check-issue-citations,check:adr-anchors,check:adr-index,check:adr-symbol-anchors,check:doc-authoring,check:nul-bytes,check:cross-package-test-inputs,check:pm-governed-merges,check:pm-prior-rulings,check:test-source-alias,check:where-matcher,check:engine-double-contract. The other 56 were not re-run on the merged head; CI runs the whole farm.The exit-code record is in the project files as
card-39152/gates-ran-0aaf3e8b.txt.Generated by Claude Code