Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,8 @@ jobs:
permissions:
contents: read
id-token: write
# Allow 90 minutes for the full Game Session native issuer suites; retain Account 60, World 40 and Game Design 30.
timeout-minutes: ${{ matrix.module == 'game-session-service' && 90 || matrix.module == 'account-service' && 60 || matrix.module == 'world-management-service' && 40 || matrix.module == 'game-design-service' && 30 || 20 }}
# Allow 90 minutes for the full Game Session native issuer suites; retain Account 60, allow World 60, and retain Game Design 30.
timeout-minutes: ${{ matrix.module == 'game-session-service' && 90 || matrix.module == 'account-service' && 60 || matrix.module == 'world-management-service' && 60 || matrix.module == 'game-design-service' && 30 || 20 }}
strategy:
fail-fast: false
matrix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,24 @@ A retained non-public catalog projection does not disqualify a new preparation f

The internal `GameSessionPrivateFreshTargetRepository` can preallocate a private realm identity in the existing canonical realm catalog from one exact retained, unexpired FRESH preparation. Its writable serializable owner transaction locks and requalifies the preparation and original complete Human policy/source, allocates a distinct realm UUID internally, and binds the immutable catalog request/outcome to that preparation’s namespace, lifecycle, generation, policy and build. Exact retry requalifies the retained evidence and preserves the original identity and bytes even after preparation expiry; it creates no new row or admission authority. Concurrent serializable attempts can return PostgreSQL `40001` because an advisory-lock wait cannot refresh the transaction snapshot. The calling owner must roll back and retry its entire transaction in a fresh serializable transaction with the same immutable request and retained preparation; a statement retry or replacement request identity is invalid. An unresolved outcome remains unresolved until exact committed readback, rather than being treated as proof that no other attempt committed. Expiry refuses new allocation and remains checked at commit; changed intent conflicts. The private projection remains non-visible, non-public, `ISOLATED`, revision `1` and `PREPARING`; it is excluded from public collection reads. SQL guards preserve the original public path and recheck the preparation deadline at commit. This identity is an input for later actual owner materialization, not a completed private target, runtime allocation, CLOSED admission pointer, owner manifest, activation or admission.

Subsequent lifecycle catalog facts use `GameSessionPrivateFreshCatalogRevisionRepository.advance` behind that same durable realm UUID and tenant-unique slug. The exact original request binds the realm, later preparation/lifecycle and both expected catalog revision and expected current lifecycle. A writable SERIALIZABLE owner transaction appends immutable revision evidence and advances the separate catalog head by exactly one; it requires a new, unexpired FRESH preparation with the same stable selectors and its own complete Human policy/source. New namespace, lifecycle, generation-one and policy/build facts belong to that revision; the original revision-one catalog row and all previous request/receipt/preparation/selection evidence remain unchanged. The caller retains the whole-transaction `40001` retry obligation. Exact historical retry/readback returns its original outcome even after later advancement or preparation expiry; changed intent conflicts. A new advancement and its head must commit together before the preparation expires.

Historical preparation/request reads and an as-of current catalog read are distinct. World-purpose reads require the target's exact preparation/lifecycle/revision to match the current catalog head as well as the selected workflow preparation; neither read may substitute a newer lifecycle. Catalog revision is independent of current-selection revision, state generation and admission-pointer version. Targets remain non-visible, non-public `ISOLATED PREPARING` with admission denied. These local source components implement neither logout/accepted-operation lifetime policy nor actor authorization, World materialization, manifests or CLOSED aggregation. The [realm-routing tracker](../../../project-management/implementation-tracking/realm-routing-and-playable-state.md#private-catalog-lifecycle-revisions) owns qualification status and remaining work.

The separate unregistered `GameSessionPrivateFreshRuntimeAllocationRepository.allocate` preallocates one opaque non-nil runtime `gameInstanceId` internally. Its exact request names the preparation/lifecycle and realm, expected current catalog revision/request/receipt and expected current-selection request/revision; no caller supplies the runtime UUID, namespace, generation or build. The existing preparation, current catalog and current-selection owners independently supply and qualify those facts under the caller-owned writable SERIALIZABLE transaction and shared source locks. One immutable allocation binds the complete derived source tuple, original canonical request bytes/digest and runtime receipt. The row is provenance only and does not create `game_instances`, a public original `StartSession` association, World rows, a manifest, actor or credential authority, CLOSED/OPEN, activation or admission. It creates no competing realm, lifecycle, namespace or current-selection authority.

