Files
prometeu-studio/discussion/lessons/DSC-0106-studio-isolated-guest-test-targets/LSN-0111-isolated-guest-targets-and-complete-structured-results.md
T
bquarkz 1471b427f1
Test / Tests and coverage occurred while executing withChecks step.
Intrepid/Prometeu/Studio/pipeline/pr-master There was a failure building this commit
feat(studio): deliver asset authoring and automation workflows
Add shared human/task asset batches with reviewed atomic publication, explicit
reference rebinds, ownership inspection and qualified glyph/scene budgets.
Expose the same authoring and capacity results through Assets and MCP.

Deliver isolated guest test targets, retained visual evidence and immutable
runtime lifecycle/control observations. Preserve provider qualification and
installed authoring examples alongside the completed discussion lessons.

Close AGD-106 coordination and the delivered discussion workflows through
housekeeping, updating lesson references and preserving qualification limits.
Sound remains outside the asset delivery wave.

Validation: 579 module tests and 31 additional desktop, process and installed
checks passed; native glyph/scene 16/17 boundaries qualified. Discussion
validation passed after housekeeping.
2026-11-11 01:21:25 +00:00

12 KiB

id, ticket, title, created, tags
id ticket title created tags
LSN-0111 studio-isolated-guest-test-targets Isolated Guest Targets and Complete Structured Results 2026-11-10
studio
compiler
pbs
testing
automation
mcp

Original problem and consolidated decision

Owner: studio, guest test targets and results. Compiler, compiler/PBS, runtime/headless and FE/MCP receive propagation. This lesson consolidates accepted DEC-0094 and completed PLN-0172 from DSC-0106 / AGD-0108. It builds on the shared lifecycle and original evidence services.

Replacing a production main file to run a test creates several ambiguities: which sources ran, whether the build remains usable, what happened to the user's card, and whether silence means success. A separate script also cannot provide the same authority and results to the human interface and MCP.

The decision delivers explicit project-local targets, exclusive immutable builds, a bounded shared runner and complete structured case results. It preserves normal PBS visibility, machine lifecycle/budgets, project identity and production Play. The provider exposes existing guest logs through negotiated read-only tooling; there is no new guest syscall or private game access.

Final result and qualification

The public life fixture passes; its deliberate assertion failure is reported as a failed case with successful operation completion. The public Zelda shop fixture uses existing Inventory, CaveSupplyShop and SaveStore APIs on a disposable project copy. Purchase and commit pass, then a distinct process reopens the same disposable card and passes readback. All 137 production source/barrel hashes match before and after. The passing pilot also checks the unrelated personal image.

The final qualification record contains commands, raw archived JUnit reports, normalized outcomes, source/report hashes, transcripts and screenshots. The latest reports across invocations contain 1,182 passed, twelve existing pipeline skips, zero failures/errors. This is not a claim that all suites were freshly rerun together. After the native correction, 34 cases were executed and passed across the unchanged pilot and native runner, media, Tests/MCP and DEV compatibility gates; the direct single-advance probe also passes. Installed knowledge remained up-to-date after its earlier passing run.

The qualified macOS arm64 installation is the external provider's extracted runtime/dist-staging/qualification/PLN-0202. Headless SHA-256: 18423f798ab28bbd38c12a7ee46459f3ef3d08876cc64327952f57be041fc5df. The delivery verification checks provider sources, archive, installation and fifty unchanged consumer files. The qualified provider is identified by fingerprints over an uncommitted checkout based on 49d7fca; a new commit is not its identity. Stable dispatcher/headless also match this delivery at final inspection, differing from the earlier baseline. This Studio task did not replace an installation or write/build/commit runtime.

Declare a target without changing production

prometeu.json contains versioned testTargets. Each entry declares a unique ID, entrypoint, source/support roots, exact exclusions, expected cases and test log tag. production is reserved; omitted selection retains production behavior. AppMode.Game/System remains the machine profile and appId remains project identity.

The installed life example selects src and tests/life, adds tests/support, and excludes exactly src/main.pbs. Production sources and barrels remain untouched. The compiler uses the same dependency/import/asset resolver, validates the actual included set and preserves original source paths for diagnostics. Ordinary PBS visibility still applies; test-only support is absent from production.

Target identity travels through API/Core, compiler gateway, resolved workspace, frontend lifecycle, packing and results. The selected program has one normal MemcardBoot/bootstrap/Init/Frame lifecycle. Test build output is exclusive at .studio/test-builds/<targetId>/<buildId>/. Immutable provenance covers consumed source/configuration/dependency and asset inputs. Failed/cancelled builds cannot publish a usable partial cartridge; production Play selects production explicitly.

Start once, then query the retained operation

The Tests workspace and MCP call the same GuestTestTools service. A typical request body for studio_tests_start is:

{
  "targetId": "life",
  "maxFrames": 120,
  "blockFrames": 1,
  "timeoutMs": 30000,
  "media": "memory_fresh",
  "reopenRunId": null,
  "discardUnsaved": false
}

