Repository navigation
Commit bfb6e15
test(qa-scenarios): add the service_desk mid-tier scenario card (#30699)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DTzjCSBUc4Ju3BkgVxjuJqB)_
Fixes #30478
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:新增「客服工单」中档场景卡(8 个对象:客户、坐席组、坐席、SLA 策略、升级规则、工单、沟通记录、满意度评价;3
个按行限定的角色;1 个客服绩效仪表板;120 张工单跨 7–10 月;10 道问数、6 个写操作、4 个 agent
动作),并配一份只属于这张卡的真值测试。
- **为什么改**:落实 cloud#3600 九个场景中的客服场景,让 AI 建应用、问数、代办写操作都有一张能用代码判分的客服工单卡。
- **风险与回滚**:只加测试数据和测试,所在包私有、不发布,运行时零改动;回滚即删两个新文件。
- **先看**:① `docs/qa/scenarios/service_desk.json` 的
`run.questions`、`run.personas` 与 `run.operations`;②
`packages/qa/scenarios/test/service-desk.test.ts` 的 `EXPECTED_TRUTHS`
与种子一致性用例;③ 同卡的 `$comment`(种子生成规则,真值据此手算)。
- **两分钟验证**:`pnpm --filter @objectstack/scenarios test`,预期 5 个测试文件、70
个用例全绿。
- **需要你做的**:无,席位落地。
## What changes
- `docs/qa/scenarios/service_desk.json` (new): the 客服工单 service-desk
mid-tier card.
- Eight objects: `customer`, `agent_group`, `agent`, `sla_policy`,
`escalation_rule`, `ticket`, `ticket_comment` (the ticket's lines:
customer messages, public replies and internal notes, each with the
minutes logged) and `satisfaction_rating`.
- Automation stated in the prompt and seeded: the SLA policy follows the
priority, a breach is a resolution later than the policy's target, an
active escalation rule moves an urgent (8 h) or high (24 h) ticket still
unresolved into Tier 2, and resolving a ticket sends a survey.
- Three personas, all row-scoped: `support_agent` (a02, own tickets),
`team_lead` (a04, the Technical group) and `portal_customer` (cus_03,
own company's tickets and public comments only; no internal notes,
minutes, escalation rules or contract values).
- Seed: 120 tickets opened July to October 2026, plus 249 comments, 102
surveys and the small reference tables. 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 knowledge-base articles.
- `packages/qa/scenarios/test/service-desk.test.ts` (new): this card's
own test file.
- It pins all 10 computed truths and the 11 per-persona truths against
hand-worked values; the derivations sit next to the pins.
- It asserts the mid-tier floor and the seed's consistency with its own
rules: SLA policy per priority, breach versus target, escalation versus
the active rules (no unresolved urgent or high ticket outside Tier 2),
group versus assignee, reply minutes per priority, and exactly one
survey per resolved or closed ticket.
- It asserts that no seeded row satisfies any created-row `where` in an
operation's post-state, so a grader reading the post-state back can only
match the write.
- It shows that a wrong seed cell or a wrong truth spec in a fixture
copy goes red against the pins.
- `test/library.test.ts`, the schema, the loader and the evaluator are
unchanged.
## Tests
`pnpm --filter @objectstack/scenarios test`: 5 files, 70 tests passed,
at head `aa0ceb23b9`.
`pnpm --filter @objectstack/scenarios typecheck`: exit 0 at the same
head, after building the closure.
## Acceptance notes
- **File name.** The card is `service_desk.json`, not the issue's
`service-desk.json`: a card `id` is a snake_case machine name equal to
the file's basename (the `travel_expense` landing note on the sibling
card).
- **No schema field for some floor items.** The schema has no `expect`
key for a flow, for "declarative preferred", or for a report as distinct
from a dashboard. The card states them in `prompt.detailed` (zh and en)
and in `capabilities`, seeds `escalation_rule` as an expected object,
and declares the report under `expect.dashboards`. Nothing in the loader
grades them.
- **Seven operation kinds, six operations.** `log_ticket_from_call` is
the entry from free text with lines (the ticket plus two comment lines).
`reply_then_resolve` is both the workflow step and the multi-step chain:
a reply, the resolution, and the survey the resolution sends. Its
progress query is `tk_0108_owner`.
- **A breach is judged at resolution.** `sla_breached` is set only on
resolved or closed tickets. The three October tickets still open in Tier
2 (91, 103, 111) carry `null`, so `breaches_by_customer_tier` counts 9
tickets, not 12. This is the card's stated formula, not an omission.
- **All three personas are row-scoped.** That is the top of the floor's
2-3 band. The support manager the prompt names, who alone sees hourly
costs, is not a persona.
- **Capability names.** Only the area half of a tag is a closed set.
`records-forms.master-detail-atomic-save` and
`automation.time-relative-trigger` are checklist item ids. The other
names follow the travel-expense card's spelling.
- **Unreachable reference.** `objectstack-ai/templates` is outside this
session's repository scope, so the domain is designed from the card text
alone.
## Verification
<details>
<summary>scenarios test + typecheck (head aa0ceb2)</summary>
```
Test Files 5 passed (5)
Tests 70 passed (70)
> tsc --noEmit
os-verify-lock: VERDICT command-exit 0
```
</details>
<details>
<summary>dispatch-gates --commands (50 commands, local, head
aa0ceb2)</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.
On the first pass (head 155b1dd) four of them exited 3 (PREREQUISITE
NOT MET), not red. Each exits 0 on this head after the step it names:
- `check-plugin-teardown-shape.mjs --self-test`, after `git fetch
--unshallow origin main`;
- `check:doc-formula-expressions`, `check:lean-entry-closure` and
`check:dual-build-cjs-loads`, after a full `turbo run build` (118 of 118
tasks).
`origin/main` (b77c160) is merged in; it touches neither `docs/qa/`
nor `packages/qa/`.
</details>
Changed lines: 1176 (+1176 / -0, 2 files), under the 3000 threshold.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4d1qKzjKPZvxpJsifYa)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent e9731fc commit bfb6e15
2 files changed
Lines changed: 1176 additions & 0 deletions
0 commit comments