Repository navigation
test(qa-scenarios): add the leave_balances mid-tier scenario card - #30690
Conversation
The 请假与假期余额 (leave and balances) card: seven objects (department, employee, leave_type, leave_balance, leave_request, leave_day, approval_step), a route set by the request's days (manager only up to 3 days, manager then HR above), the balance reduced on approval, three personas (two row-scoped), 120 requests from July to October 2026, 10 questions, 6 operations and 4 agent actions. Its own test file pins every computed truth, over all rows and per persona, against hand-worked values, checks the seed against the rules the card states, and shows a wrong seed cell and a wrong truth spec in a fixture copy go red. Claude-Session: https://claude.ai/code/session_016WV4cw5kGUbtDLQqKwTH7E Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
domain:devx#3 · os-elon-musk · session_016WV4cz3RTQjLh7hZBLzgtZ 席位核对 · ACCEPT ·
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 42159595597 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 42161970075 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Elon · project thread
Fixes #30479
Clause-②: no
Metadata-protocol: none
维护者速读
docs/qa/scenarios/leave_balances.json的run.operations(六个写操作及预期结果);② 同文件的run.questions与run.personas;③packages/qa/scenarios/test/leave-balances.test.ts的EXPECTED_TRUTHS。pnpm --filter @objectstack/scenarios test,预期 5 个测试文件、73 个用例全绿。What changes
docs/qa/scenarios/leave_balances.json(new): the 请假与假期余额 leave-and-balances mid-tier card.department,employee,leave_type(annual, sick, personal),leave_balance(one per employee, tracked type and leave year),leave_request,leave_day(one line per date, a full day or a half day) andapproval_step.e13), and a manager's own request goes to the HR manager (e14) at step 1. On the last approval the balance'sused_days(a roll-up of the approved requests) rises andremaining_days(entitlement + carry-over - used) falls.employee(own rows) anddept_manager(own department) carry a row scope;hr_officersees everything except the medical note, which only the requester sees.$comment, so every truth can be worked by hand.iterateadds time off in lieu.packages/qa/scenarios/test/leave-balances.test.ts(new): this card's own test file.LR-0091really exceeds its balance, so the refused submission is a real refusal.wherein an applied post-state matches no seeded row, so it can only name the row the write creates.Why
#30479 is one of the six mid-tier cards of the open scenario library. This one covers HR: leave requests whose approval route depends on their length, and balances that move when a request is approved.
Tests
pnpm --filter @objectstack/scenarios test: 5 files, 73 tests passed.pnpm --filter @objectstack/scenarios typecheck: exit 0, after building the closure withpnpm --filter '@objectstack/scenarios^...' build.eslint --no-inline-configon the new test file: exit 0.Acceptance notes
leave_balances.json, notleave-balances.jsonas the issue spells it: a card'sidis a snake_case machine name that must equal the file's basename. The test file follows the model's spelling,leave-balances.test.ts.travel_expenselanded,library.test.tschecks only that the three control cards are present, and the README's "Adding a card" step points at a per-card test file. So this PR touches neither, and the sibling cards no longer conflict on a shared line.travel_expense, the approval flow, "declarative preferred" and a report as distinct from a dashboard have no field in the schema. The card states them inprompt.detailed(zh and en) and incapabilities, seedsapproval_stepas an expected object, and declares the report underexpect.dashboards. Nothing in the loader grades them.approvals.approval-flow,access-security.row-scope,dashboards.widget-measures,records-forms.lookup), so those tags are judged once the scorer lands. Tags outside that table readunscoredthere, not failed.file_and_submit_from_textcovers two of them: entry from free text with lines, and the multi-step chain (file the request, add a full day and a morning, submit, route to the manager).file_and_submit_from_textdoes not assert the routed step-1 row. Awherecannot name the new request's id, andapprover e05 · pendingalso matches seeded rows.asOfis 2026-09-30, so October's requests are the upcoming ones and every draft or pending request is for future leave; "last month" is August. Balances belong to leave year 2026/27, which starts on 1 July, so the seed is the whole leave year so far. Days count Monday to Friday; public holidays are out of scope and the$commentsays so.objectstack-ai/templatesis not attached to this session, so the domain is designed from the card text alone.Verification
scenarios test + typecheck
one-time check: a wrong cell in the real card goes red
scripts/ablation-replace.mjssetLR-0098'sdaysfrom 5 to 6 indocs/qa/scenarios/leave_balances.jsonand ran this card's test file: 4 of 9 tests failed (the pinned truths, the lines check, the balance check, and the fixture-copy pin, which reads the real card). It then restored the file: blob equal to HEAD,git diff HEADempty.dispatch-gates --commands (50 commands, local, head 42b3e57)
All 50 derived commands exit 0 on head
42b3e57a(the commit before themainmerge). The--ranreconciliation reads: 50 derived, 50 run, 0 NOT-MEASURED, 0 UNRUN, a derived zero because every line recorded its exit code.Four of them first exited 3 (PREREQUISITE NOT MET). Each exited 0 after the step it names:
check-plugin-teardown-shape.mjs --self-test, aftergit fetch --unshallow origin main(the clone was shallow);check:doc-formula-expressions,check:lean-entry-closureandcheck:dual-build-cjs-loads, after a fullturbo run build(119 of 119 tasks).The merge of
main(9 commits) touches neitherdocs/qa/scenarios/norpackages/qa/scenarios/, and the derivation on the merged head9bd3d3c9names the same 50 commands. On that head the scenarios tests (5 files, 73 tests) and typecheck pass again.Changed lines: 1342 (+1342 / -0, 2 files), under the 3000 threshold.
Human Minimum
packages/specholds no runtime logic. (Not touched.)pnpm lintpasses. (eslint on the new test file locally; the repo-wide run is CI's.)main, one pull request.@objectstack/scenariosisprivate: trueand publishes nothing, so no changeset,skip-changeset, astravel_expenselanded.)packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code