Skip to content

Commit f4978d9

Browse files
fix(scenarios): an ISO date written with a Unicode hyphen states no figure (#37624)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuRFAatVcx79d6cbkTpzPfYU)_ Part of #36206 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户无感:评测场景卡的评分器不再把回复里用排版连字符写的日期(如 2026‑09‑01)当成三个数字扣分,普通短横写法不变。 - 属于「评测与场景卡」专题,修画廊重跑里报出的一处误判:正确的拒答被判成「说了数据支撑不了的数」。 - 只影响评测打分,不碰平台运行时;出错最多是某轮评测分数读偏,撤回这个 PR 即恢复原样。 - 无。 ## What changes - `packages/qa/scenarios/src/score/scenario-run-grade.ts`: `ISO_DATE`, the pattern `readingsIn` blanks before it reads a reply's figures, now joins a date's parts by the ASCII hyphen or by the two Unicode hyphens a typeset reply writes in its place (U+2010 hyphen, U+2011 non-breaking hyphen). Before, only the ASCII hyphen matched, so a date written as `2026`-U+2011-`09`-U+2011-`01` was read as the figures 2026, 9 and 1. - One pin in the existing ISO-date block of `test/score/scenario-run-grade.test.ts`: both hyphens read as a date, and a figure range joined by U+2011 (`12`-U+2011-`15`) still reads as two figures. - One changeset, `@objectstack/scenarios` patch. ## Why The 18.6.0 gallery re-run comment on the card (2026-11-22 22:56Z, item 2b evidence, "Minor") reports a reply that wrote `2026-09-01` with U+2011 non-breaking hyphens, so `ISO_DATE` missed it and 9, 1 and 30 were read as figures. A correct decline is then graded "stated a figure the data cannot support". The premise held at `origin/main` 54d6726 (`scenario-run-grade.ts:123`, pattern ASCII hyphen only). Every other item of the card landed earlier: items 1, 2 (operands shown) and 4-8 in #36320; item 3 and PAY-0044 in #36503 and #37047; item 2b is answered by the maintainer ruling recorded on the card (read C, no grader change). This PR widens no total and does not touch that ruling: it only keeps a date from being read as figures. ## Tests <details><summary>Package suite, typecheck, ablation (head 0eb6af3)</summary> - Through `os-verify-lock`: `pnpm --filter @objectstack/scenarios build && … typecheck && … exec vitest run --maxWorkers=2` → `VERDICT command-exit 0`; Test Files 43 passed (43), Tests 1345 passed (1345). - Ablation (`scripts/ablation-replace.mjs`, the test imports `src` by relative path, so no dist leg): `ISO_DATE`'s two hyphen classes put back to the ASCII `-`, anchor 1 → 0, blob `1854ffadf399` → `1ed8647e5c30`; `test/score/scenario-run-grade.test.ts`: 1 failed | 88 passed, the failing case being the new pin; restored blob `1854ffadf399` equals HEAD, `git diff HEAD` empty. A first attempt was an anchor miss the tool refused before running anything (the shell had turned the escape spelling in the anchor into the characters), so it measured nothing; the counted run built the anchor in a script. </details> ## Acceptance notes - `IDENTIFIER_TOKEN` still joins an identifier's parts by the ASCII `-` and `_` only, so an id written with U+2011 (`INV`-U+2011-`003`) would read its digits as a figure. No run has shown it; noted, not changed. - The other observations on the card's re-run comments stay as they are, with zero measured pull: the `via` on the two same-shaped decide operations (asset_lifecycle `manager_approves_scrap`, order_to_cash `approve_discount`), the asset_lifecycle 23/6 count (the card holds no second source: its 30 laptops are 24 in use, 5 in stock, 1 in repair), and per-group totals (the ruling refuses that widening). - The card's done-when is a gallery re-run on 18.6.0, which belongs to the eval lane; this PR does not close the card. ## Verification - Two minutes: `pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-run-grade.test.ts -t "Unicode hyphen"` → 1 passed. - Read first: the `ISO_DATE` line in `scenario-run-grade.ts` (the only behaviour change). ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. (no new names) - [x] 3. No formatter ran; `pnpm lint` passes. (CI) - [x] 4. One issue, one branch off an up-to-date `main`, one pull request. - [x] 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset. - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [x] 7. No hand edits to `content/docs/references/`, `packages/*/CHANGELOG.md` or `content/docs/releases/`. - [x] 8. Title, body and comments are in English. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgTESANUPsJKDqEn4zY)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent c9741f4 commit f4978d9

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
fix(scenarios): an ISO date written with a Unicode hyphen states no figure
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
The run grader skips the parts of an ISO date when it reads the figures a reply states, but it matched only the ASCII `-`. A reply that wrote a date with the non-breaking hyphen U+2011 (or the hyphen U+2010), as a typeset answer does, had its year, month and day read as three figures, so a correct decline was graded "stated a figure the data cannot support". Such a date is now read as a date; a figure range joined by the same hyphen still reads as figures.

‎packages/qa/scenarios/src/score/scenario-run-grade.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ const UNIT: Readonly<Record<string, number>> = {
119119
* An ISO date, with its time when it carries one (`2026-07-06`,
120120
* `2026-07-06T09:30:00Z`). A date states no figure: its year, month and day
121121
* are not counts or amounts, so {@link readingsIn} reads none of its parts.
122+
* Its parts may be joined by the Unicode hyphens a typeset reply writes in
123+
* place of `-` (U+2010 hyphen, U+2011 non-breaking hyphen): such a date is the
124+
* same date, and reading its parts would charge the reply with three figures.
122125
*/
123-
const ISO_DATE = /\b\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?\b/g;
126+
const ISO_DATE = /\b\d{4}[-\u2010\u2011]\d{2}[-\u2010\u2011]\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?\b/g;
124127

125128
/** An English month name, capitalised as a date writes it, full or short (`December`, `Dec`, `Sept`). */
126129
const MONTH = '(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)';

‎packages/qa/scenarios/test/score/scenario-run-grade.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,14 @@ describe('QA scenario round 1 (2026-11-09): correct replies the scorer failed',
374374
expect(numbersIn('Rows 12-15 of 120.')).toEqual([12, 15, 120]);
375375
});
376376

377+
it('an ISO date joined by a Unicode hyphen states no figure either', () => {
378+
// A typeset reply writes U+2011 (non-breaking hyphen) or U+2010 between the parts.
379+
expect(numbersIn('September orders, 2026\u201109\u201101 to 2026\u201109\u201130, total 28.')).toEqual([28]);
380+
expect(numbersIn('Filed on 2026\u201010\u201003 for 3 days.')).toEqual([3]);
381+
// Not a date: a figure range joined by the same hyphen still reads.
382+
expect(numbersIn('Rows 12\u201115 of 120.')).toEqual([12, 15, 120]);
383+
});
384+
377385
it("a date in the reply is no figure outside the persona's scope", () => {
378386
const input: PersonaRunInput = { object: 'leave_request', truth: { kind: 'scalar', value: 7 }, personaTruth: { kind: 'scalar', value: 3 }, hidden: {} };
379387
const g = gradePersonaRun(input, turn('You have 3 leave requests; the latest starts on 2026-07-06.\nSource: leave_request'));

0 commit comments

Comments
 (0)