PR #3224 review history
Unit 1A · identity, Account and public JOIN
Review rounds
Three-number pills mean: found (raw) / accepted here (useful) / routed
Recorded review history
Reviews and findings
- Hosted Review 1 CompletedRuntime 10m 16sFound: 6 Accepted: 6 Routed: 0
- 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.
- Handle unreadable session records at every caller.Minor
RedisSessionContextServicenow throwsIllegalStateExceptioninstead of returningOptional.empty()when a retained record cannot be deserialized. The LOGIN and PLAY pre-checks catch this exception, but shared session-resolution paths do not.openLoggingContextresolves the session context during bothafterConnectionEstablishedandhandleTextMessage. 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.
- Add one test where only the source-token
expbound rejects the context.TrivialBoth signing rejections in this test use a 31-second lifetime, which is
NOW_MILLIStoNOW_MILLIS + 31_000L. Thelifetime > MAX_LIFETIME_MILLISrule rejects both cases before the source-expiry rule has any effect. The namemetadataPastSourcedoes not match what the case tests. If someone removes thesourceExpiryMilliscomparison invalidateLifetime, this test still passes. The documented rule "must not exceed the source token'sexp" 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.
- Remove the duplicate
requireRetainedon the registry result.TrivialRedisFirstPartyConnectContextRegistry.findalready returnscontextService.requireRetained(context). Line 31 callsrequireRetainedagain 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, thenrequireRetained, thenregister, which callsrequireRetainedonce or twice more. That adds owner reads on a hot path. The testfirstPartyPlayRereadsCanonicalOwnerThenDeniesBeforeLegacyAdmissionEffectsassertsatLeast(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
findvalidates its result, document that contract onFirstPartyConnectContextRegistry.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.
- Assert the denial with a check that can fail.Trivial
Lines 1459-1461 compare
FirstPartyReceivingFixture.ACCOUNTwithcontext.accountId().contextis 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 thatfirstPartyConnectContextRegistry.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.
- 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 as2001:db8:0:0:0:0:0:1and a rejected compressed address such as2001: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.
- Hosted Review 2 CompletedRuntime 10m 21sFound: 4 Accepted: 0/2/2 Routed: 0
- 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.
- Use a message key that matches
FIRST_PARTY_AUTHORITY_UNAVAILABLE.MinorThe new failure sends error code
FIRST_PARTY_AUTHORITY_UNAVAILABLEwith message keyerror.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.LoginCommandHandlersends the same code with no message key, becauseloginErrorMessageKeyfalls back tonull. Add a dedicated key, such aserror.play.first-party-authority-unavailable, topresentation-messages.propertiesandpresentation-messages_fr.properties. As an alternative, passnullso 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.
- Remove the second first-party check, which cannot be reached.Trivial
If
sessionIdparses, the pre-check at Lines 124-153 already returns when a first-party context resolves or when resolution is invalid. IfsessionIddoes not parse,resolveSessionContexthas no valid session to return. As a result, this secondresolvecall only repeats a registry lookup and possibly a signature and owner read on everyPLAY.selectDefaultRealmnow always receives an emptyconnectContext, so its hint branch is also dead code. Remove the second resolution, or keep only a defensive assertion. Then simplifyselectDefaultRealm.- 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.
- Do not report storage failures as
CONNECT_CONTEXT_INVALIDfor ordinary text sessions.MinorThe 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
findBySessionIdthrowsSessionContextUnavailableException, or a Redis read fails, this catch returnsCONNECT_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
UNAVAILABLEforSessionContextUnavailableExceptionand other storage errors. KeepCONNECT_CONTEXT_INVALIDforresolution.invalid().PlayCommandHandlerLine 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.
- Hosted Review 3 CompletedRuntime 9m 54sFound: 2 Accepted: 0/0/1 Routed: 0
- Exclude
gameplayRouteReadinessfrom the default readiness group.MajorThe shared Docker Compose healthcheck calls
/actuator/health/readiness, and the Gateway uses that healthcheck. The default readiness group includesgameplayRouteReadiness, whosehealth()method always reportsOUT_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.
- Remove the unused
accountIdparameter fromreusableBootstrapShell.TrivialPMD reports
accountIdas 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.
- CLI Review 1 CompletedRuntime 3m 45sFound: 3 Accepted: 0/2/0 Routed: 0
- Check the new
bootstrapSessionContextresult inensureBootstrapSessionContextIfMissing.MinorbootstrapSessionContextnow returnsfalseafter it closes a first-party session withCONNECT_CONTEXT_INVALID. At Line 641,ensureBootstrapSessionContextIfMissingignores that result, andhandleTextMessagecontinues tointerpreter.interpret(...)andsendProtocolMessage(...). 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
ensureBootstrapSessionContextIfMissingand stop processing when it isfalse. 🐛 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.
- Confirm that a permanently
OUTOFSERVICEindicator does not take the whole Gateway out of readiness.MajorConfirm that a permanently `OUT_OF_SERVICE` indicator does not take the whole Gateway out of readiness.
health()now always returnsOUT_OF_SERVICE. The unchanged assertion inTcpProxyTlsListenerAdmissionIntegrationTest(lines 90-105) shows thatgameplayRouteReadinessis part of the/actuator/health/readinessgroup, 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.readinessmembership. If the probe uses the readiness group, removegameplayRouteReadinessfrom 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.
- The current-state text misstates the character-discovery outcome for an
INACTIVEmembership.MinorLines 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.requireCurrentAdmissibleConnectScopeTargetdoes readgetLifecycleState(). For a public-production realm with anINACTIVEmembership, it returns one of two codes:JOIN_REQUIREDwhenallowPublicJoinis true.PUBLIC_PRODUCTION_ADMISSION_DENIEDwhenallowPublicJoinis false.
Only a non-
INACTIVEmembership that does not admit gameplay reachesCONNECT_TOKEN_REJECTED. The testlistBootstrapCharactersClassifiesInactivePublicMembershipByJoinPolicyasserts 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.
- On an eligible public-production target, only absent membership returns
- Hosted Review 4 CompletedRuntime 8m 16sFound: 2 Accepted: 0/0/1 Routed: 0
- Remove the unused legacy admission helper.Trivial
requireAdmissibleRealmhas 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.
- 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.
- CLI Review 2 CompletedRuntime 3m 23sFound: 4 Accepted: 1/0/1 Routed: 0
- Add a non-sensitive failure category metric to
parse.Trivialparseturns everyRuntimeExceptionintoOptional.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
ReadUnavailableExceptionfrom 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 askey_unavailable,invalid_envelope,owner_unavailable, ortarget_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.
- Make the
ContextClaimsconstructor non-public, or validate the full schema in it.TrivialContextClaimsis a public record. Its canonical constructor checks only non-null IDs, themembershipVersionmap, and positive timestamps. Any caller can construct aContextClaimswith an uncheckedworldSlug,playableStateScope,canonicalClientAddress, or mismatched playtest fields. The record then looks the same as a verified claim set. The verified path is protected becauseVerifiedContexthas a private constructor. But downstream Game Session code that acceptsContextClaimsdirectly 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
fromMapenforces. - 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.
- Keep the record public for reading, but make the canonical constructor validate the same invariants that
- Return
falsefrom the generic bootstrap path when it closes the transport.MajorbootstrapSessionContextalways returnstrueafter it callsbootstrapGenericSessionContext. That method can close the session at lines 728-731 throughcloseAdmissionPointerAuthorityUnavailablewhenlistByRuntimeTargetthrows.afterConnectionEstablishedthen registers the closed session at lines 167-168.Consequences:
InMemoryActiveTransportSessionRegistry.registerusesput. The closed session replaces any incumbent transport that has the same transport ID.- The new
unregisterremoves only the exact registered session. When the incumbent closes later, itsunregisterreturnsfalse. ItsfirstPartyConnectContextRegistry.unregister,promptBurstCoordinator.evict, andrecordDisconnected(TRANSPORT_LOSS)cleanup is then skipped. - If the container runs
afterConnectionClosedsynchronously insidesession.close, that callback runs beforeregister. The closed session then stays registered with no later callback to remove it.
The first-party path already returns
falseafter 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
afterConnectionClosedsynchronously duringsession.close(...)called fromafterConnectionEstablished. 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.
- Verify that a permanently down first-party indicator does not take the whole Gateway out of service.Major
health()now always returnsOUT_OF_SERVICE.TcpProxyTlsListenerAdmissionIntegrationTestshows thatgameplayRouteReadinessis a member of the/actuator/health/readinessgroup: readiness returns 503 with this componentOUT_OF_SERVICE.The previous probe could report
UPwhen the local/ws/gameupgrade 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, andGameplayHandshakeFilterstill serves those paths.The intended "first-party unavailable" status belongs in a separate component that is not in the readiness group. Alternatively, exclude
gameplayRouteReadinessfrom the readiness group until the prerequisites are qualified.Confirm the
management.endpoint.health.group.readiness.includesetting in the Gatewayapplication.ymland the deployedreadinessProbepath. 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.
- Subagent Review 1 CompletedModel: gpt-6.1-sol · MediumFound: 3 Accepted: 3 Routed: 0
- 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.
- 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.
- 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.
- CLI Review 3 CompletedRuntime 3m 30sFound: 8 Accepted: 0/2/5 Routed: 0
- Confirm that permanent
OUTOFSERVICEdoes not take every Gateway pod out of rotation.MajorConfirm that permanent `OUT_OF_SERVICE` does not take every Gateway pod out of rotation.
health()now always returnsOUT_OF_SERVICE. The removed code tried a real WebSocket upgrade and could reportUP.TcpProxyTlsListenerAdmissionIntegrationTestshows thatgameplayRouteReadinessis part of the aggregate readiness group:/actuator/health/readinessreturns 503 with$.status=OUT_OF_SERVICE. Suppose the Gateway Deployment uses/actuator/health/readinessas 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/gamepath, whichGameplayHandshakeFilterstill forwards.Verify which probe path the Gateway Deployment and the smoke environment use. If that path aggregates
gameplayRouteReadiness, choose one fix:- Remove
gameplayRouteReadinessfrom 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.
- Remove
- Remove the registry assertions that only check their own mock stubs.Trivial
Each test calls
find(...)on a mockedActiveTransportSessionRegistrythat it stubbed earlier to return the same session. SoassertThat(registry.find(...)).contains(session)always passes and does not prove that the registration was kept. The adjacentverify(..., never()).unregister(...)already proves it.services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/service/CommunicationRecipientDeliveryServiceTest.java#L390-L390: remove thefind(42L)assertion, or use a realInMemoryActiveTransportSessionRegistry.services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/service/PlayerOutputDeliveryServiceTest.java#L67-L67: remove theregistry.find(41L)assertion.services/game-session-service/src/test/java/unit/net/firedevops/firemud/gamesession/websocket/GameSessionWebSocketHandlerTest.java#L219-L220: remove theactiveTransportSessionRegistry.find(41L)assertion. Theregisterandunregisterverifications 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.
- 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-tokenreturnsAUTH_UNAVAILABLEbefore 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-partyLOGINplusPLAYcan 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.
- 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 returnsCONNECT_TOKEN_REJECTEDfor non-admitting membership.AccountServiceImpl.issueConnectTokennow throwsAUTH_UNAVAILABLEbefore 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 textPLAYkeeps the current membership-check description, and connect-token issuance is described as returningAUTH_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.
- 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, andRedisMovementEffectIdempotencyServiceTest.RedisFirstPartyConnectContextRegistryTestcreates it in a field initializer, so it runs once per test method. A lazily created staticKeyPairkeeps 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.
- Parse IPv6 text as a literal only. Do not call
InetAddress.getByName.TrivialInetAddress.getByNameparses text as a numeric literal only when the first character is a hex digit or:. Other text that contains:(for exampleg:1orhost:80) falls through to name resolution. The result is a blocking DNS lookup inGatewayContextMetadataconstruction and inverify. 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 becauseverifyreaches 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 GuavaInetAddresses.forStringorsun.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.
- Remove the extra
requireRetainedcall afterparse.Trivialparseon line 762 has just verified the JWS, read the current canonical target, and matched it.requireRetainedon line 772 runsparseagain.firstPartyConnectContextRegistry.registeron line 791 also callsrequireRetained. As a result, one connection establishment does three RSA verifications and threeCanonicalPlayerRouteReadService.readCurrentTargetowner reads for the same token.Use the result of
parsedirectly.registerstill 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.
- Remove the
preserveConnectSelectorparameter and the outdated comment.TrivialAfter this change, the only caller passes
false.reusableBootstrapShellalso rejects shells that carry a first-party context. As a result,authenticatedBootstrapContextalways drops the selector, andbootstrapShell.firstPartyConnectContext()is alwaysnull.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
nullfor 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.
- Hosted Review 5 CompletedRuntime 9m 00sFound: 3 Accepted: 0/3/0 Routed: 0
- Do not label every gRPC
CANCELLEDasCUSTODY_LOST.MinorfailureCodemaps everyStatusRuntimeExceptionwith codeCANCELLEDtoCUSTODY_LOST.CanonicalGameplayLoginAccountClient.invokeWithBoundedRetrythrowsCANCELLEDin three cases:- The custody guard fails.
- The caller's gRPC
Contextis cancelled. - The Account transport returns
CANCELLED, which passes throughboundedTransportFailure.
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_LOSTonly when custody is actually lost. One option is to pass the observed custody state intofailureCode.🐛 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). Incleanup(...), pass!credentials.isCurrent(), or pass a precomputed flag fromreceive.- Accepted Accepted: CANCELLED alone does not establish credential custody loss. Preserve caller/transport cancellation unless observed custody is lost.
- Unregister the first-party context when bootstrap fails after
register.MinorLine 791 registers
currentinfirstPartyConnectContextRegistrybefore Line 792 saves the shell. SupposesessionContextService.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 toactiveTransportSessionRegistry. This meansafterConnectionClosedgetsfalsefromunregister(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.resolvethen finds the leaked registry context, so the session getsFIRST_PARTY_AUTHORITY_UNAVAILABLEorCONNECT_CONTEXT_INVALIDuntil 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.
- Do not let
InetAddress.getByNameresolve host names when the value contains:.MinorisCanonicalClientAddresscallsInetAddress.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,getByNameperforms a blocking DNS lookup and then returnsfalse.This check runs in two places:
- In the
GatewayContextMetadataconstructor, 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,getByNamereceives 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.
- Subagent Review 2 CompletedModel: gpt-6.1-sol · MediumFound: 0 Accepted: 0 Routed: 0
- No findings recorded for this run
- CLI Review 4 CompletedRuntime 3m 28sFound: 2 Accepted: 1/1/0 Routed: 0
- Update the second
runtime-images.ymldescription to match line 75.MinorLine 75 now states that
runtime-images.ymlruns the explicit held-admission qualification. The qualification proves only direct backendLOGIN->PLAY->LOOKand 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.
- Verify that a permanently OUTOFSERVICE
gameplayRouteReadinessdoes not keep the whole Gateway out of service.MajorVerify that a permanently OUT_OF_SERVICE `gameplayRouteReadiness` does not keep the whole Gateway out of service.
health()now returnsrecordOutOfServiceon every call. The indicator no longer has a path that reports UP.TcpProxyTlsListenerAdmissionIntegrationTest(lines 90-105) shows that this indicator belongs to thereadinessgroup. That test also shows that/actuator/health/readinessreturns 503 withOUT_OF_SERVICE.Suppose a deployment uses
/actuator/health/readinessas 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/readinessfor the readiness probe? - Does
application.ymlincludegameplayRouteReadinessinmanagement.endpoint.health.group.readiness.include?
If both are true, move
gameplayRouteReadinessout of the readiness group. For example, put it in a separategameplayhealth group. You could also report first-party unavailability as a detail that does not affect the Gateway's own readiness. Keep the fixedUNAVAILABLE_REASONeither 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.
- Do the Gateway deployment manifests or Helm values use
- Hosted Review 6 CompletedRuntime 8m 51sFound: 3 Accepted: 3 Routed: 0
- State the
verifiedAtordering rule in the normative contract.MinorGatewayFirstPartyConnectContextEnvelope.validateLifetimerejects any context whereverifiedAt > issuedAt. Both signing and verification fail withINVALID_LIFETIME. This paragraph defines bounds forissuedAtandexpiresAtonly. ForverifiedAtit 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 stampverifiedAtafterissuedAt, 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.
- Add
--allso the Compose state wait can see crashed services.Minordocker compose pslists only running containers unless you pass--all. If a required service exits, its record is missing from the output.classify_compose_statusthen returnspendingwith "missing required Compose services". The qualification keeps polling untilSMOKE_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. Thecreatedpending 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
--allto restore the intended fail-fast behaviour and the diagnostic.REQUIRED_SERVICESalready filters out one-shot helpers, andparse_compose_statusrejects 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_statusmock indev-tools/tests/smoke-transport-contract.shso 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.
- 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
No routes recorded
Unlinked items
no items unlinked