PR #3172 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
- CLI Review 1 CompletedRuntime 1m 54sFound: 1 Accepted: 0/1/0 Routed: 0
- Add the V137 restriction anchors to the AA-1.3 anchor cells.Minor
The AA-1.3 gap cell now describes "V137 immutable revision/current-result receipts, exact SQL source-head dispatch, and protective-category lifecycle sync". The row's implementation anchors do not list
V137__account_platform_restriction_revision_receipts.sqlorAccountPlatformRestrictionOperationRepository.java. The proof anchors also do not list the new focused tests:AccountPlatformRestrictionOperationPostgresIntegrationTest.javaAccountPlatformRestrictionOperationRepositoryTest.javaAccountAuthoritySourceEventReadbackTest.java
Without these links, the status row describes a capability that has no production or proof anchor. Add the migration and the repository to the implementation anchors. Add the focused tests to the proof anchors.
As per coding guidelines: "
implementedandpartialrows name concrete production anchors" and trackers must "Keep its status, implementation record, validation, gaps... aligned when a domain boundary changes."- Accepted Accepted Minor: AA-1.3 describes restriction receipts/dispatch but omits V137 repository and focused proof anchors. Add canonical links only; preserve status/limits.
- Hosted Review 1 CompletedRuntime 5m 54sFound: 3 Accepted: 0/3/0 Routed: 0
- Map a
NONRESTRICTEDsecurity lock to "notsecurity_locked", not toactive.MinorBoth the SQL lifecycle sync and the Java projection check treat a cleared protective lock as "lifecycle must be
active". The design states thatsecurity_lockedprojects onlyaccount_security_lock. A cleared lock must not move or require any other lifecycle state.The SQL trigger tries to reactivate
deactivated_pending_deleteaccounts. The transition guard then rejects the transaction, so the lock cannot be cleared after a pending-delete transition. The Java check reports the projection as unavailable for pending-delete accounts.services/account-service/src/main/resources/db/migration/V137__account_platform_restriction_revision_receipts.sql#L619-L628: updatesecurity_locked → activeonly forNONRESTRICTED. Updateactive → security_lockedonly forRESTRICTED.services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountPlatformRestrictionOperationRepository.java#L524-L529: requireRESTRICTED ⇔ lifecycle_state = 'security_locked'. Do not requireactiveforNONRESTRICTED.
📍 Affects 2 files
services/account-service/src/main/resources/db/migration/V137__account_platform_restriction_revision_receipts.sql#L619-L628(this comment)services/account-service/src/main/java/net/firedevops/firemud/accountservice/repository/AccountPlatformRestrictionOperationRepository.java#L524-L529
- Accepted Accepted Minor: security lock projects only security_locked. NONRESTRICTED must preserve pending-delete/deleted lifecycle rather than force active; SQL sync and readback must enforce matching lock bit.
- Use the immediate pre-
V137migration target.Minorcontext("126")stops beforeV126.1,V126.2, andV126.3. The test therefore covers unrelated migrations together withV137instead of testing the directV137upgrade. These migrations alter StartSession and control-UI tables, not theaccountscolumns used byAccountRepository.save.Use
126.3as the target:- Context context = context("126"); + Context context = context("126.3");- Accepted Accepted Minor: V126.3 is immediate pre-V137 schema; isolate upgrade fixture to126.3 instead of126.
- Add implementation and proof anchors for the new restriction slice to the
AA-1.3row.MinorThe gap cell now claims these new parts:
- the closed restriction event variant
- the V137 receipts
- the SQL source-head dispatch
- the lifecycle sync
The "Implementation anchors" cell does not link any production file that implements them. The "Proof anchors" cell does not link any new focused test.
Add these implementation anchors:
V137__account_platform_restriction_revision_receipts.sqlAccountPlatformRestrictionOperationRepository.javaAccountPlatformRestrictionMutationRequest.javaAccountSecurityStateAuthorityEventV1Codec.javaAccountAuthoritySourceEventReadback.java
Add these proof anchors:
AccountPlatformRestrictionOperationPostgresIntegrationTest.javaAccountPlatformRestrictionOperationRepositoryTest.javaAccountSecurityStateAuthorityEventV1CodecTest.javaAccountAuthoritySourceEventReadbackTest.java
As per coding guidelines: "Keep its status, implementation record, validation, gaps, decisions, and service-map sections aligned when a domain boundary changes" and "
implementedandpartialrows name concrete production anchors."- Accepted Accepted Minor: extend AA-1.3 canonical restriction implementation/proof anchors only, preserving status and limits.
- CLI Review 2 CompletedRuntime 2m 04sFound: 2 Accepted: 1/1/0 Routed: 0
- Reject a security-lock
RESTRICTEDresult that the lifecycle sync cannot apply.MajorThis
UPDATEchangesaccounts.lifecycle_stateonly when the account isactive(forRESTRICTED) orsecurity_locked(forNONRESTRICTED). In every other state, the update silently does nothing, and the transaction still commits. On the read side,AccountPlatformRestrictionOperationRepository.requireLifecycleProjection(Java lines 518-532) requiresstate == RESTRICTED⇔lifecycle_state == 'security_locked'.Trigger: an
account_security_lockRESTRICTEDrevision on an account indeactivated_pending_delete(ordeleted).- The operation, revision, and current projection commit with
RESTRICTED. - The lifecycle stays
deactivated_pending_delete. - Every later
readCurrentProjectionthrowsRestrictionProjectionUnavailableException. - That includes
requireCurrentPostStateon the latest-event path, soreadCurrentIssuerAccountSourcesand every closed-source readback for the account fail. - That also includes the
FOR UPDATEread inpersistWithoutOwnerProof. A recoveryNONRESTRICTEDrevision therefore cannot be written either.
The account stays unreadable until an operator repairs it by hand. The integration test only covers the
NONRESTRICTED-on-pending-deletion case, so it does not catch this.The same invariant can break from other writers. A legacy
ACCOUNT_SECURITY_STATE_CHANGEDorAccountRepositorylifecycle change can move asecurity_lockedaccount todeactivated_pending_delete(the support-reviewed transition) while the lock projection is stillRESTRICTED.The write path is default-denied today, so this does not affect production yet. Close the gap before the proof receiver is connected:
- In SQL, raise an exception in this sync function when the
UPDATEaffects zero rows and the account is not already in the target lifecycle. - In Java, reject a
RESTRICTEDsecurity-lock request inpersistWithoutOwnerProofunless the locked lifecycle isactiveorsecurity_locked. - Decide what the invariant should be for other lifecycle writers. Either guard them or relax
requireLifecycleProjectionfor non-active/non-locked states, and document the choice.
🛡️ Proposed SQL guard
UPDATE accounts SET lifecycle_state = CASE operation_row.result_state WHEN 'RESTRICTED' THEN 'security_locked' ELSE 'active' END WHERE account_uuid = NEW.account_uuid AND ((operation_row.result_state = 'RESTRICTED' AND lifecycle_state = 'active') OR (operation_row.result_state = 'NONRESTRICTED' AND lifecycle_state = 'security_locked')); + IF operation_row.result_state = 'RESTRICTED' AND NOT EXISTS ( + SELECT 1 FROM accounts + WHERE account_uuid = NEW.account_uuid AND lifecycle_state = 'security_locked') THEN + RAISE EXCEPTION 'Account security-lock result cannot be projected onto the current lifecycle' + USING ERRCODE = '23514', CONSTRAINT = 'account_authority_account_security_event_mismatch'; + END IF; RETURN NULL;- Accepted Accepted Major: RESTRICTED mutation on non-active/nonlocked lifecycle must roll back, not leave unreadable projection. Preserve canonical lock equivalence; guard source writes/precheck and independently prove rollback; legacy writer consistency needs scoped evidence.
- The operation, revision, and current projection commit with
- Add the missing
;separators in theAA-1.3anchor lists.MinorThe Implementation anchors cell has two spaces between
[V137__account_platform_restriction_revision_receipts.sql](...)and[AccountPlatformRestrictionMutationRequest.java](...), with no;. The Proof anchors cell has the same gap between[AccountAuthoritySourceEventReadbackTest.java](...)and[AccountSecurityStateAuthorityEventV1CodecTest.java](...). Every other entry in this row is separated by;. The tracker contract requires repository-local, resolvable evidence anchors.dev-tools/tests/architecture-doc-contracts.shvalidates these cells. If that script splits entries on;, it reads each pair as one malformed anchor, and the contract check can fail.The row also omits
AccountGenerationProjectionRestrictionDispatchTest.javaandRuntimeMembershipAuthorityEvidenceValidatorRestrictionDispatchTest.java. Both test the new dispatch paths. Consider adding them as proof anchors.📝 Proposed fix
-...V137__account_platform_restriction_revision_receipts.sql) [AccountPlatformRestrictionMutationRequest.java](... +...V137__account_platform_restriction_revision_receipts.sql); [AccountPlatformRestrictionMutationRequest.java](... -...AccountAuthoritySourceEventReadbackTest.java) [AccountSecurityStateAuthorityEventV1CodecTest.java](... +...AccountAuthoritySourceEventReadbackTest.java); [AccountSecurityStateAuthorityEventV1CodecTest.java](...As per coding guidelines: "Evidence targets must be repository-local and resolvable".
- Accepted Accepted Minor: two missing anchor separators remain; normalize AA-1.3 and add actual dispatch proof anchors.
- Hosted Review 2 CompletedRuntime 4m 43sFound: 1 Accepted: 1/0/0 Routed: 0
- Select the security-lock source kind from the requested state. The current fixture cannot create a
RESTRICTEDlock.MajorFor every
ACCOUNT_SECURITY_LOCKrequest,commitDraftusesSourceKind.ACCOUNT_SECURITY_RECOVERY.AccountPlatformRestrictionMutationRequest.validateOwnerSourcerejectsACCOUNT_SECURITY_RECOVERYwith any state other thanNONRESTRICTED. This guard is at Lines 169-172 ofAccountPlatformRestrictionMutationRequest.java.Some tests call
commitDraft(..., ACCOUNT_SECURITY_LOCK, RESTRICTED):- Line 298 in
restrictedSecurityLockOnActiveAccountProjectsLockedLifecycle. - Line 360 in
legacyLifecycleExitRejectsFinalRestrictedMismatchAndRollsBackItsReceipt.
In those calls, the request constructor throws
IllegalArgumentExceptionbefore persistence. Both tests then fail when PostgreSQL executes them. Locally, the cases skip without Docker, so the PR's local test results do not show this failure. The tests that need a restricted projection never get one.Use
ACCOUNT_SECURITY_POLICYforRESTRICTEDandACCOUNT_SECURITY_RECOVERYforNONRESTRICTED.🐛 Proposed fix
--- "a/services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountPlatformRestrictionOperationPostgresIntegrationTest.java" +++ "b/services/account-service/src/test/java/integration/net/firedevops/firemud/accountservice/repository/AccountPlatformRestrictionOperationPostgresIntegrationTest.java" @@ -555,14 +555,12 @@ currentProjection == null ? categoryBirth.resultId() : currentProjection.get("result_id", UUID.class); var sourceKind = category == Category.ACCOUNT_SECURITY_LOCK - ? net.firedevops.firemud.accountservice.dto - .AccountPlatformRestrictionMutationRequest.SourceKind - .ACCOUNT_SECURITY_RECOVERY - : net.firedevops.firemud.accountservice.dto - .AccountPlatformRestrictionMutationRequest.SourceKind - .LOGGING_ADMIN_MODERATION; + ? (state == RestrictionState.RESTRICTED + ? SourceKind.ACCOUNT_SECURITY_POLICY + : SourceKind.ACCOUNT_SECURITY_RECOVERY) + : SourceKind.LOGGING_ADMIN_MODERATION; var request = new AccountPlatformRestrictionMutationRequest( UUID.randomUUID(),- Accepted Verified commitDraft recovery source rejects RESTRICTED before SQL persistence. Use policy for restricted, recovery for nonrestricted; preserve punitive moderation. Bounded accepted fixture fix.
- Line 298 in
- CLI Review 3 CompletedRuntime 2m 04sFound: 1 Accepted: 1/0/0 Routed: 0
- Select the security-lock source kind from the desired state.Major
commitDraftalways usesACCOUNT_SECURITY_RECOVERYforACCOUNT_SECURITY_LOCK.AccountPlatformRestrictionMutationRequest.validateOwnerSourcerejectsACCOUNT_SECURITY_RECOVERYwithRESTRICTED. The request constructor therefore throwsIllegalArgumentExceptionbefore the draft persistence runs.These tests call
commitDraft(..., ACCOUNT_SECURITY_LOCK, RESTRICTED):restrictedSecurityLockOnActiveAccountProjectsLockedLifecyclelegacyLifecycleExitRejectsFinalRestrictedMismatchAndRollsBackItsReceipt
Both tests fail during setup. The tracker lists this suite as AA-1.3 proof, so the first physical PostgreSQL run will fail.
Proposed fix
var sourceKind = category == Category.ACCOUNT_SECURITY_LOCK - ? net.firedevops.firemud.accountservice.dto - .AccountPlatformRestrictionMutationRequest.SourceKind - .ACCOUNT_SECURITY_RECOVERY - : net.firedevops.firemud.accountservice.dto - .AccountPlatformRestrictionMutationRequest.SourceKind - .LOGGING_ADMIN_MODERATION; + ? (state == RestrictionState.RESTRICTED + ? SourceKind.ACCOUNT_SECURITY_POLICY + : SourceKind.ACCOUNT_SECURITY_RECOVERY) + : SourceKind.LOGGING_ADMIN_MODERATION;- Accepted Verified desired-state/source mismatch in commitDraft against validateOwnerSource. Policy for RESTRICTED, recovery for NONRESTRICTED; bounded fixture correction locally in canonical Account gate.
Routed Findings
No routes recorded
Unlinked items
no items unlinked