Repository navigation
Commit 189358f
fix(scenarios): asked-back no-figure ignores a count of the candidates and a year written alone (#34882)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBLW6dHPW6sSheA32XPKZzPV)_
repo:objectstack#3 · os-support-ai · session_01WGufzg1NmbJpZhtiWQkTir
Part of #34687
Clause-②: no — `statedFigures` (`./score/full`) keeps its signature and
answers differently: for the same text it returns fewer figures, leaving
out a one- or two-digit count of the candidates an ask-back offers and a
19xx/20xx year a time word or 年 marks, unless a counted noun follows
that year.
Metadata-protocol: none
## 维护者速读
- **改了什么**:数据集问答的 `asked-back:no-figure` 评分不再把"候选个数"(如 "I found 2
metrics"、「对应 2 个指标」)和单独出现的年份(如 "in 2025"、「2025 年」)当成回答里给出的数字。
- **为什么改**:正确的反问会说明有几个候选或提到年份,原来会被误判为"报了数字"而失败;这会让下一轮评测在歧义题上出现假失败(L1
6948369055 的 S1)。
- **修复轮 1**:时间词后的 19xx/20xx 数如果后面跟着被计数的名词("payments for 2031
orders"、"from 1980 invoices"),现在仍算数字;"In 2025 sales grew" 这类真年份仍不算(L1
6952038077 的 S1)。
- **风险与回滚**:只放宽两种窄形状,真实数字(金额、百分比、记录数、小数、带单位或币种的数、没有时间词的年份形数)仍然判失败;回滚即
revert 本 PR,无数据或协议影响。
- **先看**:`packages/qa/scenarios/src/score/scenario-dataset-grade.ts` 的
`OPTION_COUNT` / `BARE_YEAR` 两个正则(风险最高:放宽边界);其次
`test/score/scenario-dataset-grade.test.ts` 新增的两组用例。
- **两分钟验证**:`pnpm --filter @objectstack/scenarios exec vitest run
test/score/scenario-dataset-grade.test.ts`,预期 18 个用例全过。
- **需要你做的**:无,席位落地。
## Fix round 1
Source: L1-c ACCEPT 6952038077 at 93b7675, should-fix **S1**:
`BARE_YEAR` dropped a 19xx/20xx count that follows a time word. "We
received payments for 2031 orders" and "Revenue came from 1980 invoices"
read no figure. That is a false pass, the direction this module's rule
forbids.
**The rule.** The English year branch of `BARE_YEAR` gains one negative
lookahead. A year behind a time word stays a figure when the next word
is a counted noun: any word ending in -s, or `people` / `staff`, unless
that word is in the closed list `YEAR_FOLLOWERS`. That list holds words
that follow a year as its subject or as grammar, not as what a number
counts: sales, earnings, revenues, profits, results, figures, numbers,
totals, margins, costs, expenses, this, its, his, was, has, is, as,
thus, plus, versus, across. The Chinese branch (`(?:19|20)\d{2}` before
年) is unchanged. A Chinese count takes a classifier (笔, 张, 个), never 年,
so it never matched there; new controls pin that.
**Why an exclusion list, not a count-noun list.** A bare
`(?!\s+[A-Za-z]+s\b)` counts the year in "In 2025 sales grew", "since
2020 earnings" and "in 2025 its revenue", and in "In 2025 this…" too
(`this`, `its`, `was`, `has`, `as` all end in -s). That is the opposite
failure. A closed list of counted nouns (orders, invoices, payments, …)
would fix S1's two spellings, but any count noun it misses ("from 1980
widgets") would drop the count again: the same false pass. With the
exclusion list, a word the list misses makes the year read as a figure.
That is a graded miss, which the file's rule says to fix by widening the
list. Both lists sit on a closed word list. Only the exclusion list
fails in the direction the module allows.
**Known residue, fails safe either way:**
- An adjective between the year and a count noun ("from 1980 unpaid
invoices") still drops the count, as at 93b7675. A one-word lookahead
cannot tell "unpaid invoices" from "revenue was".
- A true year followed by a counted noun ("for 2025 orders") now reads
as a figure. That is the same spelling as S1's "for 2031 orders" and
cannot be told apart. It errs toward a graded miss.
**Pins** (new case under `asked-back`):
- Figures, graded failing `asked-back:no-figure` only: "We received
payments for 2031 orders — …?" → `[2031]`, "Revenue came from 1980
invoices, …?" → `[1980]`, "Since 2020 people bought it — …?" → `[2020]`,
「收到 2031 笔付款:…?」 → `[2031]`, 「来自 1980 张发票:…?」 → `[1980]`. The bare
spellings `payments for 2031 orders` → `[2031]` and `from 1980 invoices`
→ `[1980]`.
- No figure from the year: `In 2025 sales grew`, `since 2020 sales`,
`Since 2020 earnings, booked or billed?`, `In 2025 its booked amount or
billed amount?`, `In 2025 this means booked amount or billed amount?`,
「2025 年销售额增长」, 「自 2020 年起的营收」. And `In 2025 sales grew 12%` → `[12]`.
- "In 2025 revenue was 3.2M" → `[3.2, 3200000]` was already pinned and
stays green.
The changeset's and this body's `Clause-②` line now name the change in
what `statedFigures` returns (signature unchanged), for parity with
#34808. The README's grader paragraph names the counted-noun rule.
<details><summary>Fix round 1 package run at eea1cb4: typecheck + build
+ test</summary>
```text
os-verify-lock: ... running: pnpm --filter @objectstack/scenarios typecheck && ... build && ... test
Test Files 38 passed (38)
Tests 1055 passed (1055)
os-verify-lock: VERDICT command-exit 0
```
The file alone: `Test Files 1 passed (1)`, `Tests 18 passed (18)`. `tsc
--noEmit --listFiles` lists the test file, so typecheck covers the new
case.
</details>
<details><summary>Fix round 1 ablation: each half of the new guard
removed alone turns the new pins red, restore proven by blob
hash</summary>
Both legs used `scripts/ablation-replace.mjs --delete` in WRAP mode, at
committed HEAD 2a2c4bf. The test imports `src` by a relative path, so
no rebuild is needed between legs.
- **The counted-noun lookahead deleted.** The anchor went 1 → 0 and the
blob changed (70db4ad → 0e6b20aa). Result: 1 failed / 17 passed. The
new case fails on "We received payments for 2031 orders …", which reads
no figure. Restored to blob == HEAD (70db4ad), with `git diff HEAD`
empty.
- **The `YEAR_FOLLOWERS` exclusion deleted** (the bare -s trap). The
anchor went 1 → 0 and the blob changed (70db4ad → 46bf6387). Result: 1
failed / 17 passed. The new case fails on `In 2025 sales grew`, which
reads `[2025]` instead of `[]`. Restored to blob == HEAD, with `git diff
HEAD` empty.
My first attempt at leg 1 used plant mode with a one-character
replacement that already occurred 140 times. The tool refused it as a
no-op (replacement count 140 → 140) and restored the file, so no test
ran. I re-ran it with `--delete`.
</details>
<details><summary>Fix round 1 local gates</summary>
- `node scripts/pm/overlap-check.mjs --exclude-pr=34882` at eea1cb4
gives `VERDICT clean exit 0`. It merges cleanly with origin/main
(fc5913e) and with #34841. One earlier run of the same command, just
before the last push, answered `VERDICT cannot-answer exit 3`. It was
re-run after the push and came back clean.
- Clean, exit 0: `node scripts/check-nul-bytes.mjs`, `node
scripts/check-changeset-no-major.mjs --base origin/main`, `node
scripts/check-empty-changeset.mjs --base origin/main`, `node
scripts/check-adr-0087-registration.mjs --base origin/main` and `node
scripts/check-issue-citations.mjs`. `readClause2Line` reads the new line
as `value: no`, with no arm.
- The rest of the 60 derived commands were not re-run locally (a
declared narrowing). They are left to CI on this head.
</details>
## What changes
Source: L1 review 6948369055 on #34808, should-fix **S1**
(`asked-back:no-figure` fails a reply that counts its candidates or
names a year written alone). The ruling for this follow-up is to fix it
in code, not by a README caveat.
`statedFigures` (the reading behind `asked-back:no-figure`) now leaves
out, beside an option list's numbering:
- **A count of the options the reply offers** (`OPTION_COUNT`): a one-
or two-digit whole number followed by a candidate noun, with at most one
qualifier from a closed list between them. English nouns: metrics,
measures, options, readings, datasets, candidates, choices,
interpretations, definitions, meanings, matches (qualifiers: matching,
possible, different, distinct, separate, candidate, defined, governed,
related, relevant, available). Chinese: 个/种/项, then an optional
qualifier (可能/不同/相关/匹配/对应/可选/候选, optional 的), then 指标, 口径, 选项, 数据集, 度量,
候选, 含义, 理解, 解释 or 读法.
- **A year written alone** (`BARE_YEAR`): a 19xx/20xx number after a
time word (in, for, during, since, from, through, until, till, before,
after, year, fiscal year, calendar year, FY), or before 年.
Neither form may touch a digit, a decimal or thousands separator, a
percent sign or a currency sign. A year also may not be followed by a
unit or currency word. So the real figures still fail: `1,234,500`,
「123.4 万元」, `42%`, `42 orders`, 「3 张发票」, `3.2M`, `Revenue is 2025`, `a
total of 2025 orders`, `in 2025 dollars`, `$12 metrics`. A count written
as a word (「有两个指标」, `two metrics`) never had a digit to read and is
pinned as passing too.
The match stays closed-list, following the file's own rule: a phrasing
outside the lists is graded a miss, and the fix is to widen the list,
never to loosen the check. The README's grader paragraph names the two
new exemptions.
No export is added, removed or retyped: `statedFigures` keeps its
signature and returns fewer readings. Hence `Clause-②: no`,
`Metadata-protocol: none`, and a `patch` changeset for
`@objectstack/scenarios`.
## Tests
`test/score/scenario-dataset-grade.test.ts` gains two cases under
`asked-back`:
1. **Counted candidates and bare years pass.** Five full ask-backs
graded against `dq_revenue`, all passing with no failed check: "I found
2 metrics that match revenue: Booked amount (Order book) or Billed
amount (Billing). Which one do you mean?", "There are 2 possible
readings of revenue in 2025: …?", 「营收对应 2 个指标:订单金额(Order
book)和开票金额(Billing)。您是指哪一个?」, 「2025 年的营收有两个指标:…您是指哪一个?」 and 「营收有 2
种口径:订单金额,或开票金额?」. Seven `statedFigures` spellings also read `[]`: `12
matching metrics`, `for 2026?`, `In 2025,`, `FY 2024` / `calendar year
2025`, `2025年`, 「对应 3 个可能的口径」 and 「有 2 项指标」.
2. **True figures still fail.** Ten replies that carry a counted
candidate or a year beside a real figure. Each one's `statedFigures` is
pinned exactly, and its grade fails `asked-back:no-figure` and nothing
else: "Revenue is 1,234,500 …" → `[1234500]`, 「营收为 123.4 万元…」 → `[123.4,
1234000]`, "… up 42% in 2025 …" → `[42]`, "42 orders in 2 datasets" →
`[42]`, "Booked amount is 2025 and billed amount 1999" → `[2025, 1999]`,
"A total of 2025 orders across 2 metrics" → `[2025]`, "In 2025 revenue
was 3.2M" → `[3.2, 3200000]`, 「共 3 张发票,2 个指标…」 → `[3]`, "$12 metrics?" →
`[12]` and "in 2025 dollars" → `[2025]`.
<details><summary>Package run at 93b7675: build + typecheck +
test</summary>
```text
os-verify-lock: ... running: pnpm --filter @objectstack/scenarios build && ... typecheck && ... test
Test Files 38 passed (38)
Tests 1054 passed (1054)
os-verify-lock: VERDICT command-exit 0
```
`tsc --noEmit --listFiles` includes
`test/score/scenario-dataset-grade.test.ts` (1 hit), so the typecheck
covers the new cases.
</details>
<details><summary>Ablation: each exemption removed alone turns the pins
red, restore proven by blob hash</summary>
The test imports the grader from `src` by a relative path, so it reads
no `dist/` and needs no rebuild between legs. Both legs used
`scripts/ablation-replace.mjs --delete` in WRAP mode, at HEAD 93b7675.
- **`.replace(OPTION_COUNT, ' ')` deleted.** The anchor went 1 → 0 and
the blob changed (2dc3978 → 1663eab8). Result: 2 failed / 15 passed.
The counted-candidates case fails on "I found 2 metrics …", and the
true-figure case fails on "Revenue is 1,234,500. I found 2 metrics …"
because the reading is now `[1234500, 2]`. Restored to blob == HEAD
(2dc3978), with `git diff HEAD` empty.
- **`.replace(BARE_YEAR, ' ')` deleted.** The anchor went 1 → 0 and the
blob changed (2dc3978 → 798d2217). Result: 2 failed / 15 passed. Both
cases fail on their first year-bearing reply ("… revenue in 2025: …?"
and "… up 42% in 2025 …"). Restored to blob == HEAD, with `git diff
HEAD` empty.
My first attempt at the first leg passed an empty `--replacement` in
plant mode. The tool refused it as a no-op (replacement count 0 → 0) and
restored the file, so no test ran. I re-ran it with `--delete`.
</details>
## Acceptance notes
- `numbersIn` and the answer/leak graders in `scenario-run-grade.ts` are
untouched. Only the ask-back's no-figure reading changes.
- The year exemption only applies after a time word or before 年. A
year-shaped number elsewhere ("the 2025 figures") still reads as a
figure. That fails safe (a false fail, never a false pass); widen the
time-word list if a round shows it.
## Verification
<details><summary>Local gates at 93b7675</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` (change set derived
from merge base 7752cac, 4 paths) gave 60 commands, all run locally: 58
exit 0 and 2 exit 3 (PREREQUISITE NOT MET, read as NOT MEASURED):
- `pnpm check:dual-build-cjs-loads`: NOT MEASURED. It reads built output
for every package, and this worktree built only the scenarios closure.
CI's `Lint & Repo Gates` carries it.
- `node scripts/check-plugin-teardown-shape.mjs --self-test`: NOT
MEASURED. Its positive control is pinned to a commit outside this
shallow clone. This is checker health, and it cannot judge this diff.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0`. It merges
cleanly with origin/main (7752cac) and with #34841 (shares the README).
- Control-byte scan of the four changed files: no hits.
- CI check-runs: to be read off this PR by the seat.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01WGufzg1NmbJpZhtiWQkTir)_
<!-- signed: repo:objectstack#3 · os-support-ai ·
session_01WGufzg1NmbJpZhtiWQkTir -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 13e0305 commit 189358f
4 files changed
Lines changed: 123 additions & 6 deletions
File tree
- .changeset
- packages/qa/scenarios
- src/score
- test/score
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
99 | 148 | | |
100 | | - | |
| 149 | + | |
101 | 150 | | |
102 | 151 | | |
103 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
98 | 154 | | |
99 | 155 | | |
100 | 156 | | |
| |||
0 commit comments