Skip to content

fix(scenarios): template mode's iterate Run half runs an operation after a write on a fresh copy of the served app - #35291

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34497-template-fresh-copy
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-34497-template-fresh-copy

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
Fixes #34497

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:场景评测的 template 模式,在迭代后的 Run 半程里,某个操作若会碰到前一步写入留下的改动,现在改在一份新起的副本上跑。副本是一台空白宿主,装入迭代后应用实际对外提供的元数据(去掉读时装饰键)。不再通过应用自己的接口把数据写回。
  • 为什么改:写回会被应用自己的单向状态规则拒绝(例如 asset_lifecycle 的报废申请批准后不能退回 submitted),后续操作全部记为 NOT MEASURED,评分卡上就没有对 agent 的结论。
  • 风险与回滚:只影响评测工具(已发布的评测包的运行器),不影响产品和用户。每份副本多一次启动和一次种子加载。回滚就是 revert 本 PR,template 模式回到写回。
  • 先看:packages/qa/scenarios/src/runner/orchestrate.ts 中的 iteratedManifest 和 withInstalledBuild 的 copyOf;再看 test/runner/orchestrate.test.ts 里 Scenario runner: restoring seeded rows through the app's write door is refused by its own state rules (VALIDATION_FAILED), so later operations go unmeasured (regression from #34338) #34448 describe 的 template 用例。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run test/runner/orchestrate.test.ts -t 34497,预期 1 passed。
  • 需要你做的:无,席位落地。

What changes

  • templateMode now gives its iterate Run half a FreshCopy (orchestrate.ts). The copy is the same blank host, booted again, with the iterated app installed unmanaged the way the run's own install landed. Before, template mode wrote moved rows back through the app's doors (restoreSeededRows), and an app's one-way state rule refused that write-back.
  • iteratedManifest (module-private) builds what the copy installs: the manifest the run's install sent, with each served collection replaced by the items the host serves after the iterate. Each item goes through stripReadDecorations (@objectstack/spec/kernel) first. The spec says a served body is no valid input to its own schema until its read decorations are removed, and the unmanaged install door refuses a served flow carrying _diagnostics (measured below).
  • withInstalledBuild now hands use both copyOf(manifest) and manifest. fresh is copyOf(landed.manifest), as before. Ask mode is unchanged.
  • README bullet "Each operation starts from the seeded rows": scratch, template and ask modes run the operation on a fresh copy, and door mode (or any half given no copy) writes back. Changeset: @objectstack/scenarios patch.

Premise measurement (the card's gate, run before any change)

This was a live measurement on blank hosts scaffolded with create-objectstack@18.6.0. No model ran. Host A installed docs/qa/scenarios/builds/travel_expense.json unmanaged and then took an iterate through PUT /api/v1/meta/object/NAME: a new object demotravel_travel_advance with a state_machine validation, plus a new lookup field advance on demotravel_expense_claim. Host B was a fresh boot of the same project with A's served metadata installed unmanaged. Both then got the card's personas and seed.

Readings
  • Raw served items, as metadataAsArtifact returns them: B's install answered 422 INVALID_METADATA, refusing 3 flows for unrecognized_keys: _diagnostics.
  • With stripReadDecorations applied: B's install answered 200 (copiedCount 31). All 11 collections had the same names on A and B (objects 8/8 including the iterate's new object, apps 1, views 6, dashboards 1, reports 1, datasets 3, actions 4, flows 3, permissions 3, skills 1, hooks 1). The per-item deep diff (fields, validations, actions) found 0 differences. The only difference is objects/demotravel_travel_advance._packageId, which reads sys_metadata on A and com.example.demotravel-copy on B. That is the protection envelope, not the item.
  • Seed: A 757 inserted / 0 refused, B 757 / 0. Personas employee, dept_manager and finance_officer were assigned on both. seedDifference empty.

Tests

  • #34448 describe: the case "without a fresh copy the same rule refuses the write-back" is now "template mode: the iterate Run half measures all six operations…". It runs runCard with modes: ['template'] on asset_lifecycle. All six operations are asked and measured. dispose_scrapped_asset carries restored: { freshCopy: ['demoasset_disposal_request/dr06'] }. No rule refusal happens, and the iterated host took only its seed's writes. Every copy installed the same objects as the iterated host, including the scripted iterate's object. Every boot stopped.
  • The one-way double (OneWayApp) now serves _diagnostics on metadata reads, and its unmanaged install door refuses an item carrying it, as the real door does.
  • The #34294 case "with no fresh copy (template mode)" is retitled "(a Run half given none)". It still pins the write-back path, which door mode uses.
