Skip to content

fix(analytics): list_datasets no longer reads a qualified phrase by its last word - #39235

Queued
objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/project-thread-02jbze
Queued

objectstack-fleet[bot] wants to merge 5 commits into
mainfrom
claude/project-thread-02jbze

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

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_datasets reads 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. phraseHead becomes strippedPhrase; 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 and phraseHead. 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.
  • Changeset: @objectstack/service-analytics patch. 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:

Phrase sent On main With this change
sales orders, confirmed orders, billing orders Order count offered no candidate
overdue balance, overdue balance by owner both balance measures offered no candidate
overdue invoices Open invoices offered no candidate
booking count, total booking amount two or three measures offered no candidate
paid claims, approved claims Claimed amount, Claim count offered no candidate
hotel spend, hotel spend on paid claims Claimed amount, Estimated spend offered no candidate
booking total, total booking, booking total by status, 成交合计 Booked amount offered the same
claimed so far Claimed amount offered the same
order total, balance by owner Order count; both balance measures the same
balance, orders, claims, booked (bare) offered the same

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 total and unpaid 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 at 0aaf3e8b, and the package run again at the head cf1607f7 after merging main (5a0bb8dd).

  • Re-pinned (PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017's pins): billing orders and booking count are offered nothing; the bare orders and count beside them still are.
  • The measures-only pin moves from balance due (which now loses no word and has no second reading) to past due total, whose stripped phrase is near a dimension alone.
  • New nested suite, on the order-to-cash build and on the travel-expense build copied member by member:
    • no candidate: 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;
    • kept: orders, balance, balance by owner, claims, total claims, booking total, what is our booking total, 成交合计, order total, claimed so far;
    • both scripts: 逾期余额, 销售订单, 住宿费 have none; 未结发票合计 and open invoice total both get Open invoices; open order total gets none;
    • at the door: ["sales orders", "status"] answers with the one dimension candidate for status, 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;
    • at the door: overdue balance is no_measure with no candidates; balance is candidates_only with both balance measures.
  • Package, at cf1607f7 after rebuilding the package and its dependencies: pnpm --filter @objectstack/service-analytics test 230 files, 5957 passed, 345 skipped; typecheck exit 0 (one locked run, VERDICT command-exit 0). Before the merge, at 0aaf3e8b: 229 files, 5949 passed.
  • Ablation, once, through 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 and git diff HEAD empty.
Premises 1 to 4 of analysis 7361140919, re-run on `440331f1` before any edit
  • P1: the last-word line is at dataset-term-matcher.ts:273; the pin billing orders at test line 321.
  • P2: three copies of the matcher (7aaced0a^, main, this change) over the datasets of docs/qa/scenarios/builds/order_to_cash.json and travel_expense.json, 85 hand-written phrases. This change differs from main on 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 total and others). Bare words are the same in all three.
  • P3: one near_miss expectation in each scenario card (dq_booking_total, dq_claimed_so_far).
  • P4: order_book has the dimension order_status only.
  • The ruling's named premise, as I read it: of the candidates PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017 gained, the ones lost are exactly those of phrases that keep a second word, and booking total, 成交合计 and claimed so far keep theirs. That holds. No fork.

Live check

One question, one repetition per side, haiku / medium, subscription login, through the runner's HttpApp and ClaudeCodeDriver.ask() against pnpm dev:crm -- --fresh (the CRM example; its Opportunities measure has the synonym "number of deals"). Baseline is a second worktree at the merge-base 440331f1.

Question: "How many closed deals does each customer have?" Both sides sent list_datasets({ terms: ["closed deals", "customer"] }).

Door answer What the model did Notional cost
Before (440331f1) candidates_only, closed deals offered Opportunities asked which of three readings was meant; no figure $0.0057
After (0aaf3e8b tree) no_measure, no candidate counted from the records per customer (Initech 3, Globex Ltd 3, Acme Corp 2), said no governed metric was used and named the source $0.0086

The same script also called the door directly with fixed terms on both sides. ["deals", "customer"] is candidates_only with 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

Review round (head b30e77ce)

