docs backend evidence community safety SEC04B_DELETION_LINKAGE - AlexandreZanata/Abastevo GitHub Wiki
Date: 2026-10-11. Status: LOCAL_DONE. Scope: durable intents,
atomic revoke, wired scope cleanup — no training/consent split
(C), no local-queue sweep (D). Head: maintained dev + this task.
Plan: remediation plan
(SEC04, AUD-05). Contract: B-BR-A05 (export/erasure), B-BR-016
(ledger/replay). Constraint: bindings captured BEFORE dropping
(the AUD-05 root); receipt names intent, never completion; no
distributed transaction, no new service.
Validation: PASS
- Migration
000059_account_erasure_intents(append-only) + sqlc (InsertErasureIntentconvergent,ListErasureIntentsByAccount): one row per (account, contributor), written in the DeleteAccount transaction. -
accountMemStore + PGStore:DeleteAccountcaptures bindings, writes intents, revokes families and unlinks atomically, returning captured IDs (sorted);ListErasureIntentsreplays durable intents after crashes. -
accountService:RequestErasureport (nil refuses closed before any mutation withErrErasureWiringMissing);DeleteAccountreturnsDeletionReceipt{AccountID, ContributorIDs, ErasureRequested}; empty-capture retries replay from intents (convergent scope cleanup). -
accountHTTP:DeleteAccountreturns the receipt ({status: deleted, erasure_requested}— counts/flags only, contributor IDs stay server-side); wiring-missing maps to 500 without identity echo. -
cmd/api: wiresRequestErasure— one privacy deletion intent per contributor (deterministicaccount-erasure:<account>:<contributor>submission, reasonaccount-deletion, durableprivacy-erasurejob through the deletion ledger) plus synchronousfeedbackService.EraseAccount(tombstone + rebuild, convergent re-runs). - Tests: 4 unit (capture+enqueue+receipt, wiring-missing
no-mutation, crash replay, binding-free empty call); HTTP
receipt assertion; real-PostGIS capture/intents/revoke/replay
proof; real-PostGIS wired composition (privacy ledger intent
- tombstoned comment + unreadable view).
-
go test ./internal/modules/account/... ./internal/modules/feedback/... ./internal/modules/privacy/...green.-race -tags=integrationgreen: account adapters (incl. 2 new SEC04-B; migration 000059 applied on fresh DBs)- feedback adapters re-green.
-
go build ./...,go vet,gofmt -lclean,sqlc vetclean,git diff --checkclean,scan-secrets.shpassed (synthetic addresses only). - RED pre-GREEN: pre-fix
DeleteAccountleft comments readable with public alias after deletion (audit probe, real SQL); nil-port test failed before fail-closed ordering (mutation first); composition failed before UUID-safe generators.
- Worker executes privacy scopes asynchronously: full account→reads→restore evidence rides SEC04-D; intent rows + ledger make every crash repairable and every retry convergent.
- Training/consent reconciliation (revoke vs operational expiry): SEC04-C. Local queue/media sweep under erased owners: SEC04-D.
- Multi-replica serializability beyond row locks/advisory xact not proven. No VPS/phone change; no production claim.
Next microtask: SEC04-C attribution + aggregates + training split.