Ablations (scripts/ablation-replace.mjs; tests import src, no build leg)
  • Template mode given no copy (…opts.promptChoice, fresh); changed to …opts.promptChoice); in templateMode, blob b3da89cb to ac741fb0). The first attempt was refused with ANCHOR AMBIGUOUS (x2) and wrote nothing. Rerun with a longer anchor: -t 34497 gave 1 failed, with 3 operations NOT MEASURED: restore: the rows could not be restored to the seeded state: demoasset_disposal_request: 1 changed (dr06: status, decided_on) (refused: update … 400 VALIDATION_FAILED …). Restored blob equals HEAD, and git diff HEAD is empty.
  • No read-decoration strip (items.map(stripReadDecorations) changed to items, blob to fad3c78b): 1 failed, with 5 operations NOT MEASURED: restore: no fresh copy of the app could be seeded for it (unmanaged install refused: 422 INVALID_METADATA …). Restored blob equals HEAD, and git diff HEAD is empty.

Verification

At head 89ea8b1 (after merging origin/main 0c047d0)
  • pnpm --filter '@objectstack/scenarios...' build, then pnpm --filter @objectstack/scenarios test: Test Files 40/40, Tests 1182/1182. typecheck (tsc --noEmit) exit 0. Lock VERDICT command-exit 0.
  • dispatch-gates --commands --repo objectstack-ai/objectstack derived 63 families. 61 exited 0 and 2 exited 3. check-plugin-teardown-shape --self-test needed a shallow fixture; after git fetch --depth=1 of 621a487 the rerun exited 0 with 48 cases. check:dual-build-cjs-loads needs every package's dist, and CI runs it. --ran reconciliation: 63 derived, 61 run, 2 NOT-MEASURED, 0 UNRUN.
  • overlap-check --branch=HEAD --pr=35267: clean. check-nul-bytes exit 0.

Acceptance notes

  • The copy installs the collections the template carries, the same set the iterate is scored on (collections). An iterate that adds an item of a metadata type the template had none of is neither scored nor copied. That gap already existed and is unchanged.
  • Rows the agent inserted during the iterate turn, as opposed to metadata, are not carried to a copy. The copy holds the card's seed only, the same as the scratch and ask copies.
  • Template-mode copies boot from the host project and install the iterated app. A copy whose install is refused is NOT MEASURED, with the door's answer.
  • The dispatch named ADR-0148 D1/D2 as the scenario runner's shape. Read at this head, ADR-0148 is the recycle-bin record, and its D1/D2 (snapshot store, restore under original ids) govern record restore in the engine, not this runner. They do not bear on this change, so there is no tension to resolve. The change stays inside the runner's Run half and adds no mode, door or record field.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7

…f the served app

The copy is a blank host with what the app serves after the iterate installed
the same way (iteratedManifest: the run's install manifest, each served
collection replaced by the items served now, read decorations stripped), so an
operation an earlier write would meet runs on it instead of writing the rows
back through the app's doors.

Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7
Co-authored-by: Claude <noreply@anthropic.com>
…set_lifecycle operations on served copies

Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7
Co-authored-by: Claude <noreply@anthropic.com>
…h copy; iteratedManifest stays module-private