MCP also supplies projectRoot, the current taskId and clientRequestId. The six tools are studio_tests_targets, studio_tests_start, studio_tests_get, studio_tests_cancel, studio_tests_transcript and studio_tests_shutdown. Summary queries do not inline the transcript; bounded pages return original native records and decoded events. Repeating an identical request returns its retained operation; changed parameters conflict. Current authority is checked before cached results, so an old task cannot recover access by knowing an ID.

The runner builds an immutable target, admits the consumed target catalog, starts a fresh owned process, advances bounded blocks and drains pending log pages before the next block. It performs final reads when possible and retains native causes, original captures, completion and verdict separately. An assertion failure is not an operation transport failure. Timeout/cancel do not fabricate a completed suite; worker termination and lease closure precede final termination reporting.

Human runs use the same shared admission and manual lease. A retained native session blocks production execution and grant until explicit cleanup. During an agent grant, human mutation is disabled while result/case/evidence inspection stays available. DEV remains responsible for grant/reclaim/observation.

Check both native and producer continuity

Protocol 1.2 negotiates log_read before guest execution. get_logs accepts a nullable exclusive cursor and limit 1..1024. Null includes the first available record, including sequence zero. Typed uint64 sequence/app identity information is preserved without floating-point conversion. Reads neither run the guest nor drain the ring. Reset retains the native log stream; a new process has a new session.

Historical overflow means the ring has evicted something at some time. It is informational when this reader has lost nothing. A required-history gap, discontinuous sequence, changed stream/session, malformed tagged event or conflicting duplicate is infrastructure failure. This distinction was an explicitly authorized revision of the accepted decision, not an implementation shortcut.

Native sequence continuity is insufficient on its own: the guest accepts at most ten application log messages per frame and 256 UTF-8 bytes per message. A rejected message never receives a native sequence. Every unique structured event therefore has a contiguous zero-based producer payload.ordinal, and suite_end carries payload.eventCount, including itself. An idempotent repeated event is not counted again. A retained true assertion cannot hide a dropped false assertion.

Versioned events identify suite/case/event and kind: suite_start, case_start, assertion, checkpoint, case_end and suite_end. Only the declared test tag is decoded; ordinary game text is not an assertion. Expected and actual values retain their availability. Checkpoint IDs require admission to the shared evidence store and retain their original operation/session/build/frame provenance.

The expected catalog and transcript produce passed, failed, not_run and infrastructure_failure. Passing requires a nonempty suite, assertions, every expected case explicitly completed, consistent producer/native history and no guest/native failure. Empty, missing, malformed or unfinished suites never pass. Host retention limits fail explicitly instead of silently truncating history.

Own the media and preserve native refusal

memory_fresh creates a fresh process context; a cartridge without memcard_slots does not receive an unsupported media boot choice. Disposable create/reopen require declared card support and service-owned media under .studio/test-runs/<runId>/. Reopen selects a prior owned create run, never a personal/default image. Historical media/result records do not restore task authority after project reopen.

Commit acknowledgement, RAM contents and proven persistence are different facts. The shop writer closes cleanly; a new reader process loads the prior saved values. Both card hashes are retained. This reader publishes presentation during bootstrap, so whole-image immutability is not its oracle; the readback assertions are. The separate no-presentation native memcard cases still verify unchanged image bytes.

Dirty/pending native refusal remains visible. A refused teardown leaves the runtime attached and requires an explicit recovery/discard choice. Later cleanup changes current session facts without rewriting the immutable original test result.

Native IO progress is separate from guest execution

The first shop reader originally hit ATR-20: watchdog after 100,000 host ticks, zero completed frames, no guest fault and pending native presentation IO. The retained baseline reproduces it without Studio using exactly one advance.

The runtime owner corrected blocked bootstrap IO coordination within that original advance. Its waits occur outside firmware/VM ticks; original native deadlines, machine budgets and ownership remain. The runtime lesson explains the provider contract and controlled regressions. Studio verified the delivered fingerprints and reran the unchanged public pilot. A successful provider test alone did not substitute for consumer acceptance.

Pitfalls

  • Changing source/barrel files to select a test loses target identity and makes cancellation recovery depend on restoration.
  • Treating historical eviction as current unread loss rejects valid readers; ignoring producer ordinals can approve an incomplete suite.
  • Raising budgets or replaying advance to hide pending native IO changes the test rather than proving the original behavior.
  • Assuming commit acknowledgement proves persistence skips the required new-process readback. Comparing a presentation-publishing card as immutable uses the wrong oracle.
  • Copying a previous capture into current run provenance changes evidence identity.
  • Returning before termination or ignoring dirty refusal admits conflicting work.
  • Inferring executable equivalence from version or a repository commit discards the actual installation identity; fingerprints and executed gates must agree.

Normative and implementation references