The contract review at cf1607f7 passed with one should-fix and three nits. This commit takes three of them; it changes no code.

  • S1: the ADR note stated its principle for every reading. Its headline and principle point now speak of the second reading, and one new point says the note governs the second reading only, with the "orders" synonym as the example.
  • N2: two test titles no longer say "head".
  • N3: the changeset names the "head word" wording of the earlier changeset as superseded.
  • N1 (the review accepted it as is): no change.

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 in readDatasetTerms that calls it), then the ADR note, then the nested suite at the end of the test file.

Local gates

dispatch-gates.mjs --commands derived 72 families; all 72 ran at 0aaf3e8b and exited 0. --ran reconciliation: "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 main at cf1607f7, 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

…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>
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

10 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ⚠️ 1 changed file(s) yielded no anchor (packages/services/service-analytics/src/dataset-next-step.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/services/service-analytics/src/dataset-next-step.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 1d82054a8464ab21db825c69b659135f722345aa → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 3304e2b0255c5732f8bf8ffe45297cb292d0bd7a — the merge of head b30e77ceb33472d361b8c1a6dc23fd6343bd21d5 into base 1d82054a8464ab21db825c69b659135f722345aa, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: cf1607f7e7d87cd285967d41ad5d445521872979
Local-runs: probe — the PR's ablation claim and the first reading's behaviour on a measure whose own name is one word of the phrase could not be read off the diff; the matcher test file was run as committed, once with the stripped phrase cut back to its last word, and one throw-away probe file was run and deleted (tree restored, git status empty)
Scope: docs/adr/0149-ai-answers-business-questions-through-the-dataset-semantic-layer.md + packages/services/service-analytics/src/dataset-term-matcher.ts, packages/services/service-analytics/src/tests/dataset-term-matcher.test.ts, packages/services/service-analytics/src/dataset-next-step.ts
Security-touching: no
Rule-change-verified: none

① Derived judgments

Read: git diff origin/main...pr39235 (5 files, +255 −92; merge-base 5a0bb8dd, head confirmed cf1607f7), ruling 7363768737, analysis 7361140919, claim 7363885048 and its amendment 7363953434, dev report 7365216225, the PR body, the D3 notes of ADR-0149 on main, and .changeset/38953-booking-head-word.md (PR #39017's, still pending).

Ruled terms of step 1, one by one:

  • Term 1 (the second reading only strips total words, joining words and a trailing "by…" phrase): held. strippedPhrase cuts at the first PHRASE_ENDING_WORDS word, drops STRIPPED_WORDS, cuts one unspaced total word, and returns undefined when nothing was taken off (stripped === normalizedTerm). The three word lists are renamed and their contents are byte-identical to main. The last-word line (headPart[headPart.length - 1]) is gone. readDatasetTerms and isNearDatasetTerm call the same function, so the host-side narrowing stays a superset of what is offered.
  • Term 2 and 3 (no candidate, rule 4; overdue balance not asked, bare balance asked between two): held on the two builds and pinned at the door (no_measure, no candidates; balance is candidates_only with both balance measures). See S1 for the limit of this outside the builds.
  • Term 4 (sales orders takes rule 4, bare orders stays asked): held and pinned at the door beside an Order count measure, with the control ["orders", "status"].
  • Term 5 (re-pin billing orders, booking count; premise 2's phrases both ways; the door answer): held. The claim named dataset-tools.test.ts for the door case; it is in dataset-term-matcher.test.ts, where the build fixture lives. The dev reported it; no objection.
  • Term 6 (a short ADR note): present, see ④.
  • Term 7 (form is the dev's call): "stripped phrase tested whole" chosen and stated, with the phrases it differs on (open invoice total, unpaid invoice total).
  • Named premise and ban: booking total, what is our booking total, 成交合计, claimed so far keep their candidate (pinned); MCP 问数: list_datasets(["booking total"]) answers no_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_cash dq_booking_total) #38953's reading booking total → candidates_only, Booked amount is pinned by the untouched earlier cases of the same suite and by the new "kept" case. No fork.
  • Step 2 (MCP 问数: a measure candidate whose dataset cannot give the asked grouping is not asked about — the labelled fallback answers and mentions the measure (booked_by_category, top_claimants) #39221, open, pm:blocked): nothing of it is in the diff. dataset-next-step.ts changes one doc-comment sentence and no code line; decision, candidates, matches and the door's sentences are untouched; booked by category is unchanged.

Chinese: UNSPACED_TOTAL_WORDS holds the same eight words; a single-token phrase goes through the same end-then-start cut as before. Probed: 成交合计 and 合计成交 are offered Booked amount, 未结发票合计 Open invoices; 逾期余额, 销售订单, 住宿费 are offered nothing (pinned).

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:

  • S1 (should-fix, ADR note wording). The note's headline and its first point state the principle without scope: "a phrase that keeps another word beside its noun is not read by that noun" and "A measure near one word of a phrase, while the phrase says more than that word … So such a phrase is offered nothing." The executor holds this for the second reading only. The first reading (isNear, containment either way, the rule of the note of 2026-11-17, not touched here and not ruled on) still offers a measure when one of the measure's own targets is wholly inside the phrase. Probed at this head: with a measure carrying the synonym orders, sales orders is offered it; with a measure labelled Balance, overdue balance and overdue balance by owner are offered it, and the door asks. Neither committed build has such a target, so the ruled phrases and the card's acceptance are not affected, and the code is inside ruled term 1 ("the second reading"). But the record then promises more than the executor does, and the note's "What does not change" does not name the first reading. One added sentence in the note closes it: this note governs the second reading; the first reading is unchanged, so a measure one of whose own names, labels or synonyms is wholly inside the phrase is still offered and asked about. The code comments and the changeset already carry the scope ("near no member by itself"). Whether the first reading should follow the same principle is not ruled; if the seat wants it, that is a card of its own, not this PR.
  • N1 (nit). Joining and total words are taken off wherever they stand and the rest is joined, so open total invoice is read as open invoice and offered Open invoices, while invoice open total is not. The PR body states the joining; accepted deviation.
  • N2 (nit). The test title "a phrase whose head names the field a filtered measure aggregates…" still says "head"; the rest of the file was reworded.
  • N3 (nit, prose face). The changeset says it corrects "two sentences" of PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017's note. Both corrections are accurate (sales orders is not read as orders; booking count is not read as a count; both pinned to no candidate). A third sentence of that note, "The head word is the last word of the phrase that names what is measured", is also superseded; this changeset's fourth point ("tested whole in every script") covers it in substance without naming it.

② Semver level

  • @objectstack/service-analytics patch: correct. No spec shape, no decision value, no exported name changes (phraseHead and the word lists are module-private; exports are the same five). The form being withdrawn was never released: .changeset/38953-booking-head-word.md is still pending.
  • Clause-②: no and Metadata-protocol: none on the PR body and the changeset: correct. Nothing an author can write is refused; fewer candidates entries is the executor's rule (note of 2026-11-17), not a published accept set.
  • The changeset's own statements were checked against the code: the total words named, the joining words, the cut words, total booking amount offered nothing, the "read as before" list, the bare nouns, open invoice total as 未结发票合计. All hold.

③ Boundary flags

  • Security: no changed hunk reads or teaches permission, sharing, credential or authentication behaviour. isNearDatasetTerm narrows a host-side read; the stripped phrase is never a wider match than the old last word plus the same list, and a measure that is offered is still read. No face found.
  • Author: PR user.login is objectstack-fleet[bot].
  • SQL push-down: no query, id materialisation or in-app join in the diff.
  • Dev report: open_questions empty. Its two out-of-scope notes (acceptance read on the daily round; PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017's changeset left untouched on the seat's word) agree with the claim amendment and need no action here.
  • Docs drift comment 7365228784 reports no hand-written page naming the changed anchors; no page names the head word (grep for "head word" and phraseHead at this head finds only PR fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017's changeset).
  • Check-runs on cf1607f7 when read: 19 success, 18 skipped, 18 in progress, none failed. Not all green yet; the landing check on the full roll-up is the seat's.
  • The PR is a draft and Tier H (governed docs/adr/**).

④ Design judgment

  • docs/adr/0149-…semantic-layer.md (the hits file). Add-only: numstat 11 added, 0 removed; one note, placed after the note of 2026-12-01, dated 2026-12-03, in the form of the D3 notes before it (headline, authority with the option text verbatim and the ruling id, points, "What does not change", "State on main"). It agrees with rule 1 (unchanged), with the note of 2026-11-17 (which members are near is the executor's rule; never selected), with the example of the note of 2026-11-24 (now true again beside an Order count measure, and pinned), and leaves the "Not covered" lists of 2026-12-01 as written, as the ruling asked. Step 2 is named as owing its own note and is not stated. Against its first consumer, the executor in this PR: every statement about the second reading holds (words taken off, tested whole by the same containment, measures only, booking total → booking, claimed so far → claimed, 逾期余额 never read as 余额, four decision values unchanged). "No release carried that form" holds. The symbol anchor dataset-term-matcher.ts#readDatasetTerms resolves (check:adr-symbol-anchors green here). One statement does not hold against the consumer as written: S1.
  • dataset-term-matcher.ts (implementing): agrees with ruled term 1 and with the note's second and third points. Choosing the whole-phrase form makes one rule for spaced and unspaced scripts, which is the sounder of the two forms term 7 allowed.
  • dataset-term-matcher.test.ts (implementing): pins the ruled phrases both ways, on both builds, and at the door; the ablation shows the pins are live.
  • dataset-next-step.ts (implementing): the reworded sentence is accurate for the new function; no code.

No must-fix. One should-fix (S1), open; three nits.

Implemented-by: claude/project-thread-02jbze
Reviewed-by: session_01Utp6CaQsbKBMQtm6Tpsamd

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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b30e77ceb33472d361b8c1a6dc23fd6343bd21d5
Local-runs: probe — the seat asked for the matcher test file to be run once at the new head; it was run as committed and nothing was edited
Scope: docs/adr/0149-ai-answers-business-questions-through-the-dataset-semantic-layer.md + packages/services/service-analytics/src/dataset-term-matcher.ts, packages/services/service-analytics/src/tests/dataset-term-matcher.test.ts, packages/services/service-analytics/src/dataset-next-step.ts
Security-touching: no
Rule-change-verified: none

① Derived judgments

This is a delta of the contract review of head cf1607f7 (PASS with should-fix S1 open). Read: git diff cf1607f7..b30e77ce (one commit, 3 files, +7 −6): the ADR note, the changeset, two test titles. No code line moves: dataset-term-matcher.ts and dataset-next-step.ts are byte-identical to the reviewed head, so the judgments of the first record on ruled terms 1 to 7, the named premise (#38953's booking total), the Chinese phrases, the absence of step 2 (#39221) and the ablation stand unchanged.

Findings of the first record, by id:

  • S1: closed. The note of 2026-12-03 now scopes itself to the second reading in three places. The headline reads "the second reading of a phrase takes off only the words that do not say which number is meant; a phrase that keeps another word beside its noun is not read a second time by that noun". The principle ends "So the second reading offers such a phrase nothing". A new point, "This note governs the second reading only", says the first reading (containment either way, the executor's rule of the note of 2026-11-17) is unchanged and not ruled on, that a measure one of whose own targets is wholly inside the phrase is still offered and asked about, with the two cases probed on the earlier head (synonym "orders" for "sales orders", label "Balance" for "overdue balance"), and that whether the first reading should follow the principle is not ruled. The point "Any other word stays" now conditions its conclusion: "where the first reading found no member near them, they have no candidate". Each statement agrees with isNear and readDatasetTerms at this head. The note promises no more than the executor does.
  • N1: accepted deviation, unchanged (total and joining words are taken off wherever they stand; open total invoice is read as open invoice).
  • N2: closed. The two test titles that still said "head" are reworded ("a phrase that names nothing without them still falls back"; "a phrase that names the field a filtered measure aggregates only without its total word…"). No it( or describe( title in the file names a head; the remaining matches are HTTP headers and "headline". Bodies untouched.
  • N3: closed. The changeset no longer counts "two sentences"; it corrects "the earlier note for the second reading" and names the superseded wording: a phrase is not read by a "head word", its last word that names what is measured. Accurate against .changeset/38953-booking-head-word.md, which stays untouched.

Matcher test file at this head: 25 passed.

No new finding in the delta.

② Semver level

  • Unchanged: @objectstack/service-analytics patch; Clause-②: no, Metadata-protocol: none. The delta changes the changeset's prose only, and what it says holds.

③ Boundary flags

  • Security: the delta is record text, release-note text and two test titles; no security face.
  • Author: PR user.login is objectstack-fleet[bot].
  • SQL push-down: no query in the delta.
  • Check-runs on b30e77ce when read: 47 runs, 11 success, 20 skipped, 16 in progress, none failed. Not all green yet; the landing check on the full roll-up is the seat's.
  • The PR is Tier H (governed docs/adr/**); the note's wording was open to this review by the ruling ("the PRs' reviews settle them").

④ Design judgment

  • docs/adr/0149-…semantic-layer.md (the hits file). Still add-only against main: numstat 12 added, 0 removed (11 on the earlier head, plus the new point); no sentence of an earlier note moves. Dated 2026-12-03, same form as the D3 notes before it. Against its first consumer, the executor in this PR, every statement now holds, the first reading's included. It stays consistent with the note of 2026-11-17 (which it now cites for the first reading) and with the example of the note of 2026-11-24: beside a measure labelled "Order count" with no target inside "sales orders", the phrase has no candidate, as pinned at the door. The open question it names (the first reading and the same principle) is left unruled, which is right: ruling 7363768737 speaks of the second reading only.
  • dataset-term-matcher.test.ts (implementing): titles only; the pins are the ones the ablation showed live.

No must-fix, no should-fix. One accepted deviation (N1).

Implemented-by: claude/project-thread-02jbze
Reviewed-by: session_01Utp6CaQsbKBMQtm6Tpsamd

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

维护者速读

席位核对

ACCEPT · head b30e77ceb33472d361b8c1a6dc23fd6343bd21d5 · repo:objectstack@os-bill

  1. Shape: 5 files, +258/−94. dataset-term-matcher.ts: phraseHead becomes strippedPhrase, which strips only total and joining words and tests the rest whole. The matcher test file changes; dataset-next-step.ts has one doc-comment sentence; ADR-0149 D3 gets an add-only note dated 2026-12-03; there is one patch changeset that names the superseded "head word" wording of fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017. All within claim 7363885048 and its amendment. Accepted deviation: the ["sales orders","status"] case sits in the matcher test file, so dataset-tools.test.ts is untouched.
  2. Premises measured: the card thread re-ran premises 1 to 4 of 7361140919 on 440331f1, and all hold. Over 85 phrases, 15 differ from main, each one back to its pre-fix(analytics): list_datasets offers a measure for a phrase whose head word it carries #39017 reading. "booking total" is unchanged as candidates_only → Booked amount. The live check (haiku/medium, CRM) went from an ask-back to a labelled answer.
  3. Gates: check-runs at this head: 42 success, 20 skipped, 0 failed; mergeable. 72 derived gates ran with exit 0; the package's 5957 tests pass; the ablation gives 5 red and 20 green. Contract review at CONTRACT_REVIEW_TIER: PASS 7365356646 at cf1607f, with S1 closed by delta PASS 7365498954 at this head.
  4. Accepted deviations: N1, the stripped words are removed mid-phrase ("open total invoice" → "open invoice"), as the PR body states.
  5. Out of scope: the first reading's containment rule is not ruled, and no card is filed because the ruling did not ask for one. Step 2 is MCP 问数: a measure candidate whose dataset cannot give the asked grouping is not asked about — the labelled fallback answers and mentions the measure (booked_by_category, top_claimants) #39221. Skills-docs: none (no authorable surface).
  6. Landing: Tier H (docs/adr/**). Handed to the approver; the seat lands after approval.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-bill · os-bill · session_01Utp6CaQsbKBMQtm6Tpsamd

维护者速读

Review requested · 2026-12-03T02:54Z · Tier H (requested by relay pr_request_reviewers: the --handoff reader cannot attribute the delta record's opening sentence, which mentions the closed should-fix; the record itself lists S1 closed and nothing open) (docs/adr/**). The seat ACCEPT and contract review delta PASS 7365498954 are at Head-sha: b30e77ceb33472d361b8c1a6dc23fd6343bd21d5. Please approve at this head. On approval the seat lands it (ready + auto-merge) under the maintainer's authorization of 2026-12-02T12:07Z (「审批人批准后的 Tier H PR 你可以自主落地」).

@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 3, 2026 02:55
@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 3, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review December 3, 2026 03:11
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 3, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants