diff --git a/.changeset/36206-unicode-hyphen-date.md b/.changeset/36206-unicode-hyphen-date.md new file mode 100644 index 00000000000..b85f2f9c0ed --- /dev/null +++ b/.changeset/36206-unicode-hyphen-date.md @@ -0,0 +1,10 @@ +--- +'@objectstack/scenarios': patch +--- + +fix(scenarios): an ISO date written with a Unicode hyphen states no figure + +Clause-②: no +Metadata-protocol: none + +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. diff --git a/packages/qa/scenarios/src/score/scenario-run-grade.ts b/packages/qa/scenarios/src/score/scenario-run-grade.ts index 4fafec30520..1854ffadf39 100644 --- a/packages/qa/scenarios/src/score/scenario-run-grade.ts +++ b/packages/qa/scenarios/src/score/scenario-run-grade.ts @@ -119,8 +119,11 @@ const UNIT: Readonly> = { * An ISO date, with its time when it carries one (`2026-07-06`, * `2026-07-06T09:30:00Z`). A date states no figure: its year, month and day * are not counts or amounts, so {@link readingsIn} reads none of its parts. + * Its parts may be joined by the Unicode hyphens a typeset reply writes in + * place of `-` (U+2010 hyphen, U+2011 non-breaking hyphen): such a date is the + * same date, and reading its parts would charge the reply with three figures. */ -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; +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; /** An English month name, capitalised as a date writes it, full or short (`December`, `Dec`, `Sept`). */ const MONTH = '(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:t(?:ember)?)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)'; diff --git a/packages/qa/scenarios/test/score/scenario-run-grade.test.ts b/packages/qa/scenarios/test/score/scenario-run-grade.test.ts index 48e9b1dc483..03e2c070548 100644 --- a/packages/qa/scenarios/test/score/scenario-run-grade.test.ts +++ b/packages/qa/scenarios/test/score/scenario-run-grade.test.ts @@ -374,6 +374,14 @@ describe('QA scenario round 1 (2026-11-09): correct replies the scorer failed', expect(numbersIn('Rows 12-15 of 120.')).toEqual([12, 15, 120]); }); + it('an ISO date joined by a Unicode hyphen states no figure either', () => { + // A typeset reply writes U+2011 (non-breaking hyphen) or U+2010 between the parts. + expect(numbersIn('September orders, 2026\u201109\u201101 to 2026\u201109\u201130, total 28.')).toEqual([28]); + expect(numbersIn('Filed on 2026\u201010\u201003 for 3 days.')).toEqual([3]); + // Not a date: a figure range joined by the same hyphen still reads. + expect(numbersIn('Rows 12\u201115 of 120.')).toEqual([12, 15, 120]); + }); + it("a date in the reply is no figure outside the persona's scope", () => { const input: PersonaRunInput = { object: 'leave_request', truth: { kind: 'scalar', value: 7 }, personaTruth: { kind: 'scalar', value: 3 }, hidden: {} }; const g = gradePersonaRun(input, turn('You have 3 leave requests; the latest starts on 2026-07-06.\nSource: leave_request'));