Skip to content

feat(scenarios): the scorecard sums the ask side's cost and time per served model, and the authoring turns' time, and states each Run half's guardrail - #33872

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-dg3roj
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-dg3roj

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

epic:#33595#1 · os-tesla · session_01L9qibxnX5BL9CTRGBRRYAd

Clause-②: yes (widening) — new exports TurnCost, TurnTime, ModelSpend, AskSpend, turnCost, turnTime, askSpend, authorTimeText, askCostText and askTimeText (scorecard.ts), with AuthorCost now a type alias of TurnCost (same shape); new optional fields ModeScorecard.authorTime / askSpend and CardScorecard.authorTime / askSpend (scorecard.ts), TurnSummary.reportedDurationMs / reportedApiDurationMs (orchestrate.ts) and ParsedTurn.meta.reportedDurationMs / reportedApiDurationMs (transcript.ts); for the guardrail line, the new export guardrailTally, type GuardrailVerdict and optional field HalfScores.guardrails (scorecard.ts); all reached through ./runner (src/runner/index.ts re-exports the three files). No CLI flag.
Metadata-protocol: none

Fixes #33740

维护者速读

  • 改了什么:评分表在「Author cost」旁边新增「Author time」「Ask cost」「Ask time」三行(每个模式一格),表头也多了 author time / ask cost / ask time 三行(整张卡)。问数和操作这一侧的花费与耗时按实际服务的模型分组,例如 claude-haiku-5-5: $0.17 over 28 ask turns、8m 05s over 28 ask turns。每一轮还记下 CLI 自己报告的时长(duration_ms / duration_api_ms)。另按席位要求并入刚合并的 Scenario grader: the injection_as_data guardrail every card declares is never graded #33738:每个 Run 半场一行 guardrail:injection_as_data pass | fail | not measured: 原因。
  • 为什么改:你问过「后续统计是否还要加入花费的时间」。此前评分表只合计搭建侧的花费,问数侧的花费和所有耗时虽然逐轮记在记录里,却没有一行把它们加起来,所以按「每美元、每分钟得分」挑问数模型时看不到便宜模型省了多少、慢了多少。
  • 风险与回滚:纯代码汇总,不调模型、不改评分。时间用跑分器已有的同一个时钟(elapsedMs,进程从启动到退出),没有加第二个时钟。规则同 authorCost:只要有一轮没报花费,这一格就写 not reported;只要有一轮没计时,就写「N of M ask turns not timed」,从不把缺失读成 0,也从不显示偏小的合计。回滚即还原本 PR。
  • 先看:packages/qa/scenarios/src/runner/scorecard.ts 的 turnTime / askSpend(缺失不读成 0 的那两处判断)和 renderScorecard 新增的几行;再看 src/runner/transcript.ts 读 duration_ms 的两行。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/runner/orchestrate.test.ts -t "ask side|guardrail",预期 10 个用例全过。
  • 需要你做的:无,席位落地。

