Repository navigation
Commit b6ae87c
test(qa-scenarios): add the travel_expense mid-tier scenario card (#30600)
<!-- claude-projects-attribution: {"github_login":"marchtian"} -->
_Requested by **田騏** · [project
thread](https://claude.ai/code/project/chan_01VmuUhXU9SSUzqJYyXSmYSi?thread=cmsg_01VmuUhXU9SSUzqJYyXSmYSiNjyvCdXYygFqntMNR7S2dW)_
Fixes #30476
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:新增「差旅报销」中档场景卡(7 个对象、两级审批、3 个角色其中 2 个按行限定、1 个支出报表、120 张报销单跨
7–10 月、10 道问数、6 个写操作、4 个 agent 动作),并配一份只属于这张卡的真值测试。
- **为什么改**:落实 cloud#3600 九个场景中的财务场景,让 AI 建应用、问数、代办写操作都有一张能用代码判分的差旅报销卡。
- **风险与回滚**:只加测试数据和测试,所在包私有、不发布,运行时零改动;回滚即删两个新文件并还原 `library.test.ts`
一行。
- **先看**:① `docs/qa/scenarios/travel_expense.json` 的 `run.questions` 与
`run.operations`;② `packages/qa/scenarios/test/travel-expense.test.ts` 的
`EXPECTED_TRUTHS`;③ `packages/qa/scenarios/test/library.test.ts` 第 102
行(控制卡清单加了本卡)。
- **两分钟验证**:`pnpm --filter @objectstack/scenarios test`,预期 4 个测试文件、64
个用例全绿。
- **需要你做的**:无,席位落地。
## What changes
- `docs/qa/scenarios/travel_expense.json` (new): the 差旅报销 travel-expense
mid-tier card.
- Seven objects: `department`, `employee`, `travel_standard` (a cap per
grade and expense type), `trip_request`, `expense_claim`, `claim_line`
and `approval_step` (the two-step approval: department manager, then
Finance).
- Three personas: `employee` (own rows) and `dept_manager` (own
department) carry a row scope; `finance_officer` sees every claim but no
trip request.
- Seed: 120 claims dated July to October 2026, plus 280 lines, 204
approval steps and 126 trips. The arithmetic rule that generated it is
stated in the card's `$comment`, so every truth can be worked by hand.
- Run half: 10 questions, 6 operations and 4 agent actions (one
confirm-gated); `iterate` adds travel advances.
- `packages/qa/scenarios/test/travel-expense.test.ts` (new): this card's
own test file.
- It pins all 10 computed truths and the 7 per-persona truths against
hand-worked values.
- It asserts the mid-tier floor and the seed's own consistency: each
claim total is the sum of its lines, and a line is `over_standard`
exactly when it is above the grade cap.
- It shows that a wrong seed cell or a wrong truth spec in a fixture
copy goes red against those pins.
- `packages/qa/scenarios/test/library.test.ts`: one line. The
library-wide test asserts the exact set of loaded card ids, so
`travel_expense` is added to that list. Its truths are pinned in the
card's own file, not here.
## Tests
`pnpm --filter @objectstack/scenarios test`: 4 files, 64 tests passed.
`pnpm --filter @objectstack/scenarios typecheck`: exit 0, after building
the closure with `pnpm --filter '@objectstack/scenarios^...' build`.
## Acceptance notes
- **File name.** The card is `travel_expense.json`, not
`travel-expense.json` as the issue spells it. A card's `id` must be a
snake_case machine name, and the loader requires it to equal the file's
basename, so a hyphenated basename cannot load. The schema was not
changed.
- **No schema field for some floor items.** Three floor items have no
field in the schema:
- an approval or automation flow as a structural expectation;
- "declarative preferred";
- a report as distinct from a dashboard.
The card states them in `prompt.detailed` (zh and en) and in
`capabilities`, seeds `approval_step` as an expected object, and
declares the report under `expect.dashboards`. Nothing in the loader
grades them.
- **Seven operation kinds, six operations.** The issue names seven
operation kinds and caps the card at six operations. So
`file_and_submit_from_text` covers two of them: entry from free text
with lines, and the multi-step chain (file, add two lines, submit, route
to the manager).
- **Routed approval step not asserted.** The post-state of
`file_and_submit_from_text` does not assert the routed step-1 row. A
`where` cannot name the new claim's id, and `step 1 · approver e01 ·
pending` also matches a seeded row.
- **README step 3.** `docs/qa/scenarios/README.md` "Adding a card" step
3 says to add a card's truths to `test/library.test.ts`, but this card's
truths live in its own file. The README is unchanged here.
- **Sibling cards.** Every sibling mid-tier card has to edit the same
`library.test.ts` line, so their PRs will conflict on it in turn.
- **Unreachable references.** `objectstack-ai/templates` and
`objectstack-ai/cloud` answer 403 from this session. The domain is
designed from the card text alone, and the rulings are applied as the
card states them.
## Verification
<details>
<summary>scenarios test + typecheck (head 130acb8)</summary>
```
Test Files 4 passed (4)
Tests 64 passed (64)
> tsc --noEmit
os-verify-lock: VERDICT command-exit 0
```
</details>
<details>
<summary>dispatch-gates --commands (50 commands, local)</summary>
All 50 derived commands exit 0. The `--ran` reconciliation reads: 50
derived, 50 run, 0 NOT-MEASURED, 0 UNRUN, a derived zero because every
line recorded its exit code.
Three of them first exited 3 (PREREQUISITE NOT MET: a dist was not
built). Each exited 0 after the build it names:
- `check:doc-formula-expressions`, after building `@objectstack/formula`
and `@objectstack/lint`;
- `check:lean-entry-closure`, after building `@objectstack/objectql`;
- `check:dual-build-cjs-loads`, after a full `turbo run build`.
Changed lines: 1337 (+1336 / -1, 3 files), under the 3000 threshold.
</details>
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 135c2fb commit b6ae87c
4 files changed
Lines changed: 1343 additions & 3 deletions
File tree
- docs/qa/scenarios
- packages/qa/scenarios/test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
0 commit comments