Architecture Decision Record
ADR-005: Soft-Delete vs. Right-to-Erasure
Status
Accepted. Updated 2026-06-27 (documented the [Pii] → IAnonymizable build-time guard and PiiRedactor).
Updated 2026-08-26 (DeletedOn/DeletedBy stamps, the DeleteChildren cascade helper, and a
hard-delete fitness rule).
Updated 2026-09-07 (a pseudonymous key kept through anonymization must not appear on an
anonymous surface; Store's public review list is served through a contract that declares none).
Updated 2026-10-01 (corrected the DeleteChildren composition description; citations refreshed).
Revised 2026-10-06: Store's public review contract carries no reviewer name either, and the interceptor and controller anchors were refreshed.
Revised 2026-10-19: the framework guard runs in both directions (a reverse rule and a sample-coverage fact in PiiConventionTestsBase, v1.246.0), and ADC and Store both adopt it. Same date: ADC's Speaker becomes IAnonymizable with a [Pii] email that the cross-service UserDeleted erasure anonymizes before unlinking.
Revised 2026-10-21: ADC's Engagement module records each erased account in an ErasedUser row and refuses a later question, vote or upvote from it after the UserDeleted erasure ran; other Engagement write paths keyed to the caller's id (bookmark create, badge, room check-in, sponsor visit) run no such check.
Revised 2026-10-26: ADC's ErasedUserGuard now runs in seven Engagement write handlers keyed to the caller's id (bookmark create, badge, room check-in and sponsor visit joined question, vote and upvote), so the late-write residual of the 2026-10-21 revision is closed for those paths; the leaderboard opt-in, also keyed to the caller's id, does not call it and still lets an erased account that never opted in publish a fresh row, and the staff-driven check-ins do not call it either.
Revised 2026-10-28: the leaderboard opt-in now calls ErasedUserGuard before it publishes a row and the shared points awarder turns an award to an erased account into a no-op (ADC #296), so the leaderboard residual is closed; only the staff-driven check-ins stay unguarded.
Revised 2026-11-23: the staff manual check-in, the ticket claim and both ticket-linking services now call ADC's ErasedUserGuard (twelve per-account calls plus one batch read), the badge-scan check-in is the one staff path without it, and the hard-delete fitness base always allows six named framework erasers beside the repo's own list.
Revised 2026-11-24: the hard-delete rule reads IL through the testing package's own metadata reader instead of Mono.Cecil (MMCA.Common 1.318.0, ADR-015 Amendment (2026-11-24)); the Decision's wording is corrected in place.
Context
The framework's default deletion model is soft-delete: AuditableBaseEntity.Delete() sets IsDeleted = true and EF Core global query filters exclude the row from normal queries. The row (including any personal data it holds) stays in the database indefinitely, which is exactly what audit, referential integrity, and "undelete" (BR-135) require.
This conflicts with data-subject erasure rights (GDPR Art. 17 right-to-be-forgotten, CCPA deletion): when a person requests deletion, their personal data must actually be removed or anonymized, not merely hidden. Soft-delete alone is therefore non-compliant for personal data, and a consumer app's published privacy policy (e.g. a "we delete your data within 30 days" promise) cannot be honored by soft-delete.
A second source of retained personal data is the outbox: processed OutboxMessage rows hold serialized event payloads that may contain personal data and were previously never purged (ADR-003).
Decision
Separate the two concerns and provide an extension point for each, rather than overloading soft-delete:
- Soft-delete stays the default for lifecycle/state management (hide + retain + undelete). It is explicitly not a privacy mechanism. Three things make the lifecycle half complete rather than merely a flag:
- The deletion is stamped like any other audit fact.
IAuditableEntitycarriesDeletedOnandDeletedBybesideCreatedOn/ByandLastModifiedOn/By(MMCA.Common/Source/Core/MMCA.Common.Domain/Interfaces/IAuditableEntity.cs:26,29, implemented at.../Entities/AuditableBaseEntity.cs:39,45), so "when was this deleted, and by whom" is answerable from the row rather than from an audit-trail lookup (ADR-075). The domain does not write them: the clock and the current user live in infrastructure, soAuditSaveChangesInterceptorstamps them from theIsDeletedtransition (.../MMCA.Common.Infrastructure/Persistence/Interceptors/AuditSaveChangesInterceptor.cs:125-144, called at:87and:96, prior value read at:121-123) and clears them on the reverse one (Undelete, BR-135,AuditableBaseEntity.cs:91). Driving it from the transition rather than from the value is what keeps a later update to an already-deleted row from re-stamping it, exactly asCreatedOn/Bysurvive every update (AuditSaveChangesInterceptor.cs:15-19,:126-128, early return at:137-140,CreatedOn/Bypinned at:91-92; the domain-side note atAuditableBaseEntity.cs:62-65). - Cascading to children is a framework helper, not a loop per aggregate.
AuditableAggregateRootEntity.DeleteChildren<TChild, TChildId>(children)(.../Domain/Entities/AuditableAggregateRootEntity.cs:274-293) deletes every still-active child and aggregates the failures into oneResultviaResult.Combine(ADR-013,:292). Already-deleted children are skipped rather than reported, so re-deleting a parent is idempotent with respect to its children instead of surfacing anAlreadyDeletederror a caller cannot act on (:284-287, reasoning at:252-256). An aggregate composes it asResult.Combine(DeleteChildren<OrderLine, OrderLineIdentifierType>(_lines), base.Delete())(:262-263), so a failing child fails the whole cascade'sResult. Both arguments are evaluated beforeCombineruns (MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/Result.cs:124), so the root's in-memoryIsDeletedis set even when a child fails; what keeps the cascade atomic is that the caller does not save a failedResult. - A hard delete is a reviewable exception, enforced by a fitness rule.
ArchitectureRules.HardDeletesOnlyInAllowedTypes(.../Source/Hosting/MMCA.Common.Testing.Architecture/Rules/Domain/ArchitectureRules.SoftDelete.cs:62, surfaced through.../Bases/Domain/SoftDeleteEnforcementTestsBase.cs:17,75-79) fails the build when EF Core's erasing members (DbSet.Remove/RemoveRange,DbContext.Remove/RemoveRange,ExecuteDelete/ExecuteDeleteAsync:ArchitectureRules.SoftDelete.cs:10-11, scoped to the entity-set declaring types at:18-24) are called from a type outside the allowlist, which is the short list of places where erasing a row IS the requirement: retention purge jobs, outbox and audit-trail cleanup, and the erasure handlers below (:26-34). The allowlist has two parts. The base always allows six named MMCA.Common.Infrastructure erasers, so a consumer scanning the framework assemblies does not re-list them and a new framework eraser fails Common's own run until it is reviewed: theEFRepositoryset-based delete, the internal-command purge, theBatchedDeleteloop every retention sweep goes through, and the permission-grant, view-as-grant and passkey stores (SoftDeleteEnforcementTestsBase.cs:19-62). The repo adds its own types throughAllowedHardDeleteTypes, which is empty by default and therefore bans hard deletes outside the framework outright (:66-73). Neither a type-dependency rule nor reflection can see a call inside a method body, so the rule reads IL through the testing package's own metadata reader and matches callees by full name, which keeps the testing package's zero-reference stance toward EF Core (ArchitectureRules.SoftDelete.cs:36-43, the callee test at:124). It sees only direct calls: a hard delete reached through a repo-owned interface is caught at the implementing type, so that implementation goes on the allowlist and the abstraction stays usable (:51-56).
- The deletion is stamped like any other audit fact.
- Erasure is an explicit, additive capability. Aggregates that store personal data implement
IAnonymizable(MMCA.Common.Domain.Interfaces). An application-layer erasure handler loads the aggregate, callsAnonymize()(idempotent, returnsResult), and saves: overwriting personal fields in place so foreign keys and the audit trail survive. Fields that must remain retrievable are persisted through the AES-256-GCMEncryptedStringConverter. An erasure that runs on a consuming side reaches only the rows that exist when it runs, while an access token outlives the account it was issued for, so a consumer can record the erasure and refuse later writes from that id on each write path that checks the record (ADC Engagement'sErasedUser, which ten Engagement write handlers, the shared points awarder and the two ticket-linking services check, Revisions 2026-10-26, 2026-10-28 and 2026-11-23). - Outbox retention is bounded.
OutboxCleanupServicepurges processed outbox rows older thanOutbox:RetentionDays(default 7; set0to disable) across every relational data source, so event payloads are not retained indefinitely. - A build-time guard backs the per-entity opt-in. Domain properties holding data-subject personal data are marked
[Pii](MMCA.Common.Domain.Attributes.PiiAttribute, property-targeted). A fitness function (ArchitectureRules.EntitiesWithPiiImplementAnonymizable, surfaced throughPiiConventionTestsBase) fails the build if any Domain entity declaring a[Pii]property does not implementIAnonymizable, so "this aggregate holds personal data but has no erasure path" is caught by tooling, not by review. The companionPiiRedactor(MMCA.Common.Domain.Privacy) masks the same[Pii]-marked members when an entity is written to a log or telemetry attribute, so personal data does not leak through diagnostics. The same base also runs the guard in reverse: whateverAnonymize()overwrites must carry[Pii](Revision 2026-10-19).
The framework provides the extension points (IAnonymizable, OutboxCleanupService, PiiRedactor) and a build-time guard (the [Pii] → IAnonymizable fitness rule); each consumer app owns the policy: which properties are [Pii], the erasure orchestration/endpoint (data-subject request handling), and any data-subject access/export endpoint, because the personal-data model lives in the consumer (e.g. ADC's User).
Rationale
- Right tool per concern: soft-delete answers "is this record active?"; erasure answers "has this person's data been removed?". Conflating them (e.g. hard-deleting inside
Delete()) would break audit, undelete, and referential integrity. - Audit-preserving: anonymize-in-place keeps the row and its audit fields, satisfying both erasure and accountability obligations simultaneously.
- Idempotent + Result-based: matches the framework's domain conventions and tolerates retried erasure requests.
- Bounded retention: the cleanup service closes the "outbox grows forever / retains PII forever" gap noted in ADR-003 without changing delivery semantics.
Trade-offs
- Erasure is opt-in per entity, but the opt-in is guarded: an aggregate exposing a
[Pii]-marked property that does not implementIAnonymizablefails the architecture fitness test, so the "holds personal data but is not erasable" gap surfaces at build time rather than in a manual personal-data inventory. The residual risk shifts to marking: an entity that holds personal data on an unmarked property is invisible to the guard, so consumers still own the discipline of applying[Pii]to genuine data-subject fields. - Anonymization is irreversible by design and is not the same operation as undelete.
- The late-write guard is per write path, not per account: ADC Engagement refuses in the ten handlers that call
ErasedUserGuard(question, vote, upvote, bookmark create, badge, room check-in, sponsor visit, leaderboard opt-in and ticket claim, all keyed to the caller's id, plus the staff manual check-in, which checks the attendee's id from the request), the shared points awarder and the ticket linker turn an award or a link to an erased account into a no-op, and the roster's existing-account linker skips erased accounts through one batch read, so any write that takes a user id without calling it stays open to a token that outlives its account. The badge-scan check-in does not call it: it resolves the attendee through a badge read that honors the soft-delete filter, and the erasure soft-deletes the account's badge, so a scan of an erased attendee's badge fails as not found unless that badge erasure did not run (Revision 2026-11-23). The guard is the second line of defence: the shared deleted-user marker already answers 401 on every host while it is readable (ADR-047), so a write reaches the guard only when the best-effort marker write failed or the shared cache read failed open within the access token's remaining lifetime (Revisions 2026-10-21, 2026-10-26 and 2026-10-28). - The framework cannot, on its own, make a consumer compliant: the consumer must still wire the erasure handler, the data-subject request flow, and access/export. This ADR provides the extension points, not the policy.
- The default 7-day outbox retention is a behavior change: consumers upgrading the framework begin purging processed outbox rows older than 7 days unless they set
Outbox:RetentionDays = 0. - The
DeletedOn/DeletedBystamps are two new nullable columns on every auditable table, so adopting the framework version that introduced them costs one scaffolded migration per consumer database. They are additive (expand only, no ADR-057 override needed) and they are not backfilled: rows soft-deleted before the migration keep null stamps forever, so the pair answers "who deleted this" only from that point on. - The fitness rule turns "we soft-delete, mostly" into a reviewed inventory, not into a guarantee. It sees direct IL calls in the assemblies the repo's architecture map registers, so raw SQL, a stored procedure, or a delete issued from an unmapped assembly is invisible to it, and an allowlist entry covers every erasing call in the named type rather than the one that was reviewed.
Revision (2026-09-07)
Anonymization keeps the row and its foreign keys: Anonymize() overwrites the personal fields and
leaves the entity's relationships intact, because the aggregate still has to hang off the order and
the customer it belongs to. That is deliberate, and it creates one rule this record did not state.
A pseudonymous key retained through anonymization must never be projected onto an anonymous surface. A customer id or an order id is not personal data on its own, but on a public list it re-attaches every "anonymized" row to the same subject, and to that subject's other rows, for any reader. Anonymization that a caller can undo by grouping is not anonymization.
Store's anonymous review list is the worked case (SEC-Store-07 / SEC-Store-18). The read is served
through PublicProductReviewDTO
(MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Shared/Reviews/PublicProductReviewDTO.cs:30),
which declares the product id, rating, title, body, reviewer name, status and timestamps (:33-60)
and no CustomerId and no OrderId. The controller closes the anonymous paged endpoint over that
type rather than over the owner-facing DTO
(MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.API/Controllers/ReviewsController.cs:58,
:94-99), and the caller's sortColumn is validated against the same type (:107), so the public
shape bounds both what is returned and what can be ordered on.
Revision (2026-10-01)
No decision changed. One description in Decision 1 was corrected: it said composing
Result.Combine(DeleteChildren<...>(_lines), base.Delete()) aborts the cascade "before the root is
touched". Result.Combine takes params ReadOnlySpan<Result>
(MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/Result.cs:124), so both arguments are
evaluated first and base.Delete() sets the root's IsDeleted in memory even when a child fails;
the failure surfaces through the combined Result, and the caller not saving it is what keeps the
cascade atomic (the framework's own wording at
MMCA.Common/Source/Core/MMCA.Common.Domain/Entities/AuditableAggregateRootEntity.cs:260-261 claims
only that a failing child aborts the cascade). Citations refreshed: AuditSaveChangesInterceptor.cs
(:116-130, :73, :82, :108-109, :15-19, :123-126), AuditableAggregateRootEntity.cs
(:275-294, :293, :285-288, :253-257, :264), and the fitness-rule paths, which moved under
Rules/Domain/ and Bases/Domain/ with their line anchors unchanged.
Revision (2026-10-06)
No decision changed. Two facts recorded in the 2026-09-07 Revision were corrected against source:
PublicProductReviewDTOcarries no reviewer name, not only noCustomerIdand noOrderId: its doc says so (MMCA.Store/Source/Modules/Catalog/MMCA.Store.Catalog.Shared/Reviews/PublicProductReviewDTO.cs:8,:16-18, an anonymous visitor never sees a byline, so on the cached list the name only leaked). It declares the id, row version, product id, rating, title, body, status and the two timestamps (:33-57); the type is still declared at:30.- In
ReviewsController.csthe public query service is the constructor parameter at:57, the anonymous paged endpoint is:88-99([AllowAnonymous]at:89, signature at:93-99, the public query service called at:105), andsortColumnis validated byQueryFieldService.Validate<PublicProductReviewDTO>at:101(:107only defaults it toCreatedOn).
Anchors were re-verified against current source. The interceptor anchors in Decision 1 moved
(AuditSaveChangesInterceptor.cs:125-144, :87, :96, :121-123, :126-128, :91-92; :15-19
unchanged), which supersedes the interceptor list recorded in the 2026-10-01 Revision; the
AuditableBaseEntity.cs and AuditableAggregateRootEntity.cs anchors are unchanged.
Revision (2026-10-19)
No decision changed. The build-time guard in Decision 4 now runs in both directions, from the framework rather than from one consumer (MMCA.Common v1.246.0):
- Forward (unchanged):
EntitiesWithPiiProperties_ShouldImplement_IAnonymizable(MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Bases/Governance/PiiConventionTestsBase.cs:34). - Reverse:
PropertiesOverwrittenByAnonymize_MustCarryPii(PiiConventionTestsBase.cs:43-44, implemented byArchitectureRules.PropertiesOverwrittenByAnonymizeCarryPiiat.../Rules/Governance/ArchitectureRules.Anonymization.cs:49) builds each sample, runsAnonymize(), and fails on every string or reference property whose value moved without a[Pii]marker, because an unmarked overwritten field keeps its pre-erasure value in clear as an audit-trailOldValue(ADR-075). Value types and collections are out of scope (:40-46). - Coverage:
EveryAnonymizableDomainEntity_IsCoveredBySample(PiiConventionTestsBase.cs:37-40,ArchitectureRules.Anonymization.cs:12) fails when a concreteIAnonymizabletype in a module Domain assembly has no sample, so a new erasable entity cannot escape the reverse rule. Samples come from the overridableAnonymizableSamplestable, empty by default (PiiConventionTestsBase.cs:31), so a repo with no anonymizable module entity passes unchanged.
Both apps adopt it. Store moved its hand-written reverse rule into the base and keeps only its four
samples (ProductReview, Customer, User, Order) plus a non-vacuity guard
(MMCA.Store/Tests/Architecture/MMCA.Store.Architecture.Tests/Privacy/PiiConventionTests.cs:33-48,
:55-61). ADC supplies two samples: a User built as an external account with every device field
filled, and a Speaker with every profile field and the user link filled
(MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Privacy/PiiConventionTests.cs:23-30,
:31-41). The reverse rule found six fields ADC's Anonymize() overwrote without a marker; DeviceFormFactor,
DevicePlatform, DeviceModel, DeviceManufacturer, DeviceType and LoginProvider now carry
[Pii] (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/User.cs:85, :89, :93,
:97, :105, :109), and a data-only migration redacts their existing audit-trail rows
(MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Identity/Migrations/20261019200206_RedactAuditTrailDeviceAndProviderValues.cs:26-29).
ADC's Speaker is the second anonymizable entity. It implements IAnonymizable
(MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Speakers/Speaker.cs:28) with one
[Pii] field, the organizer-held Email (:40-41). Anonymize() (:330) replaces it with
deleted-{Id}@anonymized.invalid (:337) and keeps the name, biography and the rest of the profile,
because those are the published event program rather than account data; a speaker with no email, or
already carrying the placeholder, is a no-op. The erasure reaches it across services: Identity's
UserDeleted integration event is consumed in Conference by UserDeletedSpeakerErasureHandler
(MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Users/IntegrationEventHandlers/UserDeletedSpeakerErasureHandler.cs:40),
which anonymizes every speaker linked to the erased account and then unlinks it (:66, :74) in
one save, since the link is the only way to find the speaker. A data-only migration redacts the
speaker email values already in the Conference audit trail
(MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Conference/Migrations/20261019232613_RedactAuditTrailSpeakerEmailValues.cs:24-27).
Two paths cannot bring the address back. The Sessionize sync never writes an email: a new speaker is
created with none and an update passes the stored value through
(MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Events/UseCases/RefreshFromSessionize/SpeakerSyncStrategy.cs:126,
:163). And the BR-207 auto-link matches only a provider-verified email
(.../Users/IntegrationEventHandlers/UserRegisteredHandler.cs:99), which an address on the reserved
.invalid domain can never be, so the placeholder cannot re-attach the profile to anyone.
The Trade-offs residual narrows accordingly: a field that Anonymize() overwrites can no longer go
unmarked. A personal-data field that the erasure never touches is still invisible to both directions,
so marking discipline remains the consumer's for those.
Revision (2026-10-21)
Re-verified against current source. Decisions 1, 3 and 4 are unchanged; Decision 2 gains one
sentence and the Trade-offs one bullet, both recording the late-write guard on the consuming side
of the UserDeleted erasure in ADC and its limits.
- ADC Engagement keeps an
ErasedUserrecord per erased account. The aggregate holds the user id and the erasure time only, no name, email or other personal data (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/ErasedUsers/ErasedUser.cs:19,:22,:25, rationale at:8-16), with a unique index onUserId(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/ErasedUsers/ErasedUserConfiguration.cs:29-30; table added byMMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Engagement/Migrations/20261020142915_AddErasedUsers.cs:15). One consumer ofUserDeletedwrites it,UserDeletedSessionQuestionsHandler(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/SessionQuestions/IntegrationEventHandlers/UserDeletedSessionQuestionsHandler.cs:33), in the same save as the question-text erasure and upvote deletion (:72,:79), stamped with the event'sDeletedOn(:106).RecordErasureAsync(:94) checks for an existing record first (:101) and adds one only when absent (:112), so a redelivery writes nothing and a concurrent duplicate fails the unique index and is retried into that state. - The write handlers check it.
ErasedUserGuard.EnsureNotErasedAsync(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:26) asks whether a record exists for the caller (:33) and fails withError.Forbidden(:38) under the codeEngagement.AccountErased(:18). Three handlers call it before writing: submitting a question (.../SessionQuestions/UseCases/Submit/SubmitQuestionHandler.cs:66-68), toggling an upvote (.../SessionQuestions/UseCases/ToggleUpvote/ToggleUpvoteHandler.cs:33-35) and casting a poll vote (.../LivePolls/UseCases/CastVote/CastVoteHandler.cs:36-38). Without it, a question, vote or upvote that the erased account's still-valid access token sends after the erasure ran would carry the erased user id (and, for a question, free text) that no erasure revisits. - Coverage elsewhere. No other ADC handler reads
ErasedUser. The leaderboard opt-in relies on its own terminal marker instead: an erased, soft-deleted opt-in row refuses reactivation withPoints.AccountErased(.../Points/UseCases/SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:92-97). Four Engagement write paths keyed to the caller's id run no check at all. Two of them recreate rows the erasure removes:UserDeletedBookmarksHandlersoft-deletes the account's bookmarks (.../UserSessionBookmarks/IntegrationEventHandlers/UserDeletedBookmarksHandler.cs:46), yetCreateBookmarkHandlercreates or reactivates one forcommand.UserId(.../UserSessionBookmarks/UseCases/Create/CreateBookmarkHandler.cs:56); andUserDeletedBadgeHandlersoft-deletes the attendee badge (.../CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandler.cs:46), yetGetOrCreateMyBadgeHandlermints one for the caller (.../CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:29,:41). The room check-in and sponsor-visit handlers also write under the caller's id (.../CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:58,.../CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:50). These paths are reachable only behind the first line of defence failing: the erasure writes the shared deleted-user marker, best effort, for the 15-minute access-token lifetime (MMCA.Common/Source/Core/MMCA.Common.Application/Users/UseCases/DeleteUser/DeleteUserHandlerBase.cs:166,MMCA.Common/Source/Core/MMCA.Common.Application/Auth/SoftDeletedUserCache.cs:32), andSoftDeletedUserMiddlewareanswers 401 on every host, Engagement included, while it reads that marker (MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/SoftDeletedUserMiddleware.cs:105-111), failing open when the shared cache read throws (:95-103). So a still-valid token can bring back an erased bookmark or badge row for the erased id only when the marker write failed or the cache read failed open before that token lapsed; theErasedUserguard exists to close that same residual for questions, votes and upvotes. Store has no equivalent record or guard (no match inMMCA.Store/Source).
Revision (2026-10-26)
Re-verified against current source. Decisions 1, 3 and 4 are unchanged. The late-write guard recorded in the 2026-10-21 Revision now covers seven Engagement write handlers keyed to the caller's id, though not the leaderboard opt-in, so Decision 2's closing sentence and the matching Trade-offs bullet were updated; the 2026-10-21 Revision itself stays as written.
- Seven handlers call
ErasedUserGuard. Besides question, upvote and vote (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/SessionQuestions/UseCases/Submit/SubmitQuestionHandler.cs:66-68,.../SessionQuestions/UseCases/ToggleUpvote/ToggleUpvoteHandler.cs:33-35,.../LivePolls/UseCases/CastVote/CastVoteHandler.cs:36-38), the guard now runs before creating or reactivating a bookmark (.../UserSessionBookmarks/UseCases/Create/CreateBookmarkHandler.cs:32-34), minting the attendee badge (.../CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:40-42), recording a room check-in (.../CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:66-68) and recording a sponsor visit (.../CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:58-60). The guard's own doc names the same set (.../ErasedUsers/ErasedUserGuard.cs:7-14), as do the erasure handler that writes the record (.../SessionQuestions/IntegrationEventHandlers/UserDeletedSessionQuestionsHandler.cs:17-19,:85-87) and the aggregate (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/ErasedUsers/ErasedUser.cs:8-17). An erased bookmark or badge therefore cannot come back under the erased id even when the shared deleted-user marker is unreadable, which closes the residual item 3 of the 2026-10-21 Revision described for those four paths. - The leaderboard opt-in does not call it.
SetLeaderboardParticipationHandlerwrites under the caller's id (.../Points/UseCases/SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:46-50) and still relies on its own terminal marker, refusing only a soft-deleted row whose name the erasure replaced (:91-97). The erasure only erases rows that already exist (.../Points/IntegrationEventHandlers/UserDeletedPointsHandler.cs:66-84) and creates none, so for an account that never opted in a still-valid token can create a fresh opt-in under the erased id (SetLeaderboardParticipationHandler.cs:105-109, saved at:114) carrying the display name resolved from the token's claims (:67). That residual stays open, behind the same first line of defence as before. - Staff-driven check-ins do not call it.
ManualCheckInHandlerandCheckInAttendeeHandlerwrite a check-in under an attendee's id taken from the command or the scanned badge (.../CheckIns/UseCases/ManualCheckIn/ManualCheckInHandler.cs:44,.../CheckIns/UseCases/CheckInAttendee/CheckInAttendeeHandler.cs:64), not under the caller's id, and nothing on that path readsErasedUser, so an organizer naming an erased attendee's id in a manual check-in records it under that id. Both are organizer-only operations; the residual is recorded here rather than closed. - Anchors re-verified against current source:
AuditableAggregateRootEntity.csmoved (DeleteChildrenat:273-292,Result.Combineat:291, the already-deleted skip at:283-286, its reasoning at:252-255, the compose example at:262), which supersedes theAuditableAggregateRootEntity.csanchors in the 2026-10-01 and 2026-10-06 Revisions (the framework wording cited there at:260-261is now:258-259);Result.cs:124unchanged. Later anchors in the dated Revisions moved as follows and are recorded here rather than edited there:UserDeletedSessionQuestionsHandler.csclass:34,RecordErasureAsynccall:73, save:80, declaration:96, existence check:103,DeletedOnstamp:108, add:114;ErasedUser.csclass:20,UserId:23,ErasedOn:26; ADCUser.cs[Pii]markers:86,:90,:94,:98,:106,:110;SpeakerSyncStrategy.cspass-through of the stored email:162(:126unchanged);UserDeletedSpeakerErasureHandler.csclass:50,Anonymize():79,UnlinkUser():87, single save:99.ErasedUserGuard.cs:18,:26,:33,:38,ErasedUserConfiguration.cs:29-30and20261020142915_AddErasedUsers.cs:15are unchanged.
Revision (2026-10-28)
Re-verified against current source. Decisions 1, 3 and 4 are unchanged. The leaderboard residual recorded in item 2 of the 2026-10-26 Revision is closed (ADC #296), so Decision 2's closing sentence and the matching Trade-offs bullet were updated; the 2026-10-26 Revision itself stays as written.
- The leaderboard opt-in calls
ErasedUserGuard.SetLeaderboardParticipationHandlerruns the guard at the top of the join path (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:71-74, reasoning at:68-70), before it resolves the display name from the token (:76) and before it reactivates or creates a row, so an erased account that never opted in can no longer publish a fresh public row under the erased id. Leaving the board stays unguarded on purpose, since it is the erasure's own direction (:69-70). The terminal marker on an erased row (:100-106) still refuses reactivation as a second check. - Points awards to an erased account are a no-op. The shared
PointsAwardercalls the guard before writing a ledger entry (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:57) and returns success without writing when it refuses (:54-61), so every points adapter that comes through it, the Conference feedback event included, is covered by one check and an integration-event handler is not retried by the broker. The guard therefore has nine call sites: eight write handlers and this service. - Staff-driven check-ins are unchanged:
ManualCheckInHandlerandCheckInAttendeeHandlerstill do not call the guard (noEnsureNotErasedAsyncmatch in either file), so item 3 of the 2026-10-26 Revision still describes current code. - Anchors re-verified against current source: the seven handler call sites recorded in the
2026-10-26 Revision are unchanged (
CreateBookmarkHandler.cs:32,ToggleUpvoteHandler.cs:33,SubmitQuestionHandler.cs:66,CastVoteHandler.cs:36,RecordSponsorVisitHandler.cs:58,GetOrCreateMyBadgeHandler.cs:40,RecordRoomCheckInHandler.cs:66). InSetLeaderboardParticipationHandler.csthe anchors of the dated Revisions moved and are recorded here rather than edited there: caller id:47-51, display name:76, terminal marker:100-106(the 2026-10-21 Revision's:92-97and the 2026-10-26 Revision's:91-97), create:114-118, save:123. The shared deleted-user marker write inMMCA.Common/Source/Core/MMCA.Common.Application/Users/UseCases/DeleteUser/DeleteUserHandlerBase.csstarts at:167(inside thetryat:165, best-effort catch:171-174), not:166as the 2026-10-21 Revision records; the behavior is unchanged.
Revision (2026-11-23)
Re-verified against current source. Decisions 3 and 4 are unchanged. Decision 1's hard-delete bullet now records the framework's built-in allowlist, and Decision 2's closing sentence and the matching Trade-offs bullet record the wider guard coverage in ADC Engagement; the dated Revisions stay as written.
- The guard has twelve per-account call sites and one batch caller.
ErasedUserGuard.EnsureNotErasedAsync(MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:26) runs in ten handlers and two services. Nine handlers are keyed to the caller's id: the eight of the 2026-10-28 Revision plus the ticket claim (.../Tickets/UseCases/ClaimTicket/ClaimTicketHandler.cs:56). The two services are the points awarder (.../Points/Services/PointsAwarder.cs:57) and the ticket linker, which returns zero linked tickets for an erased account rather than failing (.../Tickets/Services/TicketLinker.cs:56-58). The roster's existing-account linker reads the erased ids for a whole batch throughGetErasedUserIdsAsync(ErasedUserGuard.cs:54, called at.../Tickets/Services/ExistingAccountLinker.cs:75) and counts an erased account as having no account (:84). - Staff check-ins: the manual one is guarded, the badge scan is not.
ManualCheckInHandlernow checks the attendee's id taken from the request before writing (.../CheckIns/UseCases/ManualCheckIn/ManualCheckInHandler.cs:41-48), so an organizer working from a stale roster cannot record a check-in under an erased id.CheckInAttendeeHandlerdoes not call the guard; it writes under the scanned badge'sUserId(.../CheckIns/UseCases/CheckInAttendee/CheckInAttendeeHandler.cs:64) after resolving the badge through the read repository (:50-58), whose reads keep the soft-delete filter unless a caller passesignoreQueryFilters(MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Repositories/EFReadRepository.cs:96-115, parameter at:100, filter bypass at:107-108). The erasure soft-deletes the account's badge (.../CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandler.cs:46) and minting a new one is guarded (GetOrCreateMyBadgeHandler.cs:40), so the scan of an erased attendee's badge fails as not found; the residual is limited to a badge whose erasure did not run. This supersedes item 3 of the 2026-10-26 and 2026-10-28 Revisions. - The hard-delete fitness base carries a framework allowlist.
SoftDeleteEnforcementTestsBasealways allows six named erasers in MMCA.Common.Infrastructure (the genericEFRepository,InternalCommandAdministration,BatchedDelete,EFPermissionGrantStore,EFViewAsGrantStore,EFPasskeyCredentialStore:MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Bases/Domain/SoftDeleteEnforcementTestsBase.cs:25-62) and passes them together with the repo'sAllowedHardDeleteTypes(:75-79). That repo list is still empty by default, which now means no hard delete outside the framework (:71-73), not none at all. - ADC's anonymizable set grew and
Userlost its device fields. The five device properties whose[Pii]markers the 2026-10-19 Revision records are no longer on ADC'sUser; the columns were dropped byMMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Identity/Migrations/20261117131307_DropUserDeviceMetadataColumns.cs.Usercarries[Pii]atMMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Domain/Users/User.cs:55,:59,:63,:93,:97,:111and:172. ADC now has fourIAnonymizableentities:User,Speaker(.../Conference.Domain/Speakers/Speaker.cs:28),Ticket(.../Engagement.Domain/Tickets/Ticket.cs:30) andTicketImportRun(.../Engagement.Domain/Tickets/TicketImportRun.cs:26), and its fitness test supplies a sample for each (MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Privacy/PiiConventionTests.cs:27,:34,:45,:57). Store's four samples and its non-vacuity guard are unchanged (MMCA.Store/Tests/Architecture/MMCA.Store.Architecture.Tests/Privacy/PiiConventionTests.cs:33-48,:55-61). - The deleted-user marker lasts 20 minutes, not 15.
SoftDeletedUserCache.MarkerDurationis 20 minutes (MMCA.Common/Source/Core/MMCA.Common.Application/Auth/SoftDeletedUserCache.cs:41), the valueMarkDeletedAsyncwrites with (:91);MarkerDurationFor(:51) sizes a marker to an access token lifetime plus a 5-minute clock skew (:22), never shorter thanMarkerDuration(:54). The 2026-10-21 Revision's "15-minute access-token lifetime" for the marker is superseded. The middleware also fails open on a host with no validator (Engagement among them) after a cache miss (MMCA.Common/Source/Presentation/MMCA.Common.API/Middleware/SoftDeletedUserMiddleware.cs:117-125), which is consistent with the Trade-offs bullet. - Anchors re-verified against current source:
AuditableBaseEntity.csUndelete:91and the domain-side note:62-65;AuditableAggregateRootEntity.csDeleteChildren:274-293,Result.Combine:292, already-deleted skip:284-287, reasoning:252-256, compose example:262-263, the framework's "a failing child aborts the whole cascade" wording:259-260(the 2026-10-26 Revision records:258-259);Result.cs:124unchanged;SoftDeleteEnforcementTestsBase.csclass:17, repo allowlist doc:66-72, fact:75-79;RecordRoomCheckInHandler.cs:67(the 2026-10-28 Revision records:66), the other six handler anchors of that Revision unchanged;Speaker.csAnonymize():337, placeholder:344;PublicProductReviewDTO.cstype:35;ReviewsController.cspublic query service:58,[AllowAnonymous]:88,Validate<PublicProductReviewDTO>:100,CreatedOndefault:106;DeleteUserHandlerBase.csmarker write:214with its best-effort catch at:216;SoftDeletedUserMiddleware.cscache-read fail-open:98-106, marker 401:108-115.