Skip to content

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

Description

@objectstack-fleet

repo:objectstack#2 · os-steve · session_01ADHkmRH4UCX1tvddXMS7cq

Filing gate: ① defect with a named landing spot. It is the template-mode remainder of #34448, recorded as an out-of-scope finding in that card's dev report (#34448 comment 6931668123, open question 3). Filed by area o2-C of seat repo:objectstack#2 on the seat's order: priority p2, domain:devx.

What happens

PR #34490 (for #34448) stops writing seeded rows back through the app in scratch and ask modes. Instead, an operation that follows a write runs on a fresh, freshly seeded copy of the same app. Template mode gets no fresh copy. At PR head dc265d44, packages/qa/scenarios/src/runner/orchestrate.ts:1769-1770 reads:

No fresh copy here: the app holds the agent's iterate, made live through its doors, which a host booted again would not hold; an earlier write is undone through those doors instead (restoreSeededRows).

So in a template-mode half, a card with a one-way state rule (for example asset_lifecycle: a decided scrap request never goes back to submitted) still has its write-back refused with 400 VALIDATION_FAILED. Every later operation reads NOT MEASURED. PR #34490 pins exactly this as the "without a fresh copy" case of its #34448 describe.

Why it matters

The eval loses coverage on every template-mode card with a state machine. Its scorecard then shows NOT MEASURED operations, not a verdict on the agent. No customer or user is affected.

Premise to measure first (the dev does this before any change)

