Repository navigation
fix(scenarios): name a card's master-detail as one in the build prompt, not as a lookup - #37781
Conversation
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQLJp32uXAwq4ixsKy
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjQLJp32uXAwq4ixsKy
📓 Docs Drift Check5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. 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 f9c48238ca0394f4976af901d22ca615ef1ebce5 && git checkout f9c48238ca0394f4976af901d22ca615ef1ebce5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 077831538950da0af7b31c5fdafa2463caaa9881 202d622ef65014a47743ebcdfca30f3083af14a3 && git checkout -B drift-repro 077831538950da0af7b31c5fdafa2463caaa9881 && git merge --no-ff 202d622ef65014a47743ebcdfca30f3083af14a3
node scripts/docs-audit/affected-docs.mjs --json 077831538950da0af7b31c5fdafa2463caaa9881 |
…e beside its card (objectstack-ai#37911) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDKEKdacsmHCLbg9139FUsL)_ repo:objectstack#2 · os-sales · session_01L6bhgWYbeKh6ewAziS6nrf Fixes objectstack-ai#34920 Clause-②: no Metadata-protocol: none Rule-change: none ## 维护者速读 - 改了什么:把 `order_to_cash`(订单到收款)卡的已验证构建作为 fixture 提交进仓库:`docs/qa/scenarios/builds/order_to_cash.json`,与一次通过的 scratch 搭建在迭代前写出的 `dist/objectstack.json` 逐字节一致,旁边是出处文件。新增一个测试,钉住每份构建与它的出处文件、卡文件、协议版本的对应关系。`travel_expense` 的出处文件里卡的 sha256 过期了,这次一并刷新。 - 为什么改:问数日轮要每天在同一份构建上跑,之前只有 `travel_expense` 一张卡有入库构建。11-25 那次通过的构建从没交出来,而且卡和 runner 后来都改了,所以按 Sales 08:40Z 在决策卡上的选择(「本专区自己搭」),在本线程重跑了一次 opus/high 搭建:Build 174/174,Seed 619/619,一次通过。 - 用户能看到什么:没有。不改任何包的发布内容,`builds/` 不随 `@objectstack/scenarios` 发出(打包脚本只读 `docs/qa/scenarios/` 一层的 `*.json`)。评测方面,新开的容器现在不用搭建就能跑两张卡的问数轮。 - 风险与回滚:只有 fixture、文档、一个测试和两张输入登记表(`turbo.json`、跨包测试输入表),回滚就是还原这个 PR。⚠ 改动 5,500 行左右,其中 fixture 自己 5,340 行,超过 3,000 行线,要你批准或合并。fixture 刻意保持原样不压缩,因为出处里的 sha256 证明的就是这份文件。 - 两分钟验证:`sha256sum docs/qa/scenarios/builds/order_to_cash.json`,应为 `5d1696c818d5…`,与出处文件一致;`pnpm --filter @objectstack/scenarios exec vitest run test/verified-builds.test.ts`,11 项全过。 - 需要你做的:`.claude/**`(Tier S)的 L2 审核通过后,由于超过 3,000 行,需要你批准或合并;交接由席位负责。 ## What changes - `docs/qa/scenarios/builds/order_to_cash.json` (new): the verified build ask rounds install for `order_to_cash`, byte for byte the `dist/objectstack.json` the scratch run below wrote after its Build half and before its iterate turn. sha256 `5d1696c818d542480819ddb67b970337e01ee94c224c99479f8cc9319797fcea`, 152,377 bytes, `manifest.engines.protocol` `^19`. - `docs/qa/scenarios/builds/order_to_cash.provenance.json` (new): card sha256 `fb53e5cf…`, runner `b620c4b2`, packages workspace @ `b620c4b2`, driver `claude-code-cli 2.1.332` on the subscription login, `opus` at `high` **with the served model id `claude-opus-5-5` beside the alias** (L2 note N5), and how the snapshot was identified. - `docs/qa/scenarios/builds/travel_expense.provenance.json`: `cardSha256` re-pinned from `212abedb…` to `a6ae8aa6…`, with an `amended` entry (`cardFrom`). The card edit between them is objectstack-ai#37781's single line, `claim_line.claim` marked `"masterDetail": true`. That mark reaches the build prompt and the loader, not the scorer, so the build is unchanged and keeps its sha256. Measured: the build re-scored at `b620c4b2` reads Build 140/141 against the card both with and without the mark, no roll-up charge. The one failing check, `master-detail-inline-edit` ("0 edited inline"), fails either way. It comes from a scorer change since the 11-18 build (135/135 then), not from this card edit, and ask rounds do not score Build. It is reported to the seat, not fixed here. - `packages/qa/scenarios/test/verified-builds.test.ts` (new, L2 note N6). For each `builds/<id>.json` it pins: - a provenance file beside it that names this build and this card; - the provenance `sha256` equal to the file's own; - `cardSha256` equal to the card file in the tree; - each `amended` entry's shape; - a protocol range the load-time handshake admits for this tree's `PROTOCOL_VERSION` (`checkProtocolCompat`); - and that the directory holds a build for every dataset card (the loader's cards with `run.datasetQuestions`). The failure messages say what to do: an `amended` entry for a hand edit, a re-score and re-pin for a card edit, a new build when the reading changes. - `turbo.json` (`@objectstack/scenarios#test` inputs) and `scripts/cross-package-test-inputs.mjs` (the scenarios row and its `heldBy`) declare `docs/qa/scenarios/builds/*.json`. Without this a build edit would not re-run the suite, and `check:cross-package-test-inputs` refuses it. `scripts/check-ci-filter-parity.mjs`'s self-test counts the newly declared glob (23 → 24), in the same shape as objectstack-ai#30289's and objectstack-ai#31729's entries. - `docs/qa/scenarios/README.md` § Verified builds: - the `--template` path is absolute (`"$(git rev-parse --show-toplevel)/docs/qa/scenarios/builds/<id>.json"`), with why: `pnpm --filter` runs the runner in `packages/qa/scenarios/`, where the repo-relative path names nothing (`readFileSync(args.template)`, `src/runner/cli.ts:628`) (N4); - the card-edit re-pin rule; - the new test. - `.claude/skills/scenario-eval/SKILL.md` (net 0 lines): - §5's fixture sentence names what installs the build (`--template`) instead of every round (N2); - the §4 ask-round comment drops "order_to_cash's build waits on objectstack-ai#34986" and has the reader `ls builds/` instead of recalling (N1). L2 notes (6986428648): - N1: done by this fixture landing, plus the §4 comment above. - N2, N4, N5, N6: done as listed. - N3: void (objectstack-ai#37257 ruled, objectstack-ai#37271 merged; this build fires no roll-up charge). - N7: the title is singular. ## Tests - **The build** (one live run, no retry needed). Command: `run-scenarios --only order_to_cash --modes scratch --packages workspace --author-model opus --author-effort high --ask-model haiku --ask-effort medium --no-iterate-run --work … --out … --record …`. - Run at `b620c4b2c6`; the working tree also held this PR's docs and test edits, none of them in a packed file. Exit 0. - Build 174/174, author `success`, 178/300 turns, 33m 51s, served `claude-opus-5-5` at effort high. - Seed 619/619. Run-问数 11/12, Run-operations 6/6 (1 platform half not measured), datasets 4/5. Iterate · Build 186/186 (23 turns). - Notional author cost $16.70 over 2 turns (subscription login, not billed). - **Which snapshot is the verified build.** A poller copied `dist/objectstack.json` every time its content changed (4 copies). - Re-scored with `scoreCardArtifact` + `rollupSourceCharges` on the namespaced card: the last two pre-iterate copies both read 174/174. - `changeSize` from `5d1696c8` to the post-iterate copy equals the record's iterate change size exactly (12 items). From the earlier `93434753` it does not. So `5d1696c8` is the build the runner verified. - **Done-when: an ask round on the committed file, no build step.** Command: `run-scenarios --only order_to_cash --modes ask --template "$(git rev-parse --show-toplevel)/docs/qa/scenarios/builds/order_to_cash.json" --packages workspace --ask-model haiku --ask-effort medium`. Exit 0. - `template.install` `{ok: true, status: 200}`, `installMode: unmanaged`. Build reads `supplied`, `no authoring turns`. - Seed 619/619, Run-问数 11/12, Run-operations 6/6, datasets 4/5, 24 ask turns served `claude-haiku-5-5` at medium. - `travel_expense`'s side of the Done-when was met by objectstack-ai#35222. - `pnpm --filter @objectstack/scenarios test`: 45 files, 1395 tests passed (before the test's dataset-card read moved to the loader); `test/verified-builds.test.ts` 11/11 after; `typecheck` clean. ## Acceptance notes - **No changeset**, labelled `skip-changeset`, a deviation from the claim's file surface. The package publishes `dist`, `README.md` and `CHANGELOG.md`, and the diff touches none of them: - `builds/` is not packed (`scripts/pack-library.mjs` copies `docs/qa/scenarios/*.json` one level deep); - `test/` is not in `files[]`; - the README edited is `docs/qa/scenarios/README.md`, not the package's. - **Beyond the claimed surface:** `turbo.json`, `scripts/cross-package-test-inputs.mjs` and `scripts/check-ci-filter-parity.mjs` (self-test count only). The N6 test reads `builds/`, and the cross-package gate refuses an undeclared input. None of the three files is a governed surface. - The fixture is pretty-printed as `objectstack build` writes it (5,340 lines), kept byte-exact because the provenance and every round's record name its sha256. ## Verification - Gate list derived on `c53622d4`: `node scripts/pm/dispatch-gates.mjs --commands` gives 77 commands; all 77 exited 0, each exit code captured before any pipe. `--ran` reconciliation: `77 derived, 77 run, 0 NOT-MEASURED, 0 UNRUN`, the zero DERIVED from the recorded codes. - `pnpm --filter @objectstack/scenarios test`: 45 files, 1395 tests passed at `c53622d4`; `typecheck` clean. - Changed lines about 5,500 against the 3,000 human-merge threshold: OVER, as dispatch-gates reports. <details><summary>Local gates (77, each exit 0)</summary> ```text node scripts/check-adr-links.mjs :: exit 0 node scripts/check-adr-links.mjs --self-test :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-adoption.mjs :: exit 0 node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs :: exit 0 node scripts/check-declaration-mirrors.mjs --self-test :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-issue-citations.mjs :: exit 0 node scripts/check-plugin-teardown-shape.mjs :: exit 0 node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0 node scripts/check-self-test-wired.mjs :: exit 0 node scripts/check-self-test-wired.mjs --self-test :: exit 0 node scripts/check-self-test-workflow-commands.mjs :: exit 0 node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0 node scripts/check-whole-set-label-write.mjs :: exit 0 node scripts/check-whole-set-label-write.mjs --self-test :: exit 0 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/docs-audit/check-affected-docs.mjs :: exit 0 node scripts/docs-audit/check-drift-comment.mjs :: exit 0 node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0 node scripts/pm/check-harness-current.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm check:adr-anchors :: exit 0 pnpm check:agent-test-spelling :: exit 0 pnpm check:bash32-floor :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cli-command-ids :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 0 pnpm check:engine-double-contract :: exit 0 pnpm check:entry-guard :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:issue-citations :: exit 0 pnpm check:keyed-text-bounds :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:logger-receiver-detach :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:objectql-double-limit :: exit 0 pnpm check:org-identifier :: exit 0 pnpm check:page-declaration-shape :: exit 0 pnpm check:parse-guard :: exit 0 pnpm check:platform-object-tenancy-census :: exit 0 pnpm check:pm-dispatch-gates :: exit 0 pnpm check:pm-governed-merges :: exit 0 pnpm check:pm-record-recognisers :: exit 0 pnpm check:pm-settings-deny-roster :: exit 0 pnpm check:pnpm-filter-targets :: exit 0 pnpm check:pnpm-flag-spellings :: exit 0 pnpm check:published-files :: exit 0 pnpm check:query-options-erasure :: exit 0 pnpm check:ratchet-remedy-authority :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:registry-log-declared :: exit 0 pnpm check:rest-log-spy-declared :: exit 0 pnpm check:scripts-symbol-anchors :: exit 0 pnpm check:skill-frame-sync :: exit 0 pnpm check:slot-lookup :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:system-context-census :: exit 0 pnpm check:test-source-alias :: exit 0 pnpm check:tier-file-adoption :: exit 0 pnpm check:turbo-task-graph :: exit 0 pnpm check:type-check-coverage :: exit 0 pnpm check:type-check-debt :: exit 0 pnpm check:undeclared-dep-imports :: exit 0 pnpm check:vouch-for-reference-callers :: exit 0 pnpm check:watch-hint-literal :: exit 0 pnpm check:where-matcher :: exit 0 ``` </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWYbeKh6ewAziS6nrf <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgWYbeKh6ewAziS6nrf --> Co-authored-by: Claude <noreply@anthropic.com>
Requested by Jack · project thread
Fixes #37760
Clause-②: no
Metadata-protocol: none
Part of objectstack-ai/cloud#5027 (M2 Build line), from the objectstack-ai/cloud#5080 itemisation (item C).
维护者速读
What changes
packages/qa/scenarios/src/schema.ts: anexpect.lookupsrow takes an optionalmasterDetail: true(the literal or absent). New exportMASTER_DETAIL_INLINE_EDIT_TAG.packages/qa/scenarios/src/runner/prompts.tsstructureLines(): a marked row is stated on its own line, "Master-detail relationships, each amaster_detailfield (not alookup) on the detail object referencing its master, the detail's rows entered inline on the master's form: ...", and the "Lookups" line keeps the rest (omitted when none is left). The row is still spelledobject.field→to, so the exact-name trace (prompt-trace.test.ts) holds unchanged.packages/qa/scenarios/src/loader.ts: a card that carriesrecords-forms.master-detail-inline-editand marks no row is refused atexpect.lookups.invoice_line.invoice,task.project,order_line.order,claim_line.claim,leave_day.request,po_line.purchase_order. The two control cards'provenanceand the corpus-drift derivation (scenario-cards.test.ts) now say a master_detail fixture field yields a marked row.@objectstack/scenariospatch.Scoring is unchanged:
lookup:OBJECT.FIELD->TOreads the target only, so alookupand amaster_detailboth pass it, and the tag's own rows still judge the type. No denominator moves.Premise check (on
origin/main8b9b9d2)structureLines()atprompts.ts:214-218listed everyexpect.lookupsrow under "Lookups": confirmed.project_with_tasksfixture inpackages/cli/src/lint/corpus.tsdeclarestask.projectasmaster_detail; the card's derivation (one lookups row per lookup or master_detail field) dropped the type. The fix is the same, and the marker now carries the type the fixture has, so the control cards stay derived mechanically (the drift pin proves it).Metadata-protocol: none.Prompt diff, all nine cards, all three prompts
27 prompts rendered before (base 8b9b9d2 source and cards) and after: the six tagged cards' build prompts change by exactly one line each; the three untagged cards' build prompts and all 18 iterate / template-iterate prompts are byte-identical.
project_with_tasks (build)
invoice_with_line_items (build)
order_to_cash, travel_expense, leave_balances, requisition_to_receipt (build)
Each: the named row leaves the "Lookups" line (every other row in its order) and a master-detail line follows it:
Tests
test/runner/prompt-trace.test.ts: per tagged card, the build prompt's master-detail line names every marked row and the Lookups line names none; per untagged card, no master-detail line and the Lookups line equals the pre-change rendering of every row.test/refusals.test.ts: the tag with no marked row is refused atexpect.lookups;masterDetail: falseis refused; control: tag plus a marked row loads clean.test/score/scenario-cards.test.ts: the corpus derivation marks amaster_detailfield, so the two control cards still equal whatcorpus.tsderives.Local, on head
202d622e:pnpm --filter @objectstack/scenarios build && typecheck && exec vitest run --maxWorkers=2: lock VERDICT command-exit 0; Test Files 44 passed (44), Tests 1374 passed (1374).prompts.tsrestored to base 8b9b9d2,prompt-trace.test.tsfails exactly the six new "names its master-detail as one" cases; restored file byte-identical to the commit (git hash-objectmatch).Derived gate families (`dispatch-gates.mjs --commands`): 68 run, 65 exit 0, 3 NOT MEASURED
pnpm check:dual-build-cjs-loadsexit 3, PREREQUISITE NOT MET (reads every package's dist; only the scenarios closure is built here).node scripts/check-plugin-teardown-shape.mjs --self-testexit 3, its positive control is pinned to a commit this shallow clone cannot reach.pnpm check:query-options-erasurehit the local 300 s cap (exit 124).CI runs all three.
Acceptance notes
master-detail-field-exists,master-detail-inline-edit) are untouched; the expected gain is the project card's 2 median points (cloud#5080: 6 points over 3 runs), measured on the next scenario round, not here.Verification
Read first:
packages/qa/scenarios/src/runner/prompts.tsstructureLines()(the split), thensrc/loader.ts(the new refusal).Two-minute check:
pnpm --filter @objectstack/scenarios exec vitest run test/runner/prompt-trace.test.ts, expect every case green, including six "names its master-detail as one" cases.Generated by Claude Code