Skip to content

fix(scenarios): each card persona's role states the writes its build prompt did not - #33707

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-y21qmf
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-y21qmf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Clause-②: no
Metadata-protocol: none

Fixes #33597

The order's HOLD is lifted: eval#1 recorded its replay on main 36936440 (mailbox #33602, comment 6890573292).

维护者速读

  • 改了什么:13 个场景卡角色的 role 文字补上了它要做或被禁止做的写操作(对象 + 动词),另加一个测试:每张卡的每个写操作都必须在该卡的构建 prompt 里写明。
  • 为什么改:feat(scenarios): check each persona's permission set against what the card has it read and write #33630 让 Build 按卡片检查权限集,但有 19 个写操作在构建 prompt 里根本没提,AI 搭建时无从知道该给这个权限;按 eval#1 的裁定,用角色字符串补上。
  • 风险与回滚:只改卡片 JSON 的 run.personas[].role 和测试,不动 schema、runner、prompt 代码;角色文字也会出现在运行时的“You act for …”里,所以这几个角色的运行 prompt 会变。回滚即 revert。
  • 先看:test/score/scenario-cards.test.ts 末尾的 TRACE 表(40 个写操作各自的出处),以及下方前后对照表。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-cards.test.ts(21 项全绿)。
  • 需要你做的:无;eval#1 的回放已记录,席位审查后合并。

What changes

The rule (done-when 2 of #33597, verbatim): 「The build prompt states nothing new: the grants already trace to the prompt through the data contract (docs/qa/scenarios/README.md "Build checks trace to the prompt"); if a grant does not, the card is fixed instead.」 The library's owner (eval#1, 05:52Z) ruled the carrier: each persona's role string, naming the object and the verbs; no new card field, no schema, runner or prompt change. The seat ruled the scope: a write need is untraced only when the card's whole rendered build prompt (buildPrompt) never states it for that persona; fix those and name them.

Re-derived over every card. personaGrantNeeds over the nine cards of docs/qa/scenarios/ gives 40 write needs (32 needed, 8 refused PERMISSION_DENIED). Each was read against its card's rendered build prompt. 21 are stated by the card's prose; 19 were not, and their persona's role now states them.

Card Persona Write need(s) not stated before Role before Role after
crm_account_with_contacts sdr contact create, update, delete Sales development representative Sales development representative who adds, updates and removes contacts
crm_account_with_contacts partner_user account update (refused) Partner portal user Partner portal user who may not change accounts
invoice_with_line_items sales_rep invoice_line create, delete; invoice update Sales representative Sales representative who adds and removes invoice lines and sends invoices
invoice_with_line_items warehouse_staff invoice update (refused) Warehouse staff Warehouse staff who may read invoices but not change them
project_with_tasks contractor task create, update, delete External contractor External contractor who logs, updates and removes their own tasks
project_with_tasks client_viewer task update (refused) Client stakeholder Client stakeholder who may not change tasks
leave_balances hr_officer leave_request delete HR officer, organization-wide — e13 …, who deletes withdrawn leave requests
leave_balances employee leave_balance update (refused) Employee, Engineering, two years of service — e07 …, who may not change their own leave balance
service_desk team_lead ticket update (reassign, close) Team lead, Technical group — a04 …, who reassigns and closes their group's tickets
service_desk support_agent ticket create (logged from a call) Support agent, Billing group — a02 …, who logs tickets from customer calls
asset_lifecycle asset_admin asset create IT asset administrator, organization-wide - e12 …, who registers assets
asset_lifecycle employee disposal_request update (refused) Employee (asset holder), Sales - e06 …, who may not approve their own disposal requests
travel_expense employee approval_step update (refused) Employee (claimant), Sales, grade g2 — e02 …, who may not approve approval steps on their own claims

The seat's list (seat record 6889635350) named the first seven rows' needs. The re-derivation adds six personas' needs on starter cards, each one the prose does not state for that persona:

  • service desk team lead: the prose says only that a lead "sees" their group's tickets;
  • service desk agent: the prose has the customer raise tickets, not the agent log one;
  • asset create: "Assets are registered" names no one;
  • leave employee balance refusal, asset employee approval refusal, travel employee approval refusal: the prose names who approves or computes, but never says that the employee may not.

The 21 needs the prose states, with the passages, are the TRACES table in the test, for example order_to_cash sales_rep sales_order update refused ← "a rep cannot approve their own order" and travel_expense finance_officer expense_claim update ← "once Finance approves, Finance pays it".

The pin (packages/qa/scenarios/test/score/scenario-cards.test.ts, section 3 TRACE). It maps every write need of the library to where its build prompt states it:

  • ROLE entries: the persona's role, judged by a plain text rule. The role must name the object (its machine name with _ read as a space, plural allowed) and a verb word for that verb class. A refused write also needs a negation ("may not", "but not", "cannot", "never"). The test also checks that the role is rendered in the prompt's persona line.
  • Prose entries: the quoted passages, each required verbatim in the rendered build prompt.

A new write need with no entry, an entry for a need that no longer exists, a role that stops naming its write, or a quoted passage edited out of the prose: each is a red. Limits are stated in the test. The rule reads words, not grammar: it does not check that the verb word governs the object, or which object a negation applies to. A prose trace is a reviewer's reading, pinned so it cannot silently stop being true. The verb word lists are the verbs the library's roles use; a new one is added in the open.

Run prompts move too. role also renders in each operation's run prompt ("You act for ", prompts.ts). The 13 edited personas' run prompts change, on all seven cards touched. The recorded fixture test/runner/fixtures/eval-r1-build-denial.recording.json replays by its replay key (card/mode/half/operation/persona), not by prompt text, so it needed no re-pin, and its suite passes unchanged.

Files. Seven card JSONs, run.personas[].role only (asset_lifecycle, crm_account_with_contacts, invoice_with_line_items, leave_balances, project_with_tasks, service_desk, travel_expense), with no title, zh/en or other prose touched. Plus test/score/scenario-cards.test.ts (the pin) and test/runner/units.test.ts (one pinned prompt line carrying the sdr role). The cards ship in the package's dist/library (scripts/pack-library.mjs; files[] holds dist), so there is a patch changeset. No src/**, schema, runner or prompt code changes.

Verification

Head 7702fe40, one commit on origin/main 36936440 (which holds #33630).

  • pnpm --filter @objectstack/scenarios build exit 0, then pnpm --filter @objectstack/scenarios test: 32 files, 763 passed (packed-tarball.test.ts reads the rebuilt dist/library byte for byte). tsc --noEmit exit 0. Root eslint (--no-inline-config) on the two touched test files exit 0.
  • Ablations through node scripts/ablation-replace.mjs, each restored to the HEAD blob with git diff HEAD empty:
    • the contractor's role back to "External contractor": 1 red;
    • one quoted prose passage reworded ("no agent can change" → "no agent may change" in service_desk.json): 1 red;
    • the leave_balances hr_officer entry deleted from the table: 2 red.
  • Derived gates: dispatch-gates --commands listed 61; each ran with </dev/null. check:cross-package-test-inputs first exited 1: the pin listed docs/qa/scenarios/ with its own readdirSync, a read no declared glob covers. It now loads the library through the package's loadScenarios, as test/library.test.ts does, and the gate re-ran exit 0. All 61 :: exit 0; the --ran reconciliation is 61 derived, 61 run, 0 NOT-MEASURED, 0 UNRUN. Changed lines: 165 (+149 / -16, 10 files).

Acceptance notes

  • The six starter-card needs above go beyond the seat's list; each is named with the reason the prose does not state it. If the owner reads one as stated, its role edit can be reverted, and its table entry becomes a prose quote.
  • The assignee and reviewer steps were skipped by order (relay draft, no reviewers).

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5

@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

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing 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): node scripts/docs-audit/affected-docs.mjs --json 6ff3eee7ca595cf1bb5c47e9fc09bb127c0a57d0 → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对 · ACCEPT · PR #33707 (#33597 round 2) · 2026-11-15T07:11Z

Head-sha: 7702fe4044d18825ecbd2d0ead7565de76cc1c4e · report 6890641277 · claim 6887965873, amendment 6889999778 · seat record 6889635350 · owner's ruling eval#1 (role strings; 2026-11-15 05:52Z) · HOLD lifted by eval#1's replay Notify 6890573292

  • Form: draft → main. The body opens with the attribution block, then the Clause-② / Metadata-protocol lines and Fixes #33597. Round 1 (feat(scenarios): check each persona's permission set against what the card has it read and write #33630, Part-of) is merged, so this round closes the card. 10 files, all inside the amended surface: the run.personas[].role strings of 7 cards, two tests and one changeset. No other card field, no src/**, no schema, no prompt code.
  • Scope (seat ruling at ~06:00Z): a write need is untraced only when the card's FULL rendered build prompt never states it for that persona, not just its role. The thread re-derived 40 write needs over the 9 cards. The prose states 21; 19 were stated nowhere. Those 19 are now carried by 13 personas' roles in 7 cards: the 11 the seat listed, plus client_viewer's refused task update and six starter-card needs, each named with its reason in the PR body. The two starter cards with no change (order_to_cash, requisition_to_receipt) keep their prompts.
  • Diff read (seat): every role keeps its old text and appends the object and the verb. A refused write carries a negation, e.g. "Warehouse staff who may read invoices but not change them", as the owner asked. No title, provenance or other prose changes.
  • The pin (scenario-cards.test.ts §3 TRACE): every write need of the library maps either to ROLE or to verbatim prose quotes in the rendered buildPrompt. ROLE is judged by a stated word rule: the object name, a verb word for that verb, and a negation for a refused need. The rule's limits are written next to it. A need with no entry, a reworded quote, or a reverted role turns it red; the thread ran ablations on all three. This makes done-when 2 hold for every future card.
  • Replay: role also enters the run prompt ("You act for …"). The eval-r1 recording fixture is keyed by card, mode, half, operation and persona, not prompt text, so it needed no re-pin. eval#1 recorded its M1 replay on the old prompts first (6890573292) and runs live confirmation runs on these prompts next.
  • Gates: check-runs at this head: 51 — 35 success, 16 skipped, 0 other (read this act; Lint & Repo Gates and TypeScript Type Check success); mergeable_state clean. Local (thread): package 763/763, typecheck 0, lint 0, derived gates 61/61 exit 0.
  • Contract review: no face. There is no packages/spec/src/**, no governed path, and Clause-②: no (only card data the package ships in dist/library changes; no export or type changes).
  • Changeset: @objectstack/scenarios patch, because the cards ship in dist/library and packed-tarball.test.ts pins them. It names the 13 personas and the run-prompt effect, which matches the diff.
  • Accepted deviations: none.
  • Landing: K = 0 (git rev-list --count --first-parent 6ff3eee7..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.

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 grader: Build does not check that each persona's permission set covers the reads and writes the card gives it

1 participant