From ec38ff3b6ae415b7a1899adad9cba177f63c2a75 Mon Sep 17 00:00:00 2001
From: Ben Hook <5009589+benhook1013@users.noreply.github.com>
Date: Sun, 11 Oct 2026 09:11:41 +1300
Subject: [PATCH 01/19] feat(account): preserve passive private LOGIN issuance
and recovery foundation
---
.../account-service/api-contracts.md | 2 +
.../account-service/runtime-and-data.md | 2 +
design/project-management/ai-observations.md | 6 +
.../player-access-and-session.md | 4 +
.../dto/AccountAuthEvidenceBundle.java | 808 ++++++
.../AccountGameplayTokenIdentityFence.java | 80 +
.../dto/CanonicalGameplayLoginRequest.java | 30 +
.../dto/GameplayCredentialSourceContext.java | 30 +
.../dto/InitialGameplayLoginResult.java | 259 ++
.../AccountAuthEvidenceBundleRepository.java | 682 +++++
...tGameplayDelegationIssuanceRepository.java | 2534 +++++++++++++++++
...yDelegationResponseEnvelopeRepository.java | 1380 +++++++++
...tGameplayTokenIdentityFenceRepository.java | 245 ++
...ountGenerationProjectionRedisContract.java | 143 +
...tionProjectionRedisScriptContribution.java | 56 +
...rrentGenerationProjectionRedisSupport.java | 183 ++
.../AccountGameplayCanonicalLoginOwner.java | 273 ++
...eplayCredentialRequestDigestKeySource.java | 49 +
...ountGameplayCredentialRequestDigester.java | 100 +
...GameplayDelegationAuthorityProjection.java | 575 +++-
...eplayDelegationCommittedIssuanceOwner.java | 455 +++
...meplayDelegationIssuanceCommitService.java | 436 +++
.../AccountGameplayDelegationRedisClient.java | 1504 ++++++++++
...playDelegationRedisScriptContribution.java | 78 +
...playDelegationResponseEnvelopeService.java | 48 +
...meplayDelegationResponseRecoveryOwner.java | 118 +
.../AccountGameplayDelegationSigner.java | 1556 ++++++++++
...ccountGameplayDelegationTokenRegistry.java | 236 ++
...ntedGameplayCredentialDigestKeySource.java | 335 +++
...ntSelectedGameplayAuthorityProjection.java | 226 ++
...on.redis.contracts.RedisScriptContribution | 2 +
...__account_gameplay_delegation_issuance.sql | 273 ++
.../V148__account_auth_evidence_bundles.sql | 374 +++
...gameplay_delegation_encrypted_response.sql | 124 +
...gameplay_delegation_committed_issuance.sql | 352 +++
...account_gameplay_token_identity_fences.sql | 85 +
...eplay_login_credential_request_binding.sql | 87 +
...lay_delegation_decimal_source_versions.sql | 138 +
...unt_auth_evidence_checkpoint_key_count.sql | 230 ++
...ount_auth_evidence_shared_issuer_guard.sql | 232 ++
...nt_gameplay_commit_bundle_source_fence.sql | 309 ++
...gameplay_authority_shared_issuer_guard.sql | 140 +
.../account_generation_projection_cas.lua | 54 +
...-session-delegation-activate-committed.lua | 62 +
...e-session-delegation-authority-project.lua | 127 +
...me-session-delegation-pending-register.lua | 39 +
...session-delegation-activate-committed.json | 36 +
...n-delegation-authority-project-issuer.json | 32 +
...e-session-delegation-pending-register.json | 34 +
.../account-generation-projection-cas.json | 34 +
...cted-membership-generation-projection.json | 34 +
...selected-tenant-generation-projection.json | 34 +
...denceBundlePersistenceIntegrationTest.java | 549 ++++
...ionIssuancePersistenceIntegrationTest.java | 2490 ++++++++++++++++
...nseEnvelopePersistenceIntegrationTest.java | 580 ++++
...nseRecoveryPersistenceIntegrationTest.java | 470 +++
...GameplayDelegationCommitSignerFixture.java | 621 ++++
...ameplayDelegationRedisIntegrationTest.java | 1708 +++++++++++
.../dto/AccountAuthEvidenceBundleTest.java | 371 +++
.../dto/InitialGameplayLoginResultTest.java | 183 ++
...countAuthEvidenceBundleRepositoryTest.java | 159 ++
...eplayDelegationIssuanceRepositoryTest.java | 880 ++++++
...egationResponseEnvelopeRepositoryTest.java | 1076 +++++++
...eplayTokenIdentityFenceRepositoryTest.java | 291 ++
...GenerationProjectionRedisContractTest.java | 173 ++
...ccountGameplayCanonicalLoginOwnerTest.java | 594 ++++
...GameplayCredentialRequestDigesterTest.java | 188 ++
...playDelegationAuthorityProjectionTest.java | 698 +++++
...yDelegationCommittedIssuanceOwnerTest.java | 265 ++
...ayDelegationIssuanceCommitServiceTest.java | 154 +
...ountGameplayDelegationRedisClientTest.java | 861 ++++++
...DelegationResponseEnvelopeServiceTest.java | 93 +
...ayDelegationResponseRecoveryOwnerTest.java | 229 ++
.../AccountGameplayDelegationSignerTest.java | 1450 ++++++++++
...layDelegationSignerTestFixtureFactory.java | 47 +
...ntGameplayDelegationTokenRegistryTest.java | 475 +++
...GameplayCredentialDigestKeySourceTest.java | 256 ++
...countResponseEnvelopeCryptographyTest.java | 348 +++
.../AccountResponseEnvelopeKeyringTest.java | 153 +
...lectedGameplayAuthorityProjectionTest.java | 217 ++
80 files changed, 30840 insertions(+), 4 deletions(-)
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountAuthEvidenceBundle.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountGameplayTokenIdentityFence.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/CanonicalGameplayLoginRequest.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/GameplayCredentialSourceContext.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/InitialGameplayLoginResult.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountAuthEvidenceBundleRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationIssuanceRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationResponseEnvelopeRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountGameplayTokenIdentityFenceRepository.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountGenerationProjectionRedisContract.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/AccountGenerationProjectionRedisScriptContribution.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/CurrentGenerationProjectionRedisSupport.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayCanonicalLoginOwner.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayCredentialRequestDigestKeySource.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayCredentialRequestDigester.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationCommittedIssuanceOwner.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationIssuanceCommitService.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationRedisClient.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationRedisScriptContribution.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationResponseEnvelopeService.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationResponseRecoveryOwner.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationSigner.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationTokenRegistry.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountMountedGameplayCredentialDigestKeySource.java
create mode 100644 services/account-service/src/main/java/net/firedevops/firemud/accountservice/service/session/AccountSelectedGameplayAuthorityProjection.java
create mode 100644 services/account-service/src/main/resources/META-INF/services/net.firedevops.firemud.common.redis.contracts.RedisScriptContribution
create mode 100644 services/account-service/src/main/resources/db/migration/V147__account_gameplay_delegation_issuance.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V148__account_auth_evidence_bundles.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V149__account_gameplay_delegation_encrypted_response.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V150__account_gameplay_delegation_committed_issuance.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V151__account_gameplay_token_identity_fences.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V152__account_gameplay_login_credential_request_binding.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V153__account_gameplay_delegation_decimal_source_versions.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V154__account_auth_evidence_checkpoint_key_count.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V155__account_auth_evidence_shared_issuer_guard.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V156__account_gameplay_commit_bundle_source_fence.sql
create mode 100644 services/account-service/src/main/resources/db/migration/V157__account_gameplay_authority_shared_issuer_guard.sql
create mode 100644 services/account-service/src/main/resources/redis/account_generation_projection_cas.lua
create mode 100644 services/account-service/src/main/resources/redis/lua/account-game-session-delegation-activate-committed.lua
create mode 100644 services/account-service/src/main/resources/redis/lua/account-game-session-delegation-authority-project.lua
create mode 100644 services/account-service/src/main/resources/redis/lua/account-game-session-delegation-pending-register.lua
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-game-session-delegation-activate-committed.json
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-game-session-delegation-authority-project-issuer.json
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-game-session-delegation-pending-register.json
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-generation-projection-cas.json
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-selected-membership-generation-projection.json
create mode 100644 services/account-service/src/main/resources/redis/scripts/account-selected-tenant-generation-projection.json
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountAuthEvidenceBundlePersistenceIntegrationTest.java
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationIssuancePersistenceIntegrationTest.java
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationResponseEnvelopePersistenceIntegrationTest.java
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationResponseRecoveryPersistenceIntegrationTest.java
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationCommitSignerFixture.java
create mode 100644 services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationRedisIntegrationTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/dto/AccountAuthEvidenceBundleTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/dto/InitialGameplayLoginResultTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountAuthEvidenceBundleRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationIssuanceRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayDelegationResponseEnvelopeRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/repository/AccountGameplayTokenIdentityFenceRepositoryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/AccountGenerationProjectionRedisContractTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayCanonicalLoginOwnerTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayCredentialRequestDigesterTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationCommittedIssuanceOwnerTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationIssuanceCommitServiceTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationRedisClientTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationResponseEnvelopeServiceTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationResponseRecoveryOwnerTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationSignerTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationSignerTestFixtureFactory.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountGameplayDelegationTokenRegistryTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountMountedGameplayCredentialDigestKeySourceTest.java
create mode 100644 services/account-service/src/test/java/unit/net/firedevops/firemud/accountservice/service/session/AccountSelectedGameplayAuthorityProjectionTest.java
diff --git a/design/architecture/microservices/account-service/api-contracts.md b/design/architecture/microservices/account-service/api-contracts.md
index cb49906801..fb68e2d35b 100644
--- a/design/architecture/microservices/account-service/api-contracts.md
+++ b/design/architecture/microservices/account-service/api-contracts.md
@@ -54,6 +54,8 @@ This target contract is not complete in the current service. The existing `secur
## Implementation Status
+The initial private gameplay LOGIN owner, signer, registry, and response-recovery code is present as unregistered Account source, with focused proof sources. This does not add or activate an API, proto method, or Spring composition; the source has no caller-selected profile or property override, and physical Redis/PostgreSQL, caller authorization, gameplay admission, and runtime activation remain unproved. See the [Player Access and Session tracker](../../../project-management/implementation-tracking/player-access-and-session.md#initial-private-gameplay-login-issuance-source-intake).
+
This Account source-currentness and first-JOIN persistence prerequisite builds on the authority-storage and retention-safety stage. V40 adds owner-proven fresh issuer/Account source baselines and complete transactional source-event hooks; the owner-local first-JOIN producer/coordinator composes immutable membership, event, audit, and terminal operation evidence. These primitives do not authenticate callers, supply the cross-service target-through-commit gate, add a public route, or wire current LOGIN/public JOIN/Game Session text JOIN. Validation of the reconciled source-currentness stage remains pending; inherited storage proof is not proof of these additions. #2898 and #2848 retain their runtime and recovery gaps.
Current explicit JOIN status: the local `/auth/bootstrap/join` controller and operation are implemented, but the exact Gateway path is blocked by its route guard and the route is absent from `publicOpenAPI`. Local policy-digest revalidation does not prove that the exact target remains valid through Account commit; the strict ADR 0025 commit gate remains incomplete. The canonical owner is [Runtime & Data](./runtime-and-data.md#membership-and-entitlement-authority), with the target contract in [ADR 0025](../../decisions/adr-0025-explicit-open-enrollment-membership.md).
diff --git a/design/architecture/microservices/account-service/runtime-and-data.md b/design/architecture/microservices/account-service/runtime-and-data.md
index a2ef64817f..9cf9b5b57f 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 now has an unregistered initial private gameplay LOGIN source slice for request-bound credential digests, signer and JWKS trust, pending and committed registry ownership, authority projection reads, and encrypted response recovery, with focused unit and Redis integration proof sources. It fixes the explicitly approved initial `game-session-account-delegation` profile and includes no caller-selected profile or property bypass. No new endpoint or runtime registration is included; physical PostgreSQL/Redis execution, consumer authorization, gameplay admission, and runtime activation remain unproved. See the [Player Access and Session tracker](../../../project-management/implementation-tracking/player-access-and-session.md#initial-private-gameplay-login-issuance-source-intake).
+
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.
diff --git a/design/project-management/ai-observations.md b/design/project-management/ai-observations.md
index ffe896b64f..89b5fe671e 100644
--- a/design/project-management/ai-observations.md
+++ b/design/project-management/ai-observations.md
@@ -102,6 +102,12 @@ Entry format:
- Expected pattern: require complete immutable publication membership before completion, and recover verified older partial unfinalized runs additively without replacing dispositions or inventing another round. Retain original and supplemental evidence together.
- Current status: the bounded controller repair passes focused local regression proof; trusted promotion and canonical live recovery remain separate steps, so the live missing finding is not yet confirmed recovered.
+- `2026-10-11`: Concurrent CI watchers can exhaust shared GitHub API quota
+ - Context: six native `gh run watch` processes in the Gameplay lane encountered the same REST rate limit while waiting for one candidate's checks.
+ - Observation: separate low-cost-looking watchers share one credential's API budget; multiplying short-interval reads can block artifact inspection and other workers' CI evidence collection.
+ - Expected pattern: use one quota-aware observation owner with bounded low-frequency consolidated reads across relevant exact heads, and back off until the reported reset. One helper launching six independent pollers is still prohibited fanout, not a single observer. Stop redundant local watchers without cancelling GitHub runs; continue safe local implementation and validation.
+ - Current status: the six distinct workflow watchers are stopped and the correction is recorded in the SQL job brief. Exact artifact qualification and CI completion remain separate evidence, not inferred from historical green runs.
+
- `2026-10-12`: Retrospective evidence needs source-clock provenance
- Context: a curated import of an independently completed review retained unknown review clocks but displayed generated recording timestamps as its start and finish.
- Observation: a storage default can create false chronology even when the immutable evidence accurately discloses missing clocks.
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 61d11e0429..4309044263 100644
--- a/design/project-management/implementation-tracking/player-access-and-session.md
+++ b/design/project-management/implementation-tracking/player-access-and-session.md
@@ -10,6 +10,10 @@ This is a non-normative implementation tracker for player access and session. Ca
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).
+### Initial private gameplay LOGIN issuance source intake
+
+Account now contains an unregistered initial private gameplay LOGIN source slice: request-bound credential digests, the canonical LOGIN owner, Account signing and JWKS trust sources, pending and committed issuance owners, bounded issuance repositories and DTOs with V147–V157 migrations, pinned Coordination Redis registry/projection scripts, and encrypted response-envelope recovery. It uses the explicit initial `game-session-account-delegation` profile only; caller-selected profile/property bypasses, new endpoints, Spring runtime registration, remote credential provisioning, and consumer activation are outside this cut. The existing mounted signer bundle retains its stronger Control-UI/readiness and callback-redaction behavior, while authority reads are added around the receiving canonical sourceVersion/issuanceFence projection encoder. Consolidated local Account/Common checks, jOOQ generation, migration-version checks, integration-source compilation, formatting, static analysis and documentation checks passed (135 tasks, 2m 21s). Account XML reports 1,152 unit cases with no failures/errors and four skips, plus 178 integration cases with no failures/errors and 175 skips; the skipped PostgreSQL/Redis cases are not physical execution proof. Physical PostgreSQL/Redis execution, caller authorization, gameplay admission, runtime activation, and end-to-end consumer proof are not claimed. See [Account Runtime and Data](../../architecture/microservices/account-service/runtime-and-data.md#implementation-status) and [Account API Contracts](../../architecture/microservices/account-service/api-contracts.md#implementation-status).
+
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
diff --git a/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountAuthEvidenceBundle.java b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountAuthEvidenceBundle.java
new file mode 100644
index 0000000000..54188382cf
--- /dev/null
+++ b/services/account-service/src/main/java/net/firedevops/firemud/accountservice/dto/AccountAuthEvidenceBundle.java
@@ -0,0 +1,808 @@
+package net.firedevops.firemud.accountservice.dto;
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
+import java.util.regex.Pattern;
+import net.firedevops.firemud.accountservice.entity.AccountIdentityProvenance;
+import net.firedevops.firemud.common.json.Rfc8785CanonicalJson;
+import net.firedevops.firemud.common.security.GameSessionAccountDelegationProfile;
+import tools.jackson.core.StreamReadFeature;
+import tools.jackson.core.type.TypeReference;
+import tools.jackson.databind.DeserializationFeature;
+import tools.jackson.databind.json.JsonMapper;
+
+/**
+ * Closed canonical Account-owned {@code account-auth-evidence-bundle/v1} value for the explicitly
+ * non-tenant Game Session-to-Account delegation.
+ *
+ *
This codec validates shape and canonical bytes only. It does not establish that owner source
+ * rows, event history, cutoff applicability, or the caller are authentic/current. The DTO itself is
+ * never proof; the Account repository must derive and persist it only from locked owner readback.
+ */
+public final class AccountAuthEvidenceBundle {
+ public static final String SCHEMA = "account-auth-evidence-bundle/v1";
+ // The existing Account response-envelope AEAD binding accepts at most 8 KiB for this value.
+ public static final int MAX_CANONICAL_BYTES = 8 * 1024;
+
+ private static final Pattern SHA256 = Pattern.compile("[0-9a-f]{64}");
+ private static final Pattern EVENT_DIGEST = Pattern.compile("sha256:[0-9a-f]{64}");
+ private static final Pattern UUID_TEXT =
+ Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}");
+ private static final Pattern V4_UUID_TEXT =
+ Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}");
+ private static final Pattern POSITIVE_DECIMAL = Pattern.compile("[1-9][0-9]{0,18}");
+ private static final Pattern NONNEGATIVE_DECIMAL = Pattern.compile("0|[1-9][0-9]{0,18}");
+ private static final Pattern POSITIVE_XID8 = Pattern.compile("[1-9][0-9]{0,19}");
+ private static final Pattern WORKLOAD =
+ Pattern.compile(
+ "^spiffe://firemud/ns/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?/sa/game-session-service$");
+
+ private static final Set ROOT_FIELDS =
+ Set.of(
+ "schema",
+ "bundleRef",
+ "snapshotIdentity",
+ "evaluationIdentity",
+ "issuer",
+ "profile",
+ "audience",
+ "scope",
+ "operation",
+ "tokenIdentity",
+ "authorityTuple",
+ "issuanceFence",
+ "membershipVersion",
+ "authoritySourceVersions",
+ "accountIdentitySource",
+ "outboxCheckpoints");
+ private static final Set BUNDLE_REF_FIELDS =
+ Set.of("bundleVersion", "sourceVersion", "sourceFence", "linearization");
+ private static final Set SCOPE_FIELDS = Set.of("kind", "accountId", "tenantIds");
+ private static final Set OPERATION_FIELDS =
+ Set.of(
+ "operationId",
+ "requestId",
+ "requestDigest",
+ "callerWorkload",
+ "callerContextId",
+ "accountId");
+ private static final Set TOKEN_IDENTITY_FIELDS =
+ Set.of("jti", "tokenGeneration", "iat", "nbf", "exp");
+ private static final Set AUTHORITY_TUPLE_FIELDS =
+ Set.of(
+ "issuerAuthGeneration",
+ "accountAuthorityGeneration",
+ "tenantAuthorityGeneration",
+ "membershipAuthorityGeneration",
+ "privateRealmGrantVersions");
+ private static final Set OPTIONAL_AUTHORITY_TUPLE_FIELDS =
+ Set.of("accountSecurityCutoff");
+ private static final Set AUTHORITY_SOURCE_VERSION_FIELDS =
+ Set.of("issuerSourceVersion", "accountSourceVersion", "issuanceFenceSourceVersion");
+ private static final Set ACCOUNT_IDENTITY_FIELDS =
+ Set.of("sourceRowId", "provenance", "sourceNumericId");
+ private static final Set OUTBOX_CHECKPOINT_FIELDS =
+ Set.of("outboxStreamKey", "outboxSequence", "sourceEventId", "sourceEventDigest");
+ private static final Set ZERO_OUTBOX_CHECKPOINT_FIELDS =
+ Set.of("outboxStreamKey", "outboxSequence");
+ private static final Set ACCOUNT_SECURITY_CUTOFF_FIELDS =
+ Set.of("accountAuthorityGeneration", "outboxStreamKey", "outboxSequence");
+ private static final String ISSUER = GameSessionAccountDelegationProfile.ISSUER;
+ private static final String PROFILE = GameSessionAccountDelegationProfile.PROFILE;
+ private static final String AUDIENCE = GameSessionAccountDelegationProfile.AUDIENCE;
+ private static final JsonMapper JSON =
+ JsonMapper.builder()
+ .enable(StreamReadFeature.STRICT_DUPLICATE_DETECTION)
+ .enable(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)
+ .build();
+
+ private final Map fields;
+ private final byte[] canonicalBytes;
+
+ private AccountAuthEvidenceBundle(Map fields, byte[] canonicalBytes) {
+ this.fields = immutableMap(fields);
+ this.canonicalBytes = canonicalBytes.clone();
+ }
+
+ /**
+ * Encodes the supplied closed value. This factory is not an authenticity boundary; production
+ * persistence must derive the values from locked owner readback and independently compare all
+ * source rows and event payloads.
+ */
+ public static AccountAuthEvidenceBundle fromOwnerEvaluation(OwnerEvaluation evaluation) {
+ Objects.requireNonNull(evaluation, "Account owner evaluation is required");
+ Map fields = fields(evaluation);
+ validateFields(fields);
+ return canonicalValue(fields);
+ }
+
+ /** Strictly parses the exact closed canonical bundle encoding. */
+ public static AccountAuthEvidenceBundle parseCanonical(byte[] value) {
+ if (value == null || value.length == 0 || value.length > MAX_CANONICAL_BYTES) {
+ throw invalid("Account auth-evidence bundle is absent or exceeds its byte bound");
+ }
+ String text = strictUtf8(value);
+ final Map parsed;
+ try {
+ parsed = JSON.readValue(text, new TypeReference<>() {});
+ } catch (RuntimeException ex) {
+ throw invalid("Account auth-evidence bundle JSON is malformed");
+ }
+ validateFields(parsed);
+ byte[] canonical = canonicalize(text);
+ if (!Arrays.equals(value, canonical)) {
+ throw invalid("Account auth-evidence bundle bytes are not canonical");
+ }
+ return new AccountAuthEvidenceBundle(parsed, canonical);
+ }
+
+ public byte[] canonicalBytes() {
+ return canonicalBytes.clone();
+ }
+
+ /** Lowercase SHA-256 digest of these exact canonical bytes. */
+ public String canonicalSha256() {
+ try {
+ return java.util.HexFormat.of()
+ .formatHex(java.security.MessageDigest.getInstance("SHA-256").digest(canonicalBytes));
+ } catch (java.security.NoSuchAlgorithmException ex) {
+ throw new IllegalStateException("SHA-256 is unavailable");
+ }
+ }
+
+ public Map fields() {
+ return immutableMap(fields);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return this == other
+ || other instanceof AccountAuthEvidenceBundle bundle
+ && Arrays.equals(canonicalBytes, bundle.canonicalBytes);
+ }
+
+ @Override
+ public int hashCode() {
+ return Arrays.hashCode(canonicalBytes);
+ }
+
+ @Override
+ public String toString() {
+ return "AccountAuthEvidenceBundle[redacted]";
+ }
+
+ private static Map fields(OwnerEvaluation evaluation) {
+ Map root = new LinkedHashMap<>();
+ root.put("schema", SCHEMA);
+ Map ref = new LinkedHashMap<>();
+ ref.put("bundleVersion", evaluation.bundleReference().bundleVersion());
+ ref.put("sourceVersion", evaluation.bundleReference().sourceVersion());
+ ref.put("sourceFence", evaluation.bundleReference().sourceFence());
+ ref.put("linearization", evaluation.bundleReference().linearization());
+ root.put("bundleRef", ref);
+ root.put("snapshotIdentity", evaluation.snapshotIdentity());
+ root.put("evaluationIdentity", evaluation.evaluationIdentity());
+ root.put("issuer", ISSUER);
+ root.put("profile", PROFILE);
+ root.put("audience", AUDIENCE);
+
+ Map scope = new LinkedHashMap<>();
+ scope.put("kind", "account");
+ scope.put("accountId", evaluation.accountId().toString());
+ scope.put("tenantIds", List.of());
+ root.put("scope", scope);
+
+ OperationIdentity operation = evaluation.operation();
+ Map operationFields = new LinkedHashMap<>();
+ operationFields.put("operationId", operation.operationId().toString());
+ operationFields.put("requestId", operation.requestId().toString());
+ operationFields.put("requestDigest", operation.requestDigest());
+ operationFields.put("callerWorkload", operation.callerWorkload());
+ operationFields.put("callerContextId", operation.callerContextId().toString());
+ operationFields.put("accountId", operation.accountId().toString());
+ root.put("operation", operationFields);
+
+ TokenIdentity token = evaluation.token();
+ Map tokenFields = new LinkedHashMap<>();
+ tokenFields.put("jti", token.jti().toString());
+ tokenFields.put("tokenGeneration", Long.toString(token.tokenGeneration()));
+ tokenFields.put("iat", token.issuedAtEpochSecond());
+ tokenFields.put("nbf", token.notBeforeEpochSecond());
+ tokenFields.put("exp", token.expiresAtEpochSecond());
+ root.put("tokenIdentity", tokenFields);
+
+ root.put("authorityTuple", deepCopyMap(evaluation.authorityTuple()));
+ root.put("issuanceFence", decimal(evaluation.issuanceFence()));
+ root.put("membershipVersion", Map.of());
+
+ AuthoritySourceVersions sourceVersions = evaluation.authoritySourceVersions();
+ Map versions = new LinkedHashMap<>();
+ versions.put("issuerSourceVersion", decimal(sourceVersions.issuerSourceVersion()));
+ versions.put("accountSourceVersion", decimal(sourceVersions.accountSourceVersion()));
+ versions.put(
+ "issuanceFenceSourceVersion", decimal(sourceVersions.issuanceFenceSourceVersion()));
+ root.put("authoritySourceVersions", versions);
+
+ AccountIdentitySource accountSource = evaluation.accountIdentitySource();
+ Map accountIdentity = new LinkedHashMap<>();
+ accountIdentity.put("sourceRowId", decimal(accountSource.sourceRowId()));
+ accountIdentity.put("provenance", accountSource.provenance().name());
+ accountIdentity.put("sourceNumericId", decimal(accountSource.sourceNumericId()));
+ root.put("accountIdentitySource", accountIdentity);
+
+ List