Repository navigation
feat(scenarios)!: cards declare user-handle fields and persona records; seed dependence is decided per turn - #31275
Conversation
…; seed dependence is decided per turn A scenario card now says which seed fields hold a user handle (run.userHandleFields) and which seed row each scoped persona is (personas[].record). userHandleFields reads the declaration instead of inferring it, and the loader refuses a scope rule ending on a field that is no declared handle, lookup, select or id, a scoped persona naming no person, and a record naming no seed row. The run record lists the fields the seed rewrote (seed.rewritten). A refused seed row now takes out only the question turns whose expected answer changes once it and its children are gone: the runner recomputes each truth over the rest of the seed with the loader's own rules (truthsOver). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nVm4yfBmbggVVSu4R
…e moves Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5nVm4yfBmbggVVSu4R
📓 Docs Drift Check16 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. 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): 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 f97176500a62ccdfdd90aff5aa3d5e6db6c7d1ee && git checkout f97176500a62ccdfdd90aff5aa3d5e6db6c7d1ee
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ea62933c2239b4c35b675f6af7d6812e01173edc 4b4df50a303cf4dee4ff4d14a070bd6b22b5179c && git checkout -B drift-repro ea62933c2239b4c35b675f6af7d6812e01173edc && git merge --no-ff 4b4df50a303cf4dee4ff4d14a070bd6b22b5179c
node scripts/docs-audit/affected-docs.mjs --json ea62933c2239b4c35b675f6af7d6812e01173edc |
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 Contract reviewServed-tier: Face: narrowing. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:devx#3 · os-project-manager · session_01FEkQ5njkh3xbcDN6EtSfw7 席位核对Verdict: ACCEPT · head
Generated by Claude Code |
Requested by Leehom · project thread
Fixes #30914
Clause-②: yes (narrowing) — the published card schema (
ScenarioCardSchema,.entry) gainsrun.userHandleFieldsandpersonas[].record; the loader refuses cards it loaded before (a scope rule ending on an undeclared field, a scoped persona naming no person);./runner'sseedDependencetakes the loaded scenario and asks per turn.Metadata-protocol: none
Skills-docs: none — no skill or docs page teaches the scenario card format; its own documentation,
docs/qa/scenarios/README.md, is updated here.维护者速读
run.userHandleFields(哪些种子字段的值是"用户句柄",如account.owner = u_sam)与personas[].record(有行范围的角色对应哪一条种子行,如员工e06);加载器拒收"范围规则落在既非句柄、也非查找/选项/id的字段上"以及"有范围却没指明是谁"的卡;跑测记录新增seed.rewritten;种子行被应用拒收时,只把"预期答案因此改变"的那几轮问答记为未测,其余照常评分。record是维护者 2026-11-07 13:34 对 Scenario runner: the seed sets owner_id from scope values that are not person handles (service_desk owns public comments by the portal user) #30913 裁决的卡片格式那一半(S3)。@objectstack/scenarios(QA 工具包)与九张卡;九张卡全部照常加载,种子改写的字段集合与改前完全相同(account.owner、invoice.owner、task.assignee);私有覆盖目录里的卡若没有这两项声明会被拒收,补声明即可。回滚即 revert 本 PR。packages/qa/scenarios/src/loader.ts(新拒收与truthsOver)、packages/qa/scenarios/src/runner/orchestrate.ts(seedDependence按轮判断)、docs/qa/scenarios/service_desk.json(三个角色的record)。pnpm --filter @objectstack/scenarios exec vitest run test/refusals.test.ts test/runner/units.test.ts,预期全绿;其中 ct4 用例显示contacts_per_account以sdr身份仍被评分。What changes
S2 — user-handle fields are declared.
run.userHandleFields: [{ object, field }](optional, at least one entry) lists the seed fields whose text stands for a user.userHandleFieldsinsrc/runner/prompts.tsnow reads this list and nothing else; it no longer infers a handle from "a direct scope field that is no lookup or select".scoperule whose last field (the last hop of a relation path) is notid, a declared lookup, a declared select or a declared handle field. It also refuses a handle declaration on the row id, a declared lookup, a declared select, an object the card does not seed, a field no seed row carries, and a duplicate.seed.rewrittenlists eachobject.fieldthe seed loaded with a user id in place of the handle text (RunHalf.seed,src/runner/orchestrate.ts).origin/main, inferred)crm_account_with_contacts:account.owner,invoice_with_line_items:invoice.owner,project_with_tasks:task.assignee; after (declared) the same three.S1 — seed dependence per turn.
seedDependence(scenario, refused)keeps its row walk (the refused rows plus their children through the declared lookups), then computes every truth again over the seed less those rows withtruthsOver(new insrc/loader.ts, the loader's own resolver, row-scope test and withheld rule, factored out asseedReaderandwithholds).question(q, persona)is not measured only when that turn's expected answer changes, or is no longer defined (seed: its expected answer is not defined without …).runHalfasks it per turn (inside the persona loop). Operations are unchanged.ct4oncrm_account_with_contactsused to leave 5 turns not measured (contacts_per_account/sdr,unattached_contacts,best_covered_account,tech_contacts,contacts_by_industry); it now leaves 2 (unattached_contacts,contacts_by_industry, the two whose answer ct4 changes).contacts_per_accountassdrstays measured.S3 —
personas[].record = { object, id }.scope, unless that persona is named by a direct scope rule on a declared handle field; optional on a global persona. The loader refuses a record naming no seeded row (including a row of an object the card does not seed).PERSON_USER_FIELD = 'user'fixes the person object's user field by name.asset_lifecycle(employee e06, dept_manager e05),leave_balances(e07, e05),order_to_cash(e03, e01),requisition_to_receipt(e02, e13),travel_expense(e02, e01),service_desk(agent a02, agent a04, customer cus_03). Each id is the one the persona'srolealready names.record(Scenario runner: the seed sets owner_id from scope values that are not person handles (service_desk owns public comments by the portal user) #30913's half).Namespacing and docs.
namespacedScenario(src/runner/namespace.ts) prefixes the object of each handle declaration and eachrecord.docs/qa/scenarios/README.mddocuments both declarations and the new refusals; the package README documents per-turn dependence andseed.rewritten. Onepatchchangeset.Tests
test/refusals.test.ts: 12 new refusal pins (one refusal each, exact path) and two controls: a scoped persona naming its record (and a global persona naming one) loads clean; deletingrun.userHandleFieldsfrom the crm card refuses both ofsdr's scope rules and its missing person. The gallery-floor fixture now scopes its second persona on a declared select and names its record.test/runner/units.test.ts:userHandleFieldsreads the declaration (a card declaring none has none); across the nine cards the handle set is the three fields and every record is pinned;seedDependenceper turn on the ac1 case, the ct4 case and a truth the rest of the seed no longer defines.test/runner/orchestrate.test.ts:seed.rewrittenin the record; the ct4 run (7/7 measured, 2 not measured; the driver is askedcontacts_per_accountassdr); the all-accounts-refused run keeps the three turns no account feeds, and a half with every turn not measured is stillnot-run.Ablations, each through
scripts/ablation-replace.mjson committed HEAD33a20989: mutation landed (anchor 1 → 0, replacement 0 → 1, blob changed), suite red, restored to the HEAD blob;git diff HEADempty after all legs. The tests importsrc/directly (nodist/in the path), so no rebuild leg.checkFieldcall deleted)seed.rewrittennot recordedAcceptance notes
recordis required unless the persona is named by a direct scope rule on a declared handle field. On the nine cards that is exactly the three controls.asset_admin,hr_officerand the like is that card's call.contact.account.ownerends onaccount.owner, a declared handle;order_line.order.owner.teamends onemployee.team, a declared select. The card's wording is "a scope on a field"; reading only direct rules would leave a path ending on an undeclared field to inference, which is what S2 removes.src/runner/namespace.tsis outside the claim's list: without it the namespaced card the runner reads keeps bare object names in the two new keys anduserHandleFieldsanswersaccount.ownerwhere the seed loop looks fordemocrm_account.owner.src/runner/seed.tsneeded no change.orchestrate.tschangesseedDependence, its caller inrunHalf, theRunHalf.seedtype and one line of the seed loop (rewritten).runner/driver.tsorrunner/cli.ts.origin/mainmoved by two commits since the branch point, neither inpackages/qa/scenarios.Verification
33a20989;4b4df50aadds one sentence to the changeset only. The derived loop started on33a20989; the changeset-reading gates were run again on4b4df50a(below). Basebdefd49f;origin/mainhas moved two commits since, neither inpackages/qa/scenarios.pnpm --filter @objectstack/scenarios exec vitest run: Test Files 28/28, Tests 571/571 (afterpnpm --filter '@objectstack/scenarios^...' build, VERDICT command-exit 0, and the package's own build, whichtest/build/*read).pnpm --filter @objectstack/scenarios typecheck(tsc --noEmit, its program includestest/**): exit 0.node --stack-size=4000 node_modules/eslint/bin/eslint.js packages/qa/scenarios --no-inline-config(the rootpnpm lint, scoped; the package has no lint script): exit 0.4b4df50a:check-changeset-no-major.mjs --base origin/mainwith this body as the event: exit 0 ("yes (narrowing)and metadata-protocolnone… a non-protocol change atpatch");check-adr-0087-registration.mjs --base origin/main: exit 0 (theno-migration-prescriptiondisposition read);check-empty-changeset.mjs --base origin/main: exit 0;check-partof-closing-keyword.mjswithPR_BODYset to this body: exit 0.runCardtests instead.Derived gates (dispatch-gates --commands, 62 commands)
dispatch-gates --ran: "62 derived famil(ies) accounted for — 61 run, 1 NOT-MEASURED".pnpm check:dual-build-cjs-loads, exit 3 PREREQUISITE NOT MET (it loads every package'sdist/; only the scenarios closure was built). CI's lint job runs it on a full build.check-plugin-teardown-shape.mjs --self-testanswered exit 3 on the shallow clone untilgit fetch --depth=1 origin 621a4876…; rerun exit 0 (recorded above as the rerun).check:type-check-debtre-measured under the lock (414 s): "0 raw tsc error(s) total, none above its recorded number".Gates outside the derived set: the artifact-roster and declared-wide families (47 commands)
check-partof-closing-keyword.mjswithPR_BODYanswered exit 0 (above).pnpm --filter @objectstack/spec run check:error-code-provenanceis among them, exit 0: the diff adds no error-code constant.Every CI family is read from this PR's check-runs, not re-run here.
Generated by Claude Code