Claude-Session: https://claude.ai/code/session_01Utp6CazXu8zyYD5PC6J2u7
Co-authored-by: Claude <noreply@anthropic.com>
@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 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/scenarios, touching 5 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/data-api.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/concepts/metadata-lifecycle.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/data-modeling/schema-design.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/deployment/cli.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/permissions/permission-sets.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/protocol/objectui/actions.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/ui/actions.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-5.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/releases/v17/17-6.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))
  • content/docs/releases/v18/18-3.mdx (via /:object/export (route, bridged from symbol templateMode — its route source's handler names it))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md) — pages documenting those are invisible to this run
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 1 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 f848e3739f36fdfadc58cb4ce07defda6e624cba → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e1f09c33e8f464e340b2a01aa6e807ae598fad43 — the merge of head 89ea8b117537c20adec815f2004625523e16c4f0 into base f848e3739f36fdfadc58cb4ce07defda6e624cba, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e1f09c33e8f464e340b2a01aa6e807ae598fad43 && git checkout e1f09c33e8f464e340b2a01aa6e807ae598fad43
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f848e3739f36fdfadc58cb4ce07defda6e624cba 89ea8b117537c20adec815f2004625523e16c4f0 && git checkout -B drift-repro f848e3739f36fdfadc58cb4ce07defda6e624cba && git merge --no-ff 89ea8b117537c20adec815f2004625523e16c4f0

node scripts/docs-audit/affected-docs.mjs --json f848e3739f36fdfadc58cb4ce07defda6e624cba

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs f848e3739f36fdfadc58cb4ce07defda6e624cba → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 89ea8b117537c20adec815f2004625523e16c4f0 · 2026-11-19T03:00Z

  • 形态: draft → main, 4 files, +116/−44, 4 commits (3 content + 1 main-only merge of 0c047d0c, taken before the PR opened). Fixes #34497 on the first content line; Scenario runner: restoring seeded rows through the app's write door is refused by its own state rules (VALIDATION_FAILED), so later operations go unmeasured (regression from #34338) #34448, Scenario runner: restore the seeded rows an operation reads before it runs, so one failed write does not cascade into the next #34294, feat(scenarios): the door rules arm has a built-in corpus, the hosted build door's authoring rules ported as data #35267 and ADR-0148 are named with no closing keyword beside them. check-governed-merges --pr 35291: 0 of 4 paths governed, 160 lines ≤ 3000 → ordinary queue landing. Clause-②: no holds: iteratedManifest is module-private, withInstalledBuild's callback shape is internal, no export changes; Metadata-protocol: none.
  • Fixes vs the card: the card's gate (measure first, no write-back fallback) and its three asks are all met: (1) template mode's iterate Run half gets a FreshCopy that installs the served metadata; (2) the "without a fresh copy" case became the template-mode case measuring all six asset_lifecycle operations, with ablations; (3) the README bullet is updated. So Fixes is right.
  • Premise: the dev measured it live on two create-objectstack@18.6.0 hosts with no model (PR body, Readings): raw served items → 422 INVALID_METADATA on 3 flows (_diagnostics); after stripReadDecorations → 200, 11 collections alike, 0 field/validation/action differences, only _packageId differs (envelope, not item); seed 757/757 on both, seedDifference empty. L1 read the readings, did not re-run them.
  • Changeset: .changeset/34497-scenario-template-fresh-copy.md, patch on @objectstack/scenarios (published; no private). Sentences read against the diff: "Template mode still wrote the moved rows back … refused with 400 VALIDATION_FAILED" = the removed comment and the old pin; "a blank host booted from the same project with the iterated app installed unmanaged, the same way the run's own install landed" = copyOf(iteratedManifest(manifest, served)) through landed.install; "each collection the app serves replaced by the items it serves after the iterate" = iteratedManifest, which also drops a collection served empty; "comes off its read decorations first (stripReadDecorations from @objectstack/spec/kernel)" = the import and items.map(stripReadDecorations); the measured-host sentences = the dev's live readings above; "carries restored: { freshCopy }" and "Door mode still writes the rows back" = doorMode calls runHalf with no fresh, pinned by the retitled Scenario runner: restore the seeded rows an operation reads before it runs, so one failed write does not cascade into the next #34294 case.
  • 差异由 L1 读过: the old fresh closure becomes copyOf(installs), with fresh = copyOf(landed.manifest), so scratch and ask copies are unchanged; template mode adds the iterated copy only. A managed fallback install stays managed on the copy, since landed.install is reused.
  • Pins: the template-mode case runs runCard on asset_lifecycle: six of six operations measured and asked, dispose_scrapped_asset restored via freshCopy: ['demoasset_disposal_request/dr06'], zero rule refusals on any app, the iterated host took only its seed's writes, every copy installed the same objects as the iterated host (including the scripted iterate's object), every boot stopped. The OneWayApp double now serves _diagnostics and its install door refuses it, as the real door does. Ablations: no copy → 1 red (3 NOT MEASURED, write-back refused 400); strip removed → 1 red (5 NOT MEASURED, install refused 422); restored blob == HEAD both times.
  • 门禁: check-runs on head 89ea8b11: 33 success, 16 skipped, 0 failure (Lint & Repo Gates, TypeScript Type Check and Test Core among the successes). Dev local NOT MEASURED: check:dual-build-cjs-loads (needs every dist), covered by CI's Lint on this head.
  • 接受的偏差: (1) The removed one-way write-back pin is not lost coverage: the write-back path stays pinned by the retitled Scenario runner: restore the seeded rows an operation reads before it runs, so one failed write does not cascade into the next #34294 case, which door mode uses. (2) A main-only merge commit without trailers. (3) The claim's ADR-0148 pointer was a keyword false hit (amendment 6998006254), so no ADR applies.
  • Nit, not blocking: the 速读 line「只影响评测工具(私有评测包的运行器)」is wrong on one word: @objectstack/scenarios is published (npx @objectstack/scenarios). A body-only edit to「已发布的评测包」fixes it.
  • 范围外去向: none. The two Acceptance notes (an iterate adding a metadata type the template lacks is neither scored nor copied; agent-inserted rows are not carried to a copy) describe existing behaviour this PR leaves unchanged.
  • 落地条款: K = 8 first-parent commits on main since merge base 0c047d0c (< 15), no locale pack. Non-governed ⇒ ai-1 lands per landing-operations.md (pr_ready + auto-merge) after this ACCEPT; on MERGED, close-out on Scenario runner: in template mode, an operation after a one-way state change still goes unmeasured, because the restore writes back through the app's doors #34497.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7

Landing · ACCEPT (L1-a) → PR #35291 comment 6998338858 · head 89ea8b11 · 2026-11-19T03:00Z

Probe Reading
check-governed-merges --pr 35291 0 of 4 paths governed; 160 lines ≤ 3000 → ordinary queue landing
check-runs on 89ea8b11 33 success, 16 skipped, 0 failure; mergeable_state clean

Area ai-1 landing armed (ready + auto-merge); #34497 close-out on MERGED.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 03:01
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 3fb7025 Nov 19, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34497-template-fresh-copy branch November 19, 2026 03:21
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

2 participants