Exact allocation retries preserve their original UUID and receipt without consulting a later head or extending expiry. Changed intent or another allocation request for the same retained preparation conflicts. `readByRequest` is independent committed historical readback only, never current permission for another effect. Before consuming an allocation, `readForWorldPreparation` separately locks and requalifies the exact current catalog, selected preparation, selection receipt and database-clock expiry, returning only an existing matching allocation; it never allocates during a read. Stale, superseded, absent or expired sources refuse new allocation and current-use reads. Storage predicates requalify all source bindings and expiry at insert and final commit. The caller must commit and independently read back the exact request before publishing preparation evidence, and retry the entire owner transaction after `40001` with the unchanged request. These local locks end with that transaction and provide no ongoing cross-owner protection or accepted-credential lifetime decision. Qualification status is recorded in the [private runtime identity tracker](../../../project-management/implementation-tracking/realm-routing-and-playable-state.md#private-fresh-runtime-identity-preparation).

The standalone, unregistered `CurrentPrivatePlaytestLifecycleReadService` exposes that internal current source only to the exact same-namespace Account workload, without propagated player context. Its bounded closed frame correlates the original read and exact namespace/tenant/world/realm, then returns explicit absence or the immutable selection, lifecycle, expiry, source/build and private-policy provenance as observed by Game Session. Account consumes these as-of facts through its peer-qualified client; they confer no grant or actor authority and protect no later cross-owner commit. `PREPARING` remains invisible to player discovery under ADR 0137.

The separate, unregistered `PrivateWorldPreparationReadService.ReadPrivateWorldPreparation` supplies World with one exact current private preparation, its already allocated private target and its already retained runtime identity allocation. It requires the exact same-namespace World Management workload certificate and no propagated caller context; it does not widen the Account-only lifecycle method. The closed request binds a fresh read-request UUID, exact namespace/tenant/world/realm scope and expected original preparation-request UUID. A missing, superseded, expired or contradictory preparation, target or runtime allocation refuses rather than returning a new selection or positive readiness; this read never allocates an identity. The request and response are bounded to 4 KiB and 64 KiB respectively, with unknown protobuf fields, noncanonical frames and partial responses rejected.

The separately opted-in `ReadPrivateWorldPreparationBuild` method projects the original selected World publication evidence from the exact retained Human policy carrier, under the same current-source locks. It rechecks the carrier digest, complete catalog/source receipt, target policy, tenant, version and release binding before returning that projection. The response is separately bounded to 5 MiB and correlated to the fresh source request; larger selections refuse rather than truncate. It does not forward the complete policy carrier or reauthorize its original publisher. The existing source/protection digest already binds the immutable carrier from which this selector is derived. Existing source-service constructors leave this build method unavailable, and no default registration is added.

The internal `GameSessionPrivatePreparationProtectionRepository` provides a separate durable source-currentness prerequisite. It acquires protection only after independently requalifying the exact current preparation, catalog revision, workflow selection and retained runtime allocation; the original fork expiry must remain valid at acquisition commit. A committed protection binds the complete source bytes and a distinct immutable hold identity/fence. Exact request replay preserves that historical protection and is not a fresh permission check. Pending protection blocks supersession of the private catalog head and current-selection head through installed owner guards. Acquisition uses an independent SERIALIZABLE transaction and retries only whole transactions aborted with SQLSTATE `40001`, at most three attempts with unchanged intent. Head writers use READ COMMITTED or SERIALIZABLE semantics; REPEATABLE READ writes refuse rather than missing newly committed protection through an old snapshot. There is deliberately no settlement or release method until the owning World terminal protocol exists: timeout, expiry, an absent World result, and caller-supplied outcome claims cannot release it. This unregistered component grants no actor authority and does not extend any expiry or accepted-credential lifetime. Its current-source read requalifies unexpired source under local owner locks; actual materialization still requires the separate protected World operation and authoritative terminal integration. No ordinary source read acquires protection as a side effect. The separate manually composed `PrivatePreparationProtectionService` exposes only acquire and exact current-read methods to the exact same-namespace World workload with no propagated player/service caller context. Its closed frames bind the acquisition/read identity, operation kind, request digest, hold identity/fence and complete original source evidence. Requests and responses are bounded to 72 KiB and use five-second call deadlines; unknown fields, noncanonical frames and changed correlations refuse. Acquisition retries may return historical retained protection after expiry, but a current read separately requalifies unexpired owner source. Neither method accepts a caller-supplied terminal result or releases protection. No handler is registered by default.

Game Session qualifies the complete retained preparation source, immutable selection receipt and original request preimages/digests, selected private Human policy, published build and exact current target revision bound to that preparation in one short independent owner transaction. It rereads the current selection and preparation before returning and dates the result after those source reads. The closed response/v2 carries the original preparation, lifecycle, namespace and generation, current-selection revision, source/policy/build identities and target allocation receipt, plus the runtime allocation request UUID, runtime `gameInstanceId`, request digest and receipt digest. The allocation hashes are validated against that complete exact source tuple rather than accepted as standalone runtime authority; response/v1 without an allocation is refused. `PREPARING` remains non-admissible. It creates no source row, runtime or admission pointer. The owner transaction ends before the response leaves Game Session, so this point-in-time evidence is not ongoing protection for a later World write. World’s independent receiving reread and its limits belong to [World API contracts](../world-management-service/api-contracts.md#private-fresh-preparation-source).

This preparation is not a World lifecycle transition or admission decision. World continues to own the runtime lifecycle state and epoch; that epoch is not allocation authority for the new playtest lifecycle or playable-state namespace. The local boundary does not authenticate or qualify an actor, produce owner manifests, complete preparation, support seeded/snapshot initialization or reset, publish lifecycle changes, register a runtime caller, create a pointer, or admit gameplay. No delivery or successful playtest availability is implied by a stored `PREPARING` row.

For `CHARACTER_CREATE`, Game Session's owner-local protection covers only the exact catalog/admission-pointer snapshot and resolved runtime target, revalidated against its current rows when acquired. It does not establish Account membership, grant, or entitlement authority and does not replace World-owned lifecycle protection; see Entity's [character creation owner protection](../entity-management-service/api-contracts.md#character-creation-owner-protection).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ ORDER BY tenant_id;

Any returned tenant blocks the migration until the Game Session data owner performs an owner-scoped, audited resolution that preserves pointer rows, audit events, and retained history. Never choose a winner, delete rows, or reset pointer state automatically. A separate-row switch must hide or demote the existing qualifying row before making its replacement qualifying, within the authorized owner's existing atomic/fenced transaction; this is not an ad hoc SQL/operator mutation path. The current `SetAdmissionPointer` and prepared-cutover mutation paths remain held, not implemented. Multi-Tenancy owns the [canonical realm-catalog and admission-pointer contract](../../system-architecture-multi-tenancy.md#realm-catalog-and-admission-pointer-contract); the [Realm Routing and Playable State tracker](../../../project-management/implementation-tracking/realm-routing-and-playable-state.md#current-status) records the current pointer and cutover status.

### Expired private preparation protection

An unresolved V1062 source-protection hold deliberately blocks private catalog-head and current-selection supersession even after the original fork expires. A resulting SQLSTATE `55000` refusal is expected while that hold remains. Run this read-only diagnostic against the deployed Game Session schema to list expired, still-protected realms and their retained hold/preparation identities:

```sql
SELECT h.target_namespace, h.canonical_tenant_id, h.world_slug, h.realm_slug,
h.realm_id, h.request_id AS protection_request_id, h.hold_id, h.fence,
h.preparation_request_id, h.playtest_lifecycle_id, h.game_instance_id,
p.fork_expiry_text, h.retained_at
FROM game_session_private_preparation_protection h
JOIN game_session_initial_playtest_preparations p
ON p.request_id = h.preparation_request_id
AND p.playtest_lifecycle_id = h.playtest_lifecycle_id
WHERE p.fork_expiry_second + p.fork_expiry_nano / 1000000000.0
<= extract(epoch FROM statement_timestamp())
ORDER BY h.target_namespace, h.canonical_tenant_id, h.world_slug, h.realm_slug,
h.retained_at, h.hold_id;
```

Keep the realm held and preserve the source and protection evidence for owner reconciliation. There is no manual release procedure without authoritative World terminal proof, and the authenticated terminal-settlement/release protocol is not implemented. Expiry, an absent World result, or an operator assertion cannot establish that an unknown operation did not commit. Do not update, delete or truncate holds, disable their guards, or reset the protected heads. The [Game Session API owner](./api-contracts.md#initial-fresh-playtest-lifecycle-source-preparation) defines protection authority and retention; the [realm-routing tracker](../../../project-management/implementation-tracking/realm-routing-and-playable-state.md#private-source-currentness-protection-preparation) records the unfinished integration and proof.

### Initial region timeline recovery boundary

For an initial region timeline whose durable preparation is `INITIALIZING` after its one-time creation permission was consumed, absent Redis metadata cannot distinguish never-executed initialization from metadata loss. Descriptor, source, connection, principal, `SCRIPT LOAD`, or current-binding/World/incarnation revalidation refusal before the SQL claim does not change the preparation phase or timeline keys. If the preparation is still `PREPARED` and the proved-absent preimage remains valid, a corrected ordinary attempt can still make the first claim; an existing `INITIALIZING` phase remains held. After those checks pass, the owner claims the permission and immediately attempts the sole `EVALSHA`; a process stop between claim and send or an ambiguous send/result leaves the scope held, with no automatic same-scope retry or recovery. Preserve the original SQL preparation and source evidence. Do not delete or reset the affected region keys, recreate metadata, or retry with a fresh create permission or same-epoch rewrite. No same-scope automated or operator repair exists. Stop and quarantine the affected admission scope; use World Management's normal authorized [instance termination lifecycle](../world-management-service/api-contracts.md#instance-termination-contract) and proceed under a new instance scope only when its usual authorization and protection are available. Otherwise keep the scope blocked for owner-scoped reconciliation. This is a safe recovery boundary, not an implemented or proved repair procedure, and does not qualify launch, production activation, or first `OPEN`. Region timeline and lease authority remain with [Tick System](../../system-architecture-ticks.md#region-authority-and-tick-executor), Redis owns the [key projection](../../system-architecture-redis.md#canonical-region-key-projection), and current Game Session recovery gaps are tracked in [runtime and tick coordination](../../../project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md#active-gaps).
Expand Down
Loading
Loading