What changes

  • Rows (runner/scorecard.ts): Author time, Ask cost and Ask time beside Author cost, one cell per mode; author time, ask cost and ask time lines under author cost for the card.
    • The ask figures cover every question and operation turn that ran (each with a TurnSummary), the Run half's and the iterate's, grouped by the model each turn was served (TurnSummary.model; a turn whose stream named none groups under MODEL_NOT_REPORTED, and the cell drops the model name when that is the only group). Models are listed most turns first, joined by ; .
    • Cost follows authorCost exactly (turnCost is its body, and authorCost now calls it): a model's cost is stated only when every one of its turns reported one; otherwise not reported (27 of 28 ask turns reported a cost), never a partial sum and never a missing cost read as zero.
    • Time is the runner's existing clock, TurnSummary.elapsedMs (meta.process.elapsedMs, spawn to exit), and nothing else: no second clock. A sum is stated only when every counted turn was timed; otherwise the cell says how many were not (2 of 28 ask turns not timed), never a smaller sum. Author time sums the build and iterate turns as Author cost does.
    • A scorecard written before these fields (the gallery exporter re-renders a record's stored scorecard) reads not recorded in the three new rows and lines; a mode with no persona turn shows —.
  • Guardrail line (runner/scorecard.ts, folded in on the seat's word once Scenario grader: the injection_as_data guardrail every card declares is never graded #33738 merged as 2ae64a6a): each Run half's RunHalf.guardrails becomes HalfScores.guardrails (guardrailTally: pass, fail, or not measured with the check's notMeasured reason, never a pass), rendered as one row per half, Run · guardrails and Iterate · Run · guardrails: guardrail:injection_as_data pass, … fail, … not measured: no turn read the cell democrm_contact.full_name of ct4. A half recorded before the guardrail was graded shows —, and a card none of whose halves carries one has no such row. The grader's detail stays on the half in cardRun; the scorecard carries the verdict only.
  • Per turn (runner/transcript.ts, runner/orchestrate.ts): the claude result line's duration_ms and duration_api_ms are read into meta.reportedDurationMs / reportedApiDurationMs and carried on TurnSummary, beside elapsedMs; absent when the stream states none. The rows do not sum them.
  • Docs: the runner README's Driver and Cost entries, a new Time entry, and the external contract's Usage entry; the changeset.

Tests

  • test/runner/orchestrate.test.ts, new describe (4): every turn timed and costed over both modes, with one question served another model, pins askSpend per mode and for the card, authorTime, the rendered lines and rows, and the record's per-turn elapsedMs / reportedDurationMs / reportedApiDurationMs / reportedCostUsd; one question untimed, one operation uncosted and one authoring turn untimed pin the "not timed" and "not reported" cells (no ms, no usd, no smaller sum) while the other model's sums stand; turns with no model, cost or process, and a scorecard written before the fields (not recorded); a model not named beside a named one, and — for no persona turn.
  • test/runner/orchestrate.test.ts, in Scenario grader: the injection_as_data guardrail every card declares is never graded #33738's runHalf guardrail describe (+1): three real runHalf halves of the crm card (an export of the addresses, one contact named, no read) and one stripped of its guardrails pin fail, pass, not measured: <reason> and nothing, the two rendered rows, the record's scorecard verdict beside the half's detail, and no row at all for a card whose halves carry none.
  • test/runner/units.test.ts: parseStreamJson reads duration_ms / duration_api_ms off a result line in the shape Claude Code 2.1.325 printed (measured below), and states none when the result line has none or there is no result line.

Acceptance notes

  • Premise (order: measure first). The card says no turn records elapsed time; main already records it, so this PR builds on it. Per driver, read on 6ec7b93c: claude, codex and external: all run the turn through runTurnProcess, which stamps meta.process.elapsedMs, and summarize copies it to TurnSummary.elapsedMs; recorded: hands back the recorded turn, so a replay carries the recorded run's time, and a recording made before process existed carries none (not timed, never zero). Cost: claude reads total_cost_usd; external: reports reportedCostUsd when the command does; codex reports none (its turn.completed carries usage only), so a codex run reads not reported. In the 15 recordings of eval#1's 2026-11-15 model and effort runs (claude-code-cli 2.1.325), all 30 author turns and all 444 persona turns carry both elapsedMs and a cost (out-33740/measure.py). No recording carries the CLI's duration (the parser dropped it until now).
  • The CLI's own durations are recorded, not summed: the runner's clock includes the CLI's start-up (5,824 ms against the CLI's duration_ms 4,366 on one turn), and two clocks in one row would read as one. Whether a row should also show duration_api_ms (model time apart from tool time) is open for a later card.
  • --driver external: has no duration field in its contract (ExternalTurnSchema is strict), and none is added: the runner times the command itself. --driver codex states no duration.
  • The Author time / Author cost rows are not split by served model; the author row already names the served model, and the card asks the grouping of the ask rows.
  • #33738's guardrail line is folded in: PR feat(scenarios): grade the injection_as_data guardrail every card declares #33843 merged (2ae64a6a) as this PR opened, and the seat asked for it. origin/main was merged a second time for it (be8db5bf), which also brought feat(scenarios): grade the injection_as_data guardrail every card declares #33843's own orchestrate.ts / orchestrate.test.ts changes; it merged clean.
  • The gallery page's own - Author cost line (export/exporter.ts) is unchanged; its scorecard table gains the rows through renderScorecard.

Verification

Measured on eval#1's records and on the CLI
  • One headless claude -p --output-format stream-json turn (Claude Code 2.1.325, --model haiku, 2026-11-15): result line duration_ms 4366, duration_api_ms 1881, total_cost_usd 0.0038; the runner-style wall clock read 5,824 ms.
  • The built ./runner re-scoring the nine stored run records of /mnt/project-files/eval/runs/2026-11-15-models/ (scratch, three control cards per model) on 38a88c33: ask cost and time per card — haiku $0.17 / 8m 05s, $0.21 / 11m 25s, $0.16 / 7m 26s; sonnet $2.31 / 7m 01s, $2.95 / 6m 54s, $2.25 / 6m 00s; opus $5.27 / 6m 13s, $6.73 / 7m 16s, $5.32 / 6m 18s (crm, invoice, project; 28 / 32 / 28 ask turns). Script and output: out-33740/real-rows.mjs, out-33740/real-rows-38a88c33.txt in the seat's folder.
Ablation
  • node scripts/ablation-replace.mjs, each restored with git diff HEAD empty and the blob equal to HEAD; the tests import src, so no build leg:
    • turnTime: turns.length > 0 && times.length === turns.length ? { ms: → turns.length > 0 ? { ms: (an untimed turn read as zero): 2 failed / 2 passed of the new describe;
    • transcript.ts: deleting the duration_ms read: the parse test failed (1 failed);
    • orchestrate.ts summarize: deleting the reportedDurationMs copy: 1 failed / 3 passed;
    • guardrailTally: c.pass ? 'pass' : 'fail' → always 'pass': 1 failed / 5 passed of the guardrail describe;
    • guardrailTally: the notMeasured branch made unreachable (a not-measured check read as fail): 1 failed / 5 passed.
Local gates
  • On head 78734648 (after the second merge of origin/main, be8db5bf, and a rebuild of the package and its closure): pnpm --filter @objectstack/scenarios typecheck :: exit 0; vitest run --maxWorkers=2 :: exit 0, Test Files 34 passed (34), Tests 865 passed (865); eslint --no-inline-config on the five touched TS files :: exit 0.
  • Derived gates (dispatch-gates --commands --repo objectstack-ai/objectstack on 78734648, 7 paths, 62 families, the same list as on 38a88c33): 62 exit 0. --ran: "62 derived famil(ies) accounted for — 62 run, 0 NOT-MEASURED". Record: out-33740/gates-ran-78734648.list. (On the first head, 38a88c33, check:dual-build-cjs-loads was NOT MEASURED, exit 3, before the closure was built; record out-33740/gates-ran-38a88c33.list.)
  • Merged origin/main before opening (38a88c33, nothing under packages/qa/scenarios) and again for Scenario grader: the injection_as_data guardrail every card declares is never graded #33738 (be8db5bf, clean).
  • 483 changed lines (+463/-20), 7 files, no governed surface.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/scenarios, touching 35 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/jobs.mdx (via duration_ms (literal, a string literal in a comment on a changed line))
What this run could not see
  • 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md) — pages documenting those are invisible to this run
  • 9 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 1 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 a32d50b666b05aa108417ba16c2b71285cbee87e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b4050eaab27b3597f9cd7db029b5382267aa3ce9 — the merge of head 78734648ae2c64a9a62e806e0c54c29aff099b60 into base a32d50b666b05aa108417ba16c2b71285cbee87e, 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 b4050eaab27b3597f9cd7db029b5382267aa3ce9 && git checkout b4050eaab27b3597f9cd7db029b5382267aa3ce9
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a32d50b666b05aa108417ba16c2b71285cbee87e 78734648ae2c64a9a62e806e0c54c29aff099b60 && git checkout -B drift-repro a32d50b666b05aa108417ba16c2b71285cbee87e && git merge --no-ff 78734648ae2c64a9a62e806e0c54c29aff099b60

node scripts/docs-audit/affected-docs.mjs --json a32d50b666b05aa108417ba16c2b71285cbee87e

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs a32d50b666b05aa108417ba16c2b71285cbee87e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet objectstack-fleet Bot changed the title feat(scenarios): the scorecard sums the ask side's cost and time per served model, and the authoring turns' time feat(scenarios): the scorecard sums the ask side's cost and time per served model, and the authoring turns' time, and states each Run half's guardrail Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

epic:#33595#1 · os-tesla · session_01L9qiby1cctpVpRbJzjccvY

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 78734648ae2c64a9a62e806e0c54c29aff099b60
Local-runs: none

① Derived judgments

The Clause-②: yes (widening) line on the changeset and the refreshed PR body is true and complete against the diff. The new exports TurnCost, TurnTime, ModelSpend, AskSpend, turnCost, turnTime, askSpend, authorTimeText, askCostText, askTimeText, guardrailTally and GuardrailVerdict live in scorecard.ts. The new optional fields are ModeScorecard / CardScorecard .authorTime / .askSpend, HalfScores.guardrails, TurnSummary.reportedDurationMs / reportedApiDurationMs and ParsedTurn.meta.reportedDurationMs / reportedApiDurationMs. All reach ./runner through export *. AuthorCost becomes a type alias of TurnCost with the same three fields. authorCost() keeps its signature and result, and authorCostText its output, so no reader changes. The answer that moves is declared. The scorecard adds Author time, Ask cost and Ask time rows per mode and lines per card. Ask figures are grouped by served model over every question and operation turn of the Run half and the iterate. Cost follows the author-cost rule (stated only when every counted turn reported one). Time is the runner's own elapsedMs, stated only when every counted turn was timed, otherwise "N of M not timed", never a smaller sum or a zero. A record written before the rows reads not recorded. The CLI's duration_ms / duration_api_ms are recorded on the turn and not summed. The Run · guardrails / Iterate · Run · guardrails rows state RunHalf.guardrails (#33738) as pass, fail or not measured: <reason>, and are absent when no half carries any.

② Semver level

Patch, as the changeset bumps it. Metadata-protocol: none holds: nothing a metadata author writes (spec, app metadata, card JSON) is added, narrowed or changed in meaning. The widening is additive exports and optional fields of the evaluation package @objectstack/scenarios. No existing export is removed, renamed or narrowed in type.

③ Boundary flags

None. No packages/spec/src/**, no governed path, no runtime or security behaviour of the platform. No grader verdict moves: the scorecard only sums and states what the record already carries. The grader stays deterministic (cloud#3600 cost ruling).

Implemented-by: claude/project-thread-dg3roj
Reviewed-by: session_01L9qiby1cctpVpRbJzjccvY

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

epic:#33595#1 · os-tesla · session_01L9qiby1cctpVpRbJzjccvY

席位核对 · ACCEPT · PR #33872 (#33740) · 2026-11-15T14:22Z

Head-sha: 78734648ae2c64a9a62e806e0c54c29aff099b60 · report 6895083714 · claim 6894028862

  • Form: draft → main. The body (r2, refreshed by the seat through the relay with the seat trailer, read back identical) and the title (the changeset's summary line, same stroke) carry the Clause-②: yes (widening) line naming every new export and field with ./runner, Metadata-protocol: none and Fixes #33740. 7 files inside the claimed surface: src/runner/{scorecard,orchestrate,transcript}.ts, their tests, the runner README and the changeset. Off-limits src/score/**, driver.ts, schema.ts and card JSONs untouched.
  • Premise (thread measured, seat accepted): the card's "no turn records elapsed time" was stale. elapsedMs already timed every live driver's process. The thread built on it with no second clock, and recorded the CLI's own duration_ms / duration_api_ms beside it without summing them.
  • Diff read (seat): ① turnCost generalises authorCost (unchanged result; AuthorCost is now an alias of the same shape); ② turnTime sums elapsedMs only when every counted turn was timed; ③ askSpend groups every question and operation turn of the Run half and the iterate's by served model; ④ the scorecard adds Author time, Ask cost and Ask time rows per mode and lines per card, with not recorded on an older record and "N of M … not timed" / "not reported (…)" instead of a smaller sum or a zero; ⑤ folded in by the seat's order: guardrailTally and the Run · guardrails / Iterate · Run · guardrails rows state RunHalf.guardrails (Scenario grader: the injection_as_data guardrail every card declares is never graded #33738) as pass, fail or not measured: <reason>, absent when no half carries any.
  • Gates: check-runs at this head: 53 — 35 success, 18 skipped, 0 other (read this act); mergeable_state clean. Local (thread): package 865/865, typecheck and eslint exit 0; derived gates 62 families, 62 run, 0 NOT-MEASURED; ablations red.
  • Contract review: declaration face, seat review VERDICT PASS at this head (comment 6895112166).
  • Changeset read sentence by sentence against the diff: the summary line; "summed cost for the authoring turns only" (matches authorCost on main); the rows paragraph and the per-model example (match ③④); the cost rule and the time rule, untimed and older records included (match ①②④); the CLI-duration paragraph (matches transcript.ts / summarize); the guardrail paragraph (matches ⑤). All hold.
  • Landing: K = 11 (git rev-list --count --first-parent a32d50b6..origin/main, PRBASE = Test Core's printed Affected-set diff base); no locale pack. Landed on the maintainer's standing word 「按 pm-dispatch 审过的pr你可以自主落地」 (2026-10-30 14:20Z, spec seat 2 thread): pr_ready + automerge_enable in this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 14:22
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 07225ae Nov 15, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-dg3roj branch November 15, 2026 15:27
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ery run date (objectstack-ai#33999)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9KP2AnyfX9ZJYh48bUsyqbo)_

Fixes objectstack-ai#33793

Clause-②: yes (widening) — new optional key
`ScenarioCardSchema.workingDays` (`.`)
Metadata-protocol: none

## 维护者速读

- 改了什么:场景卡可以声明 `workingDays:
true`;运行器平移这种卡的日期时,今天仍落在运行当天,其余日期按整工作日平移,不再按整天。请假卡 `leave_balances`
声明了它,并把 31 条落在周末的审批日期挪到下一个工作日。
- 为什么改:上一个 PR 按整天平移后,7 个运行日里有 6 天会把请假日落到周末(最多 126/307 条),应用只算周一到周五,于是 6
条真值和余额跟卡上的数字对不上,问句里的「周三」也会变成「周日」。
- 风险与回滚:只动 `packages/qa/scenarios`(运行器、加载器、卡格式多一个可选键,属放宽)和这张卡;别的 6
张带日期的卡不声明,行为不变。回滚即 revert 本 PR。
- 先看:`packages/qa/scenarios/src/runner/run-date.ts` 的
`moveFor`(两种平移的分叉点),`src/loader.ts` 的 `checkWorkingDays`,卡里 31 行
`decided_on`。
- 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run
test/runner/run-date.test.ts`,34 项全过;其中连续 7 个运行日(2026-11-15 到 11-21)各一项。
- 需要你做的:无,席位落地。

## What changes

**Step 1, measured first.** On `origin/main` (895783a), over seven
consecutive run dates 2026-11-15 (a Sunday) to 11-21, the whole-day
rebase puts this card's working days on weekends on six of the seven:
only 11-18 (delta 49, whole weeks) is clean. When a working day lands on
a weekend, the meaning changes in three places:

- **Request days.** The card's prompt has the app sum a request's day
lines "Monday to Friday only". Read that way over the moved seed, 60 to
84 of the 120 requests no longer have the seeded `days`.
- **Balances and truths.** 17 to 22 balances' `used_days` move with
them, and 6 of the 10 truths change: `approved_days`,
`top_annual_takers`, `approved_days_last_month`,
`annual_days_by_department`, `remaining_annual_by_department`,
`lowest_annual_remaining`. The persona truths change too. Only the two
approval-step questions, the medical-note count and the unanswerable one
hold.
- **Asks.** `file_and_submit_from_text` asks for weekend leave on 3 of
the 7 dates ("Sunday 13 December" on 11-15). `half_day_on_draft` targets
a line that falls on a Saturday or Sunday on 2 of the 7, and its request
has a weekend line on a third.

The other dated cards: the open library has 7 dated cards, not 9
(`crm_account_with_contacts` and `project_with_tasks` have no `asOf`).
Searching the 6 others for weekday names, `weekday`/`weekend`/`working
day`/`business day`, `周X`, `工作日` and `周末` gives **0 hits**. Their seeds
already hold 2 to 256 weekend dates each, so none keeps to working days.
`leave_balances` is the only one, with 12 hits.

**Step 2, the fix.** Three ways to fix this, with the measured reason
for the choice:

- **A whole-week delta** is ruled out by the card. It keeps weekdays
only by putting the prompt's today up to three days off the run date.
- **Snapping each moved date to its nearest working day** breaks
multi-day leave. On the same seven dates, 36 to 62 requests get two day
lines on one date (0 only on 11-18).
- **Moving the card by whole working days** keeps every Monday-to-Friday
span intact. This is the one shipped.

Changes:

- **The card format** (`src/schema.ts`): an optional card key,
`workingDays: true`, declared by the author, never inferred. It widens
what `ScenarioCardSchema` (exported from `.`) accepts, hence `Clause-②:
yes (widening)`. The new helpers in `run-date.ts` (`shiftWorkingDays`,
`workingDaysBetween`, `onWorkingDay`) reach no `exports` subpath:
`run-date.ts` is imported only by `src/runner/cli.ts`, and the built
`index`, `runner`, `score`, `score-full` and `export` declarations hold
none of them (`ScenarioCardSchema` found in `index.d.ts` as the positive
control).
- **The loader** (`src/loader.ts`, `checkWorkingDays`) refuses such a
card in two cases:
  - it has no `asOf`;
- `asOf`, or any ISO date under `run` or `iterate`, falls on a Saturday
or Sunday. The refusal names the path and the weekday. A weekend `asOf`
would be counted as the Friday before it, so that Friday and `asOf`
would both move onto the run date.
- **The rebase** (`src/runner/run-date.ts`, `moveFor`). A card without
the key moves exactly as before. A card with it moves like this:
- `asOf` goes onto the run date itself, so the prompt's today is still
the run date. The rebase also refuses a weekend `asOf` on such a card
(it throws) rather than map two dates onto one.
- Every other date moves by `workingDaysBetween(asOf, runDate)` whole
working days (`shiftWorkingDays`). A weekend run date is read as the
Friday before it.
- So a date before the card's today lands before the run date, and a
date after it lands after the run date. Consecutive working days stay
consecutive, and N working days between two dates stay N.
- Ask-text dates move the same way, and their weekday names are written
again (`shiftTextDates` now takes either a day count or the card's
move).
- Truths are recomputed over the moved seed, as before. `scopeFigures`
still stay, because the move maps distinct dates to distinct dates.
- **`docs/qa/scenarios/leave_balances.json`:**
  - It declares `workingDays: true`.
- The seed rule said "decided the day after submission" and "two days
after", which put 31 approval decisions on a Saturday or Sunday. It now
says "the working day after" and "two working days after".
- Exactly those 31 `decided_on` values move. A recomputation of every
step from its request's `submitted_on` changes no other row, and no
truth reads `decided_on`.
- **The two READMEs:**
- `docs/qa/scenarios/README.md`, the card authors' guide, gains a
paragraph. The runner moves a card's dates onto the run date, so an
author must not rely on a fixed calendar date or a weekday name. A card
on working days declares `workingDays`.
- `packages/qa/scenarios/README.md`: its run-date bullet stated the old
limit ("keeps to them only when the delta is whole weeks"). It now
states the contract.
- `.changeset/33793-working-day-rebase.md`: `@objectstack/scenarios`
patch.

## Tests

`packages/qa/scenarios/test/runner/run-date.test.ts`, 34 tests (was 18).

**New: whole working days.** These check `shiftWorkingDays` and
`workingDaysBetween`:

- across a weekend, a month end, a leap day and a year boundary, and
around the epoch week;
- each against an independent walk over the calendar, one day at a time.

**New: `leave_balances` on seven consecutive run dates (2026-11-15 to
11-21).** For each date:

- `asOf` is the run date.
- Every moved date, apart from a value that is the card's today, is a
working day.
- A date before the card's today lands before the run date, and a date
after it lands after.
- Each request's Monday-to-Friday day lines, read independently over the
moved seed, sum to its `days`. Each balance's `used_days` equals its
approved requests' days.
- Every non-calendar truth and every persona truth equals the card's own
figure.
- The English and Chinese asks name working days only. Each named
weekday is that date's own, and the dates are the ones the operation's
values and expected day lines carry.
- The half day the draft's ask names is the date of the line it targets.

**New: loader refusals.** A copy of the card with one leave day on
Saturday 2026-07-04 is refused once, at
`run.seed.leave_day[0].leave_date`. The same copy without `workingDays`
is not refused for it. A copy whose `asOf` is Saturday 2026-10-03 is
refused once, at `asOf`. A copy without `asOf` is refused.

**New: a weekend `asOf` counterexample.** A copy with `asOf` Saturday
2026-11-14 and a leave day on Friday 2026-11-13, run on Wednesday
2026-11-18: counted from that Friday, the Friday itself would move onto
11-18 with `asOf`. The rebase throws on it (`asOf 2026-11-14 is a
weekend`), and the loader refuses the same card once, at `asOf`.

**Forced edits to existing tests**, named:

- `every dated card, rebased onto each run date › run on DATE` (nine
tests). The leaf check and the calendar-window reading-back used one
whole-day delta for every card. They now read each card's move
independently: whole days, or for a `workingDays` card a walk over
working days. Only the title words changed otherwise.
- `the asks that write a date say the moved one…`: the leave pins were
the defect. On 2026-11-15 they now read "Friday 11 December and the
morning of Monday 14 December" (was Sunday 13) and "(3 December)" (was 5
December).

**Ablations**, each through `scripts/ablation-replace.mjs`, each
restored with blob equal to HEAD and an empty `git diff HEAD`:

- The loader's `asOf` check deleted: 2 of 34 red, the two loader
refusals of a weekend `asOf`.
- The rebase's weekend-`asOf` guard disabled: 1 of 34 red, the rebase
counterexample.
- At the first round's head, with `moveFor` forced to the whole-day
branch, 16 of the 31 tests went red. Those were the 9 every-dated-card
runs, the ask pins, and 6 of the 7 seven-day runs; 11-18 stayed green,
as the measurement predicts (blob 500440c to 2899d999).

## Deviations

- `packages/qa/scenarios/src/schema.ts` is outside the claim's file
surface. The card-level flag the claim allows can only live there,
because the card is a strict object the loader parses against that
schema (+6 lines, one optional key). The seat accepted this.
- The key's name, `workingDays: true`, was proposed here with `rebase:
"working_days"` and `dates: "working_days"` as alternatives. The seat
chose `workingDays`.

## Acceptance notes

- **Weekend run dates.** On a Saturday or Sunday run, the card's other
dates move as they would for the Friday before it. So 11-20 and 11-21
seed identically, and the moved data ends up to two days nearer the run
date than the card wrote it. Nothing seeded before the card's today
moves past the run date, which is objectstack-ai#33753's invariant.
- **Hire dates still move.** The rebase moves `hire_date` (whole days
before, working days now). `leave_year` (`2026/27`) and the 1 July
service rule live in the prompt and the strings, which are not moved. On
a run date about nine months or more after `asOf`, the moved leave falls
into the next leave year while the balances still say 2026/27. This was
the same before this change and is a property of the shipped rebase, not
of the weekday defect. Noted, not filed.
- The `$comment` seed rule ("working day … of July") still describes the
card's own dates. Like the prompt, it is never moved.

## Verification

<details><summary>Step 1 readings (origin/main 895783a, then this
head)</summary>

Measured with a throwaway script over `loadScenarios` +
`rebaseScenario`, not committed.

```text
origin/main, whole-day rebase:
2026-11-15 Sun delta=46 leave_day_weekend=126/307 req_days_changed=84 balances_changed=20 truths_changed=6 weekend_ask=file_and_submit_from_text
2026-11-16 Mon delta=47 leave_day_weekend=123/307 req_days_changed=82 balances_changed=22 truths_changed=6
2026-11-17 Tue delta=48 leave_day_weekend=60/307  req_days_changed=60 balances_changed=19 truths_changed=6
2026-11-18 Wed delta=49 leave_day_weekend=0/307   req_days_changed=0  balances_changed=0  truths_changed=0
2026-11-19 Thu delta=50 leave_day_weekend=60/307  req_days_changed=60 balances_changed=17 truths_changed=6
2026-11-20 Fri delta=51 leave_day_weekend=121/307 req_days_changed=81 balances_changed=20 truths_changed=6 weekend_ask=file_and_submit_from_text
2026-11-21 Sat delta=52 leave_day_weekend=124/307 req_days_changed=83 balances_changed=20 truths_changed=6 weekend_ask=file_and_submit_from_text
per-date nearest-working-day snap, requests with two lines on one date: 62 39 39 0 36 37 62
this head, working-day rebase: every one of the seven reads 0 / 0 / 0 / 0 / 0, no weekend ask
other dated cards (weekday words · weekend dates in the seed): asset_lifecycle 0·216, invoice_with_line_items 0·2, order_to_cash 0·133, requisition_to_receipt 0·147, service_desk 0·172, travel_expense 0·256
```
</details>

Head `6588d4fe1` merges `origin/main` b4ce310 (clean, merge not
rebase) on top of patch round 1 (`977f6bf6e`). The earlier merge,
`1b082ce44`, took in `origin/main` b8ac0e2 cleanly after PR objectstack-ai#33872
landed; that PR also edits `packages/qa/scenarios/README.md`.

- At `6588d4fe1`, after `pnpm install --frozen-lockfile` (the merge
moved `pnpm-lock.yaml`) and a rebuild of `@objectstack/scenarios` with
its dependency closure: `vitest run` 34 files, 881 tests, exit 0; `tsc
--noEmit` exit 0.
- At `977f6bf6e`, derived by `node scripts/pm/dispatch-gates.mjs
--commands --repo objectstack-ai/objectstack` on this diff (the same 65
families at every head): `dispatch-gates --ran` 65 derived, 65 run, 0
NOT-MEASURED, every one exit 0. The full `pnpm build` (119/119 tasks)
was done at `1b082ce44`. At `bc00b2a13`, two families had first answered
exit 3 (prerequisite not met) and passed once it was built:
`check-plugin-teardown-shape.mjs --self-test` after `git fetch
--unshallow`, and `pnpm check:dual-build-cjs-loads` after the full
build.
- `pnpm exec eslint` on `run-date.ts`, `loader.ts`, `schema.ts` and
`run-date.test.ts`: exit 0 (no diff of these since `977f6bf6e`).
- CI families are read off this PR's check runs by the seat.

Full record: `/mnt/project-files/devx-seat1/33793-gates-ran.txt`.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(the card key is a Zod field in `packages/qa/scenarios/src/schema.ts`;
`packages/spec` not touched)
- [x] 2. Every name I added uses the casing for its kind. (`workingDays`
card key and `shiftWorkingDays`, `workingDaysBetween`, `onWorkingDay`:
camelCase)
- [x] 3. No formatter ran; `pnpm lint` passes. (eslint on the four
touched source and test files: exit 0; the repo-wide run is CI's)
- [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.
(`.changeset/33793-working-day-rebase.md`, `@objectstack/scenarios`
patch)
- [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. (the 维护者速读 block is
the seat's required Chinese summary)
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRWUrXgua6hAwuKweu)_

<!-- signed: domain:devx#2 · os-steve · session_01ADHkmQTVjryTSkqydKVS6z
-->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 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.

Scenario scorecard: sum ask-side time and reported cost per served model

2 participants