From 5383bcdc0d0fb66135da33cd031b15efacdff010 Mon Sep 17 00:00:00 2001
From: Ben Hook <5009589+benhook1013@users.noreply.github.com>
Date: Mon, 12 Oct 2026 12:22:26 +1300
Subject: [PATCH 1/5] Compose complete admission receiver source on Account
restriction parent
---
...dmin-as-external-operator-write-ingress.md | 6 +
.../account-service/api-contracts.md | 2 +-
.../account-service/runtime-and-data.md | 2 +
.../api-contracts.md | 4 +-
.../character-create-action-schema.md | 2 +-
.../game-session-service/api-contracts.md | 9 +
.../game-session-service/configuration.md | 2 +
.../game-session-service/runtime-and-data.md | 1 +
.../start-session-action-schema.md | 4 +-
.../logging-admin-service/api-contracts.md | 12 +
.../logging-admin-service/configuration.md | 10 +
...ign-capability-allocation-microservices.md | 2 +-
...e-session-runtime-and-tick-coordination.md | 2 +
.../player-access-and-session.md | 12 +-
dev-tools/tests/compose-grpc-mtls-contract.sh | 7 +-
.../test_design_capability_allocation.py | 16 +
.../v1/game_session_service.proto | 28 +
...ccountGameplayAdmissionLeaseOperation.java | 47 +
...ntGameplayAdmissionOriginalAckReceipt.java | 97 ++
...countGameplayAdmissionLeaseRepository.java | 320 +++++
...ssionOriginalAckReceiptCommitExecutor.java | 187 +++
...AdmissionOriginalAckReceiptRepository.java | 172 +++
...meplayAdmissionOriginalCommitExecutor.java | 255 ++++
...nt_gameplay_admission_lease_operations.sql | 113 ++
...count_admission_unknown_decision_abort.sql | 31 +
..._admission_durable_commit_confirmation.sql | 404 +++++++
...ccount_global_pending_admission_fences.sql | 89 ++
...account_admission_original_ack_receipt.sql | 259 ++++
...rimental_admission_confirmation_writes.sql | 26 +
...account_original_ack_pg18_fresh_insert.sql | 152 +++
...rotectedEntryPrototypeIntegrationTest.java | 1065 +++++++++++++++++
...tGameplayAdmissionLeaseRepositoryTest.java | 312 +++++
...nOriginalAckReceiptCommitExecutorTest.java | 476 ++++++++
...ssionOriginalAckReceiptRepositoryTest.java | 521 ++++++++
...missionOriginalAckReceiptTestFixtures.java | 124 ++
...ayAdmissionOriginalCommitExecutorTest.java | 412 +++++++
.../impl/EntityManagementGrpcService.java | 22 +-
.../impl/EntityManagementGrpcServiceTest.java | 51 +
.../gamesession/client/GameDesignClient.java | 26 +-
...nceLaunchAssociationReadConfiguration.java | 22 +
...calInitialAdmissionOwnerConfiguration.java | 45 +
...ionOperatorAuthorizationConfiguration.java | 54 +
...icalRegionBootstrapAssignmentResolver.java | 122 ++
...anonicalInitialAdmissionWorldVerifier.java | 28 +
.../service/impl/GameSessionGrpcService.java | 139 +++
.../src/main/resources/application.yml | 4 +
...nical_authored_world_source_provenance.sql | 16 +
...RealmCatalogRepositoryIntegrationTest.java | 977 +++++++++++++++
...tingInstanceRepositoryIntegrationTest.java | 497 ++++++++
...tAssociationRepositoryIntegrationTest.java | 498 ++++++++
.../client/GameDesignClientTest.java | 42 +-
...aunchAssociationReadConfigurationTest.java | 58 +
...nitialAdmissionOwnerConfigurationTest.java | 112 ++
...peratorAuthorizationConfigurationTest.java | 271 +++++
...icalGameInstanceLaunchAssociationTest.java | 189 +++
...onCanonicalRealmCatalogRepositoryTest.java | 222 ++++
...nonicalStartingInstanceRepositoryTest.java | 56 +
...nFreshTenantAssociationRepositoryTest.java | 45 +
...ayAdmissionPointerEventRepositoryTest.java | 26 +
.../GameSessionGrpcAuthInterceptorTest.java | 19 +-
...RegionBootstrapAssignmentResolverTest.java | 136 +++
.../impl/GameInstanceServiceImplTest.java | 37 +
.../impl/GameSessionGrpcServiceTest.java | 350 ++++++
.../client/GameSessionClient.java | 219 ++++
...artSessionOperatorAuthorizationClient.java | 423 +++++++
...ionOperatorAuthorizationConfiguration.java | 90 ++
.../StartSessionAuthorizationCoordinator.java | 236 ++++
.../src/main/resources/application.yml | 3 +
.../client/GameSessionClientTest.java | 284 +++++
...essionOperatorAuthorizationClientTest.java | 605 ++++++++++
...peratorAuthorizationConfigurationTest.java | 297 +++++
...rtSessionAuthorizationCoordinatorTest.java | 858 +++++++++++++
72 files changed, 12228 insertions(+), 34 deletions(-)
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionLeaseOperation.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionOriginalAckReceipt.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionLeaseRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptCommitExecutor.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalCommitExecutor.java
create mode 100644 services/account-service/src/main/resources/db/migration/V140__account_gameplay_admission_lease_operations.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V141__account_admission_unknown_decision_abort.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V142__account_admission_durable_commit_confirmation.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V143__account_global_pending_admission_fences.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V144__account_admission_original_ack_receipt.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V145__retire_experimental_admission_confirmation_writes.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V146__account_original_ack_pg18_fresh_insert.sql
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionProtectedEntryPrototypeIntegrationTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionLeaseRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptCommitExecutorTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptTestFixtures.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalCommitExecutorTest.java
create mode 100644 services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/config/CanonicalGameInstanceLaunchAssociationReadConfiguration.java
create mode 100644 services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/config/CanonicalInitialAdmissionOwnerConfiguration.java
create mode 100644 services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/config/GameSessionStartSessionOperatorAuthorizationConfiguration.java
create mode 100644 services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/CanonicalRegionBootstrapAssignmentResolver.java
create mode 100644 services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/impl/DefaultDeniedCanonicalInitialAdmissionWorldVerifier.java
create mode 100644 services/game-session-service/src/main/resources/db/migration/V40__canonical_authored_world_source_provenance.sql
create mode 100644 services/game-session-service/src/test/java/integration/net/firedevops/firemud/gamesession/repository/GameSessionCanonicalRealmCatalogRepositoryIntegrationTest.java
create mode 100644 services/game-session-service/src/test/java/integration/net/firedevops/firemud/gamesession/repository/GameSessionCanonicalStartingInstanceRepositoryIntegrationTest.java
create mode 100644 services/game-session-service/src/test/java/integration/net/firedevops/firemud/gamesession/repository/GameSessionFreshTenantAssociationRepositoryIntegrationTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/config/CanonicalGameInstanceLaunchAssociationReadConfigurationTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/config/CanonicalInitialAdmissionOwnerConfigurationTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/config/GameSessionStartSessionOperatorAuthorizationConfigurationTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/dto/CanonicalGameInstanceLaunchAssociationTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/repository/GameSessionCanonicalRealmCatalogRepositoryTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/repository/GameSessionCanonicalStartingInstanceRepositoryTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/repository/GameSessionFreshTenantAssociationRepositoryTest.java
create mode 100644 services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/service/CanonicalRegionBootstrapAssignmentResolverTest.java
create mode 100644 services/logging-admin-service/src/main/java/net/firedevops/firemud/loggingadmin/client/StartSessionOperatorAuthorizationClient.java
create mode 100644 services/logging-admin-service/src/main/java/net/firedevops/firemud/loggingadmin/config/StartSessionOperatorAuthorizationConfiguration.java
create mode 100644 services/logging-admin-service/src/main/java/net/firedevops/firemud/loggingadmin/operator/StartSessionAuthorizationCoordinator.java
create mode 100644 services/logging-admin-service/src/test/java/unit/net/firedevops/firemud/loggingadmin/client/StartSessionOperatorAuthorizationClientTest.java
create mode 100644 services/logging-admin-service/src/test/java/unit/net/firedevops/firemud/loggingadmin/config/StartSessionOperatorAuthorizationConfigurationTest.java
create mode 100644 services/logging-admin-service/src/test/java/unit/net/firedevops/firemud/loggingadmin/operator/StartSessionAuthorizationCoordinatorTest.java
diff --git a/design/architecture/decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md b/design/architecture/decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md
index 60d0b6db7e..3e398afaee 100644
--- a/design/architecture/decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md
+++ b/design/architecture/decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md
@@ -97,6 +97,12 @@ Both issuance paths use the same bounded typed-mutation admission contract befor
For the tenant-scoped `tenantAdmin` branch of `firemud.game-session.start-session/v1`, the human evidence uses the closed `evidenceType: "HumanAuthorityEvidence/v1"` arm with Account-derived `actorAccountId`, `controlUiTokenJti`, `role`, `accountGeneration`, and `tenantGeneration`. This branch explicitly declares `assurance` absent: issuance, exact decoding, forwarding, and redemption reject an added assurance member, including `null` or a sentinel, and never invent an elevation or a JWT assurance claim. This absence is role applicability, not permission to omit unavailable evidence. Global `platformAdmin` and cross-tenant `billingAdmin` branches still require genuine current Account-owned `privileged_control` evidence; they cannot substitute this tenant branch or obtain authority from its copied role or generation values.
+#### Redeemed StartSession Projection Read
+
+After Game Session has redeemed the original human StartSession reference and allocated its owner attempt and fence, Account may serve `ReadRedeemedOperationProjection` to the exact same-namespace `game-design-service` peer only to read the immutable template-selected source/descriptor for the same original tenant, template, and `controlPlaneRequestId`. The request is bound to the exact canonical pre-authorization tuple, Account-returned authorization-reference fingerprint, original reservation owner/fence, and actual Game Session `ownerAttemptId`/`ownerFence`; Account independently revalidates the original actor and `control-ui` token `jti`, current Account source and reference expiry, and the stored original reservation and redeemed Game Session attempt/fence before returning that projection. No forwarded JWT or opaque reference is sent on this read, and neither workload identity, fingerprint, nor authority-bundle integrity alone establishes authority. The read is credential-free and read-only: it does not renew or extend a reservation/reference, issue or redeem a credential, mutate source state, select a different template or policy, create another owner attempt, commit the owner mutation, or bootstrap/activate a runtime. Exact retries repeat the same binding and return the same operation projection without policy reselection; changed, stale, or ambiguous bindings fail closed. This read is not a commit-spanning CAS proof; owner commit and runtime activation remain separately fenced by their owners.
+
+The separately bounded original Game Session read/pin continuation is governed by the [Game Session owner contract](../microservices/game-session-service/api-contracts.md#restricted-original-claim-evidence-continuation); it is not a broader template-selection or mutation permission.
+
`authorityTuple` is copied without scalarization or field renaming from the complete canonical shape in the [JWT and token contracts](../system-architecture-jwt-and-token-contracts.md#canonical-authority-tuple). `membershipVersion` is the independently applicable Account membership-version map, including `{}` when no membership applies. `HumanAuthorityEvidence/v1` carries the Account-derived actor account, `control-ui` token `jti`, role, assurance only when applicable to that role, account generation, and applicable tenant or target-tenant generation. `AutomationAuthorityEvidence/v1` carries the exact authenticated workload, automation-policy identity/version, and applicable tenant generation. The tagged `issuanceEvidence` arm must agree with Account-derived `issuanceKind`; the inapplicable arm and inapplicable authority-scope identifiers are omitted rather than serialized as `null`, empty objects, or sentinels. `sourceEvidenceId` identifies the one Account authority snapshot and its linearization evidence, while `sourceEvidenceVersion` is the corresponding Account-issued source version; together they are the canonical source fence for the bundle and are carried unchanged with the existing `{bundleVersion, sourceVersion, sourceFence, linearization}` reference. Account derives every authority, generation, membership, freshness, and branch-decision member from that one atomic snapshot and stores the source pair with the issuance record. During redemption, Account exact-compares `sourceEvidenceId`, `sourceEvidenceVersion`, the bundle reference, and every snapshot-bound field against the stored issuance record and the current applicable authority evidence; a missing, changed, or mixed-version value rejects redemption. Consumers reject missing, extra, contradictory, separately sourced, stale, expired, wrongly tagged, or non-canonical bundle fields and must redeem the original reference with Account; a copied bundle never becomes a second authority.
For every forwarded owner-mutation family, ADR 0048's canonical complete `postAuthorizationExecutionTuple` is the required post-authorization identity. It explicitly contains ADR 0048's stable `controlPlaneRequestId` for orchestration, reservation, lookup, and correlation across forwarding, `mutationDigest`, `issuanceKind`, Account-returned `authorizationReferenceFingerprint`, exact authenticated workload and actor/policy binding, exact typed `scope`, normalized `actionFamily`, `actionFamilySchemaId`, `actionFamilySchemaVersion`, typed `target`, immutable typed `targetOwner`, typed `expectedVersion`, typed `mutation`, typed `auditReason`, the exact applicable `authorityTuple`, independent applicable `membershipVersion`, positive `issuanceFence`, `reservationOwnerId`, positive `reservationClaimFence`, the exact canonical `authorityEvidenceBundle/v1` defined above (whose issuance identity carries the tagged `actionFamilyRequestIdentity` for domain action/idempotency), and every schema-bound typed presence/absence value. `targetOwner` is distinct from `target`, immutable after reservation, and is never inferred from current routing or owner state. Reservation and pre-authorization Account issuance/recovery compare `preAuthorizationReservationTuple`; post-authorization tuple completion, owner idempotency, terminal/no-commit proof, result lookup, conflict handling, and any later fresh owner attempt carries and compares its own exact tuple; no participant may omit a required identity because it is unavailable locally.
diff --git a/design/architecture/microservices/account-service/api-contracts.md b/design/architecture/microservices/account-service/api-contracts.md
index d4f3df054c..cb49906801 100644
--- a/design/architecture/microservices/account-service/api-contracts.md
+++ b/design/architecture/microservices/account-service/api-contracts.md
@@ -211,7 +211,7 @@ For the redeemed StartSession projection, `ReadRedeemedOperationProjection` acce
| `GET` | `/auth/bootstrap/worlds` | List caller-visible worlds for first-party gameplay bootstrap |
| `GET` | `/auth/bootstrap/worlds/{world}/realms` | List caller-visible realms for a selected world during first-party gameplay bootstrap |
| `GET` | `/auth/bootstrap/worlds/{world}/realms/{realm}/characters?connectScopeId={scope}` | List caller-visible characters for the signed realm-discovery target during first-party gameplay bootstrap. The REST producer applies the canonical realm-snapshot mapping to `playableStateScope` before passing it to Entity Management; callers cannot select or provide it. |
-| `POST` | `/auth/bootstrap/worlds/{world}/realms/{realm}/characters` | **Target; not currently routable or implemented.** Account-owned player-bootstrap facade for scoped character creation; retains the target delegation contract to Entity Management `CreateCharacter` after signed-scope and membership/grant checks. The REST producer applies the same canonical mapping, and `playableStateScope` is server-derived rather than an accepted request field. |
+| `POST` | `/auth/bootstrap/worlds/{world}/realms/{realm}/characters` | **Target; not currently routable or implemented.** Account-owned player-bootstrap facade for scoped character creation; retains the target delegation contract to Entity Management `CreateCharacter` after signed-scope and membership/grant checks. The REST producer applies the same canonical mapping, and `playableStateScope` is server-derived rather than an accepted request field. Account's local creation protection covers the current authenticated player's membership, applicable realm grant, and entitlement authority; see Entity's [character creation owner protection](../entity-management-service/api-contracts.md#character-creation-owner-protection) for the cross-owner terminal boundary. |
| `POST` | `/internal/runtime/public-production-join` | **Target REST adapter; not currently routable.** The local Account `JoinPublicProductionMembership` RPC implements explicit public-production membership creation; Game Session text `JOIN` dispatch to this RPC remains pending under #2898. No implicit membership-writer route is exposed. |
| `GET` | `/internal/runtime/realm-access-grants/{tenantId}/{worldSlug}/{realmSlug}/{playtestLifecycleId}/{accountId}` | Internal-only authoritative lookup for one non-public realm-access grant; the lifecycle ID is part of the exact target |
| `GET` | `/internal/runtime/accounts/{accountId}/realm-access-grants/{tenantId}/{worldSlug}/{realmSlug}/{playtestLifecycleId}` | Internal-only authoritative lookup/list for the account's exact non-public world/realm/lifecycle target used by discovery/admission filtering |
diff --git a/design/architecture/microservices/account-service/runtime-and-data.md b/design/architecture/microservices/account-service/runtime-and-data.md
index fe76c457e6..a2ef64817f 100644
--- a/design/architecture/microservices/account-service/runtime-and-data.md
+++ b/design/architecture/microservices/account-service/runtime-and-data.md
@@ -8,6 +8,8 @@ Account owns platform identity, hosted Creator Party/operator and terms currentn
## Implementation Status
+Account's unregistered original-ACK storage seam requires PostgreSQL 18 for fresh operations: the original executor performs a writable SERIALIZABLE physical COMMIT on its enlisted connection and returns an opaque acknowledgement only after observing the database clock before unchanged expiry; a separate transaction commits the exact receipt. Receiving V146 changes only the fresh receipt-insert guard, preserving the donor V122 SQL unchanged as receiving V144. Its historical durable reader remains PostgreSQL 16-only, so lost-acknowledgement recovery and retained-receipt retries remain denied on PostgreSQL 18. This storage evidence does not authenticate a caller, establish current Account ownership or admission, authorize gameplay, or register runtime behavior. Migration provenance and pending receiving proof are recorded in the [Player Access and Session tracker](../../../project-management/implementation-tracking/player-access-and-session.md#account-fresh-original-ack-storage-preparation).
+
Account V40 adds owner-proven sequence-zero source baselines to the inherited V30–V39 authority-storage and retention-safety foundation; V74–V89 preserve that baseline and add source/global-role guards, draft-source writer exclusions and fences, immutable reset/logout/security-operation receipts, creator and tenant-bootstrap provenance, individual Creator Party and hosted-terms/environment-binding persistence, and source-change journals. V90–V97 add persistence relations and guards for source-currentness work across Account, control-UI issuance, selected-publication authorization/settlement, and Game Logic. V98 adds durable hosted-terms disclosure handoff and immutable source-evidence relations with database transition guards. These DDL stages establish persistence and source-writer fence relationships; they do not activate owner writers, legal authority verification, dispatch, or consumers. New repository-created Accounts receive the V40 source baseline; retained pre-V40 rows are neither backfilled nor admitted. Password-reset completion atomically claims and consumes its token, updates the Account, appends the canonical event and receipt, and reads back current source evidence in the owner transaction. If an earlier source intent remains `WAITING`, the request returns retryable `AUTH_UNAVAILABLE`; it does not wait on a thread for settlement, and an exact retry retains the original operation identity. A `WAITING` reset intent retains the Argon2 password verifier needed by that retry; terminal source commit or abort clears the verifier while preserving its digest and immutable source binding and receipt. Finite receipt retention remains unresolved under the owning retention policy; no lifetime is selected here. Logout-all production remains unregistered and unwired. These persistence primitives do not provide public JOIN, target-currentness protection, or runtime activation. Exact physical and local proof limits are recorded in the [Player Access and Session implementation tracker](../../../project-management/implementation-tracking/player-access-and-session.md#current-status). Hard deletion remains denied, revoked grants remain tombstones, and this stage does not enable signer provisioning, LOGIN, PLAY, or activation.
Proof qualification: the earlier `7a665c83e81f5cec85fcd7ec9a205c291bc0eba2` run is historical. Later physical CI executed the inspection-lock, TRUNCATE and disclosure-source regressions successfully but failed a trigger-catalog fixture. That fixture and the final optional-inventory settlement and malformed source-vector corrections require replacement physical CI. See the [player-access tracker](../../../project-management/implementation-tracking/player-access-and-session.md#current-status) for the canonical proof inventory and exact limits. These results do not establish activation or playable closure.
diff --git a/design/architecture/microservices/entity-management-service/api-contracts.md b/design/architecture/microservices/entity-management-service/api-contracts.md
index d8eaca7da2..af5dd87d89 100644
--- a/design/architecture/microservices/entity-management-service/api-contracts.md
+++ b/design/architecture/microservices/entity-management-service/api-contracts.md
@@ -61,7 +61,7 @@ grpcurl -plaintext localhost:6565 entity_management.v1.EntityManagementService/P
## Character creation owner protection
-The fixed ordered family and raw/normalized limits are owned by the [CHARACTER_CREATE/1 action schema](./character-create-action-schema.md), using ADR 0047's unchanged byte grammar. The passive common-platform-core codec has now been proved locally, but that does not establish an authenticated producer, owner protections, or Entity terminal composition.
+The approved passive common-platform-core `CHARACTER_CREATE/1` model, codec, and bounded authored-source projection are present. The standalone parent check completed 233 tasks and 372 common-platform-core tests with zero failures, errors, or skips; this does not establish an authenticated producer, owner protections, or Entity terminal composition. The fixed ordered family and raw/normalized limits are owned by the [CHARACTER_CREATE/1 action schema](./character-create-action-schema.md), using ADR 0047's unchanged byte grammar.
`CreateCharacter` is explicitly tagged as a `CHARACTER_CREATE` mutation, distinct from `StartSession` and gameplay-admission operations in purpose, durable identity, encoded operation identity, and replay. Before acquiring any owner protection, the producer durably records that purpose, caller-stable `createCharacterRequestId`, canonical `mutationDigest`, and exact creation intent. The operation binds the authenticated account and immutable resolved target `{tenantId, worldSlug, realmSlug, playableStateNamespaceId, playableStateScope, gameInstanceId, versionId, activeLifecycleEpoch}`, the exact catalog and admission-pointer snapshot, `entryPolicy=PLAYER_CREATED`, published descriptor identity/version, and canonical creation input. The approved action family uses the existing canonical `mutationDigest/v1` byte grammar without revising that grammar or StartSession's schema. A changed digest, target, source identity, or descriptor is a conflict and cannot select substitute authority.
@@ -69,7 +69,7 @@ The operation acquires three independent owner-local protections: Account protec
All three protections remain effective while Entity performs the guarded `PLAYER_CREATED` zero-roster check and, if eligible, atomically commits the character, association, and replayable `COMMITTED` result. They may be released only after that committed result is established, or after an authenticated, fenced, definitive `ABORTED` result proves the same operation can never commit in the future. Partial acquisitions are durably recorded and reconciled against the same operation identity and digest across retry and restart. Absence, timeout, `PENDING`, unavailable reads, or diagnostic expiry never prove abort and never release protection. Authority expiry permits no new allocation; an ambiguous Entity commit remains protected for reconciliation. A changed request cannot borrow an existing hold or result.
-The producer, all three owner protections, and Entity's terminal cross-owner composition remain unimplemented or unproved; in this prerequisite, the legacy scalar-only `CreateCharacter` RPC remains the existing allocating implementation. The required denial belongs to subsequent receiving work tracked by #3122, which must reject that RPC with `FAILED_PRECONDITION` before allocation because it cannot carry the required authenticated owner proof, catalog/pointer snapshot, lifecycle protection, or durable terminal operation. Focused proof must cover owner-writer exclusion, partial acquisition and crash recovery, finite authority expiry, commit/abort races, and changed identity/digest/target/source conflicts. This target contract does not activate a route or claim live enforcement.
+The producer, all three owner protections, and Entity's terminal cross-owner composition remain unimplemented or unproved; the legacy scalar-only `CreateCharacter` RPC is now denied with `FAILED_PRECONDITION` before allocation because it cannot carry the required authenticated owner proof, catalog/pointer snapshot, lifecycle protection, or durable terminal operation. Focused proof must cover owner-writer exclusion, partial acquisition and crash recovery, finite authority expiry, commit/abort races, and changed identity/digest/target/source conflicts. This target contract does not activate a route or claim live enforcement.
## Design-Time APIs
diff --git a/design/architecture/microservices/entity-management-service/character-create-action-schema.md b/design/architecture/microservices/entity-management-service/character-create-action-schema.md
index 3c0081bcec..4d6d9f89d1 100644
--- a/design/architecture/microservices/entity-management-service/character-create-action-schema.md
+++ b/design/architecture/microservices/entity-management-service/character-create-action-schema.md
@@ -4,7 +4,7 @@ This document owns the fixed action-family schema for `firemud.entity.create-cha
## Implementation Status
-The fixed ordered `CHARACTER_CREATE/1` map below is approved. The four offline typed-preimage vectors remain unchanged, and the shared resource now includes the required negative vectors. A passive common-platform-core action model, strict ordered raw JSON encoder/decoder and digest path, and bounded authored-source projection parser are present with focused production-decoder tests. Current local proof and its limits are recorded in the [gameplay implementation tracker](../../../project-management/implementation-tracking/gameplay-rules-entities-and-effects.md#validation-and-proof). This remains local-only receiving support: it does not provide an authenticated producer, owner protections, Entity terminal composition, or route activation. The legacy scalar-only `CreateCharacter` RPC remains the existing allocating implementation. A subsequent Entity receiving change must enforce fail-closed denial with `FAILED_PRECONDITION` before allocation because this RPC cannot carry the required owner proof and operation binding; see the [Entity character-creation owner-protection contract](./api-contracts.md#character-creation-owner-protection). This schema does not activate a route or claim live creation support.
+The fixed ordered `CHARACTER_CREATE/1` map below is approved. The four offline typed-preimage vectors remain unchanged, and the shared resource now includes the required negative vectors. A passive common-platform-core action model, strict ordered raw JSON encoder/decoder and digest path, and bounded authored-source projection parser are present with focused production-decoder tests. Current local proof and its limits are recorded in the [gameplay implementation tracker](../../../project-management/implementation-tracking/gameplay-rules-entities-and-effects.md#validation-and-proof). This remains local-only receiving support: it does not provide an authenticated producer, owner protections, Entity terminal composition, or route activation. The legacy scalar-only `CreateCharacter` RPC remains denied with `FAILED_PRECONDITION` before allocation because it cannot carry the required owner proof and operation binding; see the [Entity character-creation owner-protection contract](./api-contracts.md#character-creation-owner-protection). This schema does not activate a route or claim live creation support.
The current owner carriers and protection contracts establish only the initial public-production boundary. Private/playtest creation remains unsupported and denied until the genuine catalog, pointer, lifecycle, and protection carriers exist. Conditional tuple slots define exact presence for a complete future owner proof; their presence in this schema does not enable that boundary.
diff --git a/design/architecture/microservices/game-session-service/api-contracts.md b/design/architecture/microservices/game-session-service/api-contracts.md
index b775fd99ba..27ea93ec4a 100644
--- a/design/architecture/microservices/game-session-service/api-contracts.md
+++ b/design/architecture/microservices/game-session-service/api-contracts.md
@@ -46,6 +46,8 @@ The World Management database row and monotonic lifecycle epoch are the admissio
Multi-Tenancy owns the realm catalog, the canonical durable `{tenantId, realmId}` pointer identity and its routing/admission semantics, while Game Session is the sole runtime resolver, persister, and compare-and-set orchestrator for that resolved catalog and admission-pointer state; neither service owns World lifecycle state. Replacement preparation and pointer swap carry the catalog-bound `worldSlug`/`realmSlug` selectors, stable `playableStateNamespaceId`/`playableStateScope`, and, for private/playtest targets, the canonical lifecycle proof tuple `{playtestLifecycleId, playtestStateGeneration}` from [ADR 0122](../../decisions/adr-0122-stable-playable-state-namespaces-for-runtime-replacement.md); changing `gameInstanceId` does not authorize a new realm identity, namespace, or durable-state copy. Cutover remains closed unless every owner reports fresh compatible state and the fenced pointer CAS succeeds. After a source swap, Game Session drains and closes source bindings, then asks World to progress termination; it reports a stopped runtime only after authoritative `TERMINATED` readback. Public-production requests omit both playtest fields and reject supplied values.
+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).
+
The prepared compatibility proof captures the target `gameInstanceId` at exact World lifecycle state `PREPARING` and its exact epoch as the activation precondition, together with the applicable canonical lifecycle proof tuple. Game Session then asks World to perform the owner-database `PREPARING -> ACTIVE` lifecycle CAS against that precondition; World returns the resulting exact `ACTIVE` state/epoch and the same tuple, which Game Session persists in the durable cutover execution/result. Before the admission-pointer CAS, Game Session rereads World authority and requires that same `ACTIVE` state/epoch and exact tuple. A changed state/epoch or tuple invalidates execution and preserves the prior pointer. The pointer CAS binds that durable `ACTIVE` proof and expected pointer version without making Game Session a lifecycle owner. The existing ordering remains: register source cleanup and its binding in the pointer-CAS transaction, then obtain authoritative post-swap pointer/readback confirmation of that registration and source binding before asking World to finalize the cutover hold and request the source `TERMINATING` transition. This confirmation is not the all-owner terminal cleanup acknowledgement; World obtains those owner acknowledgements during its `TERMINATING` workflow before the final `TERMINATED` CAS.
### World-owned cutover hold binding
@@ -89,6 +91,7 @@ The internal front-end to lease-owner path is a **target-state** fenced gameplay
- `Ping` – basic connectivity check.
- `StartSession` – spins up a game instance from a template-driven launch descriptor. Despite the name, this operates on game instances, not player gameplay sessions; gameplay sessions are per-player contexts backed by `session:game:*` keys.
+- `AuthorizeStartSession` – accepts the exact canonical Logging & Admin post-authorization handoff and returns only the durable owner-attempt/progress echo; it does not start or create a game instance.
- `StopSession` – stops a running game instance.
- `RestartSession` – restarts a stopped game instance.
- `EnqueueCommand` – adds a player action to the next tick's queue.
@@ -129,6 +132,12 @@ The internal front-end to lease-owner path is a **target-state** fenced gameplay
### ADR-0048 operator-write contract
+The typed `firemud.game-session.start-session/v1` action schema currently prepares only the human, tenant-scoped `tenantAdmin` authorization branch. Its Account-issued human evidence explicitly omits `assurance`, rejects extra assurance or a substituted global/automation branch, and retains current actor, role, tenant generation, membership and source checks. The normative evidence shape and role-required assurance rules remain owned by [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#bounded-owner-delegation). This schema preparation does not make the external route or owner execution complete.
+
+Source-level Game Session code now contains the StartSession claim, Account redemption, and prepared-action binding. The current-read consumer for Account's [redeemed-operation projection](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#redeemed-startsession-projection-read), the owner transaction that commits the selected descriptor, and runtime bootstrap/activation remain unwired. This source-level work does not establish service boot, a routable external StartSession path, or end-to-end execution.
+
+The typed `AuthorizeStartSession` gRPC transport now carries the exact canonical post-authorization tuple and transient Account reference to the existing owner-attempt coordinator. This method has a narrow JWT-interceptor exemption alongside `Ping`; before tuple decoding, the receiver requires the certificate-derived Logging & Admin peer, and the coordinator binds that peer to the same-namespace tuple and Account redemption. It returns only the durable owner attempt identity, fence, pending phase, and redemption progress. The coordinator is supplied only by `firemud.start-session-operator-authorization` configuration, disabled by default and requiring an explicit owner-claim lease, workload namespace, database/transaction owners, and Account peer/mTLS client inputs; otherwise the receiver fails closed. Contextual configuration proof does not establish full-service runtime. This boundary does not call the legacy instance launcher, create an instance, select a descriptor, or activate World. The numeric `StartSession` RPC remains the existing instance-start path and its legacy validation is unchanged; neither RPC is a routable Logging operator workflow yet.
+
**Target state:** every mutating operator RPC listed above (`StartSession`, `StopSession`, `RestartSession`, `ToggleFeatureFlag`, `PauseTicksForScope`, `ResumeTicksForScope`, `SetAdmissionPointer`, `ExecutePreparedVersionCutover`, and `PrepareVersionUpgrade`) requires the same durable request identity: `controlPlaneRequestId` plus the canonical `mutationDigest`. Account binds both values into the bounded operator authorization reference, and Game Session recomputes and validates the digest before execution. The owner durably records the request before execution and records a terminal result only after owner-specific commit proof; PostgreSQL-owned mutations commit domain state and result atomically, while Redis-backed projections use the durable claim, fenced mutation marker, and reconciliation contract in ADR 0048. A duplicate request carrying the same digest returns the previously committed result, while the same request identifier with a different digest returns `IDEMPOTENCY_CONFLICT` without applying either payload. A timeout must not create a new request identifier; Logging & Admin may use that identifier only for owner result lookup until the exact operation is reconciled. `FENCE_REJECTED` is non-rearmable and prohibits mutation redelivery. A retry against a current owner or fence is permitted only after the owner has durably recorded terminal `NOT_EXECUTED` proof for the original attempt; it uses a new `ownerMutationId` and a newly fenced attempt while retaining the external request tuple. After authorization expiry, reconciliation is read-only.
The current proto and admission-pointer mutation flow remain incomplete against this target. `SetAdmissionPointerRequest` and `ExecutePreparedVersionCutoverRequest` still identify routes by `worldSlug`/`realmSlug` and do not carry durable `realmId`; the persisted/read models and callers have not proved migration to `{tenantId, realmId}`. `StartSessionRequest`, `PauseTicksForScopeRequest`, `ResumeTicksForScopeRequest`, and `GameplayAdmissionPointerMutation` for `SetAdmissionPointer` carry `controlPlaneRequestId` but not `mutationDigest`; those operations must not be reported as ADR-0048-complete until the missing request-field propagation, authorization binding, owner-side digest verification, replay persistence, and focused proof converge together.
diff --git a/design/architecture/microservices/game-session-service/configuration.md b/design/architecture/microservices/game-session-service/configuration.md
index 00b02cf1d3..4100672b7a 100644
--- a/design/architecture/microservices/game-session-service/configuration.md
+++ b/design/architecture/microservices/game-session-service/configuration.md
@@ -6,6 +6,8 @@
Live pin/convergence reads now expose the authoritative `{scriptPatchVersion, scriptPinEpoch, controlPlaneRequestId}` observation, and instance-bound Automation admission carries and validates the positive epoch. The current-pin/request-result ledger commits atomically with the owner tuple; complete append-only rollout history, bounded authoritative history readback, complete history fields and focused history proof, complete source/target command identity, and remote final-effect fencing remain implementation/proof gaps. See the [Game Session runtime and tick coordination tracker](../../../project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md#active-gaps).
+The StartSession owner-redemption composition is separately conditional and disabled by default at `firemud.start-session-operator-authorization.enabled`. Enabling it requires an explicit `owner-claim-lease`, the workload namespace, the existing database/transaction owners, and configured Account peer/mTLS client material. Missing startup inputs fail composition; enabling this preparation boundary does not launch an instance, activate gameplay, or expose an external operator ingress. The contextual configuration test is not full-service runtime proof.
+
## Environment Variables
Game Session follows the configuration scheme from [Environment Variables & Secrets Management](../../infrastructure/environment-and-secrets.md). It requires the [PostgreSQL credentials](../../infrastructure/environment-and-secrets.md#postgresql-credentials) and [Redis connection](../../infrastructure/environment-and-secrets.md#redis-connection) variables.
diff --git a/design/architecture/microservices/game-session-service/runtime-and-data.md b/design/architecture/microservices/game-session-service/runtime-and-data.md
index df28765195..81b87a0f2d 100644
--- a/design/architecture/microservices/game-session-service/runtime-and-data.md
+++ b/design/architecture/microservices/game-session-service/runtime-and-data.md
@@ -20,6 +20,7 @@ The sections below define the target-state runtime contract. Current implementat
- Hidden same-type Game Session recovery within ADR 0013's qualifying conditions remains an implementation or proof gap; the target is to preserve the session through upstream rebind rather than require a player-visible re-`LOGIN` / re-`PLAY` cycle.
- The live `startSession` path keeps the Game Session row and runtime projection `STARTING` until World confirms its fenced `PREPARING -> ACTIVE` transition, then records `RUNNING`; failures before an activation attempt use the existing pre-activation cleanup. Once activation may have been issued or committed, an activation error or ambiguous result, or a later local runtime-state save/finalization failure, retains both the runtime projection and local owner row as `STARTING`, and never calls stale-epoch `failPrepared` or deletes either record. A failure proven before any World termination request is issued may restore the prior `RUNNING` row and runtime state while the World remains `ACTIVE`; once a termination request may have been issued, an error or ambiguous result leaves the local row `STOPPING` and runtime projection absent. Confirmed World termination retries local `STOPPED` finalization and never restores `RUNNING`. Durable stable lifecycle-operation identity and lifecycle readback/reconciliation remain unimplemented, so these local fail-closed quarantines are not a replacement for the target durable lifecycle cleanup workflow.
- Current `onCommand` ingress uses the live `{tenantId, gameInstanceId}` boundary as a region surrogate until true region partitioning is shipped; it carries the current `regionEpoch` and a producer-supplied `readSnapshotToken` derived from the command and ownership fence. That token is retained only as an owner-specific manifest input or correlation value, not universal evaluation authority. The target handler-scoped input manifest is owned by the [DSL lifecycle contract](../../system-architecture-scripting-dsl-reference-and-lifecycle.md#read-consistency-contract); current producer/storage behavior is narrower and does not yet seal the complete manifest.
+- Canonical region-bootstrap preparation consumes the exact World-owned operational region assignment through the existing workload-pinned lifecycle read, requiring an `ACTIVE` response bound to the complete requested target. This read-only preparation is unregistered and is not assignment allocation, a lifecycle reservation, tick authority, or proof that the current instance-scoped executor consumes the assignment. Game Session must still create a truly absent qualified timeline with `regionEpoch=1` and `lastCommittedTickId=-1` (first tick `0`), install its actual acquired executor fence atomically, and revalidate the same lease before staging. Handoff and restart must preserve an existing timeline; decimal instance-derived region IDs and lease possession do not establish World assignment authority.
- Durable command/effect execution currently covers movement and `PUT`, `TAKE`, `WEAR`, and `REMOVE` fully at the existing boundary. Current `GET` is the command spelling for the target `PICKUP`/`PickupVisibleRoomItem` family, and `GET` plus `DROP` also enqueue and execute on that durable command path, but their ADR 0054 spatial correctness remains incomplete until World `TargetingFactSnapshot` attestation/location-version propagation, the shared actor-lock/executor-fence critical section and durable barrier/handoff path, and stale-race proof are implemented. Current movement/item replay rows do not yet prove the ADR 0054 participant guard bound to root `EffectId`, typed operation, target, and request digest, or fail-closed changed reuse.
- The target spatial/ambient reconciliation contract is not a current Game Session surface: the typed `EffectReconciliationAuthority`, durable `effect_reconciliation_backlog`/authority schema, immutable effect guards, durable action ledger/results, and list/retry/acknowledgement APIs remain unimplemented. Current persistence is limited to `tick_batch`/`tick_effect` and narrower domain/remote-follow-up reconciliation; see [Game Session API status](./api-contracts.md#implementation-status) and the normative [transaction reconciliation owner](../../system-architecture-transactions.md#reconciliation-owner-of-record-spatialambient-effects).
- The target remote-follow-up contract makes terminal timeout/late outcomes immutable under the original identity: exact retries return the stored terminal outcome, and a late-applied result requires a separately documented feature-specific compensation flow. The current `scheduleFollowup` replay path returns an existing retryable-timeout pair or valid terminal pair without mutation, with focused unit proof for terminal-pair replay. This does not establish exact serialized timeout/result arbitration under concurrency, complete terminal-failure mirroring, missing-coordinator recovery, or late-result compensation. The live `late_result_requires_reconciliation` path also writes `LATE_RESULT_RECONCILED`/`PARTIAL` and mirrors `APPLIED`/`PARTIAL` to the origin without a separately identified compensation/saga flow; post-abandon re-drive and compensation ownership remain unproved.
diff --git a/design/architecture/microservices/game-session-service/start-session-action-schema.md b/design/architecture/microservices/game-session-service/start-session-action-schema.md
index f852fb1e4c..65bbfe575b 100644
--- a/design/architecture/microservices/game-session-service/start-session-action-schema.md
+++ b/design/architecture/microservices/game-session-service/start-session-action-schema.md
@@ -2,7 +2,7 @@
## Implementation status
-The shared StartSession action, mutation-digest codec, pre-authorization reservation tuple, post-authorization execution tuple, and Account authority-evidence bundle are present as common-platform-core value and codec contracts with focused Java tests and shared Java/Python digest vectors. Logging & Admin also implements durable StartSession pre-authorization reservation persistence and the read-only `ReadCurrentClaimEvidence` transport for Account claim-evidence handoff. Production reservation construction is write-denied and passive/read-only; mutation-capable construction is isolated to test-only fixtures. These implementations do not establish current Account authority. Account issuance and redemption are not wired; Game Session and Game Design runtime registration and owner execution integration are not implemented. External routing and end-to-end launch proof remain unproved. No external route or runtime activation is enabled by this boundary.
+The shared typed action, digest codec, pre-/post-authorization tuples and Account authority-evidence bundle are implemented with focused Java tests and shared Java/Python vectors. Source-level StartSession slices now include Logging & Admin durable reservation and authorization handoff, Account ISSUE/RECOVER/REDEEM plus the current-original-operation projection, and Game Session claim/redemption transport and prepared-action binding. Logging production service/repository mutation is mechanically denied pending its approved lifecycle and exact-family retention policy; authenticated evidence reads remain available, and isolated run-owned fixtures do not enable production writing. These slices are not yet an executable runtime: the Account receiving adapter remains disabled by default, its production hosted-terms environment producer and pinned trusted-provider/key-custody composition are absent, and Game Design's prepared selector/current-Account-projection consumer remains unwired. No full physical cross-service smoke has established boot or execution; source-level and component tests do not claim that proof. No external route or runtime activation is enabled by this boundary.
## Normative contract
@@ -49,6 +49,6 @@ The SHA-256 preimage follows ADR 0047's exact `mutationDigest/v1` framing. The s
The target owner is fixed to `game-session-service` for this schema and is carried separately in the ADR 0048 execution tuple; it is not a digest field. `controlPlaneRequestId`, any separately tagged action-family request identity, reservation owner and claim fence, transport credentials, opaque authorization references, actor assertions, and Account authority evidence are outside these seven grammar fields and are compared at their respective boundaries under [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#bounded-owner-delegation) and [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md#one-correlated-execution).
-The action contains no runtime version or patch input. It does not assert current ownership or authority. Owner-domain checks, source selection and execution remain separate runtime prerequisites outside this shared-contract slice.
+The action contains no runtime version or patch input. It does not assert current ownership or authority. Game Design selects a launch descriptor under its independently authorized [original-operation read boundary](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md#redeemed-startsession-projection-read); the Game Session owner performs its separate domain and execution checks.
The shared Java implementation exposes `StartSessionOperatorActionCodec.decode(byte[])`, `canonicalPreimage(...)`, and `mutationDigest(...)`, plus the immutable typed action accessors. Shared Java and Python conformance vectors are stored in [the common vector fixture](../../../../services/common-platform-core/src/test/resources/operator/start-session-mutation-digest-v1-vectors.json).
diff --git a/design/architecture/microservices/logging-admin-service/api-contracts.md b/design/architecture/microservices/logging-admin-service/api-contracts.md
index 05d8fcf0a9..e06c393852 100644
--- a/design/architecture/microservices/logging-admin-service/api-contracts.md
+++ b/design/architecture/microservices/logging-admin-service/api-contracts.md
@@ -2,6 +2,16 @@
This document defines the Logging & Admin Service REST and gRPC surfaces, authentication classes, and endpoint availability expectations.
+## StartSession Reservation Claim Evidence
+
+`logging_admin.v1.StartSessionReservationEvidenceService/ReadCurrentClaimEvidence` is a read-only internal Account handoff for [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md)'s current pre-authorization reservation. It requires the exact certificate-derived `account-service` peer in the configured workload namespace and rejects caller JWT context before reading the reservation. It is not an external operator route, authorization-reference issuance, claim renewal, ownership transfer, or commit-spanning CAS proof.
+
+The request binds the canonical non-nil `controlPlaneRequestId`, exact bounded canonical UTF-8 `preAuthorizationReservationTuple/v1`, original reservation owner/fence, current claim owner/fence, and an explicit `ISSUE` or `RECOVER` purpose. `ISSUE` requires the original owner/fence; `RECOVER` requires a distinct recovery owner and a later fence. Only an exact, unexpired, active `ACCOUNT_AUTHORIZATION/AUTHORIZATION_PENDING` row can supply evidence. The response echoes the exact tuple, mutation digest, both owner/fence pairs, purpose, claim expiry, and observation time. Missing, changed, expired, or unavailable evidence fails closed; unknown fields and malformed or non-canonical input are rejected. Account validates all returned bindings and freshness before using this snapshot as an issuance or recovery precondition; it must still establish its own current authority and durable operation boundary.
+
+Implementation status: the claim-evidence receiver and Account read client exist with focused proof. The source-level Logging coordinator and typed Account client now have a Spring composition, but it is available only through the disabled-by-default configuration described in [Configuration](./configuration.md#conditional-startsession-coordinator-composition). This does not register an external operator ingress or establish that an operator command can execute.
+
+When enabled, the Spring composition requires the configured canonical workload namespace and readable file-backed client mTLS inputs, initializes the typed Account client through the managed bean lifecycle, and connects it to the existing durable reservation service. The configuration supplies no reservation or authority source and exposes no external route. Its context test uses a controlled channel factory and test-only placeholder TLS files; it does not prove physical mTLS, production service startup, remote Account availability, or execution through Game Session launch selection and World activation. The target authorization and owner-forwarding rules remain owned by [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md) and [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md).
+
## Account Audit Ingress and Receipt
The canonical Account-to-Logging & Admin audit ingress is the existing `logging_admin.v1.LoggingAdminService/CreateLogEvent` RPC, converged in place rather than duplicated as a parallel ingress. It is a non-destructive internal service RPC, not an operator/admin mutation. Account is the producer and source authority for account state; Logging & Admin owns the receiver-side audit envelope, durable receipt/readback, deduplication, and audit projection. The audit ingress follows only shared envelope fundamentals (stable identity, event type/schema, producer occurrence time, and at-least-once/idempotent delivery) from [Session Behavior](../../system-architecture-session-behavior.md); it does **not** inherit that document's membership-specific field set or `eventDigest` grammar. Internal workload identity and method authorization follow [Authentication](../../system-architecture-authentication.md) and [gRPC](../../system-architecture-grpc.md#tls-requirements).
@@ -101,6 +111,8 @@ The implementation gap is fail-closed: the HTTP controller and Gateway route are
- Game instance session lifecycle remains a current Game Session owner-local route family (`/sessions*`), not current Logging & Admin ingress. Its target external operator path is Logging & Admin to Game Session owner RPCs with Account-issued authorization references; no complete current Logging & Admin `/sessions*` route family exists.
- Recovery actions beyond pause/resume are hypothetical target coverage until a named typed authoritative-owner contract exists. Do not add `/tick-remediation/remediate`, an open-ended payload language, or a direct Redis mutation path.
+The source-level `StartSessionAuthorizationCoordinator` now offers separate `issueHumanAndDispatch` and `recoverAndDispatch` methods that compose its existing authorization/recovery flow with `GameSessionClient`. They call the owner once only when that invocation wins the durable `OWNER_EXECUTION_PENDING` transition; exact/in-progress and recovery-unavailable results do not dispatch, and ambiguous owner outcomes propagate without automatic retry or rearming. The existing `issueHuman` and `recover` methods remain prepare-only. The typed `GameSessionClient` call sends the transient post-authorization tuple/reference and validates Game Session's secret-free durable attempt/progress echo; it requires readable file-backed workload mTLS and pins both request and response to the exact same-namespace Game Session SPIFFE URI derived from the tuple. Ping and stop keep their existing client behavior. These methods are not wired to a routable Logging & Admin StartSession ingress. Mocked tests do not establish physical mTLS, production ingress, prepared launch selection, or instance activation.
+
**Target ADR 0047/0048 owner-forwarding path:** [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md) owns the Logging & Admin ingress and Account-reference issuance boundary; [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md) owns the phase-qualified execution, redemption, and reconciliation contract. Supported executable operator mutations use Account's canonical [`IssueHumanOperatorAuthorizationReference`](../account-service/api-contracts.md#operator-authorization-references) issuance RPC after Logging & Admin authenticates the current `control-ui` actor and records durable intent. Logging & Admin forwards the opaque bounded reference and unchanged request/generation binding; the authoritative receiving owner recomputes the canonical digest and is the only service that calls Account's `RedeemOperatorAuthorization` RPC. Unattended automation uses Account's `IssueAutomationOperatorAuthorizationReference` with `exact_mtls_workload_plus_versioned_automation_policy`, bound to the exact Logging and Admin workload mTLS identity and current `automation_policy_id`/`automation_policy_version`; the currently supported automation branch is tenant-scoped only and carries the exact target `tenant_generation` through issuance, forwarding, redemption, and owner commit. It carries no human identity, end-user token, or `privileged_control` authority. For each owner contract, predicate evidence comes exclusively from Account's redemption response; any copy forwarded by Logging & Admin is unchanged audit/context evidence, not authority. The local `/moderation/actions` policy-input/audit mutation is a separate receiving-service path: after its gate exists, Logging & Admin redeems its one Account reference exactly once for local persistence and never forwards or reuses that reference. Any future moderation owner-enforcement command uses a separately issued command-bound reference redeemed exactly once by the receiving owner. The moderation route is currently gated/unavailable; it hard fails closed without dispatch or persistence and performs no target fixed-category policy/audit persistence or forwarding. `EvaluateModerationPolicy` is a live read and carries no mutation authorization reference. For non-moderation action families, the request identity is the exact `controlPlaneRequestId` plus digest pair. Moderation and appeal transports instead use dedicated `policyIntentRequestId`, `ownerEnforcementRequestId`, and stable appeal-submission request identities end-to-end; `controlPlaneRequestId` remains a separate correlation-only field and must not carry, replace, alias, or serve as any of those mutation identities. The dedicated identities are never shared or reused. Logging & Admin never becomes a second authorization authority. Current feature-flag and tick forwarding paths, plus internal admission control-plane implementations, are not evidence that this ADR 0048 target contract is complete.
For every forwarded owner mutation, excluding the separate local `/moderation/actions` policy-input/audit path, the authoritative owner calls Account's `RedeemOperatorAuthorization` with the separately issued opaque reference and its independently derived request binding. Authorization predicates and generation authority come exclusively from that Account response. Any predicate, generation, checkpoint, or assurance copies forwarded by Logging & Admin are unchanged audit/context evidence only; the owner must not authorize or mutate from those copies, and they are excluded from the canonical `mutationDigest/v1`, which covers the normalized action request rather than ingress assertions. The local moderation route is gated/unavailable; it hard fails closed without dispatch or persistence and does not persist target fixed-category policy/audit evidence, redeem, forward, or enforce.
diff --git a/design/architecture/microservices/logging-admin-service/configuration.md b/design/architecture/microservices/logging-admin-service/configuration.md
index addecea4c4..db26f7318d 100644
--- a/design/architecture/microservices/logging-admin-service/configuration.md
+++ b/design/architecture/microservices/logging-admin-service/configuration.md
@@ -27,6 +27,16 @@ The Logging & Admin Service does **not** connect to Redis at runtime. It consume
| `FIREMUD_GRPC_ACCOUNT_RESERVATION_EVIDENCE_APPROVED_LEAF_FILE` | Absolute path to the protected, method-scoped Account leaf-approval file for `ReadCurrentClaimEvidence`; blank, unreadable, or invalid policy denies the method | *(none)* |
| `FIREMUD_SERVICES_ACCOUNT_SERVICE` | gRPC endpoint (host:port) for the Account Service | *(none)* |
| `FIREMUD_SERVICES_GAME_SESSION_SERVICE` | gRPC endpoint (host:port) for the Game Session Service | *(none)* |
+| `FIREMUD_GRPC_WORKLOAD_NAMESPACE` | Canonical workload namespace for internal gRPC identity checks | *(none)* |
+| `FIREMUD_LOGGING_ADMIN_START_SESSION_OPERATOR_AUTHORIZATION_ENABLED` | Explicitly enables the local StartSession authorization coordinator composition | `false` |
+
+## Conditional StartSession Coordinator Composition
+
+The `FIREMUD_LOGGING_ADMIN_START_SESSION_OPERATOR_AUTHORIZATION_ENABLED` opt-in defaults to `false`. When explicitly enabled, Spring composes the existing durable reservation service with `StartSessionAuthorizationCoordinator` and an Account `StartSessionOperatorAuthorizationClient`; the client is initialized and closed through the managed Spring bean lifecycle.
+
+Enabled composition requires a canonical `firemud.grpc.workload-namespace` and readable file-backed gRPC client certificate-chain, private-key, and CA inputs. These use the existing common gRPC TLS resolver and the `FIREMUD_GRPC_CERT_CHAIN_PATH`, `FIREMUD_GRPC_PRIVATE_KEY_PATH`, and `FIREMUD_GRPC_CA_CERT_PATH` inputs above. Missing, plaintext, incomplete, or non-file-backed TLS inputs fail composition rather than selecting defaults. The canonical operator contracts remain in [ADR 0047](../../decisions/adr-0047-logging-admin-as-external-operator-write-ingress.md), [ADR 0048](../../decisions/adr-0048-durable-idempotent-operator-write-execution.md), and the [StartSession reservation evidence contract](./api-contracts.md#startsession-reservation-claim-evidence).
+
+This configuration creates no external operator route, trusted caller context, reservation provider, or gameplay activation. The focused configuration test uses a controlled channel factory and test-only placeholder files; it is wiring proof only, not physical mTLS, production startup, external-ingress, Game Session launch-selection, or World activation proof.
`logging_admin.v1.StartSessionReservationEvidenceService/ReadCurrentClaimEvidence` is the only method exempted from the shared Bearer-JWT interceptor. The server's required client-certificate handshake and verified TLS peer interceptor remain enabled. The receiver requires both the exact Account SPIFFE identity in `FIREMUD_GRPC_WORKLOAD_NAMESPACE` and approval of the SHA-256 fingerprint derived from the presented TLS leaf. It reads the configured file for each request; a missing path, read failure, malformed file, or unapproved leaf denies the request before reservation access. The JWT header is not an identity source for this method.
diff --git a/design/project-management/design-alignment/design-capability-allocation-microservices.md b/design/project-management/design-alignment/design-capability-allocation-microservices.md
index d98d1dea9f..8672c5e9b6 100644
--- a/design/project-management/design-alignment/design-capability-allocation-microservices.md
+++ b/design/project-management/design-alignment/design-capability-allocation-microservices.md
@@ -73,10 +73,10 @@ This ledger maps every Markdown source under [`design/architecture/microservices
| --- | --- | --- | --- | --- | --- |
| `design/architecture/microservices/entity-management-service/README.md` | `GR-3` | `AA-3`, `AR-1`, `EA-1`, `GR-1`, `GR-2`, `SF-1`, `SF-2` | Whole file. Character discovery scope -> `AA-3`; template authoring -> `AR-1`; authoritative location exclusion -> `GR-2`; LOOK presentation handoff -> `EA-1`. | Service overview | World owns location and occupancy; Entity owns actor/item state and containment. |
| `design/architecture/microservices/entity-management-service/api-contracts.md` | `GR-3` | `AR-1`, `EA-1`, `GR-2`, `GR-4`, `SF-1`, `SF-2`, `PO-4` | Overrides: **Design-Time APIs** and **Digest Input Manifest** -> `AR-1`; **LOOK Entity Listing Contract** -> `EA-1`/`GR-2`; **Actor State Query** -> `GR-4`; **Implementation Status (LOOK Slice)** -> `PO-4`. | API contract | LOOK returns structured entity facts; it does not own transcript rendering. |
-| `design/architecture/microservices/entity-management-service/character-create-action-schema.md` | `GR-3` | `AA-3`, `AR-1`, `SF-1`, `SF-2` | Whole file. Authored-source and policy handoffs -> `AR-1`; admission/account authority -> `AA-3`; authenticated owner and protocol boundaries -> `SF-1`; durable mutation workflow -> `SF-2`. | Character-creation action schema | Canonical Entity-owned CHARACTER_CREATE/1 preimage contract; allocation records ownership without duplicating its schema. |
| `design/architecture/microservices/entity-management-service/configuration.md` | `PO-3` | `GR-3`, `SF-1`, `SF-2` | Whole file. Cache variables -> `SF-2`; TLS/proto details -> `SF-1`. | Configuration contract | No unresolved ambiguity. |
| `design/architecture/microservices/entity-management-service/operations.md` | `PO-4` | `GR-1`, `GR-3`, `SF-2` | Overrides: **Tick Locking** and **Tick Idempotency** -> `GR-1`/`SF-2`. | Operations contract | No unresolved ambiguity. |
| `design/architecture/microservices/entity-management-service/runtime-and-data.md` | `GR-3` | `AR-1`, `AR-3`, `GR-1`, `GR-2`, `GR-4`, `SF-1`, `SF-2`, `PO-1` | Overrides: design/version portions of **Data Model and Versioning** -> `AR-1`; **Replacement-Instance State Classification** -> `AR-3`; **Inventory Transfer Audit** -> `PO-1`; **Instance Termination Cleanup Contract**, **Workflow Participation**, **Redis Role and Prefixes**, and **Version Sources for Entity Caches** -> `SF-2`; location/spatial boundaries -> `GR-2`. | Runtime/data contract | Character location remains explicitly World-owned. |
+| `design/architecture/microservices/entity-management-service/character-create-action-schema.md` | `GR-3` | `AA-1`, `AA-2`, `AA-3`, `AR-1`, `GR-1`, `GR-2`, `SF-1`, `SF-2` | Whole file. Account authority -> `AA-1`; gameplay admission -> `AA-2`; realm admission and playable-state policy -> `AA-3`; authored inputs -> `AR-1`; runtime coordination -> `GR-1`; location boundaries -> `GR-2`; action schema -> `SF-1`; durable mutation workflow -> `SF-2`. | Character-creation action schema | Entity owns character mutation; account, admission, authoring, runtime, location, schema, and workflow concerns remain handoffs. |
## Game Design Service
diff --git a/design/project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md b/design/project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md
index b2584d833f..01c207e9cb 100644
--- a/design/project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md
+++ b/design/project-management/implementation-tracking/game-session-runtime-and-tick-coordination.md
@@ -18,6 +18,8 @@ Local Game Session producer code includes an unregistered historical original-St
Gameplay-session context remains on the implementation-local `sessionctx:*` keys and per-instance binding identity. The target authenticated `session:game:{tenantGameplayTag}:...` family, persisted tenant-tag allocation, and namespace-qualified controller uniqueness are not implemented or end-to-end proved; the canonical tenancy and focused-isolation requirements remain in [Multi-Tenancy](../../architecture/system-architecture-multi-tenancy.md#data-separation-per-service).
+Canonical region-bootstrap receiving preparation resolves the exact World operational UUID from a workload-pinned `ACTIVE` lifecycle read bound to the complete target request; it has no runtime registration or mutation path. Focused resolver proof does not establish real owner composition or protected currentness through a later commit. Qualified timeline persistence, the actual Redis lease/durable executor-fence handshake, same-lease staging revalidation, takeover/restart preservation, and physical composition remain open under the [Game Session runtime/data contract](../../architecture/microservices/game-session-service/runtime-and-data.md#implementation-status). The legacy instance-scoped runtime row and its decimal region surrogate are unchanged; neither supplies canonical initialization or playable proof.
+
Retained bootstrap correction: V8 recognizes only the unchanged, provenance-backed historical demo/sandbox pair that was seeded with two public-production realms. It changes sandbox's public flag and advances only its catalog revision, retains runtime pointer and durable realm/namespace identity, and appends an immutable repair event in the same transaction. Unknown, operator-edited, incomplete, extra-public, or conflicting-history catalogs remain untouched and fail closed. This is not World-owner lifecycle or initial-bind proof. PostgreSQL execution remains a required separate check; the local environment has no Docker or PostgreSQL runtime.
Admission-catalog foundation status: Game Session pointer and audit rows now persist a separate positive `catalogRevision` and stable UUID `realmId`/`playableStateNamespaceId`; repository updates check both pointer version and catalog revision, and player-facing catalog/read projections fail closed on ambiguous tenant catalogs or incomplete identity. Runtime control-plane reads also reject persisted pointers with nonpositive `catalogRevision` or missing `realmId`/`playableStateNamespaceId` before constructing `GameInstanceRuntimeState`, returning `ADMISSION_POINTER_AUTHORITY_UNAVAILABLE` without partial pin/version metadata or pointer entries. Same-tenant world and realm selectors that collide under case-folding now fail closed in authority-backed catalogs and fixture catalogs while preserving the canonical routing tuple and revision. No-caller text `WORLDS`/`REALMS` and gRPC `ListGameplayWorlds`/`ListGameplayRealms` now share a public-production-only projection that retains the existing catalog health and public-realm cardinality checks; internal pointer health reads and explicit private admission/grant checks still see private realm authority. Caller-authorized private discovery remains unavailable until Account/caller integration. Focused regressions cover mixed-case collisions, single-selector resolution, private-only world omission, and private realm omission; validation remains pending. This is implemented whole-response fail-closed behavior, not successful migration or runtime proof. This does not implement a World-owner-validated initial bind, strict `JOIN`, or production activation. The configuration-driven pointer initializer validates configured seed shape without inserting pointer rows, and GS/WMS raw runtime seeding has been removed. Neither configured seeds nor legacy seed configuration provides World lifecycle proof. The extracted 35-path foundation passed a serialized `run-locked-gradle.sh` invocation of `:game-session-service:spotlessJavaApply :game-session-service:test :game-session-service:compileIntegrationTestJava linkCheck lintMarkdown --no-configuration-cache` on 2026-10-02. This executed unit proof and compiled PostgreSQL migration tests; no PostgreSQL/runtime execution proof is claimed.
diff --git a/design/project-management/implementation-tracking/player-access-and-session.md b/design/project-management/implementation-tracking/player-access-and-session.md
index 0667bc412d..61d11e0429 100644
--- a/design/project-management/implementation-tracking/player-access-and-session.md
+++ b/design/project-management/implementation-tracking/player-access-and-session.md
@@ -6,6 +6,10 @@ This is a non-normative implementation tracker for player access and session. Ca
## Current Status
+### Entity character-creation denial
+
+The existing scalar-only Entity `CreateCharacter` RPC now returns `FAILED_PRECONDITION` before allocation for valid requests in shared and isolated scopes; the focused service test also confirms the malformed zero-account case remains `INVALID_ARGUMENT`. This is denial-only implementation and unit proof. The canonical Account producer, authenticated owner proof, exact catalog/admission-pointer evidence, Game Session and World protections, and Entity durable terminal composition remain missing, so character creation is unavailable under [ADR 0140](../../architecture/decisions/adr-0140-realm-authored-controllable-actor-entry.md) and the [Entity owner-protection contract](../../architecture/microservices/entity-management-service/api-contracts.md#character-creation-owner-protection).
+
Restricted original-claim evidence continuation remains inactive and preparation-only; its bounded preparation and proof limits are recorded under [restricted original-claim continuation preparation](#restricted-original-claim-evidence-continuation-preparation).
### Account signer/currentness storage evidence preparation
@@ -24,6 +28,12 @@ The direct expiry-erasure correction adds [V126.1](../../../services/account-ser
The current Account cut adds V126 operator-authorization storage, default-inactive StartSession authorization sources, Control-UI issuance and Redis coordination, Account-owned JWKS and signer-materialization adapters, and readiness-probe sources. This preparation is tracked under AA-1.3, whose state remains `partial` / `drift-found`. StartSession composition is disabled by default. Materializer trust is disabled by default, and absent trust denies every materializer RPC. Missing bootstrap-coordinator composition denies enrollment and promotion operations; trusted generation requests, observations, and result reads remain available. No runtime issuer, signer-promotion coordinator, or consumer coordinator is registered. Production anchors include [AccountControlUiIssuanceService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuanceService.java), [AccountJwtSignerMaterializationService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountJwtSignerMaterializationService.java), and [V126](../../../services/account-service/src/main/resources/db/migration/V126__start_session_operator_authorization.sql). Focused test anchors include [StartSessionOperatorAuthorizationGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/StartSessionOperatorAuthorizationGrpcServiceTest.java), [AccountStartSessionOperatorAuthorityBundleTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountStartSessionOperatorAuthorityBundleTest.java), [AccountControlUiOwnerWorkflowPostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountControlUiOwnerWorkflowPostgresIntegrationTest.java), [AccountControlUiIssuancePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuancePostgresIntegrationTest.java), and [V126.2](../../../services/account-service/src/main/resources/db/migration/V126.2__account_control_ui_registry_cleanup_deadline.sql). At pinned head `22a6c39e3f1754acebf95477d6968c69edde66fd`, Validation run `38096949593` and Account artifact `11686863341` record the nine changed PostgreSQL/Redis integration suites executing 35 cases with zero failures, errors, or skips, plus 23 RestoredInventory unit cases. That proof remains historical and applies only to its recorded head and fixtures. Later hosted Validation run `38113324723` succeeded at head `f6d34031221a3337e7a958ac4b085554460668c9`; Account job `114394304424` and artifact `11693535744` record four owner-workflow PostgreSQL tests physically executed, including signer quarantine. This is bounded physical fixture proof, not deployment or runtime activation. At exact source head `44bbd2a9fff1e1561816e16fd0deb9cc274ae251`, Validation run `38117703529`, Account job `114405941820`, and artifact `11693819544` tested merge commit `9ca30839c8a46446f01d0a441e6e830fab8bca86` with ordered parents `4ab98ba1f0a2464349ed21ce59e7ef44ecd79e8c` and `44bbd2a9fff1e1561816e16fd0deb9cc274ae251`; the Control-UI issuance PostgreSQL suite passed 5/5 and the StartSession authorization repository PostgreSQL suite passed 15/15 with zero skips, failures, or errors. This is bounded exact-head fixture proof, not deployment or runtime activation, and aggregate validation remains red on the unrelated Gateway fixture. The Account-owned [reservation-evidence client](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/client/StartSessionReservationEvidenceClient.java) uses the existing Logging & Admin proto contract; completing the flow also depends on the out-of-cut Logging & Admin authorization coordinator/client and Game Session redemption composition. mTLS execution, the complete Logging & Admin/Game Session/World flow, player-facing JWT readiness, and activation remain unproved. V126/V126.1/V126.2 remain passive storage/source preparation; bounded cleanup and late revocation remain incomplete. Canonical JWT and signer behavior remains in [JWT and Token Contracts](../../architecture/system-architecture-jwt-and-token-contracts.md), with Account-local consequences in [Account Runtime and Data](../../architecture/microservices/account-service/runtime-and-data.md#implementation-status).
+### Account fresh original-ACK storage preparation
+
+The receiving Account cut imports the preserved original-ACK storage preparation from `codex/gameplay-game-design-publication-storage-foundation-20261009` at `d66d36951d3df780641e0ef04819f15df52ddc39` plus its uncommitted PostgreSQL 18 fresh-path changes. Only the receiving migration filenames are allocated anew: V140 ← source V118 (lease operations), V141 ← V119 (unknown-decision abort), V142 ← V120 (original-finalization stamp and experimental confirmation storage), V143 ← V121 (global pending fences), V144 ← V122 (original-ACK receipt), V145 ← V136 (experimental confirmation write retirement), and V146 ← V139 (PostgreSQL 18 fresh-insert guard). Their SQL bytes, including historical version comments, are preserved. Source V122 retains SHA-256 `c4f66ce16c77514717cbc9d2e0d65bc8c8ee0882239371d8518f587a0ef53490`, matching the historical `2cb445617f584d25c805f5c08e9dde67fff4efc4` migration; no donor renumbering or external migration application is performed.
+
+The unregistered executors and receipt repository preserve the exact original operation, source identity, finalization XID, unchanged expiry and original clock bound. Fresh original and independent receipt COMMITs are explicitly PostgreSQL 18-only; retained COMMITTED retries cannot mint another acknowledgement, and the unchanged historical durable reader still denies PostgreSQL 18 recovery or retained-receipt retries. The copied unit proof sources and 14-case genuine/failure PostgreSQL prototype use the receiving canonical `AccountPostgresIntegrationFixture(true)` without importing another fixture or build dependencies. Receiving formatting, generated-schema compilation, unit execution and physical PostgreSQL proof remain pending the consolidated gate; no donor or earlier receiving result proves this new intake. Authentication, current ownership/admission, runtime registration, activation and playable capability status remain unchanged. Account-local storage consequences remain in [Account Runtime and Data](../../architecture/microservices/account-service/runtime-and-data.md#implementation-status).
+
### Restricted original-claim evidence continuation preparation
This inactive owner continuation may read or replay the exact immutable association pin and create at most one immutable descriptor evidence pin under that same association and original `PENDING` claim, attempt, and fence. Authenticated Account and Game Design reads occur outside SQL; owner and association state is locked and rechecked before descriptor pinning. Initial association creation also requires the exact original Account authorization reference to remain unexpired at the PostgreSQL write, independently of the owner-claim lease. Existing association replay and historical reads retain their reconciliation semantics; this preparation does not renew or reissue authorization or create a replacement claim. Its classes remain unregistered; added proto/schema support does not activate a runtime route or grant mutation authorization or player admission. Descriptor evidence does not complete canonical launch, initial World-backed admission, or historical owner reconciliation. The canonical boundary is [Game Session restricted original-claim evidence continuation](../../architecture/microservices/game-session-service/api-contracts.md#restricted-original-claim-evidence-continuation) and [ADR 0048](../../architecture/decisions/adr-0048-durable-idempotent-operator-write-execution.md).
@@ -92,7 +102,7 @@ These links add decision provenance only; they do not upgrade player-access or s
| --- | --- | --- | --- | --- | --- | --- | --- |
| `AA-1.1` Account and profile identity | `partial` | `drift-found` | [Authentication and authorization](../../architecture/system-architecture-authentication.md); [Account runtime and data](../../architecture/microservices/account-service/runtime-and-data.md); [ADR 0042](../../architecture/decisions/adr-0042-global-account-and-tenant-scoped-game-relationships.md); [ADR 0020](../../architecture/decisions/adr-0020-scoped-domain-and-operational-identifiers.md) | [AccountServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountServiceImpl.java); [AccountDto.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountDto.java); [AccountMapper.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/mapper/AccountMapper.java); [AccountController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AccountController.java); [ProfileController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/ProfileController.java); [AccountGrpcService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountGrpcService.java); [RuntimeAccountIdentityGrpcService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/RuntimeAccountIdentityGrpcService.java); [AccountRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountRepository.java); [account_service.proto](../../../protos/account/v1/account_service.proto); [openapi.yaml](../../../services/account-service/src/main/resources/openapi.yaml); [AccountIdentityProvenance.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/AccountIdentityProvenance.java); [V1__init.sql](../../../services/account-service/src/main/resources/db/migration/V1__init.sql); [V26__global_registration_join_evidence.sql](../../../services/account-service/src/main/resources/db/migration/V26__global_registration_join_evidence.sql); [V29__account_identity_uuid_bridge.sql](../../../services/account-service/src/main/resources/db/migration/V29__account_identity_uuid_bridge.sql) | [AccountServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountServiceImplTest.java); [AccountControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/AccountControllerTest.java); [PublicBootstrapRoutesProdProfileTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/PublicBootstrapRoutesProdProfileTest.java); [AccountGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountGrpcServiceTest.java); [RuntimeAccountIdentityGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/RuntimeAccountIdentityGrpcServiceTest.java); [AccountApplicationIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/AccountApplicationIntegrationTest.java); [AccountRepositoryIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountRepositoryIntegrationTest.java); [ProfileControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/ProfileControllerTest.java) | [Shared Runtime](./shared-runtime-contracts-and-persistence.md) | Account V29 and `AccountRepository` persist/read back the non-nil Account UUID, recognized provenance, and unchanged numeric source-row identity required by ADR 0020. Registration REST/gRPC output and Account fields in the existing local exports now use that UUID; new registration audit records carry the same value, and the reverse DTO mapper is removed. `AccountDto` mapping rejects missing or contradictory UUID/provenance/source-row evidence. The focused unit/controller/gRPC suites executed 238 tests (174 AccountServiceImpl, 15 AccountController, 2 production-profile route, and 47 gRPC) with no failures, errors, or skips; the 5 PostgreSQL-backed Account application integration cases compiled but skipped because Docker is unavailable. Retained-row migration proof remains available but local PostgreSQL cases skip when Docker is disabled. Registration still creates global Account state plus its platform audit outbox row only, with no profile or tenant membership; caller-supplied tenant input is not authority. Authentication results and JWT subjects remain unchanged; profile/export profile identity fields and tenant IDs remain numeric and full portable export is not implemented. Current profile GET/PUT routes enforce exact caller-account subject binding and current tenant membership; tenant-qualified routes and membership-authority-generation validation remain gaps. Credential and email-OTP gameplay authentication remain global Account-identity operations that do not select a tenant or require current membership. `RuntimeAccountIdentityGrpcService` implements the authenticated Account-owner UUID/provenance read; its 31 focused unit cases, integration-source compilation, and formatting/documentation checks do not prove PostgreSQL execution or a live mTLS handshake, and do not enable UUID authentication or gameplay admission. Lifecycle-state retention remains tracked under AA-1.3. |
| `AA-1.2` Tenant membership, roles, and delegated access | `partial` | `drift-found` | [Multi-tenancy](../../architecture/system-architecture-multi-tenancy.md); [Authentication and authorization](../../architecture/system-architecture-authentication.md); [ADR 0025](../../architecture/decisions/adr-0025-explicit-open-enrollment-membership.md); [ADR 0042](../../architecture/decisions/adr-0042-global-account-and-tenant-scoped-game-relationships.md); [ADR 0138](../../architecture/decisions/adr-0138-expiring-playtest-grants-with-bounded-active-revocation.md) | [AccountServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountServiceImpl.java); [AccountJoinOperationRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountJoinOperationRepository.java); [AccountConnectScopeRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountConnectScopeRepository.java); [ExpiredConnectScopeCleanupJob.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/ExpiredConnectScopeCleanupJob.java); [AccountAuditOutboxRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuditOutboxRepository.java); [AccountCanonicalFirstJoinTerminalCoordinator.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountCanonicalFirstJoinTerminalCoordinator.java); [AccountMembershipAuthorityEventProducer.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountMembershipAuthorityEventProducer.java); [AccountAuthorityGenerationRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepository.java); [AccountAuthoritySourceEvidenceRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidenceRepository.java); [AccountTenantAuthorityEventRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountTenantAuthorityEventRepository.java); [AccountDemoTenantEntitlementRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountDemoTenantEntitlementRepository.java); [AccountTenantEntitlementOutboxRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountTenantEntitlementOutboxRepository.java); [AccountActorStagingEligibilityService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountActorStagingEligibilityService.java); [AccountActorStagingEligibilityGrpcService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountActorStagingEligibilityGrpcService.java); [AccountActorStagingEligibilityRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountActorStagingEligibilityRepository.java); [AuthController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AuthController.java); [AccountTenantMembership.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/AccountTenantMembership.java); [AccountRealmAccessGrant.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/AccountRealmAccessGrant.java); [account_service.proto](../../../protos/account/v1/account_service.proto); [V26__global_registration_join_evidence.sql](../../../services/account-service/src/main/resources/db/migration/V26__global_registration_join_evidence.sql); [V27__retain_join_connect_scopes.sql](../../../services/account-service/src/main/resources/db/migration/V27__retain_join_connect_scopes.sql); [V30__approved_legacy_tenant_associations.sql](../../../services/account-service/src/main/resources/db/migration/V30__approved_legacy_tenant_associations.sql); [V31__subscription_authority_generation.sql](../../../services/account-service/src/main/resources/db/migration/V31__subscription_authority_generation.sql); [V32__realm_grant_currentness.sql](../../../services/account-service/src/main/resources/db/migration/V32__realm_grant_currentness.sql); [V33__fresh_tenant_identity_associations.sql](../../../services/account-service/src/main/resources/db/migration/V33__fresh_tenant_identity_associations.sql); [V34__account_membership_pair_authority.sql](../../../services/account-service/src/main/resources/db/migration/V34__account_membership_pair_authority.sql); [V35__canonical_uuid_membership_identity.sql](../../../services/account-service/src/main/resources/db/migration/V35__canonical_uuid_membership_identity.sql); [V36__account_auth_authority_generations.sql](../../../services/account-service/src/main/resources/db/migration/V36__account_auth_authority_generations.sql); [V37__canonical_first_join_scope_and_intent.sql](../../../services/account-service/src/main/resources/db/migration/V37__canonical_first_join_scope_and_intent.sql); [V38__account_first_join_authority_outbox_and_roles.sql](../../../services/account-service/src/main/resources/db/migration/V38__account_first_join_authority_outbox_and_roles.sql); [V39__canonical_first_join_terminal_receipt.sql](../../../services/account-service/src/main/resources/db/migration/V39__canonical_first_join_terminal_receipt.sql); [V40__account_authority_source_baselines.sql](../../../services/account-service/src/main/resources/db/migration/V40__account_authority_source_baselines.sql); [V53__account_protected_demo_entitlements.sql](../../../services/account-service/src/main/resources/db/migration/V53__account_protected_demo_entitlements.sql); [V73__account_tenant_authority_source_bridge.sql](../../../services/account-service/src/main/resources/db/migration/V73__account_tenant_authority_source_bridge.sql) | [AccountServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountServiceImplTest.java); [AccountRepositoryIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountRepositoryIntegrationTest.java); [AccountGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountGrpcServiceTest.java); [AccountAuditDeliveryJobTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/AccountAuditDeliveryJobTest.java); [AuthControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/AuthControllerTest.java); [ExpiredConnectScopeCleanupJobTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/ExpiredConnectScopeCleanupJobTest.java); [AccountAuditOutboxRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountAuditOutboxRepositoryTest.java); [AccountJoinDigestTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/dto/AccountJoinDigestTest.java); [AccountAuthoritySourceEvidencePersistenceIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidencePersistenceIntegrationTest.java); [AccountDemoTenantEntitlementPersistenceIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountDemoTenantEntitlementPersistenceIntegrationTest.java); [AccountCanonicalFirstJoinEventIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/AccountCanonicalFirstJoinEventIntegrationTest.java); [AccountCanonicalFirstJoinTerminalCoordinatorTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/AccountCanonicalFirstJoinTerminalCoordinatorTest.java); [AccountMembershipAuthorityEventProducerCanonicalJoinTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/AccountMembershipAuthorityEventProducerCanonicalJoinTest.java); [AccountAuthorityGenerationRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepositoryTest.java); [AccountTenantAuthorityEventRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountTenantAuthorityEventRepositoryTest.java); [AccountActorStagingEligibilityServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/AccountActorStagingEligibilityServiceTest.java); [AccountActorStagingEligibilityGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountActorStagingEligibilityGrpcServiceTest.java) | [Realm Routing](./realm-routing-and-playable-state.md); [Shared Runtime](./shared-runtime-contracts-and-persistence.md) | Membership and Account-owned realm-grant records/readers are separate. `AccountTenantAuthorityEventRepository` appends the canonical tenant authority event during demo entitlement provisioning; `AccountMembershipAuthorityEventProducer` emits the first-JOIN membership event with its billing cutoff taken from that current tenant authority event, covered by [AccountCanonicalFirstJoinEventIntegrationTest](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/AccountCanonicalFirstJoinEventIntegrationTest.java); no entitlement caller wires it, and current PostgreSQL proof remains pending because the integration source compiled but was unrun locally. On fresh connect-token issuance/cache misses, issuance revalidates pointer/visibility/membership inputs, while cached-success replay returns before those fresh reads; current-authority and postcondition revalidation remain unproved. Current explicit `JoinPublicProductionMembership` validates a server-issued scope and caller binding, re-reads Game Session routing/catalog/pointer evidence before the Account transaction, and binds a v1 digest to verified caller/scope inputs; it does not guarantee that the exact target/catalog/pointer remains valid through Account commit. The strict ADR 0025 commit gate remains incomplete, and no durable Game Session-owned target fence is implemented or proved; transaction duration or timing thresholds alone would not prove it. The subscription authority query's `FOR UPDATE` locks only the subscription row, not its joined billing-owner Account; JOIN also locks the caller Account and operation record. Terminal-operation replay performs remote scope/target/entitlement checks outside its lock-holding transaction. Pending JOINs continue to receive fresh remote reads, while the Account transaction retains atomic membership, operation-outcome, and audit-outbox persistence. Focused unit proof verifies terminal replay revalidation occurs after commit or rollback without rewriting the stored outcome; the PostgreSQL row-lock regression compiles but skips locally without Docker. PostgreSQL runtime proof and direct text-client end-to-end proof are unclaimed. Global-only registration no longer creates an admitting membership. Expired unreferenced connect-scope rows are swept under their existing expiry; V27's restrictive scope FK preserves every scope referenced by a PENDING or terminal JOIN and fences racing intent inserts. JOIN recovery/reconciliation after an unknown database commit outcome remains a separate #2848 gap under the Overseer decision; do not mark ADR 0025 complete. The Gateway continues to block public JOIN exposure, and Game Session text JOIN/Join & Play dispatch remains #2898. `AccountActorStagingEligibilityGrpcService` is a read-only internal eligibility check disabled by default; it does not establish that a realm is public or preseeded and grants no gameplay admission. Membership authority generation in runtime admission, issuance grant validation, cached-success freshness/postcondition revalidation, and the target five-field grant codec with cross-service producer/consumer and admission-propagation proof remain incomplete. Current non-public discovery and text `PLAY` require admitting membership before the applicable realm grant; connect-token issuance does not yet validate that grant. Transactional outboxes beyond the implemented registration/JOIN audit records, monotonic versioning, rate limits, tenant-scoped roles, and delegated management remain target gaps; see the [canonical Redis grant codec](../../architecture/system-architecture-redis.md#canonical-grant-authority-stream-scope-codec) and [identifier glossary](../../architecture/system-architecture-identifier-glossary.md#non-public-grant-identity). |
-| `AA-1.3` Authentication, recovery, security policy, and account data rights | `partial` | `drift-found` | [Authentication and authorization](../../architecture/system-architecture-authentication.md); [Security](../../architecture/system-architecture-security.md); [Account runtime and data](../../architecture/microservices/account-service/runtime-and-data.md); [Moderation Policies](../../architecture/microservices/logging-admin-service/moderation-policies.md); [Session behavior](../../architecture/system-architecture-session-behavior.md); [ADR 0034](../../architecture/decisions/adr-0034-layered-abuse-controls-without-attacker-triggered-account-locks.md); [ADR 0035](../../architecture/decisions/adr-0035-single-record-issued-token-registry.md); [ADR 0141](../../architecture/decisions/adr-0141-fixed-safety-restriction-categories-and-independent-lifecycles.md); [ADR 0142](../../architecture/decisions/adr-0142-bounded-moderation-appeal-cases.md) | [AuthController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AuthController.java); [AccountController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AccountController.java); [AccountServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountServiceImpl.java); [SessionServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/SessionServiceImpl.java); [JwksController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/JwksController.java); [AccountAuthorityGenerationRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepository.java); [AccountAuthoritySourceEvidenceRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidenceRepository.java); [AccountJwtSignerDesiredStateRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountJwtSignerDesiredStateRepository.java); [AccountJwtReadinessProbeRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountJwtReadinessProbeRepository.java); [AccountControlUiIssuanceService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuanceService.java); [AccountStartSessionOperatorAuthorizationService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountStartSessionOperatorAuthorizationService.java); [AccountJwtSignerMaterializationService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountJwtSignerMaterializationService.java); [application-prod.yml](../../../services/account-service/src/main/resources/application-prod.yml); [V36__account_auth_authority_generations.sql](../../../services/account-service/src/main/resources/db/migration/V36__account_auth_authority_generations.sql); [V40__account_authority_source_baselines.sql](../../../services/account-service/src/main/resources/db/migration/V40__account_authority_source_baselines.sql); [V77 reset receipts](../../../services/account-service/src/main/resources/db/migration/V77__account_password_reset_operation_receipts.sql); [V89 pending reset intent](../../../services/account-service/src/main/resources/db/migration/V89__account_password_reset_pending_draft_source_changes.sql); [V99__account_jwt_signer_desired_state.sql](../../../services/account-service/src/main/resources/db/migration/V99__account_jwt_signer_desired_state.sql); [V123__account_jwt_readiness_per_pod_closure.sql](../../../services/account-service/src/main/resources/db/migration/V123__account_jwt_readiness_per_pod_closure.sql); [V125__account_jwt_signer_promotion_receipt_binding.sql](../../../services/account-service/src/main/resources/db/migration/V125__account_jwt_signer_promotion_receipt_binding.sql); [V126](../../../services/account-service/src/main/resources/db/migration/V126__start_session_operator_authorization.sql); [V126.1](../../../services/account-service/src/main/resources/db/migration/V126.1__start_session_operator_response_envelope_erasure.sql); [V126.2](../../../services/account-service/src/main/resources/db/migration/V126.2__account_control_ui_registry_cleanup_deadline.sql); [V126.3](../../../services/account-service/src/main/resources/db/migration/V126.3__start_session_response_envelope_bounds.sql) | [AuthControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/AuthControllerTest.java); [AccountServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountServiceImplTest.java); [JwksControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/JwksControllerTest.java); [AuthTokenInterceptorTest.java](../../../services/common-security/src/test/java/unit/net/firedevops/firemud/common/security/AuthTokenInterceptorTest.java); [AccountAuthorityGenerationRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepositoryTest.java); [AccountAuthoritySourceEvidencePersistenceIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidencePersistenceIntegrationTest.java); [PasswordResetAuthorityProducerPostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/PasswordResetAuthorityProducerPostgresIntegrationTest.java); [AccountPasswordResetOperationRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountPasswordResetOperationRepositoryTest.java); [AccountJwtSignerStoragePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountJwtSignerStoragePostgresIntegrationTest.java); [AccountJwtReadinessStoragePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountJwtReadinessStoragePostgresIntegrationTest.java); [AccountStartSessionOperatorAuthorizationRepositoryIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountStartSessionOperatorAuthorizationRepositoryIntegrationTest.java); [AccountControlUiIssuancePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuancePostgresIntegrationTest.java); [AccountStartSessionOperatorAuthorizationConfigurationTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/config/AccountStartSessionOperatorAuthorizationConfigurationTest.java); [AccountJwtJwksTrustedSourceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountJwtJwksTrustedSourceTest.java); [AccountStartSessionOperatorAuthorizationServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountStartSessionOperatorAuthorizationServiceTest.java); [StartSessionOperatorAuthorizationGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/StartSessionOperatorAuthorizationGrpcServiceTest.java); [AccountJwtSignerMaterializationServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountJwtSignerMaterializationServiceTest.java) | [Shared Runtime](./shared-runtime-contracts-and-persistence.md); [Platform Operations](./platform-operations-and-delivery.md) | Public password-reset, username-recovery, and email-verification initiation use normalized email selectors and return the same neutral HTTP success for known and unknown addresses, including when known-account post-commit SMTP errors are caught and logged; unknown addresses create no token or delivery attempt. However, SMTP delivery remains synchronous after commit and is a timing oracle; durable asynchronous delivery is absent, and focused service tests prove exception containment only, not timing resistance or durable delivery. Public verification accepts no numeric account selector. The login-factor `PUT` now fails closed with `501 NOT_IMPLEMENTED` because Account has no recent ordinary reauthentication evidence mechanism; implementing that Account-owned proof and enabling the mutation remain open under ADR 0045. The current Account restriction slice adds a closed restriction event variant, V137 immutable revision/current-result receipts, exact SQL source-head dispatch, and protective-category lifecycle sync; the owner mutation stays default-denied because no authoritative policy/intent and authenticated-caller proof receiver exists. V81 (source V88) `NONRESTRICTED` birth results remain historical predecessor evidence, not current absence; focused consolidated migration/readback proof is pending, so no authorized admission or end-to-end enforcement is claimed. Separate complete bounded moderation appeal handoff, `/auth/logout` and `/auth/logout-all` revocation authority, TOTP, trusted source context, Account-owned graduated login throttles, and fail-closed limiter-outage behavior remain absent. Current token issuance still writes scope-duplicated account/tenant keys and downstream validators do not enforce the one-record issued-token registry from ADR 0035. `AUTH_ACCOUNT_LOCKED` remains reserved, while the current Game Session command limiter performs a Redis operation per command contrary to ADR 0034. Current `AccountServiceImpl.deleteAccount` fails closed by rejecting any retained JOIN operation first, then nonterminal subscriptions, and otherwise throwing `ACCOUNT_DELETE_UNAVAILABLE` before any repository deletion; retained-data lifecycle and deletion reconciliation remain unimplemented. Password-reset token consumption and exact source-fenced completion are implemented for Accounts with valid current source evidence; reset-driven revocation, other recovery workflows, and passing physical PostgreSQL proof remain incomplete. Export and JWKS foundations are live. Account signer lifecycle, current readiness, and validator-inventory storage remain passive V99–V125 evidence preparation; focused physical PostgreSQL 18 signer/readiness suites confirm bounded storage proof only with synthetic inventory/resource inputs, not live Kubernetes currentness, readiness activation, or signer activation; signer runtime/currentness remains inactive. V126/V126.1 separately add Account-owned StartSession authorization and signer-materialization source preparation: StartSession composition remains off by default, materializer trust remains off by default and denies every RPC when absent, and missing bootstrap-coordinator composition denies enrollment and promotion. These source adapters do not register a runtime issuer or promotion/consumer coordinator, establish operator lifecycle ownership under AA-1.3, or establish activation. The current AA-1.3 owner-source cut also includes V126.2 cleanup-deadline storage and V126.3 response-envelope size-guard migration. At exact source head `44bbd2a9fff1e1561816e16fd0deb9cc274ae251`, the Control-UI issuance PostgreSQL suite passed 5/5, including retained-V126.2 row preservation and denial; direct PostgreSQL proof that a newly recorded cleanup deadline cannot be changed remains a tracked gap. Bounded cleanup and late revocation remain incomplete. StartSession recovery accepts a 128 KiB authority bundle and 144 KiB binding/response within the 160 KiB envelope ceiling; the exact-head authorization repository suite passed 15/15 and covers fresh-install, ambiguous legacy-guard rejection, the 160 KiB storage edge, and retained maximum-size V126.2 ciphertext through V126.3 migration. This is bounded fixture proof and does not establish complete mTLS flow or runtime activation. |
+| `AA-1.3` Authentication, recovery, security policy, and account data rights | `partial` | `drift-found` | [Authentication and authorization](../../architecture/system-architecture-authentication.md); [Security](../../architecture/system-architecture-security.md); [Account runtime and data](../../architecture/microservices/account-service/runtime-and-data.md); [Moderation Policies](../../architecture/microservices/logging-admin-service/moderation-policies.md); [Session behavior](../../architecture/system-architecture-session-behavior.md); [ADR 0034](../../architecture/decisions/adr-0034-layered-abuse-controls-without-attacker-triggered-account-locks.md); [ADR 0035](../../architecture/decisions/adr-0035-single-record-issued-token-registry.md); [ADR 0141](../../architecture/decisions/adr-0141-fixed-safety-restriction-categories-and-independent-lifecycles.md); [ADR 0142](../../architecture/decisions/adr-0142-bounded-moderation-appeal-cases.md) | [AuthController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AuthController.java); [AccountController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/AccountController.java); [AccountServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountServiceImpl.java); [SessionServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/SessionServiceImpl.java); [JwksController.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/controller/JwksController.java); [AccountAuthorityGenerationRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepository.java); [AccountAuthoritySourceEvidenceRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidenceRepository.java); [AccountJwtSignerDesiredStateRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountJwtSignerDesiredStateRepository.java); [AccountJwtReadinessProbeRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountJwtReadinessProbeRepository.java); [AccountControlUiIssuanceService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuanceService.java); [AccountStartSessionOperatorAuthorizationService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountStartSessionOperatorAuthorizationService.java); [AccountJwtSignerMaterializationService.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountJwtSignerMaterializationService.java); [application-prod.yml](../../../services/account-service/src/main/resources/application-prod.yml); [V36__account_auth_authority_generations.sql](../../../services/account-service/src/main/resources/db/migration/V36__account_auth_authority_generations.sql); [V40__account_authority_source_baselines.sql](../../../services/account-service/src/main/resources/db/migration/V40__account_authority_source_baselines.sql); [V77 reset receipts](../../../services/account-service/src/main/resources/db/migration/V77__account_password_reset_operation_receipts.sql); [V89 pending reset intent](../../../services/account-service/src/main/resources/db/migration/V89__account_password_reset_pending_draft_source_changes.sql); [V99__account_jwt_signer_desired_state.sql](../../../services/account-service/src/main/resources/db/migration/V99__account_jwt_signer_desired_state.sql); [V123__account_jwt_readiness_per_pod_closure.sql](../../../services/account-service/src/main/resources/db/migration/V123__account_jwt_readiness_per_pod_closure.sql); [V125__account_jwt_signer_promotion_receipt_binding.sql](../../../services/account-service/src/main/resources/db/migration/V125__account_jwt_signer_promotion_receipt_binding.sql); [V126](../../../services/account-service/src/main/resources/db/migration/V126__start_session_operator_authorization.sql); [V126.1](../../../services/account-service/src/main/resources/db/migration/V126.1__start_session_operator_response_envelope_erasure.sql); [V126.2](../../../services/account-service/src/main/resources/db/migration/V126.2__account_control_ui_registry_cleanup_deadline.sql); [V126.3](../../../services/account-service/src/main/resources/db/migration/V126.3__start_session_response_envelope_bounds.sql); [AccountPasswordResetOperationRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountPasswordResetOperationRepository.java); [AccountPasswordResetDraftSourceChangeRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountPasswordResetDraftSourceChangeRepository.java); [PasswordResetTokenRepository.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/PasswordResetTokenRepository.java) | [AuthControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/AuthControllerTest.java); [AccountServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountServiceImplTest.java); [JwksControllerTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/JwksControllerTest.java); [AuthTokenInterceptorTest.java](../../../services/common-security/src/test/java/unit/net/firedevops/firemud/common/security/AuthTokenInterceptorTest.java); [AccountAuthorityGenerationRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountAuthorityGenerationRepositoryTest.java); [AccountAuthoritySourceEvidencePersistenceIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountAuthoritySourceEvidencePersistenceIntegrationTest.java); [PasswordResetAuthorityProducerPostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/PasswordResetAuthorityProducerPostgresIntegrationTest.java); [AccountPasswordResetOperationRepositoryTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountPasswordResetOperationRepositoryTest.java); [AccountJwtSignerStoragePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountJwtSignerStoragePostgresIntegrationTest.java); [AccountJwtReadinessStoragePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountJwtReadinessStoragePostgresIntegrationTest.java); [AccountStartSessionOperatorAuthorizationRepositoryIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountStartSessionOperatorAuthorizationRepositoryIntegrationTest.java); [AccountControlUiIssuancePostgresIntegrationTest.java](../../../services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountControlUiIssuancePostgresIntegrationTest.java); [AccountStartSessionOperatorAuthorizationConfigurationTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/config/AccountStartSessionOperatorAuthorizationConfigurationTest.java); [AccountJwtJwksTrustedSourceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountJwtJwksTrustedSourceTest.java); [AccountStartSessionOperatorAuthorizationServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountStartSessionOperatorAuthorizationServiceTest.java); [StartSessionOperatorAuthorizationGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/StartSessionOperatorAuthorizationGrpcServiceTest.java); [AccountJwtSignerMaterializationServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountJwtSignerMaterializationServiceTest.java) | [Shared Runtime](./shared-runtime-contracts-and-persistence.md); [Platform Operations](./platform-operations-and-delivery.md) | Public password-reset, username-recovery, and email-verification initiation use normalized email selectors and return the same neutral HTTP success for known and unknown addresses, including when known-account post-commit SMTP errors are caught and logged; unknown addresses create no token or delivery attempt. However, SMTP delivery remains synchronous after commit and is a timing oracle; durable asynchronous delivery is absent, and focused service tests prove exception containment only, not timing resistance or durable delivery. Public verification accepts no numeric account selector. The login-factor `PUT` now fails closed with `501 NOT_IMPLEMENTED` because Account has no recent ordinary reauthentication evidence mechanism; implementing that Account-owned proof and enabling the mutation remain open under ADR 0045. The current Account restriction slice adds a closed restriction event variant, V137 immutable revision/current-result receipts, exact SQL source-head dispatch, and protective-category lifecycle sync; the owner mutation stays default-denied because no authoritative policy/intent and authenticated-caller proof receiver exists. V81 (source V88) `NONRESTRICTED` birth results remain historical predecessor evidence, not current absence; focused consolidated migration/readback proof is pending, so no authorized admission or end-to-end enforcement is claimed. Separate complete bounded moderation appeal handoff, `/auth/logout` and `/auth/logout-all` revocation authority, TOTP, trusted source context, Account-owned graduated login throttles, and fail-closed limiter-outage behavior remain absent. Current token issuance still writes scope-duplicated account/tenant keys and downstream validators do not enforce the one-record issued-token registry from ADR 0035. `AUTH_ACCOUNT_LOCKED` remains reserved, while the current Game Session command limiter performs a Redis operation per command contrary to ADR 0034. Current `AccountServiceImpl.deleteAccount` fails closed by rejecting any retained JOIN operation first, then nonterminal subscriptions, and otherwise throwing `ACCOUNT_DELETE_UNAVAILABLE` before any repository deletion; retained-data lifecycle and deletion reconciliation remain unimplemented. Password-reset token consumption and exact source-fenced completion are implemented for Accounts with valid current source evidence; reset-driven revocation, other recovery workflows, and passing physical PostgreSQL proof remain incomplete. Export and JWKS foundations are live. Account signer lifecycle, current readiness, and validator-inventory storage remain passive V99–V125 evidence preparation; focused physical PostgreSQL 18 signer/readiness suites confirm bounded storage proof only with synthetic inventory/resource inputs, not live Kubernetes currentness, readiness activation, or signer activation; signer runtime/currentness remains inactive. V126/V126.1 separately add Account-owned StartSession authorization and signer-materialization source preparation: StartSession composition remains off by default, materializer trust remains off by default and denies every RPC when absent, and missing bootstrap-coordinator composition denies enrollment and promotion. These source adapters do not register a runtime issuer or promotion/consumer coordinator, establish operator lifecycle ownership under AA-1.3, or establish activation. The current AA-1.3 owner-source cut also includes V126.2 cleanup-deadline storage and V126.3 response-envelope size-guard migration. At exact source head `44bbd2a9fff1e1561816e16fd0deb9cc274ae251`, the Control-UI issuance PostgreSQL suite passed 5/5, including retained-V126.2 row preservation and denial; direct PostgreSQL proof that a newly recorded cleanup deadline cannot be changed remains a tracked gap. Bounded cleanup and late revocation remain incomplete. StartSession recovery accepts a 128 KiB authority bundle and 144 KiB binding/response within the 160 KiB envelope ceiling; the exact-head authorization repository suite passed 15/15 and covers fresh-install, ambiguous legacy-guard rejection, the 160 KiB storage edge, and retained maximum-size V126.2 ciphertext through V126.3 migration. This is bounded fixture proof and does not establish complete mTLS flow or runtime activation. |
| `AA-1.4` Commerce, subscriptions, purchases, donations, and platform fees | `partial` | `audited` | [Subscription management](../../architecture/microservices/account-service/subscription-management.md); [Stripe integration](../../architecture/microservices/account-service/stripe-integration.md); [Account runtime/data](../../architecture/microservices/account-service/runtime-and-data.md); [ADR 0143](../../architecture/decisions/adr-0143-stripe-v1-hosting-billing-and-deferred-creator-monetization.md) | [PaymentServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/PaymentServiceImpl.java); [PurchaseWorkflowServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/PurchaseWorkflowServiceImpl.java); [PaymentTransaction.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/PaymentTransaction.java); [Subscription.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/Subscription.java); [payment_service.proto](../../../protos/account/v1/payment_service.proto); [V2__payment_tables.sql](../../../services/account-service/src/main/resources/db/migration/V2__payment_tables.sql); [application.yml](../../../services/account-service/src/main/resources/application.yml) | [PaymentServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/PaymentServiceImplTest.java); [PaymentGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/PaymentGrpcServiceTest.java); [PurchaseWorkflowServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/PurchaseWorkflowServiceImplTest.java) | [Shared Runtime](./shared-runtime-contracts-and-persistence.md) | Incomplete subscription creation now fails closed before mutation instead of persisting a caller-selected locally active entitlement row. The target caller-bound billing-owner, stable request/digest, instrument, outbox, provider lifecycle/reconciliation, billing-safe owner transfer/deletion guards, and complete subscription-to-entitlement follow-through remain absent. Before first subscription creation can be enabled, Account must define the authoritative initial billing-owner source and consent/assignment workflow with a version/generation fence; no such source is selected, and caller-supplied account ID, tenant role, Creator Party, or payment-instrument ownership must not be inferred as that authority. The generic `CreatePaymentIntent`, `CreateDonation`, and `RefundPayment` RPCs fail closed with `FAILED_PRECONDITION` before `PaymentService` or provider invocation; the generic service/provider substrate remains unsupported. Creator/player purchases, donations, fees/shares, payouts, and settlement are deferred and not supported by current code. |
| `AA-1.5` Entitlements, quotas, and hosting eligibility | `partial` | `drift-found` | [Subscription management](../../architecture/microservices/account-service/subscription-management.md); [Multi-tenancy](../../architecture/system-architecture-multi-tenancy.md); [Versioning and runtime](../../architecture/system-architecture-versioning-runtime.md); [ADR 0028](../../architecture/decisions/adr-0028-differentiated-entitlement-freshness.md) | [AccountServiceImpl.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/impl/AccountServiceImpl.java); [RuntimeEntitlementsDto.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/RuntimeEntitlementsDto.java); [Subscription.java](../../../services/account-service/src/main/java/net/firedevops/firemud/accountservice/entity/Subscription.java); [account_service.proto](../../../protos/account/v1/account_service.proto); [application.yml](../../../services/account-service/src/main/resources/application.yml) | [AccountServiceImplTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountServiceImplTest.java); [AccountGrpcServiceTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/impl/AccountGrpcServiceTest.java); [PublicBootstrapRoutesProdProfileTest.java](../../../services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/controller/PublicBootstrapRoutesProdProfileTest.java) | [Realm Routing](./realm-routing-and-playable-state.md); [Game Authoring](./game-authoring-publishing-and-activation.md) | The producer returns retryable `ENTITLEMENT_UNAVAILABLE` for zero or multiple tenant subscription rows and projects status only from exactly one explicit row; gRPC carries the unavailable outcome in its error field and HTTP bootstrap routes map it to 503. Focused Account proofs cover zero rows, conflicting active/canceled rows, gRPC classification, and connect-token retry after recovery without caching an unavailable receipt. Explicit free/trial row creation and authoritative current-row selection/constraint/history remain absent. The runtime response still lacks committed status and the full explicit entitlement/freshness evidence; its row-ID-derived version/sequence and newly stamped evaluation time, quotas, real sequencing/source freshness, caching/events, strict new-commitment enforcement, five-minute continuity, and instance lifecycle enforcement remain open. The target handoff between fresh connect-token reissuance and eligible exact-binding entitlement-only reconnect continuity is unresolved: token expiry can block that continuity before Account's resume lease, and no fallback reissuance path is authorized pending owner decision. Current `past_due` handling remains gameplay-available and public-join-eligible only when the sole explicit row is `past_due`. |
| `AA-2.1` Gameplay login, character selection, and session binding | `partial` | `drift-found` | [Authentication and authorization](../../architecture/system-architecture-authentication.md); [Session behavior](../../architecture/system-architecture-session-behavior.md); [ADR 0021](../../architecture/decisions/adr-0021-staged-player-authentication-and-gameplay-binding.md); [ADR 0122](../../architecture/decisions/adr-0122-stable-playable-state-namespaces-for-runtime-replacement.md); [ADR 0132](../../architecture/decisions/adr-0132-namespace-scoped-single-character-controller.md); [ADR 0140](../../architecture/decisions/adr-0140-realm-authored-controllable-actor-entry.md) | [SessionAuthenticationService.java](../../../services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/SessionAuthenticationService.java); [PlayCommandHandler.java](../../../services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/command/text/PlayCommandHandler.java); [CanonicalGameplayMigrationDriverMain.java](../../../services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverMain.java); [CanonicalGameplayMigrationDriverProtocol.java](../../../services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverProtocol.java); [CanonicalGameplayMigrationDriverLauncher.java](../../../services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverLauncher.java); [game-session-service build](../../../services/game-session-service/build.gradle.kts) | [SessionResumptionFlowTest.java](../../../services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/command/text/SessionResumptionFlowTest.java); [CanonicalGameplayMigrationDriverMainTest.java](../../../services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverMainTest.java); [CanonicalGameplayMigrationDriverProtocolTest.java](../../../services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverProtocolTest.java); [CanonicalGameplayMigrationDriverStdoutTest.java](../../../services/game-session-service/src/test/java/net/firedevops/firemud/gamesession/repository/CanonicalGameplayMigrationDriverStdoutTest.java); [migration-driver image contract](../../../dev-tools/tests/game-session-migration-driver-image-contract.sh); [V34.3 PostgreSQL fixture](../../../services/game-session-service/src/test/java/integration/net/firedevops/firemud/gamesession/repository/CanonicalGameplayInitialAdmissionIntentRequestIdMigrationIntegrationTest.java) | [Realm Routing](./realm-routing-and-playable-state.md); [Player Experience](./player-experience-commands-and-communication.md) | Gameplay admission and binding remain partial. Exact-head execution scope and fixture results, including the V34.3 fixture pass, are recorded in the [consolidated proof record](#consolidated-exact-head-and-historical-proof). This verifies the tested migration fixture, not namespace-aware atomic takeover: that remains incomplete, as do issuer-index and region reconciliation and retained-binding inventory/conversion. Final immutable image build and authority, trusted bootstrap/execution, and live playable proof remain unproved. Current text `PLAY` checks membership and entitlement before persisted actor selection, but fresh connect-token issuance does not validate the applicable non-public realm grant; final Account admission and complete private/playtest grant and entitlement authority remain open under [Game Session admission](../../architecture/microservices/game-session-service/api-contracts.md#world-lifecycle-and-admission-boundary). Synthetic actor fallback, descriptor/template resolution, and fork-local identity proof remain gaps under [ADR 0140](../../architecture/decisions/adr-0140-realm-authored-controllable-actor-entry.md) and the [Game Session persisted-actor boundary](../../architecture/microservices/game-session-service/runtime-and-data.md#persisted-actor-admission-boundary). Deployment/mTLS and fresh-image proof for gameplay admission remain incomplete; gameplay completion under #2967/#2898 remains open. |
diff --git a/dev-tools/tests/compose-grpc-mtls-contract.sh b/dev-tools/tests/compose-grpc-mtls-contract.sh
index d05c79c135..7adbef898c 100644
--- a/dev-tools/tests/compose-grpc-mtls-contract.sh
+++ b/dev-tools/tests/compose-grpc-mtls-contract.sh
@@ -296,7 +296,12 @@ import re
import sys
lines = pathlib.Path(sys.argv[1]).read_text(encoding="utf-8").splitlines()
-for service in ("entity-management-service", "game-design-service", "world-management-service", "game-session-service"):
+for service in (
+ "entity-management-service",
+ "world-management-service",
+ "game-session-service",
+ "game-design-service",
+):
headers = [index for index, line in enumerate(lines) if line == f" {service}:"]
assert len(headers) == 1, service
start = headers[0]
diff --git a/dev-tools/validation/test_design_capability_allocation.py b/dev-tools/validation/test_design_capability_allocation.py
index dff95b88fa..61180fdd9c 100644
--- a/dev-tools/validation/test_design_capability_allocation.py
+++ b/dev-tools/validation/test_design_capability_allocation.py
@@ -251,6 +251,22 @@ def test_microservice_primary_drift(self) -> None:
"unexpected primary capability",
)
+ def test_start_session_action_schema_appendix_allocation(self) -> None:
+ self.assertEqual(
+ self.validator.expected_microservice_allocation(
+ "design/architecture/microservices/game-session-service/start-session-action-schema.md"
+ ),
+ ("AR-3", "Operator action schema"),
+ )
+
+ def test_character_create_action_schema_appendix_allocation(self) -> None:
+ self.assertEqual(
+ self.validator.expected_microservice_allocation(
+ "design/architecture/microservices/entity-management-service/character-create-action-schema.md"
+ ),
+ ("GR-3", "Character-creation action schema"),
+ )
+
def test_adr_primary_allocation_drift_with_adjusted_counts(self) -> None:
with fixture_root() as directory:
root = Path(directory)
diff --git a/protos/game-session/v1/game_session_service.proto b/protos/game-session/v1/game_session_service.proto
index 36af762c63..010eec9f8a 100644
--- a/protos/game-session/v1/game_session_service.proto
+++ b/protos/game-session/v1/game_session_service.proto
@@ -13,6 +13,8 @@ option java_multiple_files = true;
service GameSessionService {
rpc Ping(PingRequest) returns (PingResponse);
rpc StartSession(StartSessionRequest) returns (StartSessionResponse);
+ rpc AuthorizeStartSession(AuthorizeStartSessionRequest)
+ returns (AuthorizeStartSessionResponse);
rpc StopSession(StopSessionRequest) returns (StopSessionResponse);
rpc RestartSession(RestartSessionRequest) returns (RestartSessionResponse);
rpc EnqueueCommand(EnqueueCommandRequest) returns (EnqueueCommandResponse);
@@ -109,6 +111,32 @@ message StartSessionResponse {
shared.v1.ErrorDetail error = 2;
}
+// Typed non-activating operator handoff. This transport only records Account redemption progress;
+// it does not create or start a game instance and does not return a session identifier.
+message AuthorizeStartSessionRequest {
+ bytes canonical_post_authorization_execution_tuple_bytes = 1;
+ string operator_authorization_reference = 2;
+}
+
+enum StartSessionOwnerAuthorizationProgress {
+ START_SESSION_OWNER_AUTHORIZATION_PROGRESS_UNSPECIFIED = 0;
+ START_SESSION_OWNER_AUTHORIZATION_PROGRESS_EXACT_REPLAY = 1;
+ START_SESSION_OWNER_AUTHORIZATION_PROGRESS_ACCOUNT_OUTCOME_AMBIGUOUS = 2;
+ START_SESSION_OWNER_AUTHORIZATION_PROGRESS_ACCOUNT_PROJECTION_ATTACHED = 3;
+}
+
+message AuthorizeStartSessionResponse {
+ string target_namespace = 1;
+ string control_plane_request_id = 2;
+ string mutation_digest = 3;
+ string owner_attempt_id = 4;
+ string owner_mutation_id = 5;
+ int64 owner_fence = 6;
+ string owner_phase_state = 7;
+ StartSessionOwnerAuthorizationProgress progress = 8;
+ shared.v1.ErrorDetail error = 9;
+}
+
message StopSessionRequest {
string session_id = 1;
}
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionLeaseOperation.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionLeaseOperation.java
new file mode 100644
index 0000000000..11805e3eef
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionLeaseOperation.java
@@ -0,0 +1,47 @@
+package net.firedevops.firemud.accountservice.dto;
+
+import java.util.Objects;
+import java.util.UUID;
+import net.firedevops.firemud.common.account.admission.AccountGameplayAdmissionLeaseEvidence;
+
+/** Durable Account storage readback only; even COMMITTED is not authenticated admission proof. */
+public record AccountGameplayAdmissionLeaseOperation(
+ AccountGameplayAdmissionLeaseEvidence evidence,
+ State state,
+ UUID bindingDecisionId,
+ UUID orphanCleanupId) {
+ public AccountGameplayAdmissionLeaseOperation {
+ Objects.requireNonNull(evidence);
+ Objects.requireNonNull(state);
+ if ((bindingDecisionId != null
+ && (bindingDecisionId.version() != 4 || bindingDecisionId.variant() != 2))
+ || (orphanCleanupId != null
+ && (orphanCleanupId.version() != 4 || orphanCleanupId.variant() != 2))) {
+ throw new IllegalArgumentException("Canonical non-nil UUIDv4 terminal identity required");
+ }
+ if ((state == State.PENDING && (bindingDecisionId != null || orphanCleanupId != null))
+ || (state == State.COMMITTED && (bindingDecisionId == null || orphanCleanupId != null))
+ || (state == State.ABORTED && orphanCleanupId == null)) {
+ throw new IllegalArgumentException("Incomplete admission operation storage state");
+ }
+ }
+
+ public enum State {
+ PENDING,
+ COMMITTED,
+ ABORTED
+ }
+
+ /**
+ * ABORTED retains exact binding/token evidence as pending work, never completed cleanup. A null
+ * decision is unknown or unobserved, never authoritative proof that no decision exists.
+ */
+ public boolean hasPendingOrphanCleanup() {
+ return state == State.ABORTED;
+ }
+
+ @Override
+ public String toString() {
+ return "AccountGameplayAdmissionLeaseOperation[state=" + state + "]";
+ }
+}
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionOriginalAckReceipt.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionOriginalAckReceipt.java
new file mode 100644
index 0000000000..70dc704b18
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayAdmissionOriginalAckReceipt.java
@@ -0,0 +1,97 @@
+package net.firedevops.firemud.accountservice.dto;
+
+import java.math.BigInteger;
+import java.util.Objects;
+import java.util.UUID;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionLeaseOperation.State;
+
+/**
+ * Immutable storage readback of a trusted-JVM original COMMIT acknowledgement.
+ *
+ *
{@code committedBeforeMs} is opaque in-process capability evidence produced after the original
+ * physical COMMIT. SQL checks its shape and exact operation binding; SQL does not derive,
+ * authenticate, or independently prove that clock value. This receipt grants no current authority,
+ * Game Session installation, cleanup, or gameplay admission.
+ */
+public record AccountGameplayAdmissionOriginalAckReceipt(
+ AccountGameplayAdmissionLeaseOperation operation,
+ short schemaVersion,
+ UUID requestId,
+ UUID accountId,
+ UUID leaseId,
+ long leaseFence,
+ String evidenceSha256,
+ UUID bindingDecisionId,
+ long expiresAtMs,
+ String finalizationXid,
+ long committedBeforeMs,
+ String receiptXid) {
+ private static final BigInteger UINT64_MAX =
+ BigInteger.ONE.shiftLeft(64).subtract(BigInteger.ONE);
+
+ public AccountGameplayAdmissionOriginalAckReceipt {
+ Objects.requireNonNull(operation, "original committed lease operation is required");
+ Objects.requireNonNull(requestId, "request ID is required");
+ Objects.requireNonNull(accountId, "Account ID is required");
+ Objects.requireNonNull(leaseId, "lease ID is required");
+ Objects.requireNonNull(evidenceSha256, "evidence digest is required");
+ Objects.requireNonNull(bindingDecisionId, "binding decision ID is required");
+ Objects.requireNonNull(finalizationXid, "finalization transaction ID is required");
+ Objects.requireNonNull(receiptXid, "receipt transaction ID is required");
+
+ var evidence = operation.evidence();
+ var carrier = evidence.carrier();
+ var scope = (java.util.Map, ?>) carrier.get("bindingScope");
+ UUID expectedRequest = UUID.fromString((String) carrier.get("requestId"));
+ UUID expectedLease = UUID.fromString((String) carrier.get("leaseId"));
+ UUID expectedAccount = UUID.fromString((String) scope.get("accountId"));
+ long expectedFence = evidence.leaseFence().longValueExact();
+ long expectedExpiry = Long.parseLong((String) carrier.get("expiresAt"));
+
+ if (operation.state() != State.COMMITTED
+ || operation.bindingDecisionId() == null
+ || schemaVersion != 1
+ || !requestId.equals(expectedRequest)
+ || !accountId.equals(expectedAccount)
+ || !leaseId.equals(expectedLease)
+ || leaseFence <= 0L
+ || leaseFence != expectedFence
+ || !evidenceSha256.matches("[0-9a-f]{64}")
+ || !evidenceSha256.equals(evidence.sha256())
+ || !bindingDecisionId.equals(operation.bindingDecisionId())
+ || expiresAtMs <= 0L
+ || expiresAtMs != expectedExpiry
+ || committedBeforeMs <= 0L
+ || committedBeforeMs >= expiresAtMs) {
+ throw invalid();
+ }
+
+ requireCanonicalFullXid(finalizationXid);
+ requireCanonicalFullXid(receiptXid);
+ if (finalizationXid.equals(receiptXid)) throw invalid();
+ }
+
+ private static void requireCanonicalFullXid(String value) {
+ if (value.isEmpty() || !value.matches("[1-9][0-9]*")) throw invalid();
+ try {
+ BigInteger xid = new BigInteger(value);
+ if (xid.signum() <= 0 || xid.compareTo(UINT64_MAX) > 0) throw invalid();
+ } catch (NumberFormatException failure) {
+ throw invalid();
+ }
+ }
+
+ private static IllegalArgumentException invalid() {
+ return new IllegalArgumentException(
+ "Invalid original Account admission acknowledgement receipt");
+ }
+
+ @Override
+ public String toString() {
+ return "AccountGameplayAdmissionOriginalAckReceipt[requestId="
+ + requestId
+ + ", schemaVersion="
+ + schemaVersion
+ + "]";
+ }
+}
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionLeaseRepository.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionLeaseRepository.java
new file mode 100644
index 0000000000..72d774ff1c
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionLeaseRepository.java
@@ -0,0 +1,320 @@
+package net.firedevops.firemud.accountservice.repository;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.sql.Connection;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.UUID;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionLeaseOperation;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionLeaseOperation.State;
+import net.firedevops.firemud.common.account.admission.AccountGameplayAdmissionLeaseEvidence;
+import org.jooq.DSLContext;
+import org.jooq.Record;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+/**
+ * Unregistered, non-admitting Account-owned storage foundation. No production caller exists.
+ *
+ *
Owner-internal seams require a writable SERIALIZABLE Account transaction and lock Account
+ * before allocation or operation rows. They compare storage identity, not current lifecycle,
+ * billing, security, source checkpoints or authenticated workload. An eventual authenticated owner
+ * must compose every current predicate before using these seams. COMMITTED here records a decision
+ * identity only; it is never source authorization or a public finalization result.
+ *
+ *
SQL statement time guards expiry; this does not prove expiry at physical transaction COMMIT.
+ * ABORTED atomically retains the original full lease and exact orphan decision as pending cleanup;
+ * Account neither deletes Game Session state nor claims token retirement or cleanup delivery.
+ */
+public final class AccountGameplayAdmissionLeaseRepository {
+ private static final String OPERATIONS = "account_gameplay_admission_lease_operations";
+ private final DSLContext dsl;
+
+ @SuppressFBWarnings(
+ value = "EI_EXPOSE_REP2",
+ justification = "Private injected persistence context; the repository never exposes it")
+ public AccountGameplayAdmissionLeaseRepository(DSLContext dsl) {
+ this.dsl = Objects.requireNonNull(dsl);
+ }
+
+ /** Fence domain is independent of issuance/token fences; retries retain the first allocation. */
+ Allocation allocate(UUID accountId, UUID requestId, UUID leaseId) {
+ lockAccount(accountId);
+ requireUuidV4(requestId);
+ requireUuidV4(leaseId);
+ Record existing =
+ dsl.fetchOne(
+ "SELECT * FROM account_gameplay_admission_lease_allocations WHERE request_id = ?",
+ requestId);
+ if (existing != null) {
+ Allocation prior = allocation(existing);
+ if (!prior.accountId().equals(accountId)
+ || !prior.requestId().equals(requestId)
+ || !prior.leaseId().equals(leaseId)) throw conflict();
+ return prior;
+ }
+ dsl.execute(
+ "INSERT INTO account_gameplay_admission_lease_fences(account_uuid, last_fence) VALUES (?, 1) "
+ + "ON CONFLICT (account_uuid) DO UPDATE SET last_fence = "
+ + "account_gameplay_admission_lease_fences.last_fence + 1",
+ accountId);
+ Record counter =
+ dsl.fetchOne(
+ "SELECT last_fence FROM account_gameplay_admission_lease_fences WHERE account_uuid = ?",
+ accountId);
+ if (counter == null) {
+ throw new IllegalStateException("Account admission lease counter readback unavailable");
+ }
+ Long fence = counter.get("last_fence", Long.class);
+ if (fence == null || fence <= 0L) {
+ throw new IllegalStateException("Account admission lease counter readback invalid");
+ }
+ int inserted =
+ dsl.execute(
+ "INSERT INTO account_gameplay_admission_lease_allocations "
+ + "(account_uuid, request_id, lease_id, lease_fence) VALUES (?, ?, ?, ?)",
+ accountId,
+ requestId,
+ leaseId,
+ fence);
+ if (inserted != 1) {
+ throw new IllegalStateException("Account admission lease allocation insert unavailable");
+ }
+ Allocation expected = new Allocation(accountId, requestId, leaseId, fence);
+ Record readback =
+ dsl.fetchOne(
+ "SELECT * FROM account_gameplay_admission_lease_allocations WHERE request_id = ?",
+ requestId);
+ if (readback == null) {
+ throw new IllegalStateException("Account admission lease allocation readback unavailable");
+ }
+ Allocation stored = allocation(readback);
+ if (!expected.equals(stored)) throw conflict();
+ return stored;
+ }
+
+ /**
+ * Recovers the original allocation after a lost response using only the original request. An
+ * empty result is storage absence only, never authoritative absence or no-token proof.
+ */
+ Optional findAllocation(UUID accountId, UUID requestId) {
+ lockAccount(accountId);
+ requireUuidV4(requestId);
+ Record row =
+ dsl.fetchOne(
+ "SELECT * FROM account_gameplay_admission_lease_allocations WHERE request_id = ?",
+ requestId);
+ if (row == null) return Optional.empty();
+ Allocation stored = allocation(row);
+ if (!accountId.equals(stored.accountId()) || !requestId.equals(stored.requestId()))
+ throw conflict();
+ return Optional.of(stored);
+ }
+
+ /**
+ * Recovers validated original operation storage after a lost response. Workload equality is
+ * storage correlation only. An eventual facade must supply its concretely verified peer and
+ * compare current authorization and immutable client inputs before any externally usable retry.
+ * Empty storage is never admission, authoritative absence or no-token evidence.
+ */
+ Optional findByRequest(
+ UUID accountId, UUID requestId, String expectedCallerWorkload) {
+ lockAccount(accountId);
+ requireUuidV4(requestId);
+ if (expectedCallerWorkload == null || expectedCallerWorkload.isBlank()) {
+ throw new IllegalArgumentException("Exact stored caller workload correlation required");
+ }
+ Record row = select(requestId);
+ if (row == null) return Optional.empty();
+ AccountGameplayAdmissionLeaseEvidence evidence =
+ AccountGameplayAdmissionLeaseEvidence.parseCanonical(
+ row.get("evidence_json", String.class));
+ AccountGameplayAdmissionLeaseOperation stored = exact(row, evidence);
+ if (!accountId.equals(accountId(stored.evidence()))
+ || !requestId.equals(id(stored.evidence(), "requestId"))
+ || !expectedCallerWorkload.equals(stored.evidence().carrier().get("callerWorkload"))) {
+ throw conflict();
+ }
+ return Optional.of(stored);
+ }
+
+ /** Stores only the exact carrier for an already retained Account-owned allocation. */
+ AccountGameplayAdmissionLeaseOperation beginPending(
+ AccountGameplayAdmissionLeaseEvidence evidence) {
+ Objects.requireNonNull(evidence);
+ UUID accountId = accountId(evidence);
+ lockAccount(accountId);
+ Allocation expected =
+ new Allocation(
+ accountId,
+ id(evidence, "requestId"),
+ id(evidence, "leaseId"),
+ evidence.leaseFence().longValueExact());
+ Record allocated =
+ dsl.fetchOne(
+ "SELECT * FROM account_gameplay_admission_lease_allocations WHERE request_id = ?",
+ expected.requestId());
+ if (allocated == null || !expected.equals(allocation(allocated))) throw conflict();
+ Record prior = select(expected.requestId());
+ if (prior != null) return exact(prior, evidence);
+ int inserted =
+ dsl.execute(
+ "INSERT INTO "
+ + OPERATIONS
+ + " (account_uuid, request_id, lease_id, lease_fence, caller_workload, evidence_json, "
+ + "evidence_sha256, evaluated_at_ms, expires_at_ms, status) "
+ + "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, 'PENDING' "
+ + "WHERE ? <= floor(extract(epoch FROM clock_timestamp()) * 1000) "
+ + "AND ? > floor(extract(epoch FROM clock_timestamp()) * 1000)",
+ accountId,
+ expected.requestId(),
+ expected.leaseId(),
+ expected.leaseFence(),
+ evidence.carrier().get("callerWorkload"),
+ evidence.canonicalJson(),
+ evidence.sha256(),
+ time(evidence, "evaluatedAt"),
+ time(evidence, "expiresAt"),
+ time(evidence, "evaluatedAt"),
+ time(evidence, "expiresAt"));
+ if (inserted != 1) throw new IllegalStateException("Admission lease storage deadline expired");
+ return exact(select(expected.requestId()), evidence);
+ }
+
+ /** Exact retry/readback retains the original state and deadline, including expired evidence. */
+ Optional readExact(
+ AccountGameplayAdmissionLeaseEvidence evidence) {
+ Objects.requireNonNull(evidence);
+ lockAccount(accountId(evidence));
+ Record stored = select(id(evidence, "requestId"));
+ return stored == null ? Optional.empty() : Optional.of(exact(stored, evidence));
+ }
+
+ AccountGameplayAdmissionLeaseOperation recordCommitted(
+ AccountGameplayAdmissionLeaseEvidence evidence, UUID bindingDecisionId) {
+ return terminal(evidence, State.COMMITTED, bindingDecisionId, null);
+ }
+
+ /** A missing decision remains unknown; the original cleanup identity is always required. */
+ AccountGameplayAdmissionLeaseOperation recordAborted(
+ AccountGameplayAdmissionLeaseEvidence evidence,
+ UUID bindingDecisionId,
+ UUID orphanCleanupId) {
+ requireUuidV4(orphanCleanupId);
+ return terminal(evidence, State.ABORTED, bindingDecisionId, orphanCleanupId);
+ }
+
+ private AccountGameplayAdmissionLeaseOperation terminal(
+ AccountGameplayAdmissionLeaseEvidence evidence, State state, UUID decision, UUID cleanup) {
+ if (state == State.COMMITTED || decision != null) requireUuidV4(decision);
+ AccountGameplayAdmissionLeaseOperation prior =
+ readExact(evidence)
+ .orElseThrow(
+ () -> new IllegalStateException("Exact admission lease operation missing"));
+ if (prior.state() != State.PENDING) {
+ if (prior.state() != state
+ || !Objects.equals(prior.bindingDecisionId(), decision)
+ || !Objects.equals(prior.orphanCleanupId(), cleanup)) throw conflict();
+ return prior;
+ }
+ int updated =
+ dsl.execute(
+ "UPDATE "
+ + OPERATIONS
+ + " SET status = ?, binding_decision_id = ?, orphan_cleanup_id = ? "
+ + "WHERE request_id = ? AND status = 'PENDING' "
+ + "AND (? = 'ABORTED' OR expires_at_ms > floor(extract(epoch FROM clock_timestamp()) * 1000))",
+ state.name(),
+ decision,
+ cleanup,
+ id(evidence, "requestId"),
+ state.name());
+ if (updated != 1) throw new IllegalStateException("Admission lease storage deadline expired");
+ return exact(select(id(evidence, "requestId")), evidence);
+ }
+
+ private void lockAccount(UUID accountId) {
+ requireUuidV4(accountId);
+ if (!TransactionSynchronizationManager.isActualTransactionActive()
+ || TransactionSynchronizationManager.isCurrentTransactionReadOnly()
+ || !Integer.valueOf(Connection.TRANSACTION_SERIALIZABLE)
+ .equals(TransactionSynchronizationManager.getCurrentTransactionIsolationLevel())) {
+ throw new IllegalStateException("Writable SERIALIZABLE Account transaction required");
+ }
+ if (dsl.fetchOne(
+ "SELECT account_uuid FROM accounts WHERE account_uuid = ? FOR UPDATE", accountId)
+ == null) throw new IllegalStateException("Account admission storage owner missing");
+ }
+
+ private Record select(UUID requestId) {
+ return dsl.fetchOne(
+ "SELECT * FROM " + OPERATIONS + " WHERE request_id = ? FOR UPDATE", requestId);
+ }
+
+ private static AccountGameplayAdmissionLeaseOperation exact(
+ Record row, AccountGameplayAdmissionLeaseEvidence expected) {
+ if (row == null) throw new IllegalStateException("Admission lease storage readback missing");
+ AccountGameplayAdmissionLeaseEvidence stored =
+ AccountGameplayAdmissionLeaseEvidence.parseCanonical(
+ row.get("evidence_json", String.class));
+ if (!stored.sha256().equals(row.get("evidence_sha256", String.class))
+ || !stored.hasSameIdentity(expected)
+ || !accountId(stored).equals(row.get("account_uuid", UUID.class))
+ || !id(stored, "requestId").equals(row.get("request_id", UUID.class))
+ || !id(stored, "leaseId").equals(row.get("lease_id", UUID.class))
+ || !Long.valueOf(stored.leaseFence().longValueExact())
+ .equals(row.get("lease_fence", Long.class))
+ || !stored.carrier().get("callerWorkload").equals(row.get("caller_workload", String.class))
+ || !Long.valueOf(time(stored, "evaluatedAt")).equals(row.get("evaluated_at_ms", Long.class))
+ || !Long.valueOf(time(stored, "expiresAt")).equals(row.get("expires_at_ms", Long.class)))
+ throw conflict();
+ return new AccountGameplayAdmissionLeaseOperation(
+ stored,
+ State.valueOf(row.get("status", String.class)),
+ row.get("binding_decision_id", UUID.class),
+ row.get("orphan_cleanup_id", UUID.class));
+ }
+
+ private static Allocation allocation(Record row) {
+ UUID account = row.get("account_uuid", UUID.class);
+ UUID request = row.get("request_id", UUID.class);
+ UUID lease = row.get("lease_id", UUID.class);
+ Long fence = row.get("lease_fence", Long.class);
+ requireUuidV4(account);
+ requireUuidV4(request);
+ requireUuidV4(lease);
+ if (fence == null || fence <= 0L) throw conflict();
+ return new Allocation(account, request, lease, fence);
+ }
+
+ private static UUID accountId(AccountGameplayAdmissionLeaseEvidence evidence) {
+ return UUID.fromString(
+ (String) ((java.util.Map, ?>) evidence.carrier().get("bindingScope")).get("accountId"));
+ }
+
+ private static UUID id(AccountGameplayAdmissionLeaseEvidence evidence, String key) {
+ return UUID.fromString((String) evidence.carrier().get(key));
+ }
+
+ private static long time(AccountGameplayAdmissionLeaseEvidence evidence, String key) {
+ return Long.parseLong((String) evidence.carrier().get(key));
+ }
+
+ private static void requireUuidV4(UUID value) {
+ if (value == null || value.version() != 4 || value.variant() != 2)
+ throw new IllegalArgumentException("Canonical non-nil UUIDv4 identity required");
+ }
+
+ private static IdentityConflictException conflict() {
+ return new IdentityConflictException();
+ }
+
+ static final class IdentityConflictException extends IllegalStateException {
+ private static final long serialVersionUID = 1L;
+
+ IdentityConflictException() {
+ super("Exact admission operation identity conflict");
+ }
+ }
+
+ record Allocation(UUID accountId, UUID requestId, UUID leaseId, long leaseFence) {}
+}
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptCommitExecutor.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptCommitExecutor.java
new file mode 100644
index 0000000000..a3c6e2569a
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptCommitExecutor.java
@@ -0,0 +1,187 @@
+package net.firedevops.firemud.accountservice.repository;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Objects;
+import java.util.UUID;
+import javax.sql.DataSource;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionOriginalAckReceipt;
+import net.firedevops.firemud.accountservice.repository.AccountGameplayAdmissionOriginalCommitExecutor.OriginalCommitAcknowledgement;
+import net.firedevops.firemud.common.account.admission.AccountGameplayAdmissionLeaseEvidence;
+import org.jooq.SQLDialect;
+import org.jooq.impl.DSL;
+import org.springframework.jdbc.datasource.ConnectionHolder;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.TransactionSystemException;
+import org.springframework.transaction.support.DefaultTransactionStatus;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.transaction.support.TransactionTemplate;
+
+/** Unregistered opaque original-ACK receipt executor; supplies no authentication or admission. */
+final class AccountGameplayAdmissionOriginalAckReceiptCommitExecutor {
+ private final DataSource dataSource;
+
+ AccountGameplayAdmissionOriginalAckReceiptCommitExecutor(DataSource dataSource) {
+ this.dataSource = Objects.requireNonNull(dataSource);
+ }
+
+ AccountGameplayAdmissionOriginalAckReceipt confirm(
+ OriginalCommitAcknowledgement acknowledgement) {
+ Objects.requireNonNull(acknowledgement);
+ if (!acknowledgement.belongsTo(dataSource)) throw denied();
+ rejectAmbient();
+ var creation =
+ execute(
+ new ReceiptTransactionManager(dataSource),
+ repository -> {
+ var result = Objects.requireNonNull(repository.create(acknowledgement));
+ var receipt = Objects.requireNonNull(result.receipt());
+ validate(receipt, acknowledgement.evidence(), acknowledgement.decisionId());
+ if (!receipt.finalizationXid().equals(acknowledgement.finalizationXid())
+ || receipt.committedBeforeMs() != acknowledgement.committedBeforeMs())
+ throw denied();
+ return result;
+ });
+ var created = Objects.requireNonNull(creation.receipt());
+ // A fresh insert is proved by its actual receipt COMMIT; a retry COMMIT cannot prove an old
+ // row.
+ rejectAmbient();
+ var read =
+ execute(
+ new ReceiptTransactionManager(dataSource),
+ repository ->
+ creation.inserted()
+ ? repository.readExact(acknowledgement.evidence(), acknowledgement.decisionId())
+ : repository.readDurably(
+ acknowledgement.evidence(), acknowledgement.decisionId()));
+ validate(read, acknowledgement.evidence(), acknowledgement.decisionId());
+ if (!created.equals(read)) throw denied();
+ return read;
+ }
+
+ AccountGameplayAdmissionOriginalAckReceipt read(
+ AccountGameplayAdmissionLeaseEvidence evidence, UUID decisionId) {
+ Objects.requireNonNull(evidence);
+ Objects.requireNonNull(decisionId);
+ rejectAmbient();
+ var receipt =
+ execute(
+ new ReceiptTransactionManager(dataSource),
+ repository -> repository.readDurably(evidence, decisionId));
+ validate(receipt, evidence, decisionId);
+ return receipt;
+ }
+
+ private static void validate(
+ AccountGameplayAdmissionOriginalAckReceipt receipt,
+ AccountGameplayAdmissionLeaseEvidence evidence,
+ UUID decisionId) {
+ if (!receipt.operation().evidence().canonicalJson().equals(evidence.canonicalJson())
+ || !receipt.operation().evidence().sha256().equals(evidence.sha256())
+ || !receipt.bindingDecisionId().equals(decisionId)) throw denied();
+ }
+
+ private static T execute(
+ ReceiptTransactionManager manager,
+ java.util.function.Function
+ operation) {
+ var transaction = new TransactionTemplate(manager);
+ transaction.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
+ transaction.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
+ transaction.setReadOnly(false);
+ var result =
+ transaction.execute(
+ status -> {
+ if (!status.isNewTransaction()) throw denied();
+ Connection connection = manager.bindConnection();
+ var dsl = DSL.using(connection, SQLDialect.POSTGRES);
+ var repository =
+ new AccountGameplayAdmissionOriginalAckReceiptRepository(
+ dsl, new AccountGameplayAdmissionLeaseRepository(dsl));
+ return Objects.requireNonNull(operation.apply(repository));
+ });
+ if (!manager.committed) throw denied();
+ return Objects.requireNonNull(result);
+ }
+
+ private void rejectAmbient() {
+ // Spring unwraps a TransactionAwareDataSourceProxy; reject a binding on either identity.
+ DataSource enlistedSource =
+ Objects.requireNonNull(new ReceiptTransactionManager(dataSource).getDataSource());
+ if (TransactionSynchronizationManager.isActualTransactionActive()
+ || TransactionSynchronizationManager.isSynchronizationActive()
+ || TransactionSynchronizationManager.hasResource(dataSource)
+ || TransactionSynchronizationManager.hasResource(enlistedSource)) throw denied();
+ }
+
+ private static final class ReceiptTransactionManager extends DataSourceTransactionManager {
+ private static final long serialVersionUID = 1L;
+ private transient Connection connection;
+ private transient boolean committed;
+
+ private ReceiptTransactionManager(DataSource dataSource) {
+ super(dataSource);
+ // A failed guard or uncertain COMMIT must roll back before restoring auto-commit.
+ setRollbackOnCommitFailure(true);
+ }
+
+ private Connection enlistedConnection() {
+ Object resource =
+ TransactionSynchronizationManager.getResource(Objects.requireNonNull(getDataSource()));
+ if (!(resource instanceof ConnectionHolder holder)) throw denied();
+ return holder.getConnection();
+ }
+
+ private Connection bindConnection() {
+ if (connection != null) throw denied();
+ connection = enlistedConnection();
+ return connection;
+ }
+
+ @Override
+ protected void doCommit(DefaultTransactionStatus status) {
+ if (!status.isNewTransaction()
+ || connection == null
+ || connection != enlistedConnection()
+ || committed) throw denied();
+ try {
+ if (connection.getAutoCommit()
+ || connection.isReadOnly()
+ || connection.getTransactionIsolation() != Connection.TRANSACTION_SERIALIZABLE
+ || !"PostgreSQL".equals(connection.getMetaData().getDatabaseProductName()))
+ throw denied();
+ try (Statement statement = connection.createStatement()) {
+ statement.execute("SET LOCAL synchronous_commit = on");
+ try (ResultSet settings =
+ statement.executeQuery(
+ "SELECT current_setting('server_version_num')::integer, pg_is_in_recovery(), "
+ + "current_setting('fsync'), current_setting('synchronous_commit'), "
+ + "current_setting('transaction_isolation'), current_setting('transaction_read_only')")) {
+ if (!settings.next()) throw denied();
+ int version = settings.getInt(1);
+ if (version < 180000
+ || version >= 190000
+ || settings.getBoolean(2)
+ || !"on".equals(settings.getString(3))
+ || !"on".equals(settings.getString(4))
+ || !"serializable".equals(settings.getString(5))
+ || !"off".equals(settings.getString(6))
+ || settings.next()) throw denied();
+ }
+ }
+ connection.commit();
+ committed = true;
+ } catch (SQLException failure) {
+ throw new TransactionSystemException(
+ "Account receipt physical COMMIT unavailable", failure);
+ }
+ }
+ }
+
+ private static IllegalStateException denied() {
+ return new IllegalStateException("Fresh owned Account receipt COMMIT required");
+ }
+}
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptRepository.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptRepository.java
new file mode 100644
index 0000000000..ea0df8aeb8
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionOriginalAckReceiptRepository.java
@@ -0,0 +1,172 @@
+package net.firedevops.firemud.accountservice.repository;
+
+import java.sql.Connection;
+import java.util.Objects;
+import java.util.UUID;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionLeaseOperation;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionLeaseOperation.State;
+import net.firedevops.firemud.accountservice.dto.AccountGameplayAdmissionOriginalAckReceipt;
+import net.firedevops.firemud.accountservice.repository.AccountGameplayAdmissionOriginalCommitExecutor.OriginalCommitAcknowledgement;
+import net.firedevops.firemud.common.account.admission.AccountGameplayAdmissionLeaseEvidence;
+import org.jooq.DSLContext;
+import org.jooq.Record;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+
+/**
+ * Unregistered storage for an opaque trusted-JVM acknowledgement of an original Account COMMIT.
+ *
+ *
The opaque acknowledgement binds successful synchronous COMMIT of this fresh transition to a
+ * subsequent database-clock upper bound strictly before unchanged expiry, on the same connection.
+ * It is not a persisted temporal confirmation or durable receipt. The protected owner must
+ * separately persist its exact confirmation and prove the receipt's own durability. Lost
+ * acknowledgement or unavailable/late clock evidence cannot be reconstructed by retrying this
+ * executor: a retained COMMITTED operation is rejected.
+ */
+final class AccountGameplayAdmissionOriginalCommitExecutor {
+ private final DataSource dataSource;
+
+ AccountGameplayAdmissionOriginalCommitExecutor(DataSource dataSource) {
+ this.dataSource = Objects.requireNonNull(dataSource);
+ }
+
+ OriginalCommitAcknowledgement execute(
+ AccountGameplayAdmissionLeaseEvidence evidence, UUID decisionId) {
+ Objects.requireNonNull(evidence);
+ Objects.requireNonNull(decisionId);
+ var manager = new OriginalCommitTransactionManager(dataSource);
+ if (TransactionSynchronizationManager.isActualTransactionActive()
+ || TransactionSynchronizationManager.isSynchronizationActive()
+ || TransactionSynchronizationManager.hasResource(
+ Objects.requireNonNull(manager.getDataSource()))) {
+ throw denied();
+ }
+ // Each invocation owns its manager, enlisted connection and acknowledgement slot.
+ var transaction = new TransactionTemplate(manager);
+ transaction.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
+ transaction.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
+ transaction.setReadOnly(false);
+ transaction.executeWithoutResult(
+ ignored -> {
+ if (!ignored.isNewTransaction()) throw denied();
+ Connection connection = manager.enlistedConnection();
+ // The repository cannot acquire another connection: its DSL uses this connection itself.
+ var repository =
+ new AccountGameplayAdmissionLeaseRepository(
+ DSL.using(connection, SQLDialect.POSTGRES));
+ var prior =
+ repository
+ .readExact(evidence)
+ .orElseThrow(AccountGameplayAdmissionOriginalCommitExecutor::denied);
+ if (prior.state() != State.PENDING) throw denied();
+ var committed = repository.recordCommitted(evidence, decisionId);
+ if (committed.state() != State.COMMITTED
+ || !decisionId.equals(committed.bindingDecisionId())
+ || !evidence.canonicalJson().equals(committed.evidence().canonicalJson())
+ || !evidence.sha256().equals(committed.evidence().sha256())) throw denied();
+ manager.bindOriginal(connection, evidence, decisionId);
+ });
+ return Objects.requireNonNull(manager.acknowledgement);
+ }
+
+ /**
+ * Non-serializable, immutable in-process capability; only the physical COMMIT path constructs it.
+ */
+ static final class OriginalCommitAcknowledgement {
+ private final DataSource originatingSource;
+ private final AccountGameplayAdmissionLeaseEvidence evidence;
+ private final UUID decisionId;
+ private final String finalizationXid;
+ private final long committedBeforeMs;
+
+ private OriginalCommitAcknowledgement(
+ DataSource originatingSource, OriginalBinding binding, long committedBeforeMs) {
+ this.originatingSource = originatingSource;
+ evidence = binding.evidence();
+ decisionId = binding.decisionId();
+ finalizationXid = binding.finalizationXid();
+ this.committedBeforeMs = committedBeforeMs;
+ }
+
+ boolean belongsTo(DataSource source) {
+ return originatingSource == source;
+ }
+
+ AccountGameplayAdmissionLeaseEvidence evidence() {
+ return evidence;
+ }
+
+ UUID decisionId() {
+ return decisionId;
+ }
+
+ String finalizationXid() {
+ return finalizationXid;
+ }
+
+ long committedBeforeMs() {
+ return committedBeforeMs;
+ }
+
+ @Override
+ public String toString() {
+ return "OriginalCommitAcknowledgement[not a temporal confirmation]";
+ }
+ }
+
+ private record OriginalBinding(
+ AccountGameplayAdmissionLeaseEvidence evidence, UUID decisionId, String finalizationXid) {}
+
+ private static final class OriginalCommitTransactionManager extends DataSourceTransactionManager {
+ private static final long serialVersionUID = 1L;
+ private final transient DataSource originatingSource;
+ private transient Connection originalConnection;
+ private transient OriginalBinding binding;
+ private transient OriginalCommitAcknowledgement acknowledgement;
+
+ private OriginalCommitTransactionManager(DataSource dataSource) {
+ super(dataSource);
+ originatingSource = dataSource;
+ // A rejected pre-COMMIT durability check must roll back before cleanup restores auto-commit.
+ // A failed/ambiguous physical COMMIT still never produces an acknowledgement.
+ setRollbackOnCommitFailure(true);
+ }
+
+ private Connection enlistedConnection() {
+ DataSource source = Objects.requireNonNull(getDataSource());
+ Object resource = TransactionSynchronizationManager.getResource(source);
+ if (!(resource instanceof ConnectionHolder holder)) throw denied();
+ return holder.getConnection();
+ }
+
+ private void bindOriginal(
+ Connection connection, AccountGameplayAdmissionLeaseEvidence evidence, UUID decisionId) {
+ if (originalConnection != null || binding != null || connection != enlistedConnection())
+ throw denied();
+ String sql =
+ "SELECT finalization_xid, pg_current_xact_id_if_assigned()::text "
+ + "FROM account_gameplay_admission_lease_operations "
+ + "WHERE request_id = ? AND lease_id = ? AND evidence_sha256 = ? "
+ + "AND binding_decision_id = ? AND status = 'COMMITTED' FOR UPDATE";
+ try (PreparedStatement statement = connection.prepareStatement(sql)) {
+ statement.setObject(1, UUID.fromString((String) evidence.carrier().get("requestId")));
+ statement.setObject(2, UUID.fromString((String) evidence.carrier().get("leaseId")));
+ statement.setString(3, evidence.sha256());
+ statement.setObject(4, decisionId);
+ try (ResultSet row = statement.executeQuery()) {
+ if (!row.next()) throw denied();
+ String finalizationXid = row.getString(1);
+ if (finalizationXid == null
+ || !finalizationXid.matches("[1-9][0-9]{0,19}")
+ || !finalizationXid.equals(row.getString(2))
+ || row.next()) throw denied();
+ originalConnection = connection;
+ binding = new OriginalBinding(evidence, decisionId, finalizationXid);
+ }
+ } catch (SQLException failure) {
+ throw new TransactionSystemException(
+ "Original Account finalization identity unavailable", failure);
+ }
+ }
+
+ @Override
+ protected void doCommit(DefaultTransactionStatus status) {
+ if (!status.isNewTransaction()
+ || binding == null
+ || originalConnection == null
+ || originalConnection != enlistedConnection()
+ || acknowledgement != null) throw denied();
+ try {
+ Connection connection = originalConnection;
+ if (connection.getAutoCommit()
+ || connection.isReadOnly()
+ || connection.getTransactionIsolation() != Connection.TRANSACTION_SERIALIZABLE
+ || !"PostgreSQL".equals(connection.getMetaData().getDatabaseProductName()))
+ throw denied();
+ try (Statement statement = connection.createStatement()) {
+ statement.execute("SET LOCAL synchronous_commit = on");
+ try (ResultSet settings =
+ statement.executeQuery(
+ "SELECT current_setting('server_version_num')::integer, pg_is_in_recovery(), "
+ + "current_setting('fsync'), current_setting('synchronous_commit'), "
+ + "current_setting('transaction_isolation'), current_setting('transaction_read_only')")) {
+ if (!settings.next()) throw denied();
+ int version = settings.getInt(1);
+ if (version < 180000
+ || version >= 190000
+ || settings.getBoolean(2)
+ || !"on".equals(settings.getString(3))
+ || !"on".equals(settings.getString(4))
+ || !"serializable".equals(settings.getString(5))
+ || !"off".equals(settings.getString(6))
+ || settings.next()) throw denied();
+ }
+ }
+ // No callback or caller flag can mint this capability. An ambiguous JDBC outcome throws.
+ connection.commit();
+ long committedBeforeMs = observeCommitBound(connection, binding.evidence());
+ acknowledgement =
+ new OriginalCommitAcknowledgement(originatingSource, binding, committedBeforeMs);
+ } catch (SQLException failure) {
+ throw new TransactionSystemException(
+ "Original Account physical COMMIT unavailable", failure);
+ }
+ }
+
+ private static long observeCommitBound(
+ Connection connection, AccountGameplayAdmissionLeaseEvidence evidence) {
+ // This statement follows the actual successful COMMIT, before cleanup or any reconnect.
+ // A failure here cannot undo that original COMMIT, and must never mint a capability.
+ try (Statement statement = connection.createStatement();
+ ResultSet row =
+ statement.executeQuery(
+ "SELECT ceil(extract(epoch FROM clock_timestamp()) * 1000)::bigint")) {
+ if (!row.next()) throw unavailableClock();
+ BigDecimal value = row.getBigDecimal(1);
+ if (value == null) throw unavailableClock();
+ long observed = value.longValueExact();
+ long expiry = Long.parseLong((String) evidence.carrier().get("expiresAt"));
+ if (observed <= 0 || observed >= expiry || row.next()) throw unavailableClock();
+ return observed;
+ } catch (SQLException failure) {
+ throw new TransactionSystemException(
+ "Original Account post-COMMIT clock unavailable", failure);
+ } catch (ArithmeticException failure) {
+ throw unavailableClock();
+ }
+ }
+ }
+
+ private static IllegalStateException unavailableClock() {
+ return new IllegalStateException("Original Account post-COMMIT clock bound unavailable");
+ }
+
+ private static IllegalStateException denied() {
+ return new IllegalStateException("Fresh owned Account original COMMIT required");
+ }
+}
diff --git a/services/account-service/src/main/resources/db/migration/V140__account_gameplay_admission_lease_operations.sql b/services/account-service/src/main/resources/db/migration/V140__account_gameplay_admission_lease_operations.sql
new file mode 100644
index 0000000000..c2675aded2
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V140__account_gameplay_admission_lease_operations.sql
@@ -0,0 +1,113 @@
+-- Storage foundation only. No row, fence or terminal status establishes authenticated admission.
+-- The lease fence is an independent per-Account domain, never an issuance/token fence.
+CREATE TABLE account_gameplay_admission_lease_fences (
+ account_uuid UUID PRIMARY KEY REFERENCES accounts(account_uuid)
+ CHECK (account_uuid::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ last_fence BIGINT NOT NULL CHECK (last_fence > 0)
+);
+
+CREATE TABLE account_gameplay_admission_lease_allocations (
+ account_uuid UUID NOT NULL REFERENCES accounts(account_uuid)
+ CHECK (account_uuid::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ request_id UUID PRIMARY KEY CHECK (request_id::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ lease_id UUID NOT NULL UNIQUE CHECK (lease_id::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ lease_fence BIGINT NOT NULL CHECK (lease_fence > 0),
+ UNIQUE (account_uuid, lease_fence),
+ UNIQUE (account_uuid, request_id, lease_id, lease_fence)
+);
+
+CREATE TABLE account_gameplay_admission_lease_operations (
+ account_uuid UUID NOT NULL,
+ request_id UUID PRIMARY KEY,
+ lease_id UUID NOT NULL UNIQUE,
+ lease_fence BIGINT NOT NULL,
+ caller_workload TEXT NOT NULL,
+ evidence_json TEXT NOT NULL CHECK (octet_length(evidence_json) BETWEEN 1 AND 65536),
+ evidence_sha256 VARCHAR(64) NOT NULL CHECK (evidence_sha256 ~ '^[0-9a-f]{64}$'),
+ evaluated_at_ms BIGINT NOT NULL CHECK (evaluated_at_ms > 0),
+ expires_at_ms BIGINT NOT NULL,
+ status VARCHAR(16) NOT NULL CHECK (status IN ('PENDING', 'COMMITTED', 'ABORTED')),
+ binding_decision_id UUID CHECK (binding_decision_id::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ orphan_cleanup_id UUID UNIQUE CHECK (orphan_cleanup_id::text ~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$'),
+ FOREIGN KEY (account_uuid, request_id, lease_id, lease_fence)
+ REFERENCES account_gameplay_admission_lease_allocations(account_uuid, request_id, lease_id, lease_fence),
+ CHECK (expires_at_ms > evaluated_at_ms AND expires_at_ms - evaluated_at_ms <= 15000),
+ CHECK ((status = 'PENDING' AND binding_decision_id IS NULL AND orphan_cleanup_id IS NULL)
+ OR (status = 'COMMITTED' AND binding_decision_id IS NOT NULL AND orphan_cleanup_id IS NULL)
+ OR (status = 'ABORTED' AND binding_decision_id IS NOT NULL AND orphan_cleanup_id IS NOT NULL))
+);
+
+-- PostgreSQL executes these exact digest and JSON identity constraints. The jOOQ/H2 schema
+-- simulation cannot interpret their PostgreSQL expressions; omission from that simulation
+-- does not replace physical PostgreSQL migration and negative-case proof.
+-- [jooq ignore start]
+ALTER TABLE account_gameplay_admission_lease_operations
+ ADD CONSTRAINT account_admission_lease_evidence_digest_check
+ CHECK (evidence_sha256 = encode(sha256(convert_to(evidence_json, 'UTF8')), 'hex'));
+ALTER TABLE account_gameplay_admission_lease_operations
+ ADD CONSTRAINT account_admission_lease_evidence_identity_check
+ CHECK (COALESCE((evidence_json::jsonb ->> 'requestId') = request_id::text
+ AND (evidence_json::jsonb ->> 'leaseId') = lease_id::text
+ AND (evidence_json::jsonb ->> 'leaseFence') = lease_fence::text
+ AND (evidence_json::jsonb ->> 'callerWorkload') = caller_workload
+ AND (evidence_json::jsonb -> 'bindingScope' ->> 'accountId') = account_uuid::text
+ AND (evidence_json::jsonb ->> 'evaluatedAt') = evaluated_at_ms::text
+ AND (evidence_json::jsonb ->> 'expiresAt') = expires_at_ms::text, FALSE));
+-- [jooq ignore stop]
+
+-- ABORTED's immutable original evidence_json includes every exact orphan binding and token
+-- coordinate. orphan_cleanup_id identifies durable PENDING work, not delivery/retirement success.
+-- [jooq ignore start]
+CREATE FUNCTION account_gameplay_admission_storage_guard() RETURNS TRIGGER LANGUAGE plpgsql AS $$
+BEGIN
+ IF TG_OP IN ('DELETE', 'TRUNCATE') THEN
+ RAISE EXCEPTION 'Account admission storage evidence cannot be removed' USING ERRCODE = '23514';
+ END IF;
+ IF TG_TABLE_NAME = 'account_gameplay_admission_lease_fences' THEN
+ PERFORM 1 FROM accounts WHERE account_uuid = NEW.account_uuid FOR UPDATE;
+ IF TG_OP = 'INSERT' THEN
+ IF NEW.last_fence <> 1 THEN RAISE EXCEPTION 'Lease fence must start at one' USING ERRCODE = '23514'; END IF;
+ ELSIF NEW.account_uuid IS DISTINCT FROM OLD.account_uuid OR NEW.last_fence <> OLD.last_fence + 1 THEN
+ RAISE EXCEPTION 'Lease fence must advance exactly once' USING ERRCODE = '23514';
+ END IF;
+ ELSIF TG_TABLE_NAME = 'account_gameplay_admission_lease_allocations' THEN
+ IF TG_OP = 'UPDATE' THEN
+ RAISE EXCEPTION 'Lease allocation is immutable' USING ERRCODE = '23514';
+ END IF;
+ PERFORM 1 FROM accounts WHERE account_uuid = NEW.account_uuid FOR UPDATE;
+ IF NOT EXISTS (SELECT 1 FROM account_gameplay_admission_lease_fences
+ WHERE account_uuid = NEW.account_uuid AND last_fence = NEW.lease_fence) THEN
+ RAISE EXCEPTION 'Lease allocation must bind current Account allocator' USING ERRCODE = '23514';
+ END IF;
+ ELSE
+ IF TG_OP = 'INSERT' AND NEW.status <> 'PENDING' THEN
+ RAISE EXCEPTION 'Lease operation must start pending' USING ERRCODE = '23514';
+ END IF;
+ IF TG_OP = 'UPDATE' AND (OLD.status <> 'PENDING'
+ OR (to_jsonb(NEW) - ARRAY['status', 'binding_decision_id', 'orphan_cleanup_id'])
+ IS DISTINCT FROM (to_jsonb(OLD) - ARRAY['status', 'binding_decision_id', 'orphan_cleanup_id'])) THEN
+ RAISE EXCEPTION 'Exact lease evidence and terminal decisions are immutable' USING ERRCODE = '23514';
+ END IF;
+ IF (TG_OP = 'INSERT' OR NEW.status = 'COMMITTED')
+ AND (NEW.evaluated_at_ms > floor(extract(epoch FROM clock_timestamp()) * 1000)
+ OR NEW.expires_at_ms <= floor(extract(epoch FROM clock_timestamp()) * 1000)) THEN
+ RAISE EXCEPTION 'Lease operation storage deadline expired' USING ERRCODE = '23514';
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$;
+
+CREATE TRIGGER account_admission_fence_guard BEFORE INSERT OR UPDATE OR DELETE
+ ON account_gameplay_admission_lease_fences FOR EACH ROW EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+CREATE TRIGGER account_admission_allocation_guard BEFORE INSERT OR UPDATE OR DELETE
+ ON account_gameplay_admission_lease_allocations FOR EACH ROW EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+CREATE TRIGGER account_admission_operation_guard BEFORE INSERT OR UPDATE OR DELETE
+ ON account_gameplay_admission_lease_operations FOR EACH ROW EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+CREATE TRIGGER account_admission_fence_truncate_guard BEFORE TRUNCATE
+ ON account_gameplay_admission_lease_fences FOR EACH STATEMENT EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+CREATE TRIGGER account_admission_allocation_truncate_guard BEFORE TRUNCATE
+ ON account_gameplay_admission_lease_allocations FOR EACH STATEMENT EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+CREATE TRIGGER account_admission_operation_truncate_guard BEFORE TRUNCATE
+ ON account_gameplay_admission_lease_operations FOR EACH STATEMENT EXECUTE FUNCTION account_gameplay_admission_storage_guard();
+-- [jooq ignore stop]
diff --git a/services/account-service/src/main/resources/db/migration/V141__account_admission_unknown_decision_abort.sql b/services/account-service/src/main/resources/db/migration/V141__account_admission_unknown_decision_abort.sql
new file mode 100644
index 0000000000..20ed2b8443
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V141__account_admission_unknown_decision_abort.sql
@@ -0,0 +1,31 @@
+-- An aborted attempt may have an unknown binding decision. Its exact cleanup identity remains
+-- mandatory pending work, never proof of decision absence, cleanup delivery or token retirement.
+-- V87's existing rows, immutable evidence, deadline, digest and allocation guards are unchanged.
+
+-- V87 declared this table-level CHECK without an explicit name. Resolve only its exact three
+-- constrained columns; fail rather than removing an unrelated or ambiguous constraint.
+-- PostgreSQL catalog lookup is excluded only from jOOQ's schema simulation, not runtime proof.
+-- [jooq ignore start]
+DO $$
+DECLARE
+ original_shape_constraint TEXT;
+BEGIN
+ SELECT c.conname INTO STRICT original_shape_constraint
+ FROM pg_constraint c
+ WHERE c.conrelid = 'account_gameplay_admission_lease_operations'::regclass
+ AND c.contype = 'c'
+ AND ARRAY(SELECT a.attname::text
+ FROM pg_attribute a
+ WHERE a.attrelid = c.conrelid AND a.attnum = ANY(c.conkey)
+ ORDER BY a.attname) = ARRAY['binding_decision_id', 'orphan_cleanup_id', 'status'];
+ EXECUTE format('ALTER TABLE account_gameplay_admission_lease_operations DROP CONSTRAINT %I',
+ original_shape_constraint);
+END;
+$$;
+-- [jooq ignore stop]
+
+ALTER TABLE account_gameplay_admission_lease_operations
+ ADD CONSTRAINT account_admission_lease_operation_shape_check
+ CHECK ((status = 'PENDING' AND binding_decision_id IS NULL AND orphan_cleanup_id IS NULL)
+ OR (status = 'COMMITTED' AND binding_decision_id IS NOT NULL AND orphan_cleanup_id IS NULL)
+ OR (status = 'ABORTED' AND orphan_cleanup_id IS NOT NULL));
diff --git a/services/account-service/src/main/resources/db/migration/V142__account_admission_durable_commit_confirmation.sql b/services/account-service/src/main/resources/db/migration/V142__account_admission_durable_commit_confirmation.sql
new file mode 100644
index 0000000000..579800746a
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V142__account_admission_durable_commit_confirmation.sql
@@ -0,0 +1,404 @@
+-- Temporal storage durability only: neither COMMITTED nor this confirmation grants admission.
+-- Retained terminal rows are deliberately not backfilled from xmin or inferred transaction time.
+ALTER TABLE account_gameplay_admission_lease_operations ADD COLUMN finalization_xid VARCHAR(20);
+
+-- [jooq ignore start]
+ALTER TABLE account_gameplay_admission_lease_operations
+ ADD CONSTRAINT account_admission_finalization_xid_check CHECK (
+ CASE WHEN finalization_xid IS NULL THEN TRUE
+ WHEN finalization_xid ~ '^[1-9][0-9]{0,19}$' THEN
+ status = 'COMMITTED' AND finalization_xid::numeric <= 18446744073709551615
+ ELSE FALSE END);
+-- [jooq ignore stop]
+
+ALTER TABLE account_gameplay_admission_lease_operations
+ ADD CONSTRAINT account_admission_confirmation_binding_unique
+ UNIQUE (request_id, account_uuid, lease_id, lease_fence, evidence_sha256,
+ binding_decision_id, expires_at_ms, finalization_xid);
+
+CREATE TABLE account_gameplay_admission_commit_confirmations (
+ confirmation_version SMALLINT NOT NULL DEFAULT 1 CHECK (confirmation_version = 1),
+ request_id UUID PRIMARY KEY,
+ account_uuid UUID NOT NULL,
+ lease_id UUID NOT NULL,
+ lease_fence BIGINT NOT NULL CHECK (lease_fence > 0),
+ evidence_sha256 VARCHAR(64) NOT NULL CHECK (evidence_sha256 ~ '^[0-9a-f]{64}$'),
+ binding_decision_id UUID NOT NULL,
+ expires_at_ms BIGINT NOT NULL CHECK (expires_at_ms > 0),
+ finalization_xid VARCHAR(20) NOT NULL,
+ wal_insert_lsn TEXT NOT NULL,
+ wal_flush_lsn TEXT NOT NULL,
+ committed_before_ms BIGINT NOT NULL CHECK (committed_before_ms > 0 AND committed_before_ms < expires_at_ms),
+ confirmation_xid VARCHAR(20) NOT NULL,
+ FOREIGN KEY (request_id, account_uuid, lease_id, lease_fence, evidence_sha256,
+ binding_decision_id, expires_at_ms, finalization_xid)
+ REFERENCES account_gameplay_admission_lease_operations
+ (request_id, account_uuid, lease_id, lease_fence, evidence_sha256,
+ binding_decision_id, expires_at_ms, finalization_xid)
+);
+
+-- Only PostgreSQL-specific expressions and procedural enforcement are omitted from simulation.
+-- All receipt columns and the exact original-operation foreign key remain visible to jOOQ.
+-- [jooq ignore start]
+ALTER TABLE account_gameplay_admission_commit_confirmations
+ ADD CONSTRAINT account_admission_confirmation_proof_shape_check CHECK (
+ CASE WHEN finalization_xid ~ '^[1-9][0-9]{0,19}$'
+ AND confirmation_xid ~ '^[1-9][0-9]{0,19}$'
+ AND wal_insert_lsn ~ '^(0|[1-9A-F][0-9A-F]{0,7})/(0|[1-9A-F][0-9A-F]{0,7})$'
+ AND wal_flush_lsn ~ '^(0|[1-9A-F][0-9A-F]{0,7})/(0|[1-9A-F][0-9A-F]{0,7})$' THEN
+ finalization_xid::numeric <= 18446744073709551615
+ AND confirmation_xid::numeric <= 18446744073709551615
+ AND finalization_xid <> confirmation_xid
+ AND wal_insert_lsn::pg_lsn > '0/0'::pg_lsn
+ AND wal_flush_lsn::pg_lsn >= wal_insert_lsn::pg_lsn
+ ELSE FALSE END);
+
+-- Preserve every V87 guard and the V89 terminal shape; stamp only the original transition.
+CREATE OR REPLACE FUNCTION account_gameplay_admission_storage_guard() RETURNS TRIGGER LANGUAGE plpgsql AS $$
+BEGIN
+ IF TG_OP IN ('DELETE', 'TRUNCATE') THEN
+ RAISE EXCEPTION 'Account admission storage evidence cannot be removed' USING ERRCODE = '23514';
+ END IF;
+ IF TG_TABLE_NAME = 'account_gameplay_admission_lease_fences' THEN
+ PERFORM 1 FROM accounts WHERE account_uuid = NEW.account_uuid FOR UPDATE;
+ IF TG_OP = 'INSERT' THEN
+ IF NEW.last_fence <> 1 THEN RAISE EXCEPTION 'Lease fence must start at one' USING ERRCODE = '23514'; END IF;
+ ELSIF NEW.account_uuid IS DISTINCT FROM OLD.account_uuid OR NEW.last_fence <> OLD.last_fence + 1 THEN
+ RAISE EXCEPTION 'Lease fence must advance exactly once' USING ERRCODE = '23514';
+ END IF;
+ ELSIF TG_TABLE_NAME = 'account_gameplay_admission_lease_allocations' THEN
+ IF TG_OP = 'UPDATE' THEN
+ RAISE EXCEPTION 'Lease allocation is immutable' USING ERRCODE = '23514';
+ END IF;
+ PERFORM 1 FROM accounts WHERE account_uuid = NEW.account_uuid FOR UPDATE;
+ IF NOT EXISTS (SELECT 1 FROM account_gameplay_admission_lease_fences
+ WHERE account_uuid = NEW.account_uuid AND last_fence = NEW.lease_fence) THEN
+ RAISE EXCEPTION 'Lease allocation must bind current Account allocator' USING ERRCODE = '23514';
+ END IF;
+ ELSE
+ IF TG_OP = 'INSERT' AND NEW.status <> 'PENDING' THEN
+ RAISE EXCEPTION 'Lease operation must start pending' USING ERRCODE = '23514';
+ END IF;
+ IF (TG_OP = 'INSERT' AND NEW.finalization_xid IS NOT NULL)
+ OR (TG_OP = 'UPDATE' AND NEW.finalization_xid IS DISTINCT FROM OLD.finalization_xid) THEN
+ RAISE EXCEPTION 'Account admission finalization transaction is database stamped'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_finalization_xid_db_stamp';
+ END IF;
+ IF TG_OP = 'UPDATE' AND (OLD.status <> 'PENDING'
+ OR (to_jsonb(NEW) - ARRAY['status', 'binding_decision_id', 'orphan_cleanup_id', 'finalization_xid'])
+ IS DISTINCT FROM (to_jsonb(OLD) - ARRAY['status', 'binding_decision_id', 'orphan_cleanup_id', 'finalization_xid'])) THEN
+ RAISE EXCEPTION 'Exact lease evidence and terminal decisions are immutable' USING ERRCODE = '23514';
+ END IF;
+ IF (TG_OP = 'INSERT' OR NEW.status = 'COMMITTED')
+ AND (NEW.evaluated_at_ms > floor(extract(epoch FROM clock_timestamp()) * 1000)
+ OR NEW.expires_at_ms <= floor(extract(epoch FROM clock_timestamp()) * 1000)) THEN
+ RAISE EXCEPTION 'Lease operation storage deadline expired' USING ERRCODE = '23514';
+ END IF;
+ IF TG_OP = 'UPDATE' AND NEW.status = 'COMMITTED' THEN
+ NEW.finalization_xid := pg_current_xact_id()::text;
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$;
+
+CREATE FUNCTION account_gameplay_admission_confirmation_guard() RETURNS TRIGGER LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ locked_operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_commit_confirmations%ROWTYPE;
+ locked_receipt account_gameplay_admission_commit_confirmations%ROWTYPE;
+ own_xid TEXT;
+ finalization_status TEXT;
+ fixed_snapshot pg_snapshot;
+ insert_fence pg_lsn;
+ initial_flush_fence pg_lsn;
+ flush_fence pg_lsn;
+ observed_before_ms BIGINT;
+ observation INTEGER;
+BEGIN
+ IF TG_OP <> 'INSERT' THEN
+ RAISE EXCEPTION 'Account admission confirmation is immutable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_immutable';
+ END IF;
+ IF NEW.confirmation_version IS DISTINCT FROM 1 OR NEW.account_uuid IS NOT NULL
+ OR NEW.lease_id IS NOT NULL OR NEW.lease_fence IS NOT NULL OR NEW.expires_at_ms IS NOT NULL
+ OR NEW.finalization_xid IS NOT NULL OR NEW.wal_insert_lsn IS NOT NULL
+ OR NEW.wal_flush_lsn IS NOT NULL OR NEW.committed_before_ms IS NOT NULL
+ OR NEW.confirmation_xid IS NOT NULL THEN
+ RAISE EXCEPTION 'Account admission confirmation proof is database derived'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_db_proof';
+ END IF;
+ IF current_setting('transaction_isolation') IS DISTINCT FROM 'serializable'
+ OR current_setting('transaction_read_only') IS DISTINCT FROM 'off' THEN
+ RAISE EXCEPTION 'Account admission confirmation writable SERIALIZABLE transaction required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_transaction_required';
+ END IF;
+ IF pg_is_in_recovery() OR current_setting('fsync') IS DISTINCT FROM 'on' THEN
+ RAISE EXCEPTION 'Account admission confirmation durable primary required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_durable_primary';
+ END IF;
+ -- Establish the fixed transaction snapshot before the fence and before any heap read.
+ -- A subsequently visible independent row committed before this snapshot, hence before
+ -- this WAL upper bound. Even a SELECT can emit heap-pruning WAL; capture must precede it.
+ fixed_snapshot := pg_current_snapshot();
+ own_xid := pg_current_xact_id_if_assigned()::text;
+ insert_fence := pg_current_wal_insert_lsn();
+ initial_flush_fence := pg_current_wal_flush_lsn();
+ IF insert_fence IS NULL OR insert_fence <= '0/0'::pg_lsn THEN
+ RAISE EXCEPTION 'Account admission confirmation WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_wal_coverage';
+ END IF;
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations WHERE request_id = NEW.request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_operation_required';
+ END IF;
+ IF operation.status <> 'COMMITTED' OR operation.finalization_xid IS NULL
+ OR NEW.evidence_sha256 IS DISTINCT FROM operation.evidence_sha256
+ OR NEW.binding_decision_id IS DISTINCT FROM operation.binding_decision_id THEN
+ RAISE EXCEPTION 'Account admission confirmation exact committed binding required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_required';
+ END IF;
+ -- The stamp is top-level even when finalization ran in a released subtransaction.
+ IF operation.finalization_xid = own_xid THEN
+ RAISE EXCEPTION 'Account admission confirmation requires independent finalization commit'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_finalization_independent';
+ END IF;
+ SELECT * INTO receipt FROM account_gameplay_admission_commit_confirmations WHERE request_id = NEW.request_id;
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_owner_required';
+ END IF;
+ SELECT * INTO locked_operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_operation IS DISTINCT FROM operation THEN
+ RAISE EXCEPTION 'Account admission confirmation exact committed binding required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_required';
+ END IF;
+ IF receipt.request_id IS NOT NULL THEN
+ SELECT * INTO locked_receipt FROM account_gameplay_admission_commit_confirmations
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_receipt IS DISTINCT FROM receipt
+ OR receipt.account_uuid IS DISTINCT FROM operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM operation.finalization_xid THEN
+ RAISE EXCEPTION 'Account admission confirmation immutable binding conflict'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_conflict';
+ END IF;
+ -- Suppress an exact replay INSERT, including after expiry. The caller reads the retained
+ -- receipt; no new proof, XID, deadline or timing bound replaces its original evidence.
+ RETURN NULL;
+ END IF;
+ BEGIN
+ finalization_status := pg_xact_status(operation.finalization_xid::xid8);
+ EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION 'Account admission confirmation finalization proof unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_finalization_unavailable';
+ END;
+ IF finalization_status IS DISTINCT FROM 'committed' THEN
+ RAISE EXCEPTION 'Account admission confirmation requires independent finalization commit'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_finalization_independent';
+ END IF;
+ -- Account-first locking serializes first receipt creation, and exact locked revalidation
+ -- preserves the independently observed immutable operation. Only the pre-lock fence needs
+ -- coverage; this bounded polling creates no marker, forces no flush and renews no deadline.
+ FOR observation IN 1..50 LOOP
+ flush_fence := pg_current_wal_flush_lsn();
+ -- A separate statement AFTER each flush observation is essential: SQL expression order
+ -- is not a temporal guarantee. CEIL supplies a conservative DB wall-clock upper bound.
+ observed_before_ms := ceil(extract(epoch FROM clock_timestamp()) * 1000)::bigint;
+ IF observed_before_ms <= 0 OR observed_before_ms >= operation.expires_at_ms THEN
+ RAISE EXCEPTION 'Account admission confirmation original deadline expired'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_original_deadline';
+ END IF;
+ EXIT WHEN flush_fence IS NOT NULL AND flush_fence >= insert_fence;
+ IF observation = 50 THEN
+ RAISE EXCEPTION 'Account admission confirmation WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_wal_coverage',
+ DETAIL = format('phase=create snapshot=%s own_xid_if_assigned=%s finalization_xid=%s receipt_xid=%s insert_fence=%s initial_flush=%s final_flush=%s observed_db_ms=%s unchanged_expiry_ms=%s',
+ fixed_snapshot, own_xid, operation.finalization_xid, receipt.confirmation_xid,
+ insert_fence, initial_flush_fence, flush_fence, observed_before_ms, operation.expires_at_ms);
+ END IF;
+ PERFORM pg_sleep(0.01);
+ END LOOP;
+ NEW.account_uuid := operation.account_uuid;
+ NEW.lease_id := operation.lease_id;
+ NEW.lease_fence := operation.lease_fence;
+ NEW.expires_at_ms := operation.expires_at_ms;
+ NEW.finalization_xid := operation.finalization_xid;
+ NEW.wal_insert_lsn := insert_fence::text;
+ NEW.wal_flush_lsn := flush_fence::text;
+ NEW.committed_before_ms := observed_before_ms;
+ NEW.confirmation_xid := pg_current_xact_id()::text;
+ RETURN NEW;
+END;
+$$;
+
+CREATE TRIGGER account_admission_confirmation_guard BEFORE INSERT OR UPDATE OR DELETE
+ ON account_gameplay_admission_commit_confirmations FOR EACH ROW
+ EXECUTE FUNCTION account_gameplay_admission_confirmation_guard();
+CREATE TRIGGER account_admission_confirmation_truncate_guard BEFORE TRUNCATE
+ ON account_gameplay_admission_commit_confirmations FOR EACH STATEMENT
+ EXECUTE FUNCTION account_gameplay_admission_confirmation_guard();
+
+CREATE FUNCTION account_gameplay_admission_confirm_committed(
+ requested_request_id UUID, expected_sha TEXT, expected_decision UUID)
+RETURNS SETOF account_gameplay_admission_commit_confirmations LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_commit_confirmations%ROWTYPE;
+BEGIN
+ -- Enter the guard before either operation/receipt heap read. It owns the snapshot/fence
+ -- and suppresses exact retained replay without renewing proof. A stale SERIALIZABLE
+ -- conflict must surface as 40001 rather than a raw uniqueness failure.
+ INSERT INTO account_gameplay_admission_commit_confirmations(request_id, evidence_sha256, binding_decision_id)
+ VALUES (requested_request_id, expected_sha, expected_decision)
+ ON CONFLICT (request_id) DO NOTHING RETURNING * INTO receipt;
+ IF FOUND THEN
+ RETURN NEXT receipt;
+ RETURN;
+ END IF;
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations WHERE request_id = requested_request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_operation_required';
+ END IF;
+ IF operation.status <> 'COMMITTED' OR operation.finalization_xid IS NULL
+ OR expected_sha IS DISTINCT FROM operation.evidence_sha256
+ OR expected_decision IS DISTINCT FROM operation.binding_decision_id THEN
+ RAISE EXCEPTION 'Account admission confirmation exact committed binding required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_required';
+ END IF;
+ -- Exact retained replay may occur after expiry. It locks Account first and revalidates the
+ -- immutable original decision, but neither re-proves nor replaces the receipt's timing bound.
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_owner_required';
+ END IF;
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR operation.status <> 'COMMITTED' OR operation.finalization_xid IS NULL
+ OR expected_sha IS DISTINCT FROM operation.evidence_sha256
+ OR expected_decision IS DISTINCT FROM operation.binding_decision_id THEN
+ RAISE EXCEPTION 'Account admission confirmation exact committed binding required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_required';
+ END IF;
+ SELECT * INTO receipt FROM account_gameplay_admission_commit_confirmations
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR receipt.account_uuid IS DISTINCT FROM operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM operation.finalization_xid THEN
+ RAISE EXCEPTION 'Account admission confirmation immutable binding conflict'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_binding_conflict';
+ END IF;
+ RETURN NEXT receipt;
+END;
+$$;
+
+CREATE FUNCTION account_gameplay_admission_read_commit_confirmation(
+ requested_request_id UUID, expected_sha TEXT, expected_decision UUID)
+RETURNS SETOF account_gameplay_admission_commit_confirmations LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_commit_confirmations%ROWTYPE;
+ locked_operation account_gameplay_admission_lease_operations%ROWTYPE;
+ locked_receipt account_gameplay_admission_commit_confirmations%ROWTYPE;
+ own_xid TEXT;
+ fixed_snapshot pg_snapshot;
+ insert_fence pg_lsn;
+ initial_flush_fence pg_lsn;
+ flush_fence pg_lsn;
+ observed_before_ms BIGINT;
+ observation INTEGER;
+BEGIN
+ IF current_setting('transaction_isolation') IS DISTINCT FROM 'serializable'
+ OR current_setting('transaction_read_only') IS DISTINCT FROM 'off' THEN
+ RAISE EXCEPTION 'Account admission confirmation writable SERIALIZABLE transaction required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_transaction_required';
+ END IF;
+ IF pg_is_in_recovery() OR current_setting('fsync') IS DISTINCT FROM 'on' THEN
+ RAISE EXCEPTION 'Account admission confirmation durable primary required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_durable_primary';
+ END IF;
+ -- Fix the snapshot and WAL upper bound before heap reads or assigning our own XID.
+ -- Independent receipt visibility in that same snapshot covers its prior COMMIT.
+ fixed_snapshot := pg_current_snapshot();
+ own_xid := pg_current_xact_id_if_assigned()::text;
+ insert_fence := pg_current_wal_insert_lsn();
+ initial_flush_fence := pg_current_wal_flush_lsn();
+ IF insert_fence IS NULL OR insert_fence <= '0/0'::pg_lsn THEN
+ RAISE EXCEPTION 'Account admission confirmation WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_wal_coverage';
+ END IF;
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations WHERE request_id = requested_request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_operation_required';
+ END IF;
+ SELECT * INTO receipt FROM account_gameplay_admission_commit_confirmations WHERE request_id = requested_request_id;
+ IF NOT FOUND OR operation.status IS DISTINCT FROM 'COMMITTED'
+ OR expected_sha IS DISTINCT FROM operation.evidence_sha256
+ OR expected_decision IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.account_uuid IS DISTINCT FROM operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM operation.finalization_xid THEN
+ RAISE EXCEPTION 'Account admission confirmation exact durable receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_receipt_required';
+ END IF;
+ -- MVCC visibility plus exclusion of our own top-level XID also excludes our subtransactions.
+ -- Historical receipts need not retain pg_xact_status data forever: fresh WAL coverage below
+ -- covers their independently visible original COMMIT without consulting vacuum-pruned status.
+ IF receipt.confirmation_xid = own_xid THEN
+ RAISE EXCEPTION 'Account admission confirmation requires independent receipt commit'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_receipt_independent';
+ END IF;
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Account admission confirmation owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_owner_required';
+ END IF;
+ SELECT * INTO locked_operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR locked_operation IS DISTINCT FROM operation THEN
+ RAISE EXCEPTION 'Account admission confirmation exact durable receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_receipt_required';
+ END IF;
+ SELECT * INTO locked_receipt FROM account_gameplay_admission_commit_confirmations
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR locked_receipt IS DISTINCT FROM receipt THEN
+ RAISE EXCEPTION 'Account admission confirmation exact durable receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_receipt_required';
+ END IF;
+ FOR observation IN 1..50 LOOP
+ flush_fence := pg_current_wal_flush_lsn();
+ EXIT WHEN flush_fence IS NOT NULL AND flush_fence >= insert_fence;
+ IF observation = 50 THEN
+ observed_before_ms := ceil(extract(epoch FROM clock_timestamp()) * 1000)::bigint;
+ RAISE EXCEPTION 'Account admission confirmation WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_wal_coverage',
+ DETAIL = format('phase=receipt-read snapshot=%s own_xid_if_assigned=%s finalization_xid=%s receipt_xid=%s insert_fence=%s initial_flush=%s final_flush=%s observed_db_ms=%s unchanged_expiry_ms=%s',
+ fixed_snapshot, own_xid, operation.finalization_xid, receipt.confirmation_xid,
+ insert_fence, initial_flush_fence, flush_fence, observed_before_ms, operation.expires_at_ms);
+ END IF;
+ PERFORM pg_sleep(0.01);
+ END LOOP;
+ -- Return immutable historical timing evidence even after expiry; never restamp or renew it.
+ RETURN NEXT receipt;
+END;
+$$;
+-- [jooq ignore stop]
diff --git a/services/account-service/src/main/resources/db/migration/V143__account_global_pending_admission_fences.sql b/services/account-service/src/main/resources/db/migration/V143__account_global_pending_admission_fences.sql
new file mode 100644
index 0000000000..007bf4ea03
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V143__account_global_pending_admission_fences.sql
@@ -0,0 +1,89 @@
+-- Account-wide negative pending-intent protection only. Unchanged tuple versions fence stale
+-- REPEATABLE_READ/SERIALIZABLE snapshots; no logical source, restriction or authority is created.
+-- Retained WAITING evidence is preserved, including unmatched or contradictory historical rows.
+-- [jooq ignore start]
+CREATE FUNCTION account_security_state_account_row_version_fence()
+RETURNS TRIGGER LANGUAGE plpgsql AS $$
+DECLARE
+ touched_rows INTEGER;
+BEGIN
+ IF NEW.status = 'WAITING' THEN
+ UPDATE accounts SET id = id
+ WHERE account_uuid = NEW.account_uuid
+ AND id = NEW.account_id
+ AND account_uuid_source_numeric_id = NEW.account_id
+ AND account_uuid_provenance = NEW.account_provenance;
+ GET DIAGNOSTICS touched_rows = ROW_COUNT;
+ IF touched_rows <> 1 THEN
+ RAISE EXCEPTION 'Security-state intent requires the exact persisted Account row'
+ USING ERRCODE = '23514',
+ CONSTRAINT = 'account_security_state_account_row_version_fence';
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$;
+
+CREATE TRIGGER account_security_state_account_row_version_fence
+ BEFORE INSERT ON account_security_state_operations
+ FOR EACH ROW EXECUTE FUNCTION account_security_state_account_row_version_fence();
+
+CREATE FUNCTION account_draft_authorization_account_row_version_fence()
+RETURNS TRIGGER LANGUAGE plpgsql AS $$
+DECLARE
+ account_key TEXT;
+ touched_rows INTEGER;
+BEGIN
+ IF split_part(NEW.source_key, ':', 1) IN ('ACCOUNT', 'GLOBAL_ROLES') THEN
+ IF NEW.source_key !~ '^(ACCOUNT|GLOBAL_ROLES):[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' THEN
+ RAISE EXCEPTION 'Account source scope must use the exact canonical UUID key'
+ USING ERRCODE = '23514',
+ CONSTRAINT = 'account_draft_authorization_account_row_version_fence';
+ END IF;
+ account_key := split_part(NEW.source_key, ':', 2);
+ UPDATE accounts SET id = id
+ WHERE account_uuid = account_key::UUID
+ AND account_uuid <> '00000000-0000-0000-0000-000000000000'::UUID
+ AND id > 0 AND account_uuid_source_numeric_id = id
+ AND account_uuid_provenance IN (
+ 'ACCOUNT_V29_MIGRATION', 'ACCOUNT_REPOSITORY_INSERT', 'ACCOUNT_DATABASE_INSERT');
+ GET DIAGNOSTICS touched_rows = ROW_COUNT;
+ IF touched_rows <> 1 THEN
+ RAISE EXCEPTION 'Account source scope requires the exact persisted Account row'
+ USING ERRCODE = '23514',
+ CONSTRAINT = 'account_draft_authorization_account_row_version_fence';
+ END IF;
+ END IF;
+ RETURN NEW;
+END;
+$$;
+
+-- Alphabetically earlier than V76's scope_insert_phase: Account is touched before parent locking.
+CREATE TRIGGER account_draft_authorization_account_row_version_fence
+ BEFORE INSERT ON account_draft_authorization_changed_scopes
+ FOR EACH ROW EXECUTE FUNCTION account_draft_authorization_account_row_version_fence();
+
+-- Protect snapshots predating installation without asserting retained intent provenance or
+-- enrolling an Account. Exact UUID/key matching supplies negative protection only.
+DO $$
+DECLARE
+ pending_account UUID;
+BEGIN
+ FOR pending_account IN
+ SELECT a.account_uuid FROM accounts a
+ WHERE EXISTS (
+ SELECT 1 FROM account_security_state_operations security
+ WHERE security.account_uuid = a.account_uuid AND security.status = 'WAITING')
+ OR EXISTS (
+ SELECT 1 FROM account_draft_authorization_source_changes change
+ JOIN account_draft_authorization_changed_scopes changed USING (change_id)
+ WHERE change.status = 'WAITING'
+ AND changed.source_key IN (
+ 'ACCOUNT:' || a.account_uuid::TEXT, 'GLOBAL_ROLES:' || a.account_uuid::TEXT))
+ ORDER BY a.account_uuid::TEXT
+ LOOP
+ UPDATE accounts SET id = id WHERE account_uuid = pending_account;
+ END LOOP;
+END;
+$$;
+-- [jooq ignore stop]
diff --git a/services/account-service/src/main/resources/db/migration/V144__account_admission_original_ack_receipt.sql b/services/account-service/src/main/resources/db/migration/V144__account_admission_original_ack_receipt.sql
new file mode 100644
index 0000000000..431fcc9a56
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V144__account_admission_original_ack_receipt.sql
@@ -0,0 +1,259 @@
+-- Persist only an opaque trusted-JVM acknowledgement of the original physical COMMIT and its
+-- subsequent database-clock bound. The bound is not SQL-derived or authenticated by this schema.
+-- This receipt supplies no current authority or gameplay-admission result.
+CREATE TABLE account_gameplay_admission_original_commit_ack_receipts (
+ schema_version SMALLINT NOT NULL DEFAULT 1 CHECK (schema_version = 1),
+ request_id UUID PRIMARY KEY,
+ account_uuid UUID NOT NULL,
+ lease_id UUID NOT NULL,
+ lease_fence BIGINT NOT NULL CHECK (lease_fence > 0),
+ evidence_sha256 VARCHAR(64) NOT NULL CHECK (evidence_sha256 ~ '^[0-9a-f]{64}$'),
+ binding_decision_id UUID NOT NULL,
+ expires_at_ms BIGINT NOT NULL CHECK (expires_at_ms > 0),
+ finalization_xid VARCHAR(20) NOT NULL,
+ committed_before_ms BIGINT NOT NULL CHECK (
+ committed_before_ms > 0 AND committed_before_ms < expires_at_ms),
+ receipt_xid VARCHAR(20) NOT NULL,
+ FOREIGN KEY (request_id, account_uuid, lease_id, lease_fence, evidence_sha256,
+ binding_decision_id, expires_at_ms, finalization_xid)
+ REFERENCES account_gameplay_admission_lease_operations
+ (request_id, account_uuid, lease_id, lease_fence, evidence_sha256,
+ binding_decision_id, expires_at_ms, finalization_xid)
+);
+
+-- The typed JVM acknowledgement supplies committed_before_ms. SQL validates its shape and exact
+-- immutable operation binding, but cannot authenticate that opaque capability or prove its clock.
+-- [jooq ignore start]
+ALTER TABLE account_gameplay_admission_original_commit_ack_receipts
+ ADD CONSTRAINT account_admission_original_ack_receipt_xid_check CHECK (
+ CASE WHEN finalization_xid ~ '^[1-9][0-9]{0,19}$'
+ AND receipt_xid ~ '^[1-9][0-9]{0,19}$' THEN
+ finalization_xid::numeric <= 18446744073709551615
+ AND receipt_xid::numeric <= 18446744073709551615
+ AND finalization_xid <> receipt_xid
+ ELSE FALSE END);
+
+CREATE FUNCTION account_gameplay_admission_original_ack_receipt_guard()
+RETURNS TRIGGER LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ locked_operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ locked_receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ own_xid TEXT;
+ finalization_status TEXT;
+ version_num INTEGER;
+BEGIN
+ IF TG_OP IN ('DELETE', 'TRUNCATE') THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt is immutable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_immutable';
+ END IF;
+ IF TG_OP <> 'INSERT' THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt is immutable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_immutable';
+ END IF;
+ IF NEW.schema_version IS DISTINCT FROM 1
+ OR NEW.account_uuid IS NOT NULL OR NEW.lease_id IS NOT NULL
+ OR NEW.lease_fence IS NOT NULL OR NEW.expires_at_ms IS NOT NULL
+ OR NEW.receipt_xid IS NOT NULL THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt binding is database derived'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_db_binding';
+ END IF;
+ IF current_setting('transaction_isolation') IS DISTINCT FROM 'serializable'
+ OR current_setting('transaction_read_only') IS DISTINCT FROM 'off' THEN
+ RAISE EXCEPTION 'Writable SERIALIZABLE Account acknowledgement receipt transaction required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_transaction_required';
+ END IF;
+ version_num := current_setting('server_version_num')::integer;
+ IF version_num < 160000 OR version_num >= 170000
+ OR pg_is_in_recovery() OR current_setting('fsync') IS DISTINCT FROM 'on' THEN
+ RAISE EXCEPTION 'Supported durable PostgreSQL 16 primary required for Account acknowledgement receipt'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_durable_primary';
+ END IF;
+
+ -- The request lookup only discovers the owning Account. All locked reads follow Account first.
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = NEW.request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_operation_required';
+ END IF;
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_owner_required';
+ END IF;
+ SELECT * INTO locked_operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_operation IS DISTINCT FROM operation
+ OR locked_operation.status IS DISTINCT FROM 'COMMITTED'
+ OR locked_operation.finalization_xid IS NULL
+ OR NEW.evidence_sha256 IS DISTINCT FROM locked_operation.evidence_sha256
+ OR NEW.binding_decision_id IS DISTINCT FROM locked_operation.binding_decision_id
+ OR NEW.finalization_xid IS DISTINCT FROM locked_operation.finalization_xid
+ OR NEW.committed_before_ms <= 0
+ OR NEW.committed_before_ms >= locked_operation.expires_at_ms THEN
+ RAISE EXCEPTION 'Exact original Account COMMIT acknowledgement required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_binding_required';
+ END IF;
+
+ SELECT * INTO receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = NEW.request_id;
+ IF FOUND THEN
+ SELECT * INTO locked_receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_receipt IS DISTINCT FROM receipt
+ OR receipt.schema_version IS DISTINCT FROM 1
+ OR receipt.account_uuid IS DISTINCT FROM locked_operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM locked_operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM locked_operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM locked_operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM locked_operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM locked_operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM locked_operation.finalization_xid
+ OR receipt.committed_before_ms IS DISTINCT FROM NEW.committed_before_ms THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt retry conflicts'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_conflict';
+ END IF;
+ -- An exact retained ACK retry never rewrites or restamps the original receipt.
+ RETURN NULL;
+ END IF;
+
+ own_xid := pg_current_xact_id()::text;
+ IF own_xid = locked_operation.finalization_xid THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt requires independent transaction'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_independent';
+ END IF;
+ BEGIN
+ finalization_status := pg_xact_status(locked_operation.finalization_xid::xid8);
+ EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION 'Original Account finalization status unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_finalization_unavailable';
+ END;
+ IF finalization_status IS DISTINCT FROM 'committed' THEN
+ RAISE EXCEPTION 'Original Account finalization is not independently committed'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_independent';
+ END IF;
+
+ NEW.account_uuid := locked_operation.account_uuid;
+ NEW.lease_id := locked_operation.lease_id;
+ NEW.lease_fence := locked_operation.lease_fence;
+ NEW.expires_at_ms := locked_operation.expires_at_ms;
+ NEW.receipt_xid := own_xid;
+ RETURN NEW;
+END;
+$$;
+
+CREATE TRIGGER account_admission_original_ack_receipt_guard
+ BEFORE INSERT OR UPDATE OR DELETE
+ ON account_gameplay_admission_original_commit_ack_receipts FOR EACH ROW
+ EXECUTE FUNCTION account_gameplay_admission_original_ack_receipt_guard();
+CREATE TRIGGER account_admission_original_ack_receipt_truncate_guard
+ BEFORE TRUNCATE ON account_gameplay_admission_original_commit_ack_receipts FOR EACH STATEMENT
+ EXECUTE FUNCTION account_gameplay_admission_original_ack_receipt_guard();
+
+CREATE FUNCTION account_gameplay_admission_read_original_ack_receipt_durably(
+ requested_request_id UUID, expected_sha TEXT, expected_decision UUID)
+RETURNS SETOF account_gameplay_admission_original_commit_ack_receipts LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ locked_operation account_gameplay_admission_lease_operations%ROWTYPE;
+ locked_receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ own_xid TEXT;
+ fixed_snapshot pg_snapshot;
+ insert_fence pg_lsn;
+ initial_flush_fence pg_lsn;
+ flush_fence pg_lsn;
+ observation INTEGER;
+BEGIN
+ IF current_setting('transaction_isolation') IS DISTINCT FROM 'serializable'
+ OR current_setting('transaction_read_only') IS DISTINCT FROM 'off' THEN
+ RAISE EXCEPTION 'Writable SERIALIZABLE Account acknowledgement receipt read required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_transaction_required';
+ END IF;
+ IF current_setting('server_version_num')::integer < 160000
+ OR current_setting('server_version_num')::integer >= 170000
+ OR pg_is_in_recovery() OR current_setting('fsync') IS DISTINCT FROM 'on' THEN
+ RAISE EXCEPTION 'Supported durable PostgreSQL 16 primary required for Account acknowledgement receipt read'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_durable_primary';
+ END IF;
+ -- Establish one fixed snapshot and its WAL upper fence before any heap read or row lock.
+ -- A receipt visible in this snapshot committed independently before this fence.
+ fixed_snapshot := pg_current_snapshot();
+ own_xid := pg_current_xact_id_if_assigned()::text;
+ insert_fence := pg_current_wal_insert_lsn();
+ initial_flush_fence := pg_current_wal_flush_lsn();
+ IF insert_fence IS NULL OR insert_fence <= '0/0'::pg_lsn THEN
+ RAISE EXCEPTION 'Original Account acknowledgement receipt WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_wal_coverage';
+ END IF;
+
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = requested_request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account acknowledgement operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_operation_required';
+ END IF;
+ SELECT * INTO receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = requested_request_id;
+ IF NOT FOUND OR operation.status IS DISTINCT FROM 'COMMITTED'
+ OR operation.finalization_xid IS NULL
+ OR expected_sha IS DISTINCT FROM operation.evidence_sha256
+ OR expected_decision IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.schema_version IS DISTINCT FROM 1
+ OR receipt.account_uuid IS DISTINCT FROM operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM operation.finalization_xid
+ OR receipt.committed_before_ms <= 0
+ OR receipt.committed_before_ms >= operation.expires_at_ms THEN
+ RAISE EXCEPTION 'Exact durable original Account acknowledgement receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_required';
+ END IF;
+ -- receipt_xid is the database-stamped top-level XID, so this excludes the current transaction
+ -- and any released subtransaction while retaining an independently committed historical row.
+ IF receipt.receipt_xid = own_xid THEN
+ RAISE EXCEPTION 'Original Account acknowledgement receipt requires independent commit'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_independent';
+ END IF;
+
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account acknowledgement owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_owner_required';
+ END IF;
+ SELECT * INTO locked_operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR locked_operation IS DISTINCT FROM operation THEN
+ RAISE EXCEPTION 'Exact durable original Account acknowledgement receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_required';
+ END IF;
+ SELECT * INTO locked_receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = requested_request_id FOR UPDATE;
+ IF NOT FOUND OR locked_receipt IS DISTINCT FROM receipt THEN
+ RAISE EXCEPTION 'Exact durable original Account acknowledgement receipt required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_required';
+ END IF;
+
+ -- Bounded observation checks current WAL coverage only. It creates no marker, forces no flush,
+ -- consults no new clock, and never changes the original committed_before_ms or expiry.
+ FOR observation IN 1..50 LOOP
+ flush_fence := pg_current_wal_flush_lsn();
+ EXIT WHEN flush_fence IS NOT NULL AND flush_fence >= insert_fence;
+ IF observation = 50 THEN
+ RAISE EXCEPTION 'Original Account acknowledgement receipt WAL coverage unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_wal_coverage',
+ DETAIL = format('snapshot=%s own_xid_if_assigned=%s finalization_xid=%s receipt_xid=%s insert_fence=%s initial_flush=%s final_flush=%s unchanged_expiry_ms=%s',
+ fixed_snapshot, own_xid, operation.finalization_xid, receipt.receipt_xid,
+ insert_fence, initial_flush_fence, flush_fence, operation.expires_at_ms);
+ END IF;
+ PERFORM pg_sleep(0.01);
+ END LOOP;
+ RETURN NEXT receipt;
+END;
+$$;
+-- [jooq ignore stop]
diff --git a/services/account-service/src/main/resources/db/migration/V145__retire_experimental_admission_confirmation_writes.sql b/services/account-service/src/main/resources/db/migration/V145__retire_experimental_admission_confirmation_writes.sql
new file mode 100644
index 0000000000..ae140c93e9
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V145__retire_experimental_admission_confirmation_writes.sql
@@ -0,0 +1,26 @@
+-- Retire only the unwired V120 fresh temporal-confirmation writer. Retained rows, its historical
+-- independent durability reader and immutable guards remain unchanged. V120 original-finalizer
+-- XID/binding stamps and V121 pending fences are still required by genuine V122 ACK receipts.
+-- [jooq ignore start]
+CREATE FUNCTION account_gameplay_admission_confirmation_writes_retired()
+RETURNS TRIGGER LANGUAGE plpgsql AS $$
+BEGIN
+ RAISE EXCEPTION 'Experimental Account admission confirmation writes are retired'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_writes_retired';
+END;
+$$;
+
+-- PostgreSQL executes same-event triggers by name: deny before the old INSERT proof guard.
+CREATE TRIGGER account_admission_confirmation_00_retired_insert
+ BEFORE INSERT ON account_gameplay_admission_commit_confirmations FOR EACH ROW
+ EXECUTE FUNCTION account_gameplay_admission_confirmation_writes_retired();
+
+CREATE OR REPLACE FUNCTION account_gameplay_admission_confirm_committed(
+ requested_request_id UUID, expected_sha TEXT, expected_decision UUID)
+RETURNS SETOF account_gameplay_admission_commit_confirmations LANGUAGE plpgsql AS $$
+BEGIN
+ RAISE EXCEPTION 'Experimental Account admission confirmation writes are retired'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_confirmation_writes_retired';
+END;
+$$;
+-- [jooq ignore stop]
diff --git a/services/account-service/src/main/resources/db/migration/V146__account_original_ack_pg18_fresh_insert.sql b/services/account-service/src/main/resources/db/migration/V146__account_original_ack_pg18_fresh_insert.sql
new file mode 100644
index 0000000000..437e9ba23b
--- /dev/null
+++ b/services/account-service/src/main/resources/db/migration/V146__account_original_ack_pg18_fresh_insert.sql
@@ -0,0 +1,152 @@
+-- Converge only the fresh original-ACK receipt insertion guard to PostgreSQL 18. Historical
+-- readDurably recovery remains fenced to its existing PostgreSQL 16 contract and is not widened.
+-- [jooq ignore start]
+DO $migration$
+DECLARE
+ guard_definition TEXT;
+ reader_definition TEXT;
+ guard_oid REGPROCEDURE := to_regprocedure(
+ 'account_gameplay_admission_original_ack_receipt_guard()');
+BEGIN
+ IF current_setting('server_version_num')::integer < 180000
+ OR current_setting('server_version_num')::integer >= 190000 THEN
+ RAISE EXCEPTION 'PostgreSQL 18 required for Account fresh original-ACK insert convergence';
+ END IF;
+ IF guard_oid IS NULL THEN
+ RAISE EXCEPTION 'Account original-ACK insert guard missing before V139';
+ END IF;
+ SELECT pg_get_functiondef(guard_oid) INTO guard_definition;
+ IF guard_definition IS NULL
+ OR position('version_num < 160000 OR version_num >= 170000' IN guard_definition) = 0
+ OR position('account_admission_original_ack_receipt_durable_primary' IN guard_definition) = 0
+ OR position('pg_xact_status(locked_operation.finalization_xid::xid8)' IN guard_definition) = 0
+ OR position('account_gameplay_admission_original_commit_ack_receipts' IN guard_definition) = 0
+ OR NOT EXISTS (
+ SELECT 1 FROM pg_trigger
+ WHERE tgname = 'account_admission_original_ack_receipt_guard'
+ AND tgfoid = guard_oid AND NOT tgisinternal) THEN
+ RAISE EXCEPTION 'Account V122 original-ACK insert guard drifted before V139';
+ END IF;
+ SELECT pg_get_functiondef(
+ to_regprocedure('account_gameplay_admission_read_original_ack_receipt_durably(uuid,text,uuid)'))
+ INTO reader_definition;
+ IF reader_definition IS NULL
+ OR position('current_setting(''server_version_num'')::integer < 160000' IN reader_definition) = 0
+ OR position('current_setting(''server_version_num'')::integer >= 170000' IN reader_definition) = 0
+ OR position('Supported durable PostgreSQL 16 primary required for Account acknowledgement receipt read' IN reader_definition) = 0 THEN
+ RAISE EXCEPTION 'Account V122 historical original-ACK reader drifted before V139';
+ END IF;
+END;
+$migration$;
+
+CREATE OR REPLACE FUNCTION account_gameplay_admission_original_ack_receipt_guard()
+RETURNS TRIGGER LANGUAGE plpgsql AS $$
+DECLARE
+ operation account_gameplay_admission_lease_operations%ROWTYPE;
+ locked_operation account_gameplay_admission_lease_operations%ROWTYPE;
+ receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ locked_receipt account_gameplay_admission_original_commit_ack_receipts%ROWTYPE;
+ own_xid TEXT;
+ finalization_status TEXT;
+ version_num INTEGER;
+BEGIN
+ IF TG_OP IN ('DELETE', 'TRUNCATE') THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt is immutable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_immutable';
+ END IF;
+ IF TG_OP <> 'INSERT' THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt is immutable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_immutable';
+ END IF;
+ IF NEW.schema_version IS DISTINCT FROM 1
+ OR NEW.account_uuid IS NOT NULL OR NEW.lease_id IS NOT NULL
+ OR NEW.lease_fence IS NOT NULL OR NEW.expires_at_ms IS NOT NULL
+ OR NEW.receipt_xid IS NOT NULL THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt binding is database derived'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_db_binding';
+ END IF;
+ IF current_setting('transaction_isolation') IS DISTINCT FROM 'serializable'
+ OR current_setting('transaction_read_only') IS DISTINCT FROM 'off' THEN
+ RAISE EXCEPTION 'Writable SERIALIZABLE Account acknowledgement receipt transaction required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_transaction_required';
+ END IF;
+ version_num := current_setting('server_version_num')::integer;
+ IF version_num < 180000 OR version_num >= 190000
+ OR pg_is_in_recovery() OR current_setting('fsync') IS DISTINCT FROM 'on' THEN
+ RAISE EXCEPTION 'Supported durable PostgreSQL 18 primary required for Account acknowledgement receipt'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_durable_primary';
+ END IF;
+
+ -- The request lookup only discovers the owning Account. All locked reads follow Account first.
+ SELECT * INTO operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = NEW.request_id;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement operation missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_operation_required';
+ END IF;
+ PERFORM 1 FROM accounts WHERE account_uuid = operation.account_uuid FOR UPDATE;
+ IF NOT FOUND THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement owner missing'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_owner_required';
+ END IF;
+ SELECT * INTO locked_operation FROM account_gameplay_admission_lease_operations
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_operation IS DISTINCT FROM operation
+ OR locked_operation.status IS DISTINCT FROM 'COMMITTED'
+ OR locked_operation.finalization_xid IS NULL
+ OR NEW.evidence_sha256 IS DISTINCT FROM locked_operation.evidence_sha256
+ OR NEW.binding_decision_id IS DISTINCT FROM locked_operation.binding_decision_id
+ OR NEW.finalization_xid IS DISTINCT FROM locked_operation.finalization_xid
+ OR NEW.committed_before_ms <= 0
+ OR NEW.committed_before_ms >= locked_operation.expires_at_ms THEN
+ RAISE EXCEPTION 'Exact original Account COMMIT acknowledgement required'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_binding_required';
+ END IF;
+
+ SELECT * INTO receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = NEW.request_id;
+ IF FOUND THEN
+ SELECT * INTO locked_receipt FROM account_gameplay_admission_original_commit_ack_receipts
+ WHERE request_id = NEW.request_id FOR UPDATE;
+ IF NOT FOUND OR locked_receipt IS DISTINCT FROM receipt
+ OR receipt.schema_version IS DISTINCT FROM 1
+ OR receipt.account_uuid IS DISTINCT FROM locked_operation.account_uuid
+ OR receipt.lease_id IS DISTINCT FROM locked_operation.lease_id
+ OR receipt.lease_fence IS DISTINCT FROM locked_operation.lease_fence
+ OR receipt.evidence_sha256 IS DISTINCT FROM locked_operation.evidence_sha256
+ OR receipt.binding_decision_id IS DISTINCT FROM locked_operation.binding_decision_id
+ OR receipt.expires_at_ms IS DISTINCT FROM locked_operation.expires_at_ms
+ OR receipt.finalization_xid IS DISTINCT FROM locked_operation.finalization_xid
+ OR receipt.committed_before_ms IS DISTINCT FROM NEW.committed_before_ms THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt retry conflicts'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_conflict';
+ END IF;
+ -- An exact retained ACK retry never rewrites or restamps the original receipt.
+ RETURN NULL;
+ END IF;
+
+ own_xid := pg_current_xact_id()::text;
+ IF own_xid = locked_operation.finalization_xid THEN
+ RAISE EXCEPTION 'Original Account COMMIT acknowledgement receipt requires independent transaction'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_independent';
+ END IF;
+ BEGIN
+ finalization_status := pg_xact_status(locked_operation.finalization_xid::xid8);
+ EXCEPTION WHEN OTHERS THEN
+ RAISE EXCEPTION 'Original Account finalization status unavailable'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_finalization_unavailable';
+ END;
+ IF finalization_status IS DISTINCT FROM 'committed' THEN
+ RAISE EXCEPTION 'Original Account finalization is not independently committed'
+ USING ERRCODE = '23514', CONSTRAINT = 'account_admission_original_ack_receipt_independent';
+ END IF;
+
+ NEW.account_uuid := locked_operation.account_uuid;
+ NEW.lease_id := locked_operation.lease_id;
+ NEW.lease_fence := locked_operation.lease_fence;
+ NEW.expires_at_ms := locked_operation.expires_at_ms;
+ NEW.receipt_xid := own_xid;
+ RETURN NEW;
+END;
+$$;
+-- [jooq ignore stop]
diff --git a/services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionProtectedEntryPrototypeIntegrationTest.java b/services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionProtectedEntryPrototypeIntegrationTest.java
new file mode 100644
index 0000000000..3f9823683d
--- /dev/null
+++ b/services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayAdmissionProtectedEntryPrototypeIntegrationTest.java
@@ -0,0 +1,1065 @@
+package net.firedevops.firemud.accountservice.repository;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import integration.net.firedevops.firemud.accountservice.repository.AccountPostgresIntegrationFixture;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.time.Instant;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import net.firedevops.firemud.accountservice.entity.Account;
+import net.firedevops.firemud.accountservice.repository.AccountGameplayAdmissionOriginalCommitExecutor.OriginalCommitAcknowledgement;
+import net.firedevops.firemud.common.account.admission.AccountGameplayAdmissionLeaseEvidence;
+import org.flywaydb.core.Flyway;
+import org.jooq.DSLContext;
+import org.jooq.SQLDialect;
+import org.jooq.impl.DSL;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
+import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
+import org.springframework.transaction.TransactionDefinition;
+import org.springframework.transaction.support.TransactionTemplate;
+
+/**
+ * PostgreSQL 18 proof for fresh original-ACK storage only.
+ *
+ *
Tests exercise the original operation's physical COMMIT, its opaque pre-expiry
+ * acknowledgement, and a separate physical receipt COMMIT. PostgreSQL 18 does not enable the
+ * retained historical durability reader or lost-acknowledgement recovery. SQL and JVM storage proof
+ * establish no authentication, current ownership, admission, production privilege adoption, or
+ * gameplay.
+ */
+@Execution(ExecutionMode.SAME_THREAD)
+class AccountGameplayAdmissionProtectedEntryPrototypeIntegrationTest {
+ private static final AccountPostgresIntegrationFixture POSTGRES =
+ new AccountPostgresIntegrationFixture(true);
+
+ @BeforeAll
+ static void startPostgres() {
+ POSTGRES.start();
+ }
+
+ @AfterAll
+ static void stopPostgres() {
+ POSTGRES.stop();
+ }
+
+ private static final String TENANT = "22222222-2222-4222-8222-222222222222";
+ private static final String OTHER = "33333333-3333-4333-8333-333333333333";
+ private static final String RECEIPTS = "account_gameplay_admission_original_commit_ack_receipts";
+
+ @Test
+ void coldGenuineAcknowledgedFinalizationPersistsExactProofWithoutAuxiliaryWrites() {
+ var context = context();
+ var ack = finalized(context, 15000);
+ var receipt =
+ new AccountGameplayAdmissionOriginalAckReceiptCommitExecutor(context.admin()).confirm(ack);
+ var scope = (Map, ?>) ack.evidence().carrier().get("bindingScope");
+ assertThat(receipt.schemaVersion()).isEqualTo((short) 1);
+ assertThat(receipt.requestId()).isEqualTo(request(ack.evidence()));
+ assertThat(receipt.accountId()).isEqualTo(UUID.fromString((String) scope.get("accountId")));
+ assertThat(receipt.leaseId())
+ .isEqualTo(UUID.fromString((String) ack.evidence().carrier().get("leaseId")));
+ assertThat(receipt.leaseFence()).isEqualTo(ack.evidence().leaseFence().longValueExact());
+ assertThat(receipt.evidenceSha256()).isEqualTo(ack.evidence().sha256());
+ assertThat(receipt.bindingDecisionId()).isEqualTo(ack.decisionId());
+ assertThat(receipt.finalizationXid()).isEqualTo(ack.finalizationXid());
+ assertThat(receipt.committedBeforeMs()).isEqualTo(ack.committedBeforeMs());
+ assertThat(ack.committedBeforeMs()).isLessThan(expiry(ack));
+ assertThat(receipt.expiresAtMs()).isEqualTo(expiry(ack));
+ assertThat(receipt.receiptXid()).isNotEqualTo(ack.finalizationXid());
+ assertThat(receipt.operation().evidence()).isEqualTo(ack.evidence());
+ assertThat(context.dsl().fetchCount(DSL.table(RECEIPTS))).isOne();
+ assertThatThrownBy(
+ () ->
+ context
+ .dsl()
+ .fetch(
+ "SELECT * FROM account_gameplay_admission_confirm_committed(?, ?, ?)",
+ request(ack.evidence()),
+ ack.evidence().sha256(),
+ ack.decisionId()))
+ .hasMessageContaining("Experimental Account admission confirmation writes are retired");
+ assertThat(
+ context.dsl().fetchCount(DSL.table("account_gameplay_admission_commit_confirmations")))
+ .isZero();
+ }
+
+ @Test
+ void catalogChurnBeforeOriginalCommitPreservesGenuineAcknowledgedFinalization() {
+ var context = context();
+ for (int index = 0; index < 30; index++) {
+ context.dsl().execute("CREATE TABLE retired_entry_catalog_" + index + "(id integer)");
+ context.dsl().execute("DROP TABLE retired_entry_catalog_" + index);
+ }
+ var ack = finalized(context, 15000);
+ var receipt =
+ new AccountGameplayAdmissionOriginalAckReceiptCommitExecutor(context.admin()).confirm(ack);
+ assertThat(receipt.finalizationXid()).isEqualTo(ack.finalizationXid());
+ assertThat(receipt.committedBeforeMs()).isEqualTo(ack.committedBeforeMs());
+ assertThat(receipt.expiresAtMs()).isEqualTo(expiry(ack));
+ }
+
+ @Test
+ void concurrentGenuineAckCreatorsRetainOneExactWinnerWithoutRestamping() throws Exception {
+ var context = context();
+ var ack = finalized(context, 15000);
+ var original = operation(context, ack.evidence());
+ var sources = sourceSnapshot(context);
+ var start = new CountDownLatch(1);
+ java.util.concurrent.Callable