Files
prometeu-runtime/discussion/lessons/DSC-0068-memcard-public-host-persistence/LSN-0073-public-persistence-is-a-process-and-ownership-contract.md
bquarkz a4bec5bc45
Intrepid/Prometeu/Runtime/pipeline/head This commit looks good
feat(host): expose memcard controls and qualify process persistence
2026-10-30 10:10:07 +00:00

7.3 KiB

id, ticket, title, created, tags
id ticket title created tags
LSN-0073 memcard-public-host-persistence Public persistence is a process and ownership contract 2026-10-30
memcard
persistence
headless
host
ownership

Context

The runtime now exposes media preparation, three explicit boot choices, native observation, protected teardown and same-media recovery through its installed headless protocol. The file backend has a single owner across compatible hosts, including read-only opens. Runtime tests remain neutral PBX/ABI programs and do not depend on a source-language frontend or another application's build.

Historical source: accepted decision DEC-0068, executed through PLN-0199 from AGD-0071. Their workflow files are disposable. The published contracts are Save Memory and MEMCARD and Headless Automation. This lesson explains those published results rather than defining new behavior.

A native API is not an installed integration surface

Injecting storage into an in-process host is useful for controlled faults, but does not establish that a consumer can configure the distributed executable. Media preparation and player choice therefore became explicit operations of the existing transport. The negotiated minor and capability identify support; an executable version string alone does not. A client without the extension continues using the original non-memcard shapes.

Preparing media separately from boot lets missing, corrupt, read-only and busy files produce native domain errors before game initialization. Opening is not creation. A persistent choice does not turn into fresh RAM after a failure. These distinctions belong to the provider so every consumer sees the same storage and admission policy.

Result knowledge, RAM state and resource lifetime are separate

A retained terminal result is a statement about an attempt. It is not evidence that a worker still owns the source, and absence of a mounted backend is not evidence that the worker is active. In particular, reacquisition can fail after the previous IO safely returned. An explicit worker-return observation separates that case from an outstanding operation.

This distinction also matters after watchdog escalation. A late completion can provide the original worker error and return its resources without rewriting the terminal result already exposed to the game. Same-card reconciliation keeps that original result available until guest release. It does not consume the result to make media operations easier. Controlled tests exercise both a refusal before publication and an uncertain attempt inside metadata publication.

Ending a session does not establish media health. An installed image with an indeterminate publication stays write-blocked after reset, and a new persistent admission cannot bypass the need for explicit revalidation.

RAM has its own state. A memory-only commit completes without a durability claim and leaves modified RAM dirty. Teardown first waits for or cancels already admitted IO, then reevaluates RAM. It can avoid an unnecessary discard prompt if the save completes cleanly during that wait. If dirty data remains, refusal keeps the process, session and channel available for a later explicit decision.

A process boundary makes file ownership visible

Serializing one runtime's transactions does not exclude another process that opened the same image from making decisions against an older map. The shared file backend now attaches an exclusive OS lock to the open file, including read-only access. Hardlink and symlink tests exercise identity rather than path string equality. Creation locks its new file before publishing a non-replacing name. Resource ownership continues through cancellation, result release and blocked teardown until IO actually ceases or the owner process dies.

Recovery has to account for the lock held by the same host. Opening another descriptor before relinquishing the safely quiescent backend can conflict with that host's own lock. The recovery boundary transfers ownership, validates the expected card identity before mutation and preserves local RAM on failure. The selected path containing a different card is an identity error, not implicit permission to register or load a replacement game record.

Deterministic guest progress and asynchronous observation coexist

The headless owner polls native IO between commands. Completion and deadlines can become observable while guest PC, stack, tick and frame remain unchanged. Driving IO does not require inventing game frames or restarting initialization.

Two integration details were exposed by the first real memcard frame. A controlled bootstrap slice can consume the runtime's step marker before a logical frame closes; the host retains its requested advancement until the frame or an explicit stop boundary. Also, a host dialog can reuse frame ID zero. Its producer is excluded from canonical game capture, so an initial game frame is neither mistaken for the dialog nor rejected merely for sharing that numeric ID.

A resident game waiting for external media action is paused rather than terminated. Recovery preserves its continuation and admitted RAM. It does not call bootstrap again. Explicit continuation in RAM uses the existing SO choice and remains distinct from restarting a game with fresh memory.

A readback oracle should be unable to save its own answer

The neutral writer stores bytes 0, 127, 128 and 255 and exposes the guest query SUCCESS through public state inspection. A different process runs a reader with no save or presentation import. It checks each prior byte, traps on a wrong or missing payload and exposes a separate readback result. The entire image remains unchanged by that reader. A further process changes app_version while retaining the same uint32 app_id. Read-only loading into RAM is qualified independently.

The same process oracle runs through the public dispatcher from another working directory against a real extracted archive produced by the distribution workflow. That establishes something stronger than reopening a native object in one test process or copying target/debug binaries into a directory labeled as an install. Archive, binary, schema and source fingerprints identify the evidence precisely even while the implementation is an uncommitted checkout.

Evidence and ownership boundary

Qualification evidence records 1,107 passing workspace tests, 73 passing release tests, strict formatter/clippy checks, and both extracted distribution tests passing. The generic workspace gate has 14 ignored manual or installation tests; the two installation tests were separately run successfully. Execution was qualified on macOS arm64. This is not a physical power-cut, cross-target or storage-latency qualification.

The runtime delivery prepares a supported contract and its independent evidence. No consumer source, configuration, SDK, workflow or tests were changed or run. Future client/frontend integration uses the published surface and has its own acceptance criteria. Its completion is neither claimed nor required to close this provider work. This boundary prevents a provider plan from absorbing another domain merely because that consumer originally discovered the missing interface.