Repository navigation
fix(scenarios): on a masking-off round, a withheld field the reply says does not exist is no decline - #36352
Conversation
… schema masking Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY Co-authored-by: Claude <noreply@anthropic.com>
…he runner and the transcript Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY Co-authored-by: Claude <noreply@anthropic.com>
…arrowing the record schema Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
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 aebbba4a5ecb0685d5f61c414db800811b1ad2dc && git checkout aebbba4a5ecb0685d5f61c414db800811b1ad2dc
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3a81fb7586c175330bd6338a6d1b6abf7d39e6eb 6a9b1bd17d34b893ab05862110306cee604bfebe && git checkout -B drift-repro 3a81fb7586c175330bd6338a6d1b6abf7d39e6eb && git merge --no-ff 6a9b1bd17d34b893ab05862110306cee604bfebe
node scripts/docs-audit/affected-docs.mjs --json 3a81fb7586c175330bd6338a6d1b6abf7d39e6eb
|
|
repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY Contract reviewServed-tier: Owed on the ① Derived judgments
② Semver level
③ Boundary flagsNone. The one-line Implemented-by: No must-fix, no should-fix. VERDICT: PASS |
|
repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY 席位核对L1 verdict: ACCEPT at head
|
…sh (dataset coverage, over-gating, delete floor, card wording) (objectstack-ai#36617) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi91tYCagMT6JaQ6YA5YqnWwi)_ Part of objectstack-ai#36558 (all seven items land here; the card's done-when, a re-run on 18.6.0, is the eval seat's and is the remainder: items 4, 5 and 7 are card wording, which only a fresh build can show working). Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户看到什么变化:用户无感;只有评测席位跑场景卡时,打分器的三处判法和四张卡的提问措辞变了。 - 为什么做:属于「评测度量:场景卡与评测轮次」专题,修掉画廊刷新里评分器误判和卡片措辞把模型带偏的问题。 - 出错会怎样:最坏是某次评测把一个回答或构建判得偏严或偏松,只影响评测分数,不碰线上功能,可直接撤回。 - 要你做什么:无 ## What changes One item per row; every conclusion is against `origin/main` at the merge base of this branch. | Item | What changed | |:--|:--| | 1. withheld-field decline | `scenario-run-grade.ts`: on a `withheld` truth, the asker and field-absence wordings are read with the reply's dataset-coverage sentences left out (`datasetCoverage`). A sentence is one when it names a dataset or report, by the word or by the name/label of a dataset a `query_dataset` answer of the turn served, and nothing in it binds to the asker (you, your role, permission, access, visible, hidden, ...). "The Approved Leave dataset can't group by medical note" is no decline; "... can't show medical notes to you: the field is hidden from your role" still is. The objectstack-ai#36323 and objectstack-ai#36352 readings are unchanged (their pins pass untouched). | | 2. over-gating | `gradeAgentActions` adds `action:OBJECT.NAME->not-confirm-gated` for every card action marked `confirm: false`: it fails when the build sets `ai.requiresConfirmation: true` (or does not declare the action). The build prompt's action header now says an unmarked action runs with no confirmation gate, so the build is told what it is graded on. | | 3. delete floor | `gradePersonaGrants` reads a granted `delete` against the platform's owner-only delete floor (`deleteFloorReading`), from the platform code: `member_default`'s `owner_only_deletes` (`created_by == current_user.id`, `plugin-security/src/platform-ownership-policies.ts`) is lifted only by `SharingService.checkDelete` answering `allow` (`plugin-sharing/src/sharing-service.ts`): ownership, Modify All or a write depth of `org`, and only where the object's org-wide default is not public and it has an `owner_id` (`checkDelete` abstains otherwise, and an abstain keeps the floor, Modify All included). The runner loads seed rows as the admin, so no persona created one; the row's owner is the runner's own `rowOwner`, moved to `src/row-owner.ts` so the scorer reads the same answer without importing the runner (re-exported from `runner/prompts.ts`, runner surface unchanged). A row only an authored delete/all row policy, a `controlled_by_parent` master's gate, or a declared route action (`via`, or the confirm-gated action for a waiting write) could admit is not measured. leave_balances `hr_officer` with `allowDelete` and no Modify All now fails `persona-grant:hr_officer:leave_request:delete`, naming LR-0100 and LR-0003. | | 4. service_desk `log_ticket` | The action summary now says it assigns the ticket to the signed-in agent who logs it and opens it (status open). | | 5. leave_balances `sick_by_medical_note` | The ask (en and zh) counts by what the medical note itself says, not by whether a medical certificate is attached. | | 6. order_to_cash `overpay_invoice` | **Accepted `HOOK_ABORTED`; the seed is unchanged.** `refusalMeets` now lets a declared `VALIDATION_FAILED` be met by `HOOK_ABORTED` at a 4xx status. Reason: the card measures that the app's own rule refuses an overpayment, and `HOOK_ABORTED` is exactly that (the ledger's undeclared hook refusal, answered at the status the hook chose, else 400; a sandbox fault is served 5xx and stays unmet). Ruling A on objectstack-ai#31999 item 9 already accepts a hook's *declared* refusal; an undeclared one is the same app rule without a code. The seed route cannot keep the card measuring what it claims: invoices are seeded with their stored `amount_paid` / `balance`, which already count each loaded payment, and the card's questions read those totals; no seed in which a rule comparing a payment with its invoice's balance accepts every loaded payment and refuses the overpayment exists short of seeding invoices without those totals, which changes what the questions measure. | | 7. `automation.record-triggered-flow` | **An explicit flow ask on the two cards; the posture line is kept.** requisition_to_receipt: "the requisition becomes ordered, set by a record-triggered flow on the purchase order when its status changes to sent". travel_expense: "a record-triggered flow on the approval step then moves the claim on (once the manager approves, the claim becomes manager-approved and its Finance step opens)". Both cards' "prefer declarative" line now lists record-triggered flows (en and zh). The posture line is right: it is about a value derived from other fields, which a flow leaves empty on every loaded row; both asks are runtime events whose seeded rows already carry their status, so they do not contradict it. asset_lifecycle and service_desk carry the tag and already ask for flows. | Also: `packages/qa/scenarios/README.md` and `docs/qa/scenarios/README.md` describe the three new readings; one `@objectstack/scenarios` patch changeset (the card JSONs ship in the package library). ## Tests All on head `a2c2e31cdb`, package `@objectstack/scenarios`, after `pnpm --filter '@objectstack/scenarios^...' build` and the package's own build, through the shared verify lock. - `pnpm --filter @objectstack/scenarios typecheck`: exit 0. - `pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2`: Test Files 42 passed (42), Tests 1324 passed (1324). - New pins: item 1 in `test/score/scenario-run-grade.test.ts` (new describe), item 2 as an `ACTION_DEGRADATIONS` row in `test/score/scenario-tags.test.ts`, item 3 in a new describe there (leave_balances card, seven cases), item 6 in `test/runner/mid-tier-run-readings.test.ts` beside the ruling-A cases. - **Forced test changes** (an item flipped an existing reading): - Item 2 adds one check per `confirm: false` action: control-card totals 26/37/32 become 28/39/34 (`scenario-cards.test.ts`), the rich build's action count 5 becomes 6 and the missing-action list gains `set_task_status->not-confirm-gated` (`scenario-tags.test.ts`). - Item 3: the crm fixture builds (`test/export/fixture.ts`, `test/runner/orchestrate.test.ts`) and the crm completed build (`scenario-cards.test.ts`) give the sdr `writeScope: 'org'` on contact, which lifts the floor for its deletes of admin-owned contacts without unmasking `email` the way Modify All would; the completed-build case gains a degrade that drops it. The project card's `task` is a `controlled_by_parent` detail, so `persona-grant:contractor:task:delete` reads not measured on a granting set in three `scenario-tags.test.ts` cases, and the waiting-confirmation case's figures move accordingly. No case was deleted. - The R3 ACTING roster in `mid-tier-run-readings.test.ts` needed no change: no operation ask was reworded (item 5 rewords a question). <details><summary>Ablations (one per changed tested behaviour, unit tests import src/, so no dist leg; each mutation through scripts/ablation-replace.mjs, restored to the HEAD blob with an empty git diff HEAD)</summary> - Item 1, the dataset-coverage filter made a no-op: `scenario-run-grade.test.ts` Tests 2 failed / 86 passed (the two ⛔ cases). - Item 2, the not-gated check made to pass whenever declared: `scenario-tags.test.ts` Tests 1 failed / 109 passed (`set_task_status->not-confirm-gated fails on its own defect`). - Item 3, the floor reading switched off: `scenario-tags.test.ts` + `scenario-cards.test.ts` Tests 9 failed / 122 passed. - Item 6, `HOOK_ABORTED` taken out of `refusalMeets`: `mid-tier-run-readings.test.ts` Tests 1 failed / 61 passed. </details> ## Acceptance notes - The update half of the same floor (`owner_only_writes`) is not modelled by `persona-grant:*:update`; the card scoped item 3 to delete. An update floor reading would follow `checkEdit` (an edit share and a queue also lift it, a `public_read_write` default opens it). Noted, not filed: no run has shown it. - A `delete` the card refuses `PERMISSION_DENIED` is still judged by the set alone; no open card declares one, so the floor is not read on that leg. - A `controlled_by_parent` detail's delete is not measured rather than modelled through its master's update gate; on the control cards that is `task` and `invoice_line`. - The build prompt does not state the delete floor; per `docs/qa/scenarios/README.md` the persona's role must imply its grants (hr_officer is "organization-wide ... who deletes withdrawn leave requests"). - `docs/qa/scenarios/builds/travel_expense.provenance.json` records the card's sha256 at build time; the card text changed, so a re-export reads the provenance as against the earlier card. Nothing pins that hash. ## Verification First read (by risk): 1. `packages/qa/scenarios/src/score/scenario-tags.ts` `deleteFloorReading`: the floor model, the one reading of platform code in this PR. 2. `packages/qa/scenarios/src/score/scenario-run-grade.ts` `declinesWithheld` / `datasetCoverage`: what counts as binding to the asker. 3. `packages/qa/scenarios/src/score/scenario-operation-grade.ts` `refusalMeets`: the `HOOK_ABORTED` widening. Two-minute check: `pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/score/scenario-tags.test.ts` shows the describe "a delete the set grants, read against the platform's owner-only delete floor" with seven passing cases. <details><summary>Local gate subset (dispatch-gates --commands derivation at a2c2e31: 70 commands; 69 exit 0, 1 NOT MEASURED)</summary> - `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran FILE`: "70 derived famil(ies) accounted for — 69 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)". - NOT MEASURED: `pnpm check:dual-build-cjs-loads`, exit 3, PREREQUISITE NOT MET (it reads every package's dist; only the scenarios closure is built here). Left to CI. - Every other derived command exited 0, among them `check:nul-bytes`, `check:cross-package-test-inputs`, `check:test-source-alias`, `check:published-files`, `check:doc-authoring`, `check:issue-citations`, `check:type-check-coverage`, `check:type-check-debt`, `check:adr-0087-registration`, `check:changeset-no-major`, `check:empty-changeset`. - `overlap-check`: VERDICT clean exit 0 (origin/main merges cleanly, 0 PR heads share a file). - Everything else CI runs (the repo-wide lint, Test Core including the `repo` project, Build Core, the type-check lanes) is CI's. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmPTDM2MxHR8cvoMVUX <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmPTDM2MxHR8cvoMVUX --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Fixes #36329
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
The ruling this grade follows (#35113 comment 6979780844), verbatim:
PR #36323 split the withheld reading (
declinesWithheld) from the value-absent wordings. It still accepted the field-absence wordings, which under default masking are honest (the asker's schema lacks the field) and on a masking-off round are untrue (the field is in the asker's schema). The grade had no masking input, so it could not tell the two apart.packages/qa/scenarios/src/score/scenario-run-grade.ts:declinesWithheld(replyText, schemaMasking)keeps the asker-bound wordings (ASKER_DECLINE) and the withheld write (WITHHELD_ACT) on both modes, and reads the field-absence wordings,UNRECORDED("has no ... field", "there is no ... field", "neither ... has a ... field", "no ... field exists", "the data / app doesn't record") and the newUNTRACKED("is / aren't tracked", moved out ofASKER_DECLINE_EN), only when masking ison.DECLINEstill matches the same set (UNTRACKED_ENjoins its alternation), sodeclines(theunanswerablegrade,observe.ts) reads as before.PersonaRunInput.schemaMasking?: 'on' | 'off', absent meanson.packages/qa/scenarios/src/score/index.ts:CardAnswer.schemaMasking?: 'on' | 'off', passed togradePersonaRunonly when set.packages/qa/scenarios/src/runner/orchestrate.ts:RunOptions.schemaMasking?: SchemaMaskingand a lastschemaMaskingparameter onrunHalf; every question turn'sgradeCardAnswerreads it.cli.tspasses the round'sroundSchemaMasking(the value the record stamps asenv.schemaMasking) only when it isoff, so a default round's call is unchanged.packages/qa/scenarios/src/export/transcript.ts: the gallery transcript re-grades each recorded reply under the record'senv.schemaMasking, never the exporter's environment. Without this, a masking-off record whose withheld reply now gradescorrect: falsewould be refused at export with "grades differently from the run record".ScenarioRunRecordSchemais unchanged (no narrowing of what a record may carry); any value butoffreads as the default.PersonaRunInput.schemaMasking(./score,./score/full),CardAnswer.schemaMasking(./score/full),RunOptions.schemaMaskingandrunHalf'sschemaMaskingparameter (./runner). All optional, absent means masked: every existing caller grades byte for byte as before.Tests
test/score/scenario-run-grade.test.ts, new top-level describe on the realtravel_expensecard (department_budgetsasemployee,travel_budgetwithheld), masking the only difference in each pair:schemaMasking: 'off'and pass masked (statedongrades equal to absent);relaunch_estimate-as-contractor reply "The Project object has no hours field, and neither does the Task object." keeps gradingcorrect: trueby default and fails with masking off;onandoff; a codedPERMISSION_DENIEDrefusal with no figure passes on both;recoverable_vat(unanswerable) the field-absence wordings decline on every masking. The existing unrecorded-data CONTROLs (eval#1 records describe, therecoverable_vat"no data" control) are untouched and green.test/runner/orchestrate.test.ts, new describe:runCardon the crm card with an agent answeringpartner_user's withheldaccount_count/smallest_headcount"The app doesn't record accounts.": correct by default and withon,did not decline a question the persona may not seewithoff, every other turn's grade identical.test/export/exporter.test.ts, new describe: a masking-off fixture record re-grades inbuildTranscriptto the run'scorrect: false; the same record without the stamp is refused.test/export/fixture.tsrunCrmgains aschemaMaskingoption.Test readings
pnpm --filter @objectstack/scenarios build, thenexec vitest run --maxWorkers=2→Test Files 42 passed (42),Tests 1292 passed (1292);pnpm --filter @objectstack/scenarios typecheckexit 0 (tsc --listFilesincludes the three edited test files andfixture.ts). LockVERDICT command-exit 0.scripts/ablation-replace.mjs, fix committed first; tests importsrc/directly, nodist/in the path):return schemaMasking === 'on' && (UNRECORDED→return true && (UNRECORDED, anchor 1 → 0, blob 48068bfacd58 → 62b82e8275b8:Tests 4 failed | 300 passed (304)across the three files (the two masking-off grade cases, the runCard case, the transcript case). Restored: blob == HEAD,git diff HEADempty.schemaMaskingspread inrunHalf'sgradeCardAnswercall deleted, blob fa631f415b4d → 8ae598f822ae:Tests 2 failed | 224 passed (226)(runCard case, transcript case). Restored, blob == HEAD.maskingOffspread inbuildTranscriptdeleted, blob c7f967313c4b → 4e71c3a48c69:Tests 1 failed | 58 passed (59)(the transcript case refuses). Restored, blob == HEAD.Acceptance notes
cannot/unablestay asker-bound on both modes, so "I cannot find a travel budget field" still declines with masking off. Only the wordings that assert the field's absence from the app moved.cli.tshand-off ofroundSchemaMaskingintorunCard(mainboots real apps; its existing tests stop at the refusal). The value is the sameschemaMaskingthe record stamps on the next line.--driver recorded:FILE) grades under the replay round's masking, which its record states; the recording file does not stamp the masking it was made under (unlike its prompt choice, whichassertPromptChoicerefuses on mismatch). Replaying a masking-off recording without--schema-masking offyields a self-consistent masked record of off-round answers.src/score/**,src/runner/**, their tests and.changeset/.src/export/transcript.tsandtest/export/**are outside it; the transcript edit is required by this change (see What changes), not a rider.Verification
Read first, by risk:
scenario-run-grade.ts,ASKER_DECLINE_EN/UNTRACKED_EN/DECLINE:DECLINEmust stay the same union (the whole existing suite is the check).scenario-run-grade.ts,declinesWithheld: field-absence wordings gated onschemaMasking === 'on'.transcript.ts,maskingOff: read from the record, never fromprocess.env.Two-minute check:
pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/score/scenario-run-grade.test.ts, expect 78 passed.Gate readings (local subset at head 6a9b1bd)
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands: 68 commands for 10 paths; each run with its exit captured before any pipe.node scripts/check-plugin-teardown-shape.mjs --self-test(its positive-control commit is outside this clone's history) andpnpm check:dual-build-cjs-loads(reads every package'sdist/; only this package's dependency closure was built). Both run in CI's Lint & Repo Gates.--ranreconciliation:✓ dispatch-gates --ran: 68 derived famil(ies) accounted for — 66 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3).test:repoand the full farm run in CI.Generated by Claude Code