# L1: kept PGlite opens the declared database once

The Rallly K6 pair on the mini used substrate `63e422d7`, engine `d82b143`,
World runtime `3.0.2194`, origin `http://localhost:4417` and one kept browser
profile. The retained `k6-lap-63e422d7/dry-run1.log` and `dry-run2.log` start at
2026-10-12T21:41:36Z and 21:43:43Z. These are the mini's existing visit readings;
this source change ran no app, World, test, build, typecheck or probe.

| Visit | Retained World log lines | Spawn to serving |
| --- | --- | --- |
| First | `dry-run1.log:27` places the prepared cluster; `:28` spawns at +0.39 s; `:71` serves at +0.91 s | 0.52 s |
| Kept | `dry-run2.log:27` spawns at +0.46 s; `:66` serves at +1.41 s; no placement line | 0.95 s |

The exact runtime tarball is `volter-world-runtime-3.0.2194.tgz`, 966,100 bytes,
SHA256 `754795562c963e8506a41bc3ea4f0aff353829e09355c7ab84732de3f6a92429`.
Its compiled `dist/src/pglite-backing.js:468` returns `placed: false` when
`PG_VERSION` exists, and `:622` passes `--prepared` only when placement happened.
Its `pglite-host.mjs` matches source commit
`9fc0ce4d9c233c9953351c743727241c4f2cfdfd` byte for byte. Without that flag,
`openDeclaredDatabase` opens `template1`, checks or creates the identity,
closes that instance, then opens the declared database. With it, the host opens
only the declared database. This establishes the extra initialization path;
the old logs do not contain the untruncated flag or the host's private log.

The fix keeps a declared-database identity receipt inside the live cluster after
this boot's own listener receipt and PostgreSQL protocol answer establish
readiness. An exact runtime/PGlite/user/database match uses the existing direct
open. Missing or different identity retains maintenance, removing the old
receipt before a partial legacy rename can leave it stale. The receipt contains
no password or migration assertion. A matching kept open reads the receipt
once and does not rewrite it. Both World and host logs name the selected path.

Existing clusters without the receipt take maintenance once before subsequent
opens qualify. Independent mini readings must still show the new branch and
compare first and kept opens; no improvement is claimed from source alone.
The separate `runtime modules loaded` interval, 129.9 ms versus 268.3 ms at
line 21 of each log, precedes PGlite spawn and remains unattributed. Neither log
establishes WAL replay or recovery as the cause.

## Architecture intent

The owning managed-infrastructure section of
[architecture](../contributing/architecture.md) is human-required by
[policy](../../policy/human-required-paths.yml). The paragraph below accompanies
the code on `w3/arc-world`; the owner reads that branch before `main`.
Provenance: lead ruling under owner delegation, 2026-10-12,
`/Users/yueranyuan/volter/heavy-runs/review/five-on-the-ledger/OWNER-RULINGS.md`,
section "2026-10-12 22:28:46Z: decisions are delegated to the lead", ruling
"twin-world architecture paragraphs land with their code on w3/arc-world".
This extends the existing prepared-open mechanism to proved kept identity;
it does not supersede an ADR or invariant.

> A serving PGlite cluster keeps its declared database identity inside its data
> directory. The runtime publishes that receipt only after this host's listener
> receipt and PostgreSQL protocol answer establish readiness. A later open with
> the same runtime, exact PGlite pin, user and database opens the declared
> database directly, just as placement does. Missing or different identity takes
> the maintenance path; its previous identity receipt is removed before that
> path can rename a legacy database. The receipt does not vouch for a migration
> or any application data, and the gateway still checks this boot's declared
> password. The boot and host logs name the selected open path.
