FireMUD Delivery Status

PR data refreshed

PR #3224 review history

Converge first-party receiving and retain protected LOGIN source

Unit 1A · identity, Account and public JOIN

Review rounds

Three-number pills mean: found (raw) / accepted here (useful) / routed

Hosted CodeRabbit6 completed
4/4/02/1/02/1/03/3/03/3/0
CLI CodeRabbit4 completed
3/2/04/2/08/7/02/2/0
Subagent Review2 completed
3/3/00/0/0

Recorded review history

Reviews and findings

  1. Hosted Review 1 CompletedRuntime 10m 16s
    Found: 6 Accepted: 6 Routed: 0
    1. CodeRabbit summary-only outside-diff finding 1 of 1 (aggregate; no individual detail)

      summary-only aggregate; provider supplied no individual detail

      • Accepted Valid: Account runtime/data245 contradicts current issueConnectToken fail-closed before membership/replay. Mark replay as target and current AUTH_UNAVAILABLE explicitly.
    2. Handle unreadable session records at every caller.Minor

      RedisSessionContextService now throws IllegalStateException instead of returning Optional.empty() when a retained record cannot be deserialized. The LOGIN and PLAY pre-checks catch this exception, but shared session-resolution paths do not.

      openLoggingContext resolves the session context during both afterConnectionEstablished and handleTextMessage. Those methods use try-with-resources without a catch, so an unreadable record can escape and fail connection setup or message processing. Recipient delivery and communication command handling also call the shared resolution services without handling the exception.

      Add fail-closed handling for these callers. Keep the failure scoped to the affected session or operation.

      • Accepted Valid: corrupt lookup can abort recipient iteration/TELL parsing and leak logging context on WebSocket setup. Scope typed unavailability denial to affected session/operation; preserve fail-closed behavior.
    3. Add one test where only the source-token exp bound rejects the context.Trivial

      Both signing rejections in this test use a 31-second lifetime, which is NOW_MILLIS to NOW_MILLIS + 31_000L. The lifetime > MAX_LIFETIME_MILLIS rule rejects both cases before the source-expiry rule has any effect. The name metadataPastSource does not match what the case tests. If someone removes the sourceExpiryMillis comparison in validateLifetime, this test still passes. The documented rule "must not exceed the source token's exp" then has no test.

      Add a case that keeps a valid 30-second envelope and uses a source that expires earlier.

      🧪 Proposed test addition

           var tooLongSource =
               new GatewayFirstPartyConnectContextEnvelope.GameplayConnectSource(
      @@
           assertThatThrownBy(
                   () ->
                       GatewayFirstPartyConnectContextEnvelope.sign(tooLongSource, metadata31, signingKey))
               .isInstanceOf(GatewayFirstPartyConnectContextEnvelope.VerificationException.class);
      +
      +    var earlyExpirySource =
      +        new GatewayFirstPartyConnectContextEnvelope.GameplayConnectSource(
      +            source.accountId(),
      +            source.tenantId(),
      +            source.realmId(),
      +            source.worldSlug(),
      +            source.realmSlug(),
      +            source.playableStateNamespaceId(),
      +            source.playableStateScope(),
      +            source.gameInstanceId(),
      +            source.pointerVersion(),
      +            source.catalogRevision(),
      +            source.connectScopeId(),
      +            source.requestId(),
      +            source.authorityTuple(),
      +            source.membershipVersion(),
      +            source.connectTokenJti(),
      +            source.replayAdmissionFence(),
      +            source.playtestLifecycleId(),
      +            source.playtestStateGeneration(),
      +            NOW_MILLIS / 1_000L + 10L);
      +    assertThatThrownBy(
      +            () ->
      +                GatewayFirstPartyConnectContextEnvelope.sign(
      +                    earlyExpirySource, metadata(), signingKey))
      +        .isInstanceOf(GatewayFirstPartyConnectContextEnvelope.VerificationException.class)
      +        .extracting("reason")
      +        .isEqualTo(GatewayFirstPartyConnectContextEnvelope.FailureReason.INVALID_LIFETIME);
      
      • Accepted Valid: both existing rejection cases exceed 30 seconds. Add valid-duration envelope bounded by earlier source expiry to isolate that invariant.
    4. Remove the duplicate requireRetained on the registry result.Trivial

      RedisFirstPartyConnectContextRegistry.find already returns contextService.requireRetained(context). Line 31 calls requireRetained again on that validated value. Each call does an RSA signature check and a canonical route read (routes.readCurrentTarget). The second call adds no safety, because the result is already current.

      The LOGIN and PLAY pre-checks run this resolution on every command for a parseable transport ID. WebSocket bootstrap runs parse, then requireRetained, then register, which calls requireRetained once or twice more. That adds owner reads on a hot path. The test firstPartyPlayRereadsCanonicalOwnerThenDeniesBeforeLegacyAdmissionEffects asserts atLeast(2) reads, so it stays valid if you remove this call.

      ♻️ Proposed change

      --- "a/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/FirstPartyConnectContextResolution.java"
      +++ "b/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/FirstPartyConnectContextResolution.java"
      @@ -26,9 +26,9 @@
             if (sessionContext != null && sessionContext.hasPartialPersistedFirstPartyConnectContext()) {
               return new FirstPartyConnectContextResolution(Optional.empty(), true);
             }
             if (registryContext.isPresent()) {
      -        FirstPartyConnectContext current =
      -            firstPartyConnectContextRegistry.requireRetained(registryContext.orElseThrow());
      +        // Registry.find already returns a freshly re-verified context.
      +        FirstPartyConnectContext current = registryContext.orElseThrow();
               if (persisted.isPresent() && !current.equals(persisted.orElseThrow())) {
                 return new FirstPartyConnectContextResolution(Optional.empty(), true);
               }
      

      If the interface should not assume that find validates its result, document that contract on FirstPartyConnectContextRegistry.find.

      • Accepted Valid: sole real Redis find implementation revalidates signature and owner route before returning. Document interface contract and avoid immediate duplicate, preserving persisted-only validation.
    5. Assert the denial with a check that can fail.Trivial

      Lines 1459-1461 compare FirstPartyReceivingFixture.ACCOUNT with context.accountId(). context is the fixture-built input, and the handler never changes it, so this assertion passes even if the handler is broken. The test name says the handler preserves account identity, but nothing checks what the handler does with that identity. Assert the handler output instead. For example, verify that firstPartyConnectContextRegistry.requireRetained(context) was called, and check that the result carries no account binding. Otherwise, remove the assertion.

      • Accepted Valid: unchanged input-account assertion is tautological. Assert actual validated registry lookup and existing denial/no effects; no account field exists on output.
    6. Lock the IPv6 canonical-address contract.Trivial

      The current Gateway client-IP path uses the uncompressed JDK form. This matches isCanonicalClientAddress, so RFC 5952 text is not a current mismatch. Document this form and add tests for an accepted uncompressed address such as 2001:db8:0:0:0:0:0:1 and a rejected compressed address such as 2001:db8::1. Update the producer and validator together if the format later changes.

      • Accepted Valid existing JDK IPv6 canonical wire form lacks explicit accepted/rejected coverage; preserve producer/validator behavior and document/test current form.
  2. Hosted Review 2 CompletedRuntime 10m 21s
    Found: 4 Accepted: 0/2/2 Routed: 0
    1. Document the registry-expiry recovery boundary.Trivial

      With the default settings, registry expiry does not provide a recovery window. The persisted fallback reparses the compact JWS, and the verifier rejects it when its envelope lifetime has ended. The fallback then returns an invalid resolution.

      If this boundary is intentional, document that retained-context recovery applies only while the signed envelope remains valid. If recovery must continue after registry expiry, define a separate authorized retention record and freshness rule; do not bypass envelope-expiry validation in requireRetained.

      • Accepted Document existing persisted recovery limit: requireRetained reparses and validates compact JWS lifetime. Registry loss does not extend envelope expiry; no retention or validation change.
    2. Use a message key that matches FIRST_PARTY_AUTHORITY_UNAVAILABLE.Minor

      The new failure sends error code FIRST_PARTY_AUTHORITY_UNAVAILABLE with message key error.play.connect-context-invalid. A localized renderer that resolves the key will show the "connect context invalid" text, which contradicts the error code. Clients using a localized locale, such as _fr, would get the wrong recovery text. Lines 229-237 repeat the same key.

      LoginCommandHandler sends the same code with no message key, because loginErrorMessageKey falls back to null. Add a dedicated key, such as error.play.first-party-authority-unavailable, to presentation-messages.properties and presentation-messages_fr.properties. As an alternative, pass null so the renderer uses the literal message.

      Proposed change

      --- "a/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/command/text/PlayCommandHandler.java"
      +++ "b/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/command/text/PlayCommandHandler.java"
      @@ -137,10 +137,10 @@
               if (resolution.connectContext().isPresent()) {
                 // Current canonical target is reread by resolution before legacy Account, roster or
                 // binding work.
                 return failure(
                     "FIRST_PARTY_AUTHORITY_UNAVAILABLE",
                     "First-party gameplay is unavailable",
      -              "error.play.connect-context-invalid",
      +              "error.play.first-party-authority-unavailable",
                     Map.of(),
                     "unknown",
                     null,
      
      • Accepted Verified first-party authority-unavailable response uses unrelated invalid-context localization. Use null message key for the correct literal unavailable message, preserving fail-closed behavior.
    3. Remove the second first-party check, which cannot be reached.Trivial

      If sessionId parses, the pre-check at Lines 124-153 already returns when a first-party context resolves or when resolution is invalid. If sessionId does not parse, resolveSessionContext has no valid session to return. As a result, this second resolve call only repeats a registry lookup and possibly a signature and owner read on every PLAY. selectDefaultRealm now always receives an empty connectContext, so its hint branch is also dead code. Remove the second resolution, or keep only a defensive assertion. Then simplify selectDefaultRealm.

      • Accepted Accept unreachable realm-hint cleanup only: present context returns before selectDefaultRealm. Retain second resolution as defensive reread because registry/session may change after the first check; add race regression.
    4. Do not report storage failures as CONNECT_CONTEXT_INVALID for ordinary text sessions.Minor

      The new pre-check runs for every parseable transport ID, including raw Telnet and trusted TCP Proxy sessions. These sessions have no first-party context. If findBySessionId throws SessionContextUnavailableException, or a Redis read fails, this catch returns CONNECT_CONTEXT_INVALID. That tells an ordinary client that its connect context is invalid, but the client never sent one. The error also does not tell the client to retry.

      Keep the fail-closed behavior, but return an unavailability code such as UNAVAILABLE for SessionContextUnavailableException and other storage errors. Keep CONNECT_CONTEXT_INVALID for resolution.invalid(). PlayCommandHandler Line 150 has the same mapping.

      Proposed change

      --- "a/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/command/text/LoginCommandHandler.java"
      +++ "b/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/command/text/LoginCommandHandler.java"
      @@ -108,9 +108,11 @@
                 }
                 return failure("FIRST_PARTY_AUTHORITY_UNAVAILABLE", "First-party login is unavailable");
               }
      -      } catch (RuntimeException invalidOrUnavailable) {
      -        return failure("CONNECT_CONTEXT_INVALID", "Connect context invalid");
      +      } catch (SessionContextUnavailableException unavailable) {
      +        return failure(AUTHENTICATION_UNAVAILABLE_CODE, "Authentication service unavailable");
      +      } catch (RuntimeException invalidOrUnavailable) {
      +        return failure("CONNECT_CONTEXT_INVALID", "Connect context invalid");
             }
           }
           Optional<TextCommandPayload.EmailLoginChallengeRequest> maybeChallengeRequest =
               command.emailLoginChallengePayload();
      
      • Accepted Verified initial session storage exceptions map to invalid context even for ordinary text transports. Return existing retryable authentication-unavailable result; explicit invalid-resolution denial remains.
  3. Hosted Review 3 CompletedRuntime 9m 54s
    Found: 2 Accepted: 0/0/1 Routed: 0
    1. Exclude gameplayRouteReadiness from the default readiness group.Major

      The shared Docker Compose healthcheck calls /actuator/health/readiness, and the Gateway uses that healthcheck. The default readiness group includes gameplayRouteReadiness, whose health() method always reports OUT_OF_SERVICE. The Gateway therefore remains unhealthy even when its non-gameplay routes are available.

      If a deployment uses this endpoint for readiness, the Gateway can also be removed from service rotation. Expose gameplay-route readiness in a separate health group.

      ♻️ Suggested configuration direction

      management:
        endpoint:
          health:
            group:
              readiness:
                include: readinessState
              gameplay:
                include: gameplayRouteReadiness
      
      • Rejected Canonical Gateway README Readiness/Liveness requires public readiness to represent gameplay admission safety. Account/replay/key qualification remains absent; excluding gameplayRouteReadiness would falsely advertise readiness. TCP Proxy listener readiness is separately scoped.
    2. Remove the unused accountId parameter from reusableBootstrapShell.Trivial

      PMD reports accountId as unused after the verified-context path was removed. Drop the parameter and update the call at Line 264.

      • Accepted Unused private accountId parameter is confirmed. Remove only it and its single call argument; existing Login behavior and tests remain, with focused validation.
  4. CLI Review 1 CompletedRuntime 3m 45s
    Found: 3 Accepted: 0/2/0 Routed: 0
    1. Check the new bootstrapSessionContext result in ensureBootstrapSessionContextIfMissing.Minor

      bootstrapSessionContext now returns false after it closes a first-party session with CONNECT_CONTEXT_INVALID. At Line 641, ensureBootstrapSessionContextIfMissing ignores that result, and handleTextMessage continues to interpreter.interpret(...) and sendProtocolMessage(...). This path is reachable when a first-party session context disappears after establishment. For example, takeover deletion or LOGOUT removes the context, and the next frame re-runs bootstrap after the signed context has expired. The handler then processes the frame on a transport it has just closed.

      Return the boolean from ensureBootstrapSessionContextIfMissing and stop processing when it is false. 🐛 Proposed fix

      -  private void ensureBootstrapSessionContextIfMissing(
      +  private boolean ensureBootstrapSessionContextIfMissing(
             WebSocketSession session, String transportSessionId) {
           if (!StringUtils.hasText(transportSessionId)) {
      -      return;
      +      return true;
           }
           ...
           if (tenantScopedContext.isPresent()) {
             sessionContextService.save(tenantScopedContext.orElseThrow());
      -      return;
      +      return true;
           }
      -    bootstrapSessionContext(session);
      +    return bootstrapSessionContext(session);
         }
      
      -      ensureBootstrapSessionContextIfMissing(session, sessionId);
      +      if (!ensureBootstrapSessionContextIfMissing(session, sessionId)) {
      +        return;
      +      }
      
      • Accepted handleTextMessage ignores failed rebootstrap after context loss and reaches interpreter/output after the first-party transport is closed. Propagate the existing boolean and stop processing; add focused regression.
    2. Confirm that a permanently OUTOFSERVICE indicator does not take the whole Gateway out of readiness.Major

      Confirm that a permanently `OUT_OF_SERVICE` indicator does not take the whole Gateway out of readiness.

      health() now always returns OUT_OF_SERVICE. The unchanged assertion in TcpProxyTlsListenerAdmissionIntegrationTest (lines 90-105) shows that gameplayRouteReadiness is part of the /actuator/health/readiness group, and that the aggregate is 503. Assume a Kubernetes readiness probe, or a load-balancer health check, targets /actuator/health/readiness. Then no Gateway pod ever becomes Ready. The cluster drops every Gateway route from service endpoints, including HTTP APIs and the trusted TCP Proxy path. The README describes the trusted TCP Proxy path as a separate boundary that stays available.

      Check the deployed probe paths and the management.endpoint.health.group.readiness membership. If the probe uses the readiness group, remove gameplayRouteReadiness from that group, or report it as a detail that does not gate the group. Keep it out until first-party admission is qualified.

      • Rejected Canonical Gateway README Readiness and Liveness explicitly scopes public readiness to gameplay admission safety and requires OUT_OF_SERVICE until Account/replay/key qualification. Dedicated TCP Proxy readiness is separate; excluding gameplay contradicts the owner contract.
    3. The current-state text misstates the character-discovery outcome for an INACTIVE membership.Minor

      Lines 57, 180, and 311 say three things:

      • On an eligible public-production target, only absent membership returns JOIN_REQUIRED.
      • Any present membership that does not admit gameplay is denied as CONNECT_TOKEN_REJECTED.
      • Line 311 adds that character-discovery consumers do not enforce the lifecycle state and do not classify INACTIVE.

      AccountServiceImpl.requireCurrentAdmissibleConnectScopeTarget does read getLifecycleState(). For a public-production realm with an INACTIVE membership, it returns one of two codes:

      • JOIN_REQUIRED when allowPublicJoin is true.
      • PUBLIC_PRODUCTION_ADMISSION_DENIED when allowPublicJoin is false.

      Only a non-INACTIVE membership that does not admit gameplay reaches CONNECT_TOKEN_REJECTED. The test listBootstrapCharactersClassifiesInactivePublicMembershipByJoinPolicy asserts this behavior. Correct the three statements so they match the implemented branch.

      📝 Suggested wording for line 311

      -Only an absent membership on an eligible public-production target may return `JOIN_REQUIRED`; a present non-admitting membership is denied as `CONNECT_TOKEN_REJECTED`. Character-discovery consumers do not yet enforce the emitted lifecycle state or authority generation, so that response is not classified as `INACTIVE`.
      +On an eligible public-production target, absent or `INACTIVE` membership returns `JOIN_REQUIRED` (or `PUBLIC_PRODUCTION_ADMISSION_DENIED` when public joining is disallowed); any other present non-admitting membership is denied as `CONNECT_TOKEN_REJECTED`. Character discovery does not yet enforce the emitted membership authority generation.
      

      As per path instructions: "Review docs for canonical-current-state consistency."

      Also applies to: 180-180, 311-311

      • Accepted Current character discovery explicitly classifies INACTIVE public membership by allowPublicJoin; the three current-state statements contradict the implementation and focused unit proof.
  5. Hosted Review 4 CompletedRuntime 8m 16s
    Found: 2 Accepted: 0/0/1 Routed: 0
    1. Remove the unused legacy admission helper.Trivial

      requireAdmissibleRealm has no caller in the repository. Remove it to avoid retaining partial legacy admission logic.

      -  private RuntimeRealmTarget requireAdmissibleRealm(
      -      BootstrapContext bootstrapContext,
      -      Long expectedTenantId,
      -      String worldSlug,
      -      String realmSlug) {
      -    RuntimeRealmTarget realm = requireRealmTarget(expectedTenantId, worldSlug, realmSlug);
      -    if (!hasRealmAdmissionAccess(bootstrapContext, realm)) {
      -      throw new AuthenticationException(
      -          "ADMISSION_POINTER_UNAVAILABLE",
      -          "Selected gameplay realm is no longer admissible; rerun realm discovery before retrying gameplay entry");
      -    }
      -    RuntimeEntitlementsDto entitlements =
      -        getTenantEntitlementsForRuntime(realm.tenantId(), "bootstrap-selected-target");
      -    if (!entitlements.gameplayAvailable()) {
      -      throw new AuthenticationException(
      -          "ADMISSION_POINTER_UNAVAILABLE",
      -          "Selected gameplay realm is no longer admissible; rerun realm discovery before retrying gameplay entry");
      -    }
      -    return realm;
      -  }
      -
      
      • Accepted Repository-wide search finds only the private requireAdmissibleRealm declaration after connect-token production was held. Removing this unused partial admission helper improves canonical convergence without changing the live realm/entitlement paths.
    2. Remove the extra blank lines in the new entry.Trivial

      Lines 99, 103, and 104 are blank lines marked as changed. Other entries use one blank line between entries and none between bullets. The extra lines make the entry inconsistent with the file's format, and the file is append-only.

      The content is consistent with the append-only rule and the entry format. It has a date, context, observation, expected pattern, and reconsideration trigger. Only the spacing needs correction.

      • Rejected Reviewed fc2 source has exactly one blank line between entries at99; lines100–104 are the heading and four contiguous nonblank bullets. Claimed internal blank lines103/104 do not exist. Preserve append-only content; no spacing correction needed.
  6. CLI Review 2 CompletedRuntime 3m 23s
    Found: 4 Accepted: 1/0/1 Routed: 0
    1. Add a non-sensitive failure category metric to parse.Trivial

      parse turns every RuntimeException into Optional.empty() and records nothing. The changed code reads three different sources: signature verification, the key source, and the canonical route reader. Operators cannot tell these failures apart:

      • KeySourceUnavailableException (the default bean always throws this).
      • An expired or forged token.
      • A ReadUnavailableException from the canonical owner.

      Each of these closes the client with CONNECT_CONTEXT_INVALID. Increment a counter that is tagged only with a fixed category, such as key_unavailable, invalid_envelope, owner_unavailable, or target_mismatch. Do not log the token or the exception message. [observability_hygiene]

      • Accepted Fixed non-sensitive failure categories materially distinguish key, envelope and canonical-owner outages without changing fail-closed client behavior. Inject Micrometer and prove finite tags; no token or dynamic identity logging.
    2. Make the ContextClaims constructor non-public, or validate the full schema in it.Trivial

      ContextClaims is a public record. Its canonical constructor checks only non-null IDs, the membershipVersion map, and positive timestamps. Any caller can construct a ContextClaims with an unchecked worldSlug, playableStateScope, canonicalClientAddress, or mismatched playtest fields. The record then looks the same as a verified claim set. The verified path is protected because VerifiedContext has a private constructor. But downstream Game Session code that accepts ContextClaims directly cannot tell whether the instance is verified. Two fixes are possible:

      • Keep the record public for reading, but make the canonical constructor validate the same invariants that fromMap enforces.
      • Expose claims only through VerifiedContext, with a private nested type or a package-private constructor.
      • Rejected ContextClaims is data, not the verified authority type. VerifiedContext constructor is private; FirstPartyConnectContext requires that wrapper and re-verifies retained bytes. Production claim constructors are internal decode/sign paths; no direct claims admission bypass exists.
    3. Return false from the generic bootstrap path when it closes the transport.Major

      bootstrapSessionContext always returns true after it calls bootstrapGenericSessionContext. That method can close the session at lines 728-731 through closeAdmissionPointerAuthorityUnavailable when listByRuntimeTarget throws. afterConnectionEstablished then registers the closed session at lines 167-168.

      Consequences:

      • InMemoryActiveTransportSessionRegistry.register uses put. The closed session replaces any incumbent transport that has the same transport ID.
      • The new unregister removes only the exact registered session. When the incumbent closes later, its unregister returns false. Its firstPartyConnectContextRegistry.unregister, promptBurstCoordinator.evict, and recordDisconnected(TRANSPORT_LOSS) cleanup is then skipped.
      • If the container runs afterConnectionClosed synchronously inside session.close, that callback runs before register. The closed session then stays registered with no later callback to remove it.

      The first-party path already returns false after it closes the session. Apply the same rule to the generic path.

      🐛 Proposed fix

      -    bootstrapGenericSessionContext(session, sessionId.orElseThrow());
      -    return true;
      +    return bootstrapGenericSessionContext(session, sessionId.orElseThrow());
      
        private boolean bootstrapGenericSessionContext(WebSocketSession session, long sessionId) {
          ...
          if (tenantId.isEmpty() || bootstrapGameInstanceId.isEmpty()) {
            return true;
          }
          ...
          } catch (RuntimeException ex) {
            logger.warn("Unable to resolve runtime pointer for generic bootstrap", ex);
            closeAdmissionPointerAuthorityUnavailable(session);
            return false;
          }
          ...
          return true;
        }
      

      Confirm whether the deployed servlet WebSocket container runs afterConnectionClosed synchronously during session.close(...) called from afterConnectionEstablished. The incumbent replacement happens in both cases.

      • Accepted Generic bootstrap can close on pointer authority failure yet report success, registering a closed transport over the incumbent or continuing interpretation. Propagate false and prove no registration/output on failure.
    4. Verify that a permanently down first-party indicator does not take the whole Gateway out of service.Major

      health() now always returns OUT_OF_SERVICE. TcpProxyTlsListenerAdmissionIntegrationTest shows that gameplayRouteReadiness is a member of the /actuator/health/readiness group: readiness returns 503 with this component OUT_OF_SERVICE.

      The previous probe could report UP when the local /ws/game upgrade succeeded. With this change, Gateway readiness can never succeed while first-party admission is unqualified. If the Kubernetes readiness probe targets /actuator/health/readiness, every Gateway pod stays out of its Service endpoints. That outage also covers the trusted TCP Proxy path and every non-gameplay API route, and GameplayHandshakeFilter still serves those paths.

      The intended "first-party unavailable" status belongs in a separate component that is not in the readiness group. Alternatively, exclude gameplayRouteReadiness from the readiness group until the prerequisites are qualified.

      Confirm the management.endpoint.health.group.readiness.include setting in the Gateway application.yml and the deployed readinessProbe path. Confirm that the deployed Gateway can still pass readiness with this indicator.

      • Rejected Canonical Gateway readiness explicitly gates public gameplay safety and stays OOS during held first-party qualification. Root1875 selects explicit held-admission proof, preserving that gate; excluding it contradicts current owner contract.
  7. Subagent Review 1 CompletedModel: gpt-6.1-sol · Medium
    Found: 3 Accepted: 3 Routed: 0
    1. Docker Compose status can outlive qualification deadlineMinor

      dev-tools/smoke/held_admission_qualification.py:310

      • Accepted subprocess.run without timeout can stall before its monotonic deadline is checked. Bound it by remaining time and fail through normal cleanup.
    2. Held endpoints lack run-owned Compose service bindingMinor

      dev-tools/smoke/held_admission_qualification.py:357

      • Accepted Loopback-only overrides can target another deployment and falsely attribute its denials to the claimed stack. Bind service ports using existing owner helper.
    3. Held smoke regression grep cannot match actual source wordingMajor

      dev-tools/tests/smoke-transport-contract.sh:1547

      • Accepted Exact lowercase contiguous grep cannot match capitalized split Python literals and makes the required contract fail. Fix assertion against emitted behavior.
  8. CLI Review 3 CompletedRuntime 3m 30s
    Found: 8 Accepted: 0/2/5 Routed: 0
    1. Confirm that permanent OUTOFSERVICE does not take every Gateway pod out of rotation.Major

      Confirm that permanent `OUT_OF_SERVICE` does not take every Gateway pod out of rotation.

      health() now always returns OUT_OF_SERVICE. The removed code tried a real WebSocket upgrade and could report UP. TcpProxyTlsListenerAdmissionIntegrationTest shows that gameplayRouteReadiness is part of the aggregate readiness group: /actuator/health/readiness returns 503 with $.status = OUT_OF_SERVICE. Suppose the Gateway Deployment uses /actuator/health/readiness as its Kubernetes readiness probe. Then no Gateway pod becomes Ready, and the Service sends no traffic to any Gateway route. That includes non-gameplay API routes and the trusted TCP Proxy /ws/game path, which GameplayHandshakeFilter still forwards.

      Verify which probe path the Gateway Deployment and the smoke environment use. If that path aggregates gameplayRouteReadiness, choose one fix:

      • Remove gameplayRouteReadiness from the readiness group and expose it as a separate health component.
      • Make the indicator report a non-blocking status for the disabled first-party capability.

      Either fix keeps the trusted TCP Proxy path and other routes available.

      • Rejected Repeated proposal contradicts canonical Gateway readiness/admission-safety owner and Root1875/8b held qualification. Public readiness stays OOS; exact held Gateway/Telnet refusals plus separate backend positive proof are required, not readiness exclusion.
    2. Remove the registry assertions that only check their own mock stubs.Trivial

      Each test calls find(...) on a mocked ActiveTransportSessionRegistry that it stubbed earlier to return the same session. So assertThat(registry.find(...)).contains(session) always passes and does not prove that the registration was kept. The adjacent verify(..., never()).unregister(...) already proves it.

      • services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/service/CommunicationRecipientDeliveryServiceTest.java#L390-L390: remove the find(42L) assertion, or use a real InMemoryActiveTransportSessionRegistry.
      • services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/service/PlayerOutputDeliveryServiceTest.java#L67-L67: remove the registry.find(41L) assertion.
      • services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/websocket/GameSessionWebSocketHandlerTest.java#L219-L220: remove the activeTransportSessionRegistry.find(41L) assertion. The register and unregister verifications at Lines 217-218 already prove the intended behavior.
      • Accepted Each cited find assertion reads its own stubbed mock and proves no preservation. Adjacent never-unregister/register verifications already prove interactions. Remove only three tautological assertions, preserve useful close/metric/transport checks.
    3. Update the stale AA-1.2 and AA-2.2 rows that this change contradicts.Minor

      The AA-2.1 row now states that /auth/connect-token returns AUTH_UNAVAILABLE before cached-success replay. The AA-1.2 row (Line 172) is unchanged and still states: "On fresh connect-token issuance/cache misses, issuance revalidates pointer/visibility/membership inputs, while cached-success replay returns before those fresh reads". The AA-2.2 row (Line 177) still states: "First-party LOGIN plus PLAY can replay retained context after deliberate logout". Line 247 now marks that behavior as historical. Line 180 also still states that connect-token issuance requires admitting membership. Capability Status rows are the "complete scan-first status surface". Align these rows with the fail-closed state.

      As per coding guidelines: "Keep its status, implementation record, validation, gaps, decisions, and service-map sections aligned when a domain boundary changes".

      • Accepted Verified stale AA membership/replay and logout capability rows contradict current fail-closed Account and first-party paths. Update only affected current-state clauses; preserve statuses, unrelated proof and target gaps.
    4. Remove the contradictory current replay-hit statement in Line 35.Minor

      Line 26 now states that the current Account connect-token surface fails closed. Line 35 is unchanged and still states that current connect-token issuance requires a fresh membership adapter response on a cache miss. It also states that a current session:connect-token:* replay hit can return a cached success. It further states that current issuance returns CONNECT_TOKEN_REJECTED for non-admitting membership. AccountServiceImpl.issueConnectToken now throws AUTH_UNAVAILABLE before any of these reads. Line 34 also describes "current replay-cache miss/hit behavior". The canonical authentication document therefore contradicts the Account runtime documents and the code. Update Lines 34–35 so that only text PLAY keeps the current membership-check description, and connect-token issuance is described as returning AUTH_UNAVAILABLE.

      As per path instructions: "Review docs for canonical-current-state consistency. Flag obsolete transitional guidance, conflicts between architecture docs".

      • Accepted Authentication lines34–35 still describe current connect-token replay/membership processing despite unconditional AUTH_UNAVAILABLE before those reads. Retain current text PLAY behavior, distinguish target-only issuance and remove obsolete replay-hit claims.
    5. Reuse one RSA key pair for all fixture instances.Trivial

      Each new FirstPartyReceivingFixture() generates a new 2048-bit RSA key pair. Many tests create the fixture: PlayCommandHandlerTest, GameSessionWebSocketHandlerTest, FirstPartyConnectContextServiceTest, FirstPartyConnectContextResolutionTest, and RedisMovementEffectIdempotencyServiceTest. RedisFirstPartyConnectContextRegistryTest creates it in a field initializer, so it runs once per test method. A lazily created static KeyPair keeps per-test isolation for the mocks and the meter registry and removes the repeated key generation.

      ♻️ Proposed change

      -  public FirstPartyReceivingFixture() {
      -    try {
      -      KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
      -      generator.initialize(2048);
      -      keys = generator.generateKeyPair();
      -    } catch (Exception failure) {
      -      throw new IllegalStateException(failure);
      -    }
      +  private static final class SharedKeys {
      +    private static final KeyPair KEYS = generate();
      +
      +    private static KeyPair generate() {
      +      try {
      +        KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
      +        generator.initialize(2048);
      +        return generator.generateKeyPair();
      +      } catch (Exception failure) {
      +        throw new IllegalStateException(failure);
      +      }
      +    }
      +  }
      +
      +  public FirstPartyReceivingFixture() {
      +    keys = SharedKeys.KEYS;
      
      • Accepted Fixture constructs a fresh2048RSA pair per instance across many tests. Reuse one lazy immutable test keypair while retaining instance mocks/metrics; no production key or cross-test mutable authority sharing.
    6. Parse IPv6 text as a literal only. Do not call InetAddress.getByName.Trivial

      InetAddress.getByName parses text as a numeric literal only when the first character is a hex digit or :. Other text that contains : (for example g:1 or host:80) falls through to name resolution. The result is a blocking DNS lookup in GatewayContextMetadata construction and in verify. The bad value is rejected afterward, but the lookup still adds latency and a network side effect on the request path. Today the risk is low because verify reaches this check only after the signature passes. The address is still Gateway-supplied input, so a literal-only parser is safer.

      Before you call getByName, reject any input that is not hex digits and colons. Another option is to use a literal-only parser such as Guava InetAddresses.forString or sun.net.util.IPAddressUtil.textToNumericFormatV6.

      ♻️ Proposed guard

           if (value.indexOf(':') >= 0) {
      +      for (int i = 0; i < value.length(); i++) {
      +        char c = value.charAt(i);
      +        if (c != ':' && Character.digit(c, 16) < 0) {
      +          return false;
      +        }
      +      }
             try {
               byte[] address = InetAddress.getByName(value).getAddress();
      
      • Accepted Colon branch calls getByName before excluding non-ASCII-hex input. Add minimal literal-character guard before that call, retaining16byte/mapped/canonical checks. No measured DNS lookup claim; no parallel schema/parser family.
    7. Remove the extra requireRetained call after parse.Trivial

      parse on line 762 has just verified the JWS, read the current canonical target, and matched it. requireRetained on line 772 runs parse again. firstPartyConnectContextRegistry.register on line 791 also calls requireRetained. As a result, one connection establishment does three RSA verifications and three CanonicalPlayerRouteReadService.readCurrentTarget owner reads for the same token.

      Use the result of parse directly. register still checks the context again at the registry boundary.

      ♻️ Proposed change

      -      FirstPartyConnectContext current =
      -          firstPartyConnectContextService.requireRetained(connectContext);
      +      FirstPartyConnectContext current = connectContext;
      
      • Accepted Immediate requireRetained follows successful parse with no intervening owner operation, duplicating verification. Use parsed context here; preserve registry register revalidation after Redis existing-session read so that boundary remains fresh.
    8. Remove the preserveConnectSelector parameter and the outdated comment.Trivial

      After this change, the only caller passes false. reusableBootstrapShell also rejects shells that carry a first-party context. As a result, authenticatedBootstrapContext always drops the selector, and bootstrapShell.firstPartyConnectContext() is always null.

      The comment above this call (lines 265-268) still says that a verified first-party connect context can keep its connect selector. That path no longer exists. Remove the parameter, pass null for both selector fields, and update the comment.

      • Accepted Only helper caller passes false and reusable shell rejects first-party context. Remove obsolete preserveConnectSelector argument/branches and stale comment, keep selector fields null and existing rejection.
  9. Hosted Review 5 CompletedRuntime 9m 00s
    Found: 3 Accepted: 0/3/0 Routed: 0
    1. Do not label every gRPC CANCELLED as CUSTODY_LOST.Minor

      failureCode maps every StatusRuntimeException with code CANCELLED to CUSTODY_LOST. CanonicalGameplayLoginAccountClient.invokeWithBoundedRetry throws CANCELLED in three cases:

      1. The custody guard fails.
      2. The caller's gRPC Context is cancelled.
      3. The Account transport returns CANCELLED, which passes through boundedTransportFailure.

      In cases 2 and 3, the presentation can still be current, but the outcome reports CUSTODY_LOST. This misclassifies cancellation by the caller or the transport as credential custody loss in the outcome and in any downstream diagnostics.

      Report CUSTODY_LOST only when custody is actually lost. One option is to pass the observed custody state into failureCode.

      🐛 Proposed fix

      --- "a/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/InitialGameplayLoginOwner.java"
      +++ "b/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/service/InitialGameplayLoginOwner.java"
      @@ -187,12 +187,12 @@
           if (failure instanceof CanonicalGameplayLoginResult.CredentialDecisionException decision) {
             return Optional.of(decision.code());
           }
      -    if (failure instanceof io.grpc.StatusRuntimeException transport) {
      -      if (transport.getStatus().getCode() == io.grpc.Status.Code.CANCELLED) {
      -        return Optional.of("CUSTODY_LOST");
      -      }
      -      return Optional.of(transport.getStatus().getCode().name());
      -    }
      +    if (failure instanceof io.grpc.StatusRuntimeException transport) {
      +      if (transport.getStatus().getCode() == io.grpc.Status.Code.CANCELLED && custodyLost) {
      +        return Optional.of("CUSTODY_LOST");
      +      }
      +      return Optional.of(transport.getStatus().getCode().name());
      +    }
           if (failure instanceof InitialGameplayLoginCredentialPresentation.CustodyLostException) {
             return Optional.of("CUSTODY_LOST");
           }
      

      Change the signature to failureCode(RuntimeException failure, boolean custodyLost). In cleanup(...), pass !credentials.isCurrent(), or pass a precomputed flag from receive.

      • Accepted Accepted: CANCELLED alone does not establish credential custody loss. Preserve caller/transport cancellation unless observed custody is lost.
    2. Unregister the first-party context when bootstrap fails after register.Minor

      Line 791 registers current in firstPartyConnectContextRegistry before Line 792 saves the shell. Suppose sessionContextService.save(shell) throws. In that case the catch blocks close the session or rethrow, but the registry entry stays in place. The transport was never added to activeTransportSessionRegistry. This means afterConnectionClosed gets false from unregister(sessionId, session) and returns before Line 184. As a result, nothing removes the leaked first-party entry.

      What happens next: a later ordinary transport with the same session ID sends LOGIN or PLAY. FirstPartyConnectContextResolution.resolve then finds the leaked registry context, so the session gets FIRST_PARTY_AUTHORITY_UNAVAILABLE or CONNECT_CONTEXT_INVALID until the registry entry expires.

      Remove the entry on any failure that happens after registration.

      Proposed fix

      --- "a/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/websocket/GameSessionWebSocketHandler.java"
      +++ "b/services/game-session-service/src/main/java/net/firedevops/firemud/gamesession/websocket/GameSessionWebSocketHandler.java"
      @@ -788,9 +788,18 @@
               closeInvalidFirstPartyContext(session);
               return false;
             }
      -      firstPartyConnectContextRegistry.register(sessionId, current);
      -      sessionContextService.save(shell);
      -      return true;
      +      firstPartyConnectContextRegistry.register(sessionId, current);
      +      try {
      +        sessionContextService.save(shell);
      +      } catch (RuntimeException saveFailure) {
      +        try {
      +          firstPartyConnectContextRegistry.unregister(sessionId);
      +        } catch (RuntimeException cleanupFailure) {
      +          saveFailure.addSuppressed(cleanupFailure);
      +        }
      +        throw saveFailure;
      +      }
      +      return true;
           } catch (SessionContextUnavailableException unavailable) {
             throw unavailable;
           } catch (RuntimeException invalidOrUnavailable) {
      
      • Accepted Accepted: successful registry registration followed by failed shell save leaks context. Remove on save failure and preserve primary exception if cleanup also fails.
    3. Do not let InetAddress.getByName resolve host names when the value contains :.Minor

      isCanonicalClientAddress calls InetAddress.getByName(value) for every value that contains :. The JDK parses the value as a literal only in two cases:

      • The value starts with a hexadecimal digit.
      • The value starts with : or [.

      Any other value goes to name resolution. One example is gateway:1. For that value, getByName performs a blocking DNS lookup and then returns false.

      This check runs in two places:

      • In the GatewayContextMetadata constructor, on the Gateway signing path, which is reactive.
      • In ContextClaims.fromMap, on the Game Session verification path.

      A malformed client address from the canonicalization path therefore causes an unbounded blocking network call. The method then fails closed. The validator must parse literals only.

      Reject any character outside [0-9a-f:] before the parse. JDK canonical output is lowercase, so the check can exclude uppercase. Uppercase input fails the round-trip comparison in any case. With this check, getByName receives only literal-shaped input and never resolves a name.

      🛡️ Proposed fix

      --- "a/services/common-security/src/main/java/net/firedevops/firemud/common/security/GatewayFirstPartyConnectContextEnvelope.java"
      +++ "b/services/common-security/src/main/java/net/firedevops/firemud/common/security/GatewayFirstPartyConnectContextEnvelope.java"
      @@ -476,9 +476,15 @@
           if (value == null || value.isEmpty() || value.length() > 64) {
             return false;
           }
           if (value.indexOf(':') >= 0) {
      +      for (int index = 0; index < value.length(); index++) {
      +        char c = value.charAt(index);
      +        if (!(c == ':' || (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'))) {
      +          return false;
      +        }
      +      }
             try {
               byte[] address = InetAddress.getByName(value).getAddress();
               // InetAddress#getHostAddress emits the JDK's uncompressed IPv6 spelling. That spelling
               // is the canonical address representation for this envelope, including the full eight
               // groups; compressed IPv6 text is intentionally rejected.
      
      • Accepted Accepted literal-only address parsing; overlaps CLI3 ASCII hex/colon guard prepared locally. No hostname resolution should occur.
  10. Subagent Review 2 CompletedModel: gpt-6.1-sol · Medium
    Found: 0 Accepted: 0 Routed: 0
    1. No findings recorded for this run
  11. CLI Review 4 CompletedRuntime 3m 28s
    Found: 2 Accepted: 1/1/0 Routed: 0
    1. Update the second runtime-images.yml description to match line 75.Minor

      Line 75 now states that runtime-images.yml runs the explicit held-admission qualification. The qualification proves only direct backend LOGIN -> PLAY -> LOOK and Gateway/Telnet fail-closed behavior. Line 149 is unchanged. It still says the workflow "runs applicable full-stack smoke". Lines 81 and 87 also describe "full-stack smoke". These two descriptions now contradict each other in the same document. Reword line 149 to use the held-admission qualification and its stated limits.

      As per path instructions: "Review docs for canonical-current-state consistency."

      • Accepted The same CI/CD owner document describes runtime-images as held-admission qualification at75 but full-stack public smoke at149. Align the second workflow description and PR-source smoke prose with direct-backend and fail-closed limits; retain branch-image semantics.
    2. Verify that a permanently OUTOFSERVICE gameplayRouteReadiness does not keep the whole Gateway out of service.Major

      Verify that a permanently OUT_OF_SERVICE `gameplayRouteReadiness` does not keep the whole Gateway out of service.

      health() now returns recordOutOfService on every call. The indicator no longer has a path that reports UP. TcpProxyTlsListenerAdmissionIntegrationTest (lines 90-105) shows that this indicator belongs to the readiness group. That test also shows that /actuator/health/readiness returns 503 with OUT_OF_SERVICE.

      Suppose a deployment uses /actuator/health/readiness as the Kubernetes readiness probe. Then the Gateway pod never becomes Ready. Kubernetes then removes the pod from its Service endpoints. The pod stops serving every route, not only first-party /ws/game/**. The blocked paths include the trusted TCP Proxy path, which this PR keeps forwardable. The blocked paths also include the HTTP API routes. The README describes only first-party gameplay as unavailable. A Gateway that cannot become Ready would cause a much wider outage than the README describes.

      Check these two facts:

      • Do the Gateway deployment manifests or Helm values use /actuator/health/readiness for the readiness probe?
      • Does application.yml include gameplayRouteReadiness in management.endpoint.health.group.readiness.include?

      If both are true, move gameplayRouteReadiness out of the readiness group. For example, put it in a separate gameplay health group. You could also report first-party unavailability as a detail that does not affect the Gateway's own readiness. Keep the fixed UNAVAILABLE_REASON either way.

      • Accepted Both repo-default probe/group predicates are true. One pod readiness gates public HTTP and dedicated TCP Services, contrary to claimed transport separation. Removing the indicator violates canonical public fail-closed semantics; Root target disposition required.
  12. Hosted Review 6 CompletedRuntime 8m 51s
    Found: 3 Accepted: 3 Routed: 0
    1. State the verifiedAt ordering rule in the normative contract.Minor

      GatewayFirstPartyConnectContextEnvelope.validateLifetime rejects any context where verifiedAt > issuedAt. Both signing and verification fail with INVALID_LIFETIME. This paragraph defines bounds for issuedAt and expiresAt only. For verifiedAt it states nothing except "positive UTC epoch-millisecond integer". The payload schema is closed, and Gateway and Game Session are separate owners. A producer that follows only this text can stamp verifiedAt after issuedAt, and the receiver would then reject every context. Add the rule to the owner contract.

      📝 Proposed wording

      -`issuedAt`, `verifiedAt`, and `expiresAt` are positive UTC epoch-millisecond integers. `expiresAt` must follow `issuedAt`, ...
      +`issuedAt`, `verifiedAt`, and `expiresAt` are positive UTC epoch-millisecond integers no greater than 9007199254740991. `verifiedAt` must not follow `issuedAt`. `expiresAt` must follow `issuedAt`, ...
      
      • Accepted Verified existing envelope validation already enforces safe integer bounds and verifiedAt<=issuedAt; canonical normative owner omits these constraints. Align text only with implemented producer/receiver predicates.
    2. Add --all so the Compose state wait can see crashed services.Minor

      docker compose ps lists only running containers unless you pass --all. If a required service exits, its record is missing from the output. classify_compose_status then returns pending with "missing required Compose services". The qualification keeps polling until SMOKE_HEALTH_TIMEOUT_SECONDS (240 s by default) runs out. The fail-fast branch at Lines 144-148 ("is not running: {state}") never runs for an exited container. The created pending branch never runs either.

      The result still fails closed. However, a crashed service costs the full health timeout, and the error message reports "missing" instead of the exit state. Add --all to restore the intended fail-fast behaviour and the diagnostic. REQUIRED_SERVICES already filters out one-shot helpers, and parse_compose_status rejects duplicate service records.

      🩹 Proposed fix

      --- "a/dev-tools/smoke/held_admission_qualification.py"
      +++ "b/dev-tools/smoke/held_admission_qualification.py"
      @@ -515,7 +515,7 @@
           deadline = time.monotonic() + timeout_seconds
           last_output = ""
           last_pending = "Compose status has not been read"
      -    command = ["docker", "compose", *compose_args, "ps", "--format", "json"]
      +    command = ["docker", "compose", *compose_args, "ps", "--all", "--format", "json"]
           while True:
               remaining = deadline - time.monotonic()
               if remaining <= 0:
      

      If you apply this fix, update the timeout_compose_status mock in dev-tools/tests/smoke-transport-contract.sh so its expected command matches.

      • Accepted Verified actual Compose status command omits stopped services; existing classifier already handles exited/created states. Add--all and qualify actual command/case through existing bounded transport contract; no admission or cleanup weakening.
    3. CodeRabbit summary-only outside-diff finding 1 of 1 (aggregate; no individual detail)

      summary-only aggregate; provider supplied no individual detail

      • Accepted Fully read one outside-diff summary finding. Account status75 still describes removed connect-token replay/membership paths; issueConnectToken now returnsAUTH_UNAVAILABLE before them. Correct local status and preserve separate textPLAY limitations.

Routed Findings

0 Open0 Accepted/Fixed0 Rejected

No routes recorded

Unlinked items

no items unlinked