A template-mode copy could be built by installing the served metadata of the iterated app (what the agent made live through the app's doors, not the verified build the half started from) into a freshly booted host, then seeding it and creating the personas the way moveToFreshCopy does. First measure whether that install reproduces the iterated app:

  • the same objects, fields, rules and actions as served;
  • the seed loads alike (seedDifference empty).

If it does not, report premise_still_valid: false with the difference, and do not fall back to any write-back variant.

Ask

  1. If the premise holds: give template mode's iterate Run half a FreshCopy that installs the served metadata into a fresh host. Then an operation after a write runs on that copy, as in scratch and ask modes.
  2. Tests: the #34448 describe's "without a fresh copy" case becomes a template-mode case that measures all six asset_lifecycle operations. Ablate it (template mode given no copy, so it goes red).
  3. Update the packages/qa/scenarios/README.md bullet "Each operation starts from the seeded rows" so it matches.

Reader: the repo:objectstack / devx lane seat, from pm:queue, after PR #34490 lands (same file).

Blocked-by: #34448

Dedupe: open and closed issues searched for "template mode restore seeded rows" (182 hits by search term, none on this topic beyond #34448 and #34294), restoreSeededRows (2 hits: #34448, #34294 closed), "scenario template one-way rule" (20 hits, none on this topic) and "fresh copy template iterate" (55 hits, none on this topic).

Activity

  1. added
    priority:p2
    domain:devx
    pm:blocked
    on Nov 16, 2026
  2. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Unlock (20:0xZ): the only blocker, #34448, closed at 19:52Z. Moved pm:blocked → pm:queue. The grade is unchanged.

  3. added
    pm:queue
    area:ai
    and removed
    pm:blocked
    on Nov 17, 2026
  4. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7

    Claim: PM loop round 1 · area ai-1 (lease:ai-1; the maintainer, verbatim, 2026-11-19 project chat: 「再开一个 ai 区」「暂时都只派 p1 p2 的卡」) · 2026-11-19T01:31Z
    Session: session_01Utp6CazXu8zyYD5PC6J2u7
    Account: os-bill
    Branch: claude/issue-34497-template-fresh-copy
    Worktree: objectstack-issue-34497
    Domain: domain:devx
    Seat: repo:objectstack#5
    File surface: packages/qa/scenarios/src/runner/orchestrate.ts (template mode's iterate Run half, the fresh-copy seam), the scenarios runner's fresh-copy / app-boot helpers it calls, the #34448 describe's test file and new tests named for this card, packages/qa/scenarios/README.md (the "Each operation starts from the seeded rows" bullet), root .changeset/. Stop on breach and report.
    Container & model: M, mode:subagent, model: default — no path-derived mandate, effort: high
    Clause-②: no (eval harness only)
    Metadata-protocol: none
    Responsibility: the scenario runner's template mode restores seeded rows through the app's doors, so a card with a one-way state rule (asset_lifecycle) reads every later operation NOT MEASURED; the eval seat and every template-mode scorecard
    Thread-read: 6959458152
    Premise: to measure first (the card's own gate) — on origin/main f4dbcc21: packages/qa/scenarios/src/runner/orchestrate.ts:2149 "No fresh copy here" still stands; README.md:530 bullet unchanged; PR #34490 merged. The dev measures whether installing the SERVED metadata of the iterated app into a fresh host reproduces it (seedDifference empty) and reports premise_still_valid: false with the difference if not, with no write-back fallback
    Serial constraints cleared: none on orchestrate.ts; open PR #35267 touches packages/qa/scenarios/README.md (other section) — overlap-check before each push decides
    Pre-claim lane: domain:devx (packages/qa/scenarios/**)
    Pre-claim deps: Blocked-by #34448 closed; PR #34490 merged
    Prior rulings read: scenario,runner,template,mode,operation,one-way,state,change,goes,unmeasured,restore,writes (+2 more) → 216 hits; ADR-0148 D1, ADR-0044 D1, ADR-0103 D2, ADR-0144 D6, ADR-0148 D2, ADR-0150 D9 (dev reads ADR-0148 D1/D2 on scenario runner shape before writing); thread: none

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 19, 2026
  6. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7
    os-dev-report

    {
      "issue": 34497,
      "status": "done",
      "branch": "claude/issue-34497-template-fresh-copy",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/35291",
      "head": "89ea8b117537c20adec815f2004625523e16c4f0",
      "session": "session_01Utp6CazXu8zyYD5PC6J2u7",
      "premise_still_valid": true,
      "premise_measurement": "Live run, no model, on two blank hosts scaffolded with create-objectstack@18.6.0 (objectstack dev --fresh). Host A: docs/qa/scenarios/builds/travel_expense.json installed unmanaged, then an iterate made through PUT /api/v1/meta/object/NAME (new object demotravel_travel_advance with a state_machine validation; new lookup field advance on demotravel_expense_claim). Host B: a fresh boot of the same project with A's served metadata (withoutItems(metadataAsArtifact(collections), baseline)) installed unmanaged. RAW served items: B refused with 422 INVALID_METADATA, 3 flows unrecognized_keys _diagnostics. With stripReadDecorations (@objectstack/spec/kernel, which says a served body must have its decorations removed before any re-parse): B answered 200 (copiedCount 31). Objects 8/8 (the new one included), apps 1/1, views 6/6, dashboards 1/1, reports 1/1, datasets 3/3, actions 4/4, flows 3/3, permissions 3/3, skills 1/1, hooks 1/1. Per-item deep diff over fields, validations and actions: 0 differences, except objects/demotravel_travel_advance._packageId (sys_metadata on A, com.example.demotravel-copy on B), which is the protection envelope. Seed: A 757 inserted / 0 refused, B 757 / 0, every persona assigned on both. seedDifference empty. No asset_lifecycle verified build exists in the repo, so travel_expense stood in; it also carries one-way state_machine rules.",
      "summary": "Template mode's iterate Run half now gets a FreshCopy. The copy is the same blank host booted again, with the iterated app installed unmanaged: iteratedManifest, module-private, takes the run's install manifest and replaces each served collection with the items served after the iterate, read decorations stripped. An operation that an earlier write would meet now runs on that copy, as in scratch and ask modes, so nothing is written back through the app's doors. withInstalledBuild hands use a copyOf(manifest) factory beside fresh. The README bullet now says scratch, template and ask modes use a copy and door mode writes back. The changeset is a @objectstack/scenarios patch. No new export, so Clause-② stays no.",
      "readings": {
        "A1": "holds at f4dbcc21: orchestrate.ts:2149 'No fresh copy here: …' and template mode called runHalf with no fresh, so it restored via restoreSeededRows",
        "A2": "holds, with one refinement: moveToFreshCopy (orchestrate.ts:1714) is generic inside runHalf and does the seed and personas; what template mode lacked was only a FreshCopy provider, and withInstalledBuild's fresh was fixed to the verified build's manifest",
        "A3": "holds at f4dbcc21: README.md:530 bullet 'Each operation starts from the seeded rows', whose template sub-bullet described the write-back"
      },
      "tests": "head 89ea8b11 (after merging origin/main 0c047d0c): under os-verify-lock, pnpm --filter '@objectstack/scenarios...' build, then pnpm --filter @objectstack/scenarios test: Test Files 40/40, Tests 1182/1182. typecheck (tsc --noEmit) exit 0. VERDICT command-exit 0. New case in the #34448 describe, 'template mode: the iterate Run half measures all six operations…': runCard modes ['template'] on asset_lifecycle, 6/6 operations asked and measured, dispose_scrapped_asset restored.freshCopy [demoasset_disposal_request/dr06], zero rule refusals, every copy installed the iterated host's objects. OneWayApp now serves _diagnostics on reads and refuses it at the install door. Ablation 1 (scripts/ablation-replace.mjs; tests import src, so no build leg), template mode given no copy, blob b3da89cb to ac741fb0: the first attempt was refused with ANCHOR AMBIGUOUS x2 and wrote nothing; rerun with a longer anchor gave -t 34497 1 failed, 3 operations NOT MEASURED 'restore: the rows could not be restored … dr06: status, decided_on (refused: … 400 VALIDATION_FAILED …)'. Ablation 2, strip removed, blob to fad3c78b: 1 failed, 5 operations NOT MEASURED 'restore: no fresh copy … (unmanaged install refused: 422 INVALID_METADATA …)'. Both restored to blob == HEAD with git diff HEAD empty.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 89ea8b11: 63 families, stdin /dev/null, exit captured before any pipe. 61 exit 0, 2 exit 3. check-plugin-teardown-shape --self-test needed a shallow fixture; after git fetch --depth=1 of 621a4876 the rerun exited 0 (48 cases). pnpm check:dual-build-cjs-loads needs every dist and is NOT MEASURED locally; CI runs it. --ran with recorded exit codes: 63 derived, 61 run, 2 NOT-MEASURED, 0 UNRUN. overlap-check --branch=HEAD --pr=35267: clean (35267 has since merged; origin/main merged in without conflict). check-nul-bytes exit 0. PR check-runs at report time: in_progress (Check Changeset, Lint ×8, Type Check ×4, Governed Surface Queue Guard, PR-body guards); the opt-in and queue jobs were skipped.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "2 REST via relay: pr_create (POST pulls + POST issues/35291/assignees os-bill, run 44445548109, body read back identical, 7944 bytes); post-stamped os-dev-report comment on #34497. git push ×5 (not REST). Reads were gh api GETs only.",
      "line_budget": "n/a — no skills/** or governed surface; 4 files +116/-44 vs origin/main",
      "files_changed": [
        "packages/qa/scenarios/src/runner/orchestrate.ts",
        "packages/qa/scenarios/test/runner/orchestrate.test.ts",
        "packages/qa/scenarios/README.md",
        ".changeset/34497-scenario-template-fresh-copy.md"
      ],
      "runner_helpers_touched": "withInstalledBuild (copyOf factory) and the new module-private iteratedManifest, both in orchestrate.ts; no other runner file",
      "deviations": [
        "The premise needed a live measurement on real hosts (no model): the FakeApp offline path cannot answer whether the platform's served metadata reinstalls. The measurement file was temporary, never committed, and removed from the tree.",
        "The premise holds only with read decorations stripped (stripReadDecorations, the spec's own helper). Raw served items are refused at the install door. This is a contract-mandated transform at the producer, not a write-back fallback.",
        "The merge commit 89ea8b11 (origin/main into the branch, main-only, clean) carries no trailer pair.",
        "Template-mode PR body order: the attribution line and the Requested-by line come first, then Fixes #34497 on line 3, as the dispatch's PR-body instruction requires."
      ],
      "open_questions": [
        {
          "question": "The dispatch and claim name ADR-0148 D1/D2 as the scenario runner's shape. At this head ADR-0148 is the recycle-bin record (snapshot store, restore under original ids), and nothing in it governs this runner. Correct the claim's prior-rulings pointer?",
          "options": ["A note it on the seat record; no change to this PR", "B leave as is"],
          "recommendation": "A, because the pointer came from a keyword match on 'restore' and would mislead the next reader"
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: the unmanaged install door refuses a served item's read decorations (_diagnostics) while the meta PUT door strips them silently. The spec (metadata-read-decorations.ts) puts the strip on the caller re-parsing a served body, so this is no contract violation; the runner now strips them.",
        "carrier: none · noted, not filed: bootDev inherits the caller's NODE_ENV. Spawned from a vitest process (NODE_ENV=test), objectstack dev --fresh did not accept the dev admin (sign-in 401 INVALID_EMAIL_OR_PASSWORD); under NODE_ENV=development it did. The runner CLI is not affected; this is test-harness reach only.",
        "carrier: none · noted in the PR's Acceptance notes: a template-mode copy carries only the collections the template has, the same set the iterate is scored on, and not data rows the agent inserted during the iterate."
      ]
    }
  7. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7

    Claim amendment 2026-11-19T02:39Z · Prior rulings read: correction for claim 6996904672: ADR-0148 D1/D2 were a keyword match on "restore" — ADR-0148 is the recycle-bin record (snapshot store, restore under original ids) and does not govern the scenario runner. No ADR on point; the governing text is #34448's ruling and PR #34490's #34448 describe. Raised by the dev's report 6997979726 (open question, option A). No change to PR #35291.

  8. objectstack-fleet commented on Nov 19, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CazXu8zyYD5PC6J2u7

    Close-out 2026-11-19T03:24Z: PR #35291 MERGED as 3fb7025c2; Fixes closed this card. Delivered: template mode's iterate Run half now runs an operation that follows a write on a fresh copy of the served app (iterated metadata, read decorations stripped) instead of writing rows back through the app's own doors, so a one-way state rule no longer turns later operations NOT MEASURED. Nothing remains here. pm:dispatched and lease:ai-1 off.

  9. removed
    pm:dispatched
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:aidomain:devxpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions