Repository navigation
feat(scenarios): check each persona's permission set against what the card has it read and write - #33630
Conversation
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
…'s confirm-gated route Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
📓 Docs Drift CheckThis PR changes 1 package(s): 20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 645cdbcb1c719457c9cdd3b7541d86196f76ef5e && git checkout 645cdbcb1c719457c9cdd3b7541d86196f76ef5e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 279ac14b605117de8e231ca8fdbd9e8287b022ab && git checkout -B drift-repro 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 && git merge --no-ff 279ac14b605117de8e231ca8fdbd9e8287b022ab
node scripts/docs-audit/affected-docs.mjs --json 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2
|
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head ead8d70 · 2026-11-15T05:08Z |
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract reviewServed-tier: Face: declaration only. ① Derived judgmentsPublished surface of
Gates: every check-run on this head concluded success or skipped, with none failed, cancelled or pending. This includes Findings:
② Semver levelClause-②: yes (widening). This matches the diff: exports and an output field are added, and two input fields become optional. Nothing is removed, renamed or tightened, so it is not a narrowing, and no BREAKING banner or ADR-0087 disposition is owed.
③ Boundary flagsDev deviations and acceptance notes (6888503308 and the PR body):
Other items:
Implemented-by: VERDICT: PASS |
…ld evidence Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 279ac14 · 2026-11-15T05:34Z |
|
review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB Contract reviewServed-tier: Face: declaration only. This is the delta over record 6889624779, which reviewed head
I compared each head against its own merge base: ① Derived judgmentsThe earlier findings:
The hop's own change to the published surface:
Gates on this head: 48 check-runs. 19 are success and 16 skipped. None failed or was cancelled. 13 are still in progress: Findings:
② Semver levelClause-②: yes (widening). This still matches the diff. On top of the surface judged in 6889624779 ②, the hop adds evidence entries to an existing
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
epic:#33595#1 · os-tesla · session_01L9qiby1cctpVpRbJzjccvY 席位核对 · ACCEPT · PR #33630 (#33597, Part-of) · 2026-11-15T05:51ZHead-sha:
|
Siblings #33630 and #33669 landed on scorecard.ts and both scenario READMEs. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyuQ5bYYSR8WDVsZCY
…prompt did not (objectstack-ai#33707) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoHnY9LA8HUaCTtrGYLcCo2G)_ Clause-②: no Metadata-protocol: none Fixes objectstack-ai#33597 > The order's HOLD is lifted: eval#1 recorded its replay on `main` `36936440` (mailbox objectstack-ai#33602, comment 6890573292). ## 维护者速读 - 改了什么:13 个场景卡角色的 `role` 文字补上了它要做或被禁止做的写操作(对象 + 动词),另加一个测试:每张卡的每个写操作都必须在该卡的构建 prompt 里写明。 - 为什么改:objectstack-ai#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 objectstack-ai#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 <role>", `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 objectstack-ai#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.com/claude-code) https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5 <!-- signed: epic:objectstack-ai#33595#1 · os-tesla · session_01L9qibxF3yXjruc2fxomWA5 --> Co-authored-by: Claude <noreply@anthropic.com>
…ation gate on an explicit ask meets pending_confirmation (temporary) (objectstack-ai#33706) <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoJsCrsZsoD4xhKCu2LENAFM)_ Fixes objectstack-ai#33676 Clause-②: yes (widening) — the grade accepts a new observation as `pending_confirmation`; new exports `AGENT_CONFIRMATION_MEETS_PENDING`, `askNamesTarget`, `askedFirst`, `confirmedByAgent` and the types `AgentConfirmationRule`, `AgentConfirmedObservation`, `AskNaming` (`./score`, `./score/full`), `actionGatesOf`, `confirmationTally` and `ConfirmationTally` (`./runner`); new optional fields `OperationGrade.confirmation`, `OperationObservation.agentConfirmed`, `GradeOperationOptions.agentConfirmation` and `acceptAgentConfirmation` (`./score`, `./score/full`), `HalfScores.confirmation` and `CardScorecard.confirmation` (`./runner`) Metadata-protocol: none ## 维护者速读 - 改了什么:场景评分器对卡片声明为 `pending_confirmation` 的不可逆操作加一条临时放行:智能体经声明了 `ai.requiresConfirmation: true` 的业务动作、自己带 `confirm: true` 执行,且卡片原文的指令点名了目标行、写入恰好是声明的那一行时,也算通过;每半场和整张卡都分别记「asked first」与「confirmed by the agent」。 - 为什么改:平台今天分不清「人确认」和「调用方自己确认」,画廊三次首发跑里同一操作时过时不过(第 3 次只差这一项),导出卡在智能体的抛硬币上;你已选 A(「同意」),真正的修复是 cloud#3826 第 6 项。 - 风险与回滚:只改已发布评测包 `@objectstack/scenarios` 的评分与运行器(新增导出和可选字段,只加不减),不改卡片 schema 的接受集,不碰平台运行时;回滚:把 `AGENT_CONFIRMATION_MEETS_PENDING` 改成 `false` 即恢复严格,或 revert 本 PR。 - 先看:`packages/qa/scenarios/src/score/scenario-operation-grade.ts` 的 `askNamesTarget` 与 `agentConfirmationChecks`;`src/runner/observe.ts` 的 `agentConfirmedOf`;`src/runner/scorecard.ts` 的确认计数。 - 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-operation-grade.test.ts test/runner/mid-tier-run-readings.test.ts`(95 项全绿)。 - 需要你做的:无,席位落地。 ## What changes **The grade** (`scenario-operation-grade.ts`). For an operation declaring `outcome: pending_confirmation`, an applied write is judged by five checks instead of failing outright; all must pass, and an unobserved fact fails: | Check | Passes when | |:--|:--| | `confirmed-by-agent:explicit-ask` | the ask, as the card authors it, names the target row (`askNamesTarget`, below) | | `confirmed-by-agent:through-action` | the write went through `run_action`, and no raw data door (`create_record`, `update_record`, `delete_record`) applied a write on the object | | `confirmed-by-agent:action-gated` | the build declares `ai.requiresConfirmation: true` on every action that applied it (read from the built artifact; not read ⇒ fail) | | `confirmed-by-agent:confirm-sent` | every such call carried `confirm: true` (the spec's `AI_ACTION_CONFIRMATION_MEMBER`) | | `confirmed-by-agent:rows` | the rows the turn changed on the operation's object are exactly the target, holding the declared `values` (gone, for a `delete`); a value declared as the card's `asOf` is met by the run date only where the platform stamped it, as for `applied` | A pending action with nothing written keeps passing on the old two checks. `refused` operations (oversteps, invalid writes) never reach this branch, so they keep their own outcomes. **Visible** (`OperationGrade.confirmation`, `scorecard.ts`). A passing `pending_confirmation` grade says `asked first` or `confirmed by the agent`. Each half's scorecard carries `confirmation: { askedFirst, confirmedByAgent }`, the Run-operations cells read `1/1 (irreversible: 0 asked first · 1 confirmed by the agent)`, and the card carries the sum on its own line: `irreversible operations: 1 asked first · 1 confirmed by the agent (accepted until real human confirmation lands)`. The run record keeps every grade and check, so it says which way each operation went. **Removable.** One switch, `AGENT_CONFIRMATION_MEETS_PENDING` (true), guarding one function, `agentConfirmationChecks`; both carry a comment pointing to objectstack-ai/cloud#3826 item 6, and both READMEs name them. `false` grades strictly again; `GradeOperationOptions.acceptAgentConfirmation` overrides it per grade (the tests use it). **Observation** (`observe.ts`, `orchestrate.ts`). For a `pending_confirmation` operation the runner now records `agentConfirmed`: each applied `run_action` on the object (the action the door's answer names, so a listed face such as `OBJECT-ACTION` resolves to the action; an answer naming another object is not counted), whether it carried `confirm: true`, the build's gate for it (`actionGatesOf`, from the built artifact the half already holds), each raw door that applied a write there, the changed row ids and the target row after the turn. **Docs.** A JSDoc block on `pending_confirmation` in `src/schema.ts` (no accept set changed), a paragraph in `packages/qa/scenarios/README.md`, and an addition to the outcome list in `docs/qa/scenarios/README.md`. ## Tests - `test/score/scenario-operation-grade.test.ts`, a new top-level `describe`: the four conditions met (pass, `confirmed by the agent`, every check's detail pinned); asked first (pass, `asked first`); each refused shape fails on exactly its check: an ask that names no target; a direct `update_record`; an action declaring no confirmation; an action whose declaration was not read; no `confirm: true`; another row written; a wrong value; the target untouched; a run date the agent wrote itself; a `delete` passing and failing; no observation; the switch off and no card rule (strict as before); a `refused` overstep with the same observation (unchanged). - `test/runner/mid-tier-run-readings.test.ts`, a new top-level `describe` (R4): - every `pending_confirmation` operation in the library (9) names its target by `askNamesTarget`, with the reading pinned for three; controls: an ask naming a value many rows hold, naming nothing, a value inside a longer token ("Gadgets"), and a `create`. - two **recorded** eval round 1 turns, replayed through `RecordedDriver` (`fixtures/eval-r1-confirm-gate.recording.json`, from `/mnt/project-files/eval/runs/2026-11-14/controls.rec.json`, trimmed to the calls the grade reads): `invoice_with_line_items/remove_line` went through `run_action` on `demoinvoice_delete_invoice_line` with `confirm: true` and now passes (`confirmed by the agent`; the recorded build declares `requiresConfirmation: true` on that action; it failed in the round 1 record, and still fails strictly or with the action ungated); `crm_account_with_contacts/remove_ben` went through `delete_record` with `confirm: true` and still fails on `through-action`. - `asset_lifecycle/dispose_scrapped_asset` in the shape of the three gallery runs: the 428 `ACTION_CONFIRMATION_REQUIRED`, the agent's own retry with `confirm: true`, the target written with the run date stamped; asked first; the same write through `update_record`, and one touching another request (both fail); and run 3 re-graded in its shape (the Build half confirmed by the agent, the Iterate half asked first, every half passes, the rendered scorecard says so). ## Verification Head `05abcb83` (merge of main `6ff3eee7`; implementation in `89a474e0` and `24687ca6`). - `pnpm --filter @objectstack/scenarios build && … exec vitest run --maxWorkers=2 && … exec tsc --noEmit -p tsconfig.json` :: exit 0 on `05abcb83`: 32 files, 771/771 tests (750/750 on `24687ca6` before the merge). - `npx eslint --no-inline-config` on the changed TS files :: exit 0. - Ablations (`scripts/ablation-replace.mjs`, each restored to the HEAD blob): drop the `through-action` raw-door guard → 2 of 95 fail; loosen the ask's uniqueness (`left.length !== 1`) → 1 fails; let other rows through in `rows` (`others.length > 0`) → 2 fail. - Derived gates: `node scripts/pm/dispatch-gates.mjs --commands` gives 67 families; all 67 run with `</dev/null`, all exit 0. Two first exited 3 on a prerequisite, not a defect: `check-plugin-teardown-shape.mjs --self-test` (its pinned fixture `621a4876` was outside the shallow clone; after `git fetch origin 621a487 --depth=1`, 48 cases pass) and `check:dual-build-cjs-loads` (no `dist/`; after `turbo run build --filter='./packages/**' --filter='@objectstack/dogfood^...'`, 123 entry points load). `dispatch-gates --ran` :: exit 0: 67 derived, 67 run, 0 NOT-MEASURED, 0 UNRUN. The gates ran on `24687ca6`; the post-merge derivation is identical. ## Acceptance notes - **The "explicit ask" rule chosen: a property the card authors, never the agent's text.** `askNamesTarget` reads the ask the runner sends (its `en`, else its `zh`, as `operationPrompt` takes it) and the seed. Each text value of the target row that the ask states as a whole token narrows the object's seed rows to the ones holding it, and so does a reference the target holds to another object's seed row that the ask names by one of its own values (`invoice` `i3`, named `INV-003`). The ask names the target when only the target is left. All nine library cards pass it (for example `dispose_scrapped_asset`: name `DR-0004`, asset `AST-0088`, status `approved`; `remove_line`: invoice `INV-003`, product `Gadget`). "Not overreaching" needs no reading here: a write the persona may not make is declared `refused` and keeps that outcome. - **The switch:** `AGENT_CONFIRMATION_MEETS_PENDING` in `packages/qa/scenarios/src/score/scenario-operation-grade.ts`, guarding `agentConfirmationChecks`. - **Ask §5 is already met on main, not edited:** `scenario-tags.ts`'s `ai.agent-actions` tag runs `gradeAgentActions`, which checks `ai.requiresConfirmation === true` (`action:OBJECT.NAME->confirm-gated`) for every card action marked `confirm`; all nine `pending_confirmation` operations have such an action on their object. Per the seat's territory amendment, `scenario-tags.ts` and `scenario-run-grade.ts` are untouched. - **The three gallery recordings were not reachable.** They were recorded in the epic seat's own session and are not in this repository or the project's shared files, so the `asset_lifecycle` fixtures are rebuilt in their shape (the card's table, run 3 in particular). **Re-grading run 3 with `--driver recorded:` is not possible either way:** a recorded replay returns the agent's tool answers without executing them against the booted app, so no row changes and the `rows` check (like every `applied` post-state) cannot pass in a replay. What a replay can show is shown on the two recorded eval turns above. - **"The action's declared effects":** neither the card nor the action metadata declares an action's effects today, so the check judges only the operation's own object (exactly the target changed, holding the declared values). Other fields the action sets on the target, and rows it writes on other objects (the asset row `dispose_asset` marks disposed), are not judged. - **Effect on recorded rounds:** the round 1 `invoice_with_line_items` scratch run's `remove_line` (recorded `run_action` with `confirm: true`) would now pass; the raw `delete_record` deletes with `confirm: true` in the later rounds still fail. - **Exports that remain** (the seat asked for module-private helpers): `AGENT_CONFIRMATION_MEETS_PENDING` (the switch), `askNamesTarget` (read by `score/index.ts` and the tests), `askedFirst` / `confirmedByAgent` (read by `scorecard.ts`), the types `AgentConfirmationRule`, `AgentConfirmedObservation`, `AskNaming` (in exported signatures), `actionGatesOf` and `confirmationTally` (tests), `ConfirmationTally` (in `HalfScores`). `agentConfirmationChecks`, `agentConfirmedOf`, `changedIds` and `confirmationText` are module-private. - **Overlap:** `scorecard.ts` and `packages/qa/scenarios/README.md` with objectstack-ai#33630; `docs/qa/scenarios/README.md` with objectstack-ai#33630 and objectstack-ai#33669. Both landed while this was in flight; main was merged again (`05abcb83`) with no conflict, and the package re-verified. Small additive hunks; the record-note lines objectstack-ai#33630 sits beside were left untouched. - **Deviations:** the signature is a plain `Signed:` line, not an HTML comment (os-dev forbids dev-written HTML comments; as objectstack-ai#33629 / objectstack-ai#33669). Assignee and reviewer steps were skipped by order (relay draft, no reviewers). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibyuQ5bYYSR8WDVsZCY Signed: domain:devx#3 · os-tesla · session_01L9qibyuQ5bYYSR8WDVsZCY --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Tesla · project thread
Clause-②: yes (widening) — additive in-process surface of the published
@objectstack/scenarios, reachable from./score/full(src/score/index.tsre-exportsscenario-tags.ts; the narrow./scoreentry does not) and, forpersonaGrants, from./runnerthroughBuildHalf.score: the functionspersonaGrantNeedsandgradePersonaGrants, the typesPersonaGrantVerbandPersonaGrantNeed, the fieldpersonaGrantsonScenarioArtifactScore, andScenarioArtifactCard['run']accepting optionalquestionsandoperations.scoreScenarioArtifact/scoreCardArtifactanswer differently: theirpassedandtotalnow count the persona grant checks and leave out every not-measured check, so a card's Build score can move../runner'srunRecordlists each persona grant check in the first build's evidence.Metadata-protocol: none
Part-of #33597 (the card stays open for its done-when 2 card-fix round, seat record 6889635350)
维护者速读
persona-grant:<persona>:<object>:<verb>检查,按卡片本身推出每个角色该读、该写、该被拒的对象权限,拿去比对构建出的该角色权限集。@objectstack/scenarios的评分(scenario-tags.ts加测试和文档,另在 runner 的scorecard.ts证据列表加一行,席位在审查后纳入本 PR),不碰 schema、卡片 JSON;回滚即 revert 本 PR。packages/qa/scenarios/src/score/scenario-tags.ts的personaGrantNeeds与gradePersonaGrants,以及下方“九个录制构建前后对比”表。pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-tags.test.ts test/score/scenario-cards.test.ts(111 项全绿)。What changes
scoreCardArtifact/scoreScenarioArtifactgainpersonaGrants: one Build check per persona × object × verb the card implies, namedpersona-grant:<persona>:<object>:<verb>, judged against that persona's own set (<namespace>_<persona id>, the name the runner'spermissionSetNamesigns the persona in with).What the card implies, from the card alone (
personaGrantNeeds):questions[].personas) needsreadon its object, unless the persona hides that whole object (hidden.objects): such a persona declines, it reads nothing;appliedorpending_confirmationneeds its kind (create/update/delete) on its object, foractingAs;PERMISSION_DENIEDmust be refused by that persona's set; any other refusal (VALIDATION_FAILED) implies nothing about the grant.How a check is judged (
gradePersonaGrants). The grant is the platform's own answer: the set is folded by@objectstack/core'sbuildEffectiveObjectPermissions(the map/auth/me/permissionsserves, the'*'wildcard included where the object'saccess.defaultlets it cover), then asked through the spec'sobjectPermissionGrants(edit and delete are read ∧ grant, as the enforcement door folds them). No model judge, no network.when, not editable, no Modify All vote to override it; the platform answers the same 403 from plugin-security's field-level write step). It is not measured when only a row rule could refuse it (an applying write row policy or a row-conditioned field entry), and fails when nothing in the set refuses it.Not-measured checks now leave the card score's
passedandtotal, asCheckResult.notMeasuredalready promises.Files:
packages/qa/scenarios/src/score/scenario-tags.ts, its tests (test/score/scenario-tags.test.ts,test/score/scenario-cards.test.ts),packages/qa/scenarios/README.md,docs/qa/scenarios/README.md(a Grants. bullet under "Build checks trace to the prompt"), one changeset, and one line insrc/runner/scorecard.ts(runRecord's build evidence) with its pin intest/runner/orchestrate.test.ts— the order keptsrc/runner/**off-limits until #33625 merged; the seat took that follow-up (review#2 N4) into this PR after it did. None of the other paths the order puts off-limits (src/schema.ts,scenario-run-grade.ts,scenario-operation-grade.ts,score/index.ts,docs/qa/scenarios/*.json) and nopackages/specor governed path is touched.Why
The first live run of project_with_tasks built a contractor set that reads tasks only; every task write the card gives the contractor came back 403, and the Build half still scored 30/30, because nothing compared the sets against what the card has each persona do. The prompt already asks for it (
packages/qa/scenarios/src/runner/prompts.ts):Fork 1: a
PERMISSION_DENIEDrefusal is not only an absent grantThe platform answers 403
PERMISSION_DENIEDfor an object verb it does not grant, a field the set does not let the caller edit, and a row its policy refuses. The seat ruled option B (seat comment 6888060472): a refused write passes on an absent grant or a field lock on a field it names, is not measured when only a row rule could refuse it, and fails when nothing refuses it.Fork 2: a write the card routes through a confirm-gated action
Ruling A on #31999 item 9 (record 6764953017), quoted:
The three model-built crm builds withhold the sdr's raw contact delete and route it through the card's confirm-gated
delete_contactaction (an action body runs elevated; the MCP/REST action door gates only onrequiredPermissions). The seat first carried ruling A to the Build side as (ii): a withheld write verb on an object where the build declares the card's agent action is not measured. Measured, (ii) erased the target defect: every control card declares an agent action for each write it asks, and the r1 project build declares all three (demoproject_create_task,demoproject_set_task_status,demoproject_delete_task), so r1 would have scored 32/32. The seat then ruled (ii-a), which replaces (ii), with this reasoning:prompts.ts: "Business actions an AI agent may call (expose each to AI; ask before acting where marked)"). They are an optional route, so anappliedwrite stays measured against the grant;pending_confirmationoperation ("ask before acting"). Only there does a missing raw verb count as not measured, with the action named, never a pass.The rule as built: a write verb the set withholds that only
pending_confirmationoperations need, where the card's agent action on that object hasconfirm: trueand the build declares it there by name.Nine recorded builds, before → after
Each recorded build was rebuilt from its recorded source against the published 18.4.0 install (
objectstack build, exit 0 each) and scored withscoreCardArtifactover the namespaced card. "Before" is the Build score without the persona grant checks.demoproject_delete_task)democrm_delete_contact)democrm_delete_contact)democrm_delete_contact)The literal reading (i) would fail the sdr delete on all three model crm builds (27/28, 27/28, 25/27).
The r1 invoice run's 403 on the sales_rep's line create is not an object-grant gap: the set grants create. #33596 records that
add_line's declared values omit the requiredunit_price. These checks read field entries only for writes the card refuses, so that gap is not visible as a Build finding here, and this PR does not widen into it.Verification
Run from the worktree at head
0b8737ea(after mergingorigin/mainat6e287974), with the package closure built (turbo run build --filter='./packages/**' --filter='@objectstack/dogfood^...', exit 0). Headead8d70aafter it changes only the changeset'sClause-②line (to the widening above);check-empty-changesetandcheck-changeset-no-majorre-ran on it, exit 0.pnpm --filter @objectstack/scenarios test— 32 files, 720 passed.tsc --noEmitexit 0. Root eslint (--no-inline-config) on the three changed source/test files exit 0. Of those,test/score/is 198 passed:scenario-tags.test.tspins, on the realproject_with_tasksandrequisition_to_receiptcards:VALIDATION_FAILEDderives nothing);contractor grants no create on task, which operation add_task needs);totaldown by one);delete_taskis not measured with the action named,totaldown by one; with the card action not confirm-gated, or the delete applied outright, it fails; the withheld update stays failed besideset_task_status;'*'wildcard covers a public object and not a private one; the namespaced set name, and a missing set failing every check.scenario-cards.test.ts: the crm control's completed build scores 1; removing the sdr's contact edit or giving the partner user account edit scores lower; removing the sdr's contact delete keeps 1 withtotalandpassedone lower (the confirm-gated route).node scripts/ablation-replace.mjs(each restored to the HEAD blob,git diff HEADempty): forcinggrantedtotrueturned 6 persona tests red; deleting the field-lock return turned the field-lock pin red; deleting theconfirm === truecondition turned 4 red; deleting thepending_confirmation-only condition turned the applied-delete pin red.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstacklisted 63; each ran with</dev/null, all:: exit 0;--ranreconciliation: 63 derived, 63 run, 0 NOT-MEASURED, 0 UNRUN.Acceptance notes
os servealso hands anisDefaultset to every member (appSecurityPluginOptions); in template mode a package-levelisDefaultis a suggestion only. A build that grants through anisDefaultset would run in scratch and fail here; that gap is reported, not closed.packages/qa/scenarios/src/runner/scorecard.ts,runRecord) adds...m.build.score.personaGrants(head279ac14b), pinned intest/runner/orchestrate.test.ts; the tally already counted them.🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5