↑↓ to navigate Enter to open "…" all these words ANDOR to combine

Architecture Decision Record

ADR-072: QR Badge Check-In and Points Gamification in ADC

Status

Accepted (2026-08-13). Amended (2026-08-14): ADC shipped two attendee-self-recorded scan surfaces (sponsor booth visits and room self check-in), a third CheckInScope, a sixth earn rule, and a leaderboard display-name erasure path. Every decision below still holds (the opaque credential, one aggregate carrying a scope, index-as-anti-farming, the ADC-local ledger, the opt-in leaderboard); the "organizers scan attendees, never the reverse" posture is the one that acquired a recorded exception, amended in place in the Decision and Rationale below. Revised (2026-08-31): four content-level facts changed and are corrected in place. The sponsor-visit award is 20 rather than 5, duplicate-key classification moved out of the Engagement module into MMCA.Common's IUniqueConstraintViolationDetector (which matches provider error numbers first and message text only as a fallback), the leaderboard total is summed by the database rather than folded in memory, and a batch feedback path joined the two single-answer raise sites. Every decision above still holds; only the passages that describe those four facts, and the citations throughout, move. Revised (2026-10-01): a fourth handler (the event-side batch path) raises the feedback events. Revised 2026-10-06: the question award runs through BestEffort.ExecuteAsync, the scanner reports a non-badge QR as a skipped outcome, and a rejoin of an erased leaderboard row is refused. Revised 2026-10-07: anchors refreshed after the v1.233.0 release. Revised 2026-10-21: session check-in points are awarded once per time slot rather than once per session (a handler-side rule over a Conference schedule read, layered on the ledger index), the room self check-in response reports EarnsPoints and PointsPaused and refuses the check-in when the Conference lookup fails, an absent points entry keeps its default rather than disabling the rule, and a lost check-in insert race answers as a repeat. Revised 2026-10-26: the two self-service check-ins now record that they refuse an erased account and an unpublished event, a lost concurrent opt-out answers as success, the UserDeleted consumer also erases the attendee badge (so the display name is not the only data it reaches), the five pre-redelivery retries are exponential (1 to 30 seconds) rather than immediate, and anchors are refreshed. Revised 2026-10-28: the points awarder awards nothing to an erased account and the leaderboard join refuses an erased account up front, and anchors are refreshed. Revised 2026-11-23: the Engagement service registers six broker consumers through EngagementBrokerConsumers.Register (UserRegistered and UserEmailVerified joined for ticket linking), the UserDeleted consumer also runs a ticket erasure handler that anonymizes ticket holder fields and clears the link, the GDPR export also carries tickets, the duplicate-key detector's text fallback is described as running for every link the error number did not classify, and anchors are refreshed.

Context

ADC wanted two conference-day capabilities that turn out to be one mechanism. Organizers want to know who actually attended which session, which the schedule cannot tell them: a bookmark is an intention and feedback arrives from a self-selected minority. Attendees want a reason to show up to a session they did not plan on and to leave feedback afterwards, which is a rewards problem rather than a data problem.

Registration and door admission are not part of this. ADC sells tickets through TicketLeap, and TicketLeap already scans people through the door on the morning of the event. Rebuilding arrival check-in would produce two systems with two different opinions about who is in the building, and the one holding the money would be right. What TicketLeap cannot do is tell an organizer that 60 people sat in the third-track talk at 2pm.

That framing left a set of open questions with no recorded answer:

  • What does the QR actually carry? A signed token (JWT or an HMAC over the user id) verifies offline and needs no lookup. An opaque handle carries nothing and requires the server.
  • Who scans whom? An attendee scanning a code posted on a room door needs no staff, but a photograph of that door code lets anyone check in from the hallway. An organizer scanning an attendee's badge needs a person with a device.
  • Is a session check-in the same kind of thing as an event check-in? They differ only by whether a session is named.
  • Where do points live? A points ledger is generic infrastructure by shape, and ADR-042 and this workspace's practice both say reusable infrastructure belongs to MMCA.Common. But no second consumer exists: MMCA.Store has no loyalty feature today.
  • Is a leaderboard compatible with an attendee's privacy expectations? Ranking people by name is a publication of attendance behavior.

The framework half of the mechanism (the QR component and the camera capability) is ADR-071. This record decides what ADC does with it.

Decision

The badge credential is an opaque, server-verified handle

AttendeeBadge (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:17-24) is one row per user holding a single Guid Credential, minted on first read of /my-badge by a get-or-create command rather than a query (.../Engagement.Application/CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs). Two unique indexes cover it, on UserId and on Credential (.../Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/AttendeeBadgeConfiguration.cs:31-36).

  • The credential is Guid.NewGuid() and explicitly not Guid.CreateVersion7() (AttendeeBadge.cs:65-68): a v7 value embeds a timestamp and orders monotonically, which is exactly wrong for a bearer value that must be unguessable.
  • Regenerate() (:59-63) issues a new credential, which revokes every previously printed or screenshotted copy in one write.
  • The wire format is mmca-adc:badge:{credential} (.../Engagement.Shared/CheckIns/Badges/BadgePayload.cs:15-20). TryExtractCredential (:30-45) accepts the prefixed form or a bare GUID, case-insensitively, and rejects Guid.Empty, so the manual path can take a typed value and the scanner can reject a foreign QR by prefix.

Organizers scan attendees, with two recorded self-service exceptions

/check-in (.../Engagement.UI/Pages/CheckIns/CheckInScan.razor:1-2) is [Authorize(Roles = RoleNames.Organizer)] and its writes carry [HasPermission(EngagementPermissions.CheckInManage)] ("engagement:checkin:manage", .../Engagement.Shared/Authorization/EngagementPermissions.cs:24, applied at .../Engagement.API/Controllers/CheckInsController.cs:105 and :129, and on the attendance stats read at :213). The attendee's page /my-badge is authenticated-only and displays, never writes. Every CheckIn row therefore records both parties: UserId (.../Engagement.Domain/CheckIns/CheckIn.cs:31) and CheckedInByUserId (:49).

Two later endpoints on the same controller are the exception, and are deliberately built as one: they are attendee scans of a printed QR and carry no [HasPermission] at all. POST /checkins/sponsor-visits (CheckInsController.cs:158-173) records a booth visit behind [FeatureGate(EngagementFeatures.SponsorVisits)] (:160), and POST /checkins/room-visits (:193-208) checks the caller into whatever session a room is hosting behind [FeatureGate(EngagementFeatures.RoomCheckIn)] (:195). Neither takes an attendee from the request: the identity comes from the token, as on /my-badge, and the room endpoint resolves the session server-side from the room plus a configured grace window rather than accepting a session id (:179-180; CheckInSettings.RoomCheckInGraceMinutes, 15 by default at .../Engagement.Shared/CheckIns/CheckInSettings.cs:21, read at .../CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:74-76). Before any of that, both handlers refuse an erased account's still-valid token (ErasedUserGuard.EnsureNotErasedAsync, RecordRoomCheckInHandler.cs:66-69, .../CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:58). Once the session or sponsor is resolved, both refuse a check-in against an unpublished event with CheckInProcessor.EventNotPublished (RecordRoomCheckInHandler.cs:80-81, RecordSponsorVisitHandler.cs:71), which the room page shows as its own NotPublished state (.../Engagement.UI/Pages/CheckIns/Rooms/RoomCheckIn.razor:81-83). Badge minting applies the same erased-account guard (GetOrCreateMyBadgeHandler.cs:40). For these rows the two parties are the same person, which the aggregate says outright (CheckIn.cs:46-49). All four POST actions on the controller carry [Idempotent] (:104, :128, :159, :194), since a repeat already answers 200 and a replay says the same thing.

The room response tells the attendee whether this check-in earns points (RecordRoomCheckInHandler.cs:125-133, EarnsPoints and PointsPaused at :131-132, documented at CheckInsController.cs:183-186). PointsPaused is true when Points:SessionCheckIn is configured to 0 or below, and then the time-slot question is not asked and the check-in is still recorded (RecordRoomCheckInHandler.cs:85-90); an absent entry keeps the default of 10 (PointsSettings.cs:22, bound without validation at .../MMCA.ADC.Engagement.Service/Program.cs:94-95). Otherwise the handler asks the shared time-slot rule before it writes (RecordRoomCheckInHandler.cs:92-99, described below) and fails closed: when the Conference lookup fails it returns the failure before the write (:100-101, the write at :108-117), so on this path the rule's Conference read can refuse a check-in, not only an award.

The scan surface adapts to the head rather than branching on platform, per ADR-071: ScannerAvailable => Scanner.IsSupported (CheckInScan.razor.cs:46) gates the camera card (CheckInScan.razor:78-102), while the manual attendee-search panel is always rendered once an event is loaded (the loading, error and no-event states come first, CheckInScan.razor:17-32), because on a web or Windows head that search is the check-in surface (CheckInScan.razor:122-127). The scan loop does not fail on a non-badge QR: it reports it to the operator as a skipped NotABadge outcome and keeps scanning (CheckInScan.razor.cs:224-233, the outcome at :230).

One CheckIn aggregate carrying a scope

CheckInScope is Event = 0 / Session = 1 / Sponsor = 2 (.../Engagement.Shared/CheckIns/CheckInScope.cs:17, :20, :26), and one aggregate covers all three: EventId is always set (CheckIn.cs:37), SessionId only for session scope (:40), and SponsorId only for sponsor scope (:43), with CheckInInvariants.EnsureTargetMatchesScope(scope, sessionId, sponsorId) enforcing the pairing in the factory (:102). Session check-in is the case ADC actually runs; event scope exists because the model costs nothing extra to support and the door remains TicketLeap's job. Sponsor scope was added later and cost exactly one nullable column plus one index, which is the property this section claimed in advance.

Idempotency and anti-farming are the same index

A repeat scan is answered, not written: CheckInProcessor.FindExistingAsync returns the prior row and the processor reports AlreadyCheckedIn = true without a write (.../Engagement.Application/CheckIns/Services/CheckInProcessor.cs:73-77, surfaced on the DTO at :167), so no second integration event is published. A concurrent double scan that loses the insert race answers the same way: the processor catches the unique violation, re-reads the stored winner and reports it as already recorded, rethrowing only when no winner is found (:95-110, the rethrow at :106-107). Three filtered unique indexes are the backstop under a concurrent double scan (.../EntityConfiguration/CheckIns/CheckInConfiguration.cs:49-63): (UserId, EventId) filtered to [Scope] = 0, (UserId, SessionId) filtered to [Scope] = 1, and (UserId, SponsorId) filtered to [Scope] = 2 (the filter literals are constants at :25-27), all three also excluding soft-deleted rows. The third one is what makes a shared sponsor deep link worth nothing past the first scan.

The points ledger uses the same construction for a different purpose. PointsEntry (.../Engagement.Domain/Points/PointsEntry.cs:31, properties :34-46) is append-only with no mutators at all, is marked IAuditedEntity so that absence of an update is provable in the data rather than merely asserted (:31), raises PointsEntryChanged on create (:96-101), and carries a unique index on (UserId, ActivityType, SubjectKey) (.../EntityConfiguration/Points/PointsEntryConfiguration.cs:46-48). That one index is simultaneously the idempotency guard for redelivered integration events and the anti-farming rule: because the subject key is session:{id}, event:{id} or sponsor:{id} (.../Engagement.Shared/Points/PointsSubjectKeys.cs:16-32, max 64 chars at :14), asking five questions in one session earns the question award exactly once. Session check-in points carry one further rule on top of that index, enforced in handler code: once per time slot (below).

Points are ADC-local, with the extraction path pre-paid

IPointsAwarder is deliberately conference-agnostic: AwardAsync(userId, activity, subjectKey, occurredOnUtc, ct) (.../Engagement.Application/Points/Services/IPointsAwarder.cs:35-40) names no event, session, or conference concept, and the record for that choice is in the interface itself (:12-17): the ledger is built so it can MOVE to MMCA.Common the day a second consumer (Store loyalty) exists, not before.

  • PointsSettings (section "Points" at :16, .../Engagement.Shared/Points/PointsSettings.cs:13-41) carries the rule values: EventCheckIn 25, SessionCheckIn 10, SessionFeedback 15, EventFeedback 15, QuestionAsked 5, SponsorVisit 20 (:38), LeaderboardSize 10 (:41). The deployed configuration restates the same seven values rather than relying on the defaults (.../MMCA.ADC.Engagement.Service/appsettings.json:27-35).
  • Zero disables a rule. PointsAwarder short-circuits on value <= 0 and writes nothing (.../Points/Services/PointsAwarder.cs:47-52). An absent config entry does not take that path: the section binds without validation (.../MMCA.ADC.Engagement.Service/Program.cs:94-95), so a missing key keeps the property default above.
  • An erased account earns nothing. After the rule check, PointsAwarder runs ErasedUserGuard.EnsureNotErasedAsync and returns a success no-op for an erased account (PointsAwarder.cs:54-61). Every points adapter, the Conference feedback events included, comes through the awarder, so that one check covers every award trigger below. Because it is a success, the integration-event adapters do not log their award-failed warning for it (they log on a failed award and never throw, .../Points/IntegrationEventHandlers/SessionFeedbackSubmittedPointsHandler.cs:51-52, AttendeeCheckedInPointsHandler.cs:78-79).
  • The awarded Points value is snapshotted onto the entry at award time (PointsEntry.cs:40), so the ledger records what a rule was worth then.
  • A duplicate is success, not failure: the pre-check returns Result.Success() (PointsAwarder.cs:65-74) and a lost race is caught and also returns success (:85-92).

Award triggers come from three different mechanisms, chosen per event source:

Activity Trigger Subject key Delivery
EventCheckIn (25) AttendeeCheckedIn, event scope event:{id} Outbox integration event
SessionCheckIn (10) AttendeeCheckedIn, session scope, first check-in of its time slot session:{id} Outbox integration event
SessionFeedback (15) SessionFeedbackSubmitted session:{id} Outbox integration event
EventFeedback (15) EventFeedbackSubmitted event:{id} Outbox integration event
QuestionAsked (5) SessionQuestionChanged, Added only session:{id} In-module domain event
SponsorVisit (20) AttendeeCheckedIn, sponsor scope sponsor:{id} Outbox integration event

The three AttendeeCheckedIn rows are one method mapping wire scope onto an earn rule (.../Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:117-151, sponsor branch at :140-146; PointsActivityType.SponsorVisit = 6). The SessionCheckIn row carries one extra check before the award (HandleScopedAsync, :51-80): session points are awarded once per time slot, so a session check-in preceded by an earlier check-in to a different, overlapping session of the same event earns nothing (:62-67). The rule is stated once, in .../CheckIns/Services/SessionTimeSlotPoints.cs:9-28: "earlier" is decided from the committed rows (CheckedInOn, then id), never from handling order, so concurrent or out-of-order events still give the slot's points to its earliest check-in, and Conference answers only which sessions overlap. It applies to every session check-in, door scans included, and never to event or sponsor awards (AttendeeCheckedInPointsHandler.cs:28-35). When Conference does not know the session the award stands (:104-105); any other lookup failure throws so the delivery is retried (:107-110). On this award path attendance is never affected, because the row was written before the event was raised; the room self check-in below is the one path that asks the rule before writing.

Room self check-in has no rule of its own: it writes an ordinary session-scoped CheckIn through the shared core (.../CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:108-117, the scope argument at :112), so it earns the SessionCheckIn row above under the same time-slot rule, which it asks in advance to tell the attendee (:88-104).

AttendeeCheckedIn (.../Engagement.Shared/CheckIns/IntegrationEvents/AttendeeCheckedIn.cs:24-33) is raised inside CheckIn.Create (CheckIn.cs:112-119), so the outbox captures it in the same transaction as the row (ADR-003), and it carries Scope as a string (:27) so a new scope stays additive. SponsorId proved that: it was added as an optional last parameter (:32), so consumers keep deserializing payloads that predate it. It is ADC's first broker self-consumption: the Engagement service both publishes and consumes it (.../Services/MMCA.ADC.Engagement.Service/Program.cs:206-215 for the reasoning). AddBrokerMessaging (Program.cs:222) is handed EngagementBrokerConsumers.Register, whose RegisterIntegrationEventConsumer<T> calls register six consumers (.../Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:34-42): the four on this surface (AttendeeCheckedIn at :36, the two feedback events at :37-38, UserDeleted at :39) plus UserRegistered and UserEmailVerified (:40-42), which drive ticket linking rather than points.

The two feedback events are new to the Conference module (.../Conference.Shared/Sessions/IntegrationEvents/SessionFeedbackSubmitted.cs:20-26, .../Conference.Shared/Events/IntegrationEvents/EventFeedbackSubmitted.cs:19-24) and are raised on the answer-create path only, never on the BR-107 upsert-update path. Four handlers raise them, and the create-path-only rule holds at all four: the single-answer paths AddSessionQuestionAnswerHandler.cs:113 and AddEventQuestionAnswerHandler.cs:104, and the two batch paths BatchAddSessionQuestionAnswersHandler.cs:156-157 and BatchAddEventQuestionAnswersHandler.cs:153-154, each of which emits one feedback event per newly created answer so a whole form submitted in one call produces exactly what the single-answer handler would have produced call by call (BatchAddSessionQuestionAnswersHandler.cs:153-155, BatchAddEventQuestionAnswersHandler.cs:150-152). One feedback form therefore produces one event per answer row on either path, and the shared subject key collapses them to one award.

QuestionAsked rides the existing in-module SessionQuestionChanged domain event, filtered to DomainEntityState.Added (.../Points/DomainEventHandlers/SessionQuestionSubmittedPointsHandler.cs:65-69), keyed by session rather than by question (:94).

The leaderboard is opt-in, and opting in is a row

LeaderboardOptIn (.../Engagement.Domain/Points/LeaderboardOptIn.cs:32, :35) holds UserId and a DisplayName snapshot, resolved server-side from the caller's token claims rather than accepted from the request body (SetLeaderboardParticipationHandler.cs:199-230, the three claim lookups at :201-203; the request carries only Participate, .../Engagement.Shared/Points/SetLeaderboardParticipationRequest.cs:11, dispatched at SetLeaderboardParticipationHandler.cs:54-56). Opting out soft-deletes the row (LeaveAsync, :152-181, active.Delete() at :164) and rejoining reactivates it (JoinAsync, :63-136, the reactivation at :108, the BR-135 pattern), so nobody's name is on the board without a live opt-in. A concurrent opt-out that loses the rowversion check to an identical one is a success, since being off the board is what was asked (:172-178). A join from an erased account's still-valid token is refused before anything else, by the same ErasedUserGuard the self-service check-ins use (:71-74), which returns Forbidden Engagement.AccountErased (.../Engagement.Application/ErasedUsers/ErasedUserGuard.cs:18, :37-41). The ErasedUser record it checks is written during the same UserDeleted delivery that erases the name (.../SessionQuestions/IntegrationEventHandlers/UserDeletedSessionQuestionsHandler.cs:101-115), so once erasure has finished that is the code an erased account's rejoin gets. A row whose name was erased is also terminal on its own: when no ErasedUser record exists, rejoining it returns Forbidden Points.AccountErased instead of reactivating (:100-106), a backstop behind the guard. A join that loses a race to a concurrent identical join (a unique-index violation on the insert path, or a concurrency conflict on the reactivate path) is treated as the already-on-board success (IsLostJoinRace, :144-146, catch filter at :125). Erasure is a separate, irreversible promise: EraseDisplayName() (LeaderboardOptIn.cs:119-130) overwrites the published name in place when the account behind it is erased, and it is driven by the UserDeleted broker consumer, UserDeleted -> UserDeletedPointsHandler (EngagementBrokerConsumers.cs:39, the mapping documented at Program.cs:185-200, the UserDeleted line at :193), because the published name lives in the Engagement database, beyond the reach of the Identity-side erasure. It is not the only such data: the same consumer also runs the bookmark, session-question, poll-vote, badge and ticket erasure handlers (Program.cs:194-196, which labels the last one "ticket-unlink"; the erasure rationale at :202-204 lists the other rows but not tickets). UserDeletedTicketHandler does more than unlink: in one pass and one save it anonymizes every linked ticket's holder fields (Ticket.Anonymize) and then clears the link, reading past the soft-delete filter so a deleted roster row stops naming the erased person too (.../Tickets/IntegrationEventHandlers/UserDeletedTicketHandler.cs:11-18, :43-58). UserDeletedBadgeHandler deletes the attendee badge for the same reason, its per-user credential being out of Identity's reach (.../CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandler.cs:10-13). The opt-in row itself survives (anonymize-in-place, ADR-005). GetLeaderboard (.../Points/UseCases/GetLeaderboard/GetLeaderboardHandler.cs) reads only opted-in users' entries (:39-46), asks the database for one grouped SUM per attendee rather than reading the ledger rows (SumByAsync, :55-59, filtered to the opted-in ids at :58), then orders by total and display name (:68-69) and assigns distinct sequential ranks (:73).

Engagement.CheckIn and Engagement.Points are feature flags enforced with [FeatureGate] at the controllers (CheckInsController.cs:39, PointsController.cs:34, ADR-031), and the two self-service surfaces added two more, gated per action rather than per controller so each printed artifact can be retired on its own: Engagement.SponsorVisits (.../Engagement.Shared/EngagementFeatures.cs:59) and Engagement.RoomCheckIn (:71). GDPR export is extended in the same pass: user_engagement_export.proto gains points_entries, leaderboard_opt_in and leaderboard_display_name (:34-41) plus an EngagementPointsEntryExportItem message (:107-124); the check-in history followed as check_ins = 6 (:45) with an EngagementCheckInExportItem message (:126-145) carrying scope, event, session and sponsor. The same contract now also carries poll_votes = 7 and question_upvotes = 8 (:49, :52; messages at :147-153 and :155-160) and tickets = 9 (:56, message EngagementTicketExportItem at :59-86), which belong to the live-poll, question-upvote and ticket-roster features rather than to this record.

Rationale

  • An opaque credential makes the server the only interpreter. A JWT or HMAC badge would verify offline, but the scanning device is online by necessity (it has to write a check-in row), so offline verification buys nothing. What it costs is real: a signed token is self-describing, so a screenshot leaks whatever claims it carries; it cannot be revoked without a revocation list, which is a second store; and it is long, which makes a denser QR that is harder to read off a dim phone screen. A GUID is short, meaningless to anyone holding it, and revoked by one Regenerate().
  • Scanning direction decides who can cheat. A code posted at a room door is a photograph away from remote check-in by anyone in the building or on social media. Making the organizer's device the scanner moves the trust to a person holding a permission, and the record of who scanned lands on every row. That is why the organizer scan remains the primary path, and it is unchanged. Amended 2026-08-14: ADC now also ships the other direction, as a bounded exception rather than a reversal. Sponsor booth visits and room self check-in are printed QRs the attendee scans, so the code is shareable and the argument above applies to them in full. What changed is that the exposure is now priced instead of avoided: the once-per-subject filtered unique index caps a leaked sponsor link at one award per attendee (CheckInConfiguration.cs:59-63), the award is a single per-sponsor grant and zero-able mid-conference (PointsSettings.cs:33-38), each surface has its own kill switch (EngagementFeatures.cs:59, :71), and the row still records both parties even when they are the same person (CheckIn.cs:46-49), so a self-recorded row is identifiable as one rather than indistinguishable from an organizer scan. Both flags ship on (.../MMCA.ADC.Engagement.Service/appsettings.json:21-22), so the exception is live, not dormant: turning either off is a configuration change that restores the original posture for that surface.
  • Session-first respects the product that already owns the door. TicketLeap is the system of record for admission, and a second arrival check-in would create a disagreement rather than a capability. The scope enum leaves event check-in modelled and available without ADC asserting ownership of it.
  • One aggregate with a scope beats two aggregates that differ by a nullable column. Splitting EventCheckIn and SessionCheckIn would duplicate the factory, the integration event, the idempotency rule, the query surface and the migration for a distinction that a single enum expresses. The filtered unique indexes give each scope its own exact constraint anyway.
  • The anti-farming rule and the idempotency rule are genuinely the same rule. "Award this user once for this subject" is what makes a redelivered broker message safe and what makes a fifth question worth nothing. Expressing it once, as a unique index, means the two cannot drift apart, and the database is the arbiter rather than handler code. The one rule the index cannot express is session check-in's once per time slot, because "overlapping" is a schedule fact Conference owns: that rule lives in handler code (SessionTimeSlotPoints), whose overlap predicate is stated once and asked by both the award and the room response. The two callers do not share everything around it: the award lets a Conference NotFound stand (AttendeeCheckedInPointsHandler.cs:104-105) while the room path fails the request on any lookup failure (RecordRoomCheckInHandler.cs:100-101), and the room path asks at the request instant (:98) while the stored row takes a later clock read (CheckInProcessor.cs:85), so under concurrent check-ins the room's EarnsPoints is a prediction the eventual award can contradict. As a points rule it only ever withholds an award the index would otherwise allow. The index remains the arbiter for idempotency.
  • ADC-local is the honest place for the ledger today. Moving it to MMCA.Common now would add a public API surface and a lockstep release obligation (ADR-016) for a single consumer, and the shape of a second consumer is guesswork until Store actually needs loyalty. The cost of waiting was paid up front instead: the awarding vocabulary carries no conference nouns and the subject key is an opaque string, so the move is a project relocation rather than a redesign.
  • Opt-in is the only defensible default for a leaderboard. A ranked list of names is a publication of who attended what. Snapshotting the display name at opt-in additionally keeps the board query out of Identity, so the reward surface does not become a second read path onto user records.
  • Points are earned by facts the system already publishes. Check-in, feedback and question-asked are events that exist for their own reasons; the ledger is a consumer of them, so gamification adds no new write path to the features it rewards.

Trade-offs

  • The badge credential is a bearer value. Anyone who photographs an attendee's screen can be checked in as that attendee. The mitigations are that a badge scan is organizer-side, that every row records who scanned, and that Regenerate() invalidates a leaked code, but the value itself carries no proof of possession.
  • QuestionAsked is at-most-once and says so. It rides an in-process domain event dispatched after commit, so a crash in that window loses one five-point award and nothing else: no question is lost and no total is corrupted (SessionQuestionSubmittedPointsHandler.cs:31-39). The award additionally runs through MMCA.Common's BestEffort.ExecuteAsync (:81-101, ADR-096), so a failing award never fails the question that already committed: a thrown award is logged as a Warning and counted on besteffort.dispatch.failed, and only the caller's own cancellation is rethrown (MMCA.Common.Application/Services/BestEffort.cs:59, :70, :108). Only that pre-dispatch crash is silent; every path that declines to award logs it, at a level matching how surprising it is (:40-46, :104-111). Promotion to an integration event is a one-file change per side, deliberately deferred: five points do not justify an outbox row per question.
  • The feature flags gate the surface, not the ledger. [FeatureGate] sits on the controllers and the two self-service actions, and no Engagement handler implements IFeatureGated, so turning Engagement.Points off hides the pages and the API while the event consumers keep accruing entries. That is recoverable (the ledger is append-only and correct) but it is not what "off" usually means.
  • Rule values are snapshotted, so history is mixed-rate. Changing SessionCheckIn from 10 to 15 does not restate earlier entries, which is right for an audit ledger and confusing on a leaderboard where two attendees with identical activity can hold different totals.
  • Duplicate-key detection is an injected framework concern, not module code. The Application layer references neither EF Core nor SqlClient, so it cannot read a provider error number itself. It asks someone who can: IUniqueConstraintViolationDetector (MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IUniqueConstraintViolationDetector.cs:31) is constructor-injected into the handlers on this surface that can lose an insert race, so PointsAwarder (:33, catch filter at :85), SetLeaderboardParticipationHandler (:36, catch filter at :125, the detector call at :145, alongside IConcurrencyConflictDetector at :37) and GetOrCreateMyBadgeHandler (:22, catch filter at :62) classify one way rather than three; other Engagement handlers outside this record inject it the same way (CreateBookmarkHandler.cs:22, CastVoteHandler.cs:26, ToggleUpvoteHandler.cs:23). The check-in write path reaches the same detector without injecting it: CheckInProcessor classifies its lost insert race through unitOfWork is IUniqueConstraintViolationDetector (CheckInProcessor.cs:95-96), which MMCA.Common's UnitOfWork implements (MMCA.Common.Infrastructure/Persistence/UnitOfWork.cs:24). The registered implementation walks the inner exception chain matching SQL Server error numbers 2601 and 2627 first (MMCA.Common.Infrastructure/Persistence/SqlServerUniqueConstraintViolationDetector.cs:34, :37, :50-54), and falls back to the message text "duplicate key" or "UNIQUE constraint failed" for any link the error number did not classify (:40, :43, :63-67). That is a gap between the detector's code and its own documentation: the type summary says every other SQL Server error is deliberately NOT a unique violation and must keep propagating (:14-17), and the inline comment calls the text check "ONLY a fallback" for a link that is not a SqlException (:56-57), yet nothing skips a SqlException link at the fallback, so a SqlException carrying a different error number whose message contains that text also classifies. The fallback is provider-dependent string matching, kept because a wrapper (a retry decorator re-throwing its own type, a test double) carries the number nowhere but the message (:57-60), and because it is what classifies the violation on another engine registered with this default detector: SQLite's "UNIQUE constraint failed" and PostgreSQL's "duplicate key value violates unique constraint" (:20-24). The pre-check makes the whole path rare, not hot.
  • The leaderboard total is a database SUM, so ordering is the part that stays in memory. GetLeaderboardHandler pushes the aggregation down (SumByAsync, :55-59) and one grouped total comes back per opted-in attendee rather than every ledger row. What still runs in the handler is the ordering, the Take and the rank assignment (:65-77), bounded by the opt-in population rather than by the size of the ledger. The remaining wrinkle is a type one: points are stored as int and the grouped sum speaks decimal, so the selector widens implicitly and the total narrows back on the way out (:50-53, :61).
  • Broker self-consumption for an in-service concern. AttendeeCheckedIn is published and consumed by the same Engagement service, so an in-service award takes a broker round-trip. That is the price of keeping the award path identical to the cross-module ones (feedback arrives from Conference) and of leaving Engagement extractable, but it is a real hop for a local fact.
  • A once-per-subject rule caps engagement as well as farming. The second question an attendee asks in a session earns nothing, which is the anti-farming rule working as designed and also a small disincentive at exactly the moment a room is warming up. Session check-in is capped harder, at once per time slot: an attendee who moves from one overlapping talk to another is checked in to both and earns points for the first only. The award also takes a cross-service Conference read, so a Conference outage delays session awards rather than granting them: the handler throws and the delivery runs MMCA.Common's bounded retry and redelivery schedule (5 in-process retries, MMCA.Common.Infrastructure/Messaging/MessageBusSettings.cs:99, at exponential intervals from 1 to 30 seconds, :106 and :112, then redeliveries after 60, 600 and 3600 seconds, the framework default at :217 that applies when no intervals are configured (:240) and the transport declares none of its own, as on ADC's Service Bus transport), and an outage that outlasts it dead-letters the award for an operator replay.
  • The export carries the activity as a number. activity_type is an int32 rather than a proto enum (user_engagement_export.proto:114, with the reasoning at :108-113), because proto3 forces a zero member and 0 is reserved as "unset" on the C# side, so a reader of the raw export sees 3 rather than SessionFeedback. The check-in export item repeats the trade for scope (:130, reasoning at :127-129).

Revision (2026-10-01)

One content fact changed and is corrected in place in the Decision: a fourth handler raises the feedback events. The event-side batch path, BatchAddEventQuestionAnswersHandler.cs:153-154, emits one EventFeedbackSubmitted per newly created answer exactly as the session-side batch path does (BatchAddSessionQuestionAnswersHandler.cs:156-157), so the create-path-only rule and the one-award-per-subject collapse hold at all four raise sites. No decision or rationale changed. The remaining edits are citation refreshes after files moved into feature subfolders (Engagement.Shared/CheckIns/Badges/, Engagement.UI/Pages/CheckIns/, EntityConfiguration/CheckIns/ and EntityConfiguration/Points/, and MMCA.Common's Interfaces/Infrastructure/Persistence/IUniqueConstraintViolationDetector.cs:31) and line shifts in CheckInsController.cs, EngagementFeatures.cs, RecordRoomCheckInHandler.cs, CheckInScan.razor(.cs), SetLeaderboardParticipationHandler.cs, the two single-answer feedback handlers and the Engagement service Program.cs.

Revision (2026-10-06)

Content corrections, made in place; no decision or rationale changed:

  • The QuestionAsked award no longer has a hand-written CA1031-suppressed catch: it runs through MMCA.Common's BestEffort.ExecuteAsync (ADR-096), which logs a Warning, counts besteffort.dispatch.failed and rethrows only the caller's cancellation. The best-effort semantics are unchanged.
  • The /check-in scan loop now reports a non-badge QR to the operator as a NotABadge outcome before continuing, rather than discarding it silently; the page's role attribute uses the RoleNames.Organizer constant.
  • SetLeaderboardParticipationHandler refuses to reactivate an erased opt-in (Points.AccountErased) and also classifies a lost reactivation race through IConcurrencyConflictDetector.
  • IUniqueConstraintViolationDetector is no longer injected into only three handlers; the Trade-offs passage now names the other Engagement handlers that inject it (outside Engagement, Conference's CreateSessionHandler.cs:27 injects it too).
  • The GDPR export contract gained poll_votes and question_upvotes, noted in the Decision.

Every path:line anchor in the live sections was re-verified against current source and refreshed (Program.cs, SetLeaderboardParticipationHandler.cs, SessionQuestionSubmittedPointsHandler.cs, CheckInScan.razor(.cs) and user_engagement_export.proto).

Revision (2026-10-07)

Re-verified against current source. No decision, rationale, behavior or count changed: the Engagement service still self-consumes AttendeeCheckedIn through the broker, registers the same four consumers inside AddBrokerMessaging, and drives the leaderboard display-name erasure from UserDeleted. Only the Engagement service Program.cs anchors moved, each by one line.

  1. Anchors re-verified against current source: in Source/Services/MMCA.ADC.Engagement.Service/Program.cs, the self-consumption reasoning is :276-285, AddBrokerMessaging is :291, the four RegisterIntegrationEventConsumer<T> calls are :293-296 (UserDeleted at :296), the UserDeleted mapping comment is :268-270, and the erasure rationale is :272-274.

Revision (2026-10-21)

Re-verified against current source. The opaque credential, the scoped CheckIn aggregate, the ADC-local ledger, broker self-consumption with the same four consumers, and the opt-in leaderboard are unchanged. Session check-in points moved from once per session to once per time slot, and the Decision, Rationale and Trade-offs are amended in place for it.

  1. Session check-in points are awarded once per time slot: AttendeeCheckedInPointsHandler skips the award when an earlier, overlapping check-in to another session of the same event exists (AttendeeCheckedInPointsHandler.cs:62-67), the rule stated once in SessionTimeSlotPoints.cs:9-28. A Conference NotFound lets the award stand (AttendeeCheckedInPointsHandler.cs:104-105); any other failure throws so the delivery retries (AttendeeCheckedInPointsHandler.cs:107-110). The Decision table row, the award prose, the "same index" Rationale bullet and the once-per-subject Trade-off now say so.
  2. The room self check-in asks the same rule before it writes and returns EarnsPoints and PointsPaused (RecordRoomCheckInHandler.cs:90-106, :133-134); a Conference failure there fails the request before the write (:102-103, write :110-119), so on that path the rule's read can refuse attendance, and the Decision no longer says the check-in is recorded either way. The Rationale bullet now says only the overlap predicate is shared: the two callers differ on NotFound and on the instant they ask at (RecordRoomCheckInHandler.cs:100, CheckInProcessor.cs:85).
  3. CheckInProcessor catches a lost insert race, re-reads the winner and answers already recorded (CheckInProcessor.cs:96-111), classifying through the UnitOfWork cast to IUniqueConstraintViolationDetector (MMCA.Common.Infrastructure/Persistence/UnitOfWork.cs:24); the Trade-offs list of insert-race handlers now names it.
  4. The third [HasPermission] on CheckInsController is on the GET stats read (:186-187), not a write, and all four POST actions carry [Idempotent] (:78, :102, :133, :168).
  5. An absent Points entry does not disable a rule: the section binds without validation (Source/Services/MMCA.ADC.Engagement.Service/Program.cs:128-129), so a missing key keeps its property default (SessionCheckIn 10 at PointsSettings.cs:21); only a configured value of 0 or below is the kill switch (RecordRoomCheckInHandler.cs:90). The "Zero disables a rule" bullet and the PointsPaused prose are corrected.
  6. A Conference outage delays a session award only for as long as MMCA.Common's bounded retry and redelivery schedule lasts (MMCA.Common.Infrastructure/Messaging/MessageBusSettings.cs:92, :211); past it the award dead-letters. The once-per-subject Trade-off now says so.
  7. Anchors re-verified against current source: CheckInsController.cs room-visits :167-182, its [FeatureGate] :169, server-side resolution :153-154; RecordRoomCheckInHandler.cs grace read :68, write :110-119, scope :114; CheckInProcessor.cs repeat answer :73-77, DTO :168; AttendeeCheckedInPointsHandler.cs TryMapAward :117-151, sponsor branch :140-146; CheckInScan.razor camera card :76-100, manual panel :120-125; CheckInScan.razor.cs NotABadge block :206-215, outcome :212; Engagement service Program.cs reasoning :277-286, AddBrokerMessaging :292, consumers :294-297 (UserDeleted :297), mapping :266-271, erasure rationale :273-275; CastVoteHandler.cs:26, ToggleUpvoteHandler.cs:23.

Revision (2026-10-26)

Re-verified against current source. The opaque credential, the scoped CheckIn aggregate, the ledger index, the once-per-time-slot rule, broker self-consumption with the same four consumers, and the opt-in leaderboard are unchanged; the Points section still binds without validation, so an absent entry keeps its default and 0 is the kill switch. Items 1 to 3 add facts the Decision omitted (item 3 also corrects its claim that the published name is the only personal data out of Identity's reach), and item 4 restates the Trade-offs retry and redelivery schedule.

  1. Both self-service check-ins refuse an erased account's still-valid token (RecordRoomCheckInHandler.cs:65-68, RecordSponsorVisitHandler.cs:58) and an unpublished event (RecordRoomCheckInHandler.cs:88-89, RecordSponsorVisitHandler.cs:71), the latter shown as a NotPublished state on the room page (Pages/CheckIns/Rooms/RoomCheckIn.razor:58); badge minting applies the same erased-account guard (GetOrCreateMyBadgeHandler.cs:40).
  2. LeaveAsync treats a concurrent opt-out that loses the rowversion check as success (SetLeaderboardParticipationHandler.cs:163-169).
  3. The UserDeleted consumer runs the bookmark, session-question, poll-vote and badge erasure handlers as well as the display-name one (Program.cs:276-277), and UserDeletedBadgeHandler deletes the attendee badge because its credential is also beyond the Identity-side erasure (UserDeletedBadgeHandler.cs:10-13), so the Decision no longer calls the published name the one piece of personal data out of Identity's reach.
  4. The 5 retries before redelivery are in-process UseMessageRetry attempts at exponential intervals from 1 to 30 seconds (MessageBusSettings.cs:99, :106, :112), not immediate ones. The redelivery default of 60, 600 and 3600 seconds is now the framework default (MessageBusSettings.cs:217) that applies when no intervals are configured (:240) and the transport declares none; ADC's Service Bus transport declares none.
  5. Anchors re-verified against current source: Engagement service Program.cs points binding :134-135, reasoning :283-292, AddBrokerMessaging :303, consumers :305-308 (UserDeleted :308), mapping :268-277 (UserDeleted :275); RecordRoomCheckInHandler.cs grace read :74, pause gate :96-98, rule :100-107 asked at :106, failure :108-109, ask block :98-112, write :116-125, scope :120, response :133-141 (EarnsPoints/PointsPaused :139-140); CheckInProcessor.cs race catch :95-110, cast :95-96, rethrow :106-107, DTO :167; SetLeaderboardParticipationHandler.cs JoinAsync :62-127, AccountErased :88-97, reactivation :99, catch filter :116, IsLostJoinRace :135-137 (detector call :136), LeaveAsync :143-172, Delete :155, ResolveDisplayName :190-221, claim lookups :192-194; CheckInScan.razor states :17-32, camera card :78-102, manual panel :122-127; CheckInScan.razor.cs NotABadge block :215-224, outcome :221; PointsSettings.cs class :13-41, SessionCheckIn :22, SponsorVisit :38 (doc :33-38), LeaderboardSize :41; GetOrCreateMyBadgeHandler.cs :22, :62; CreateBookmarkHandler.cs:22; MessageBusSettings.cs:99.

Revision (2026-10-28)

Re-verified against current source. The opaque credential, the scoped CheckIn aggregate, the ledger index, the once-per-time-slot rule, broker self-consumption with the same four consumers (AttendeeCheckedIn, SessionFeedbackSubmitted, EventFeedbackSubmitted, UserDeleted), and the opt-in leaderboard are unchanged. Items 1 and 2 add erased-account guards the Decision omitted; item 3 re-points the anchors that the inserted guards and the Program.cs edits moved.

  1. PointsAwarder awards nothing to an erased account: after the rule check it runs ErasedUserGuard.EnsureNotErasedAsync and returns a success no-op (Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:54-61), so one check covers every points adapter, the Conference feedback events included. The Decision gains an "An erased account earns nothing" bullet.
  2. SetLeaderboardParticipationHandler.JoinAsync refuses a join from an erased account before anything else (SetLeaderboardParticipationHandler.cs:71-74) with Engagement.AccountErased (ErasedUserGuard.cs:18), so the terminal Points.AccountErased row check (:100-106) is now a backstop for an erased row with no ErasedUser record. The leaderboard paragraph now says so.
  3. Anchors re-verified against current source: Engagement service Program.cs reasoning :284-293, AddBrokerMessaging :304, consumers :306-309 (UserDeleted :309), mapping :268-278 (UserDeleted :276, the other erasure handlers :277-278), erasure rationale :280-282; PointsAwarder.cs detector :33, zero short-circuit :47-52, pre-check :65-74, lost race :85-92 (catch filter :85); SetLeaderboardParticipationHandler.cs detectors :36 and :37, dispatch :54-56, JoinAsync :63-136, reactivation :108, catch filter :125, IsLostJoinRace :144-146 (detector call :145), LeaveAsync :152-181, Delete :164, opt-out race :172-178, ResolveDisplayName :199-230, claim lookups :201-203.

Revision (2026-11-23)

Re-verified against current source. The opaque credential, the scoped CheckIn aggregate, the ledger index, the once-per-time-slot rule, broker self-consumption of AttendeeCheckedIn, the Points binding without validation and the opt-in leaderboard are unchanged. Items 1 to 4 correct content in place; item 5 re-points the anchors that moved.

  1. The Engagement service registers six broker consumers, not four. AddBrokerMessaging (Source/Services/MMCA.ADC.Engagement.Service/Program.cs:222) is handed EngagementBrokerConsumers.Register, which adds UserRegistered (on its own named queue, EngagementBrokerConsumers.cs:30, :40-41) and UserEmailVerified (:42) for ticket linking beside the four on this surface (:36-39). The Decision now says so.
  2. The UserDeleted consumer also runs the ticket erasure handler (Program.cs:194-196; Engagement.Application/Tickets/IntegrationEventHandlers/UserDeletedTicketHandler.cs:11-18), which anonymizes the holder fields of every linked ticket (soft-deleted rows included) and clears the link in one save, so six handlers run on that one consumer. The erasure rationale at Program.cs:202-204 does not list tickets.
  3. The GDPR export contract also carries tickets = 9 (user_engagement_export.proto:56, message :59-86), which belongs to the ticket roster rather than to this record; the Decision names it.
  4. The duplicate-key detector's text fallback runs for every link in the chain the error number did not classify, a SqlException with another number included (MMCA.Common.Infrastructure/Persistence/SqlServerUniqueConstraintViolationDetector.cs:50-54, :63-67); the Trade-offs no longer say it applies only to a non-SqlException link, and name the conflict with the detector's own comments (:14-17, :56-57) as a gap.
  5. Anchors re-verified against current source: Engagement service Program.cs points binding :94-95, mapping :185-200 (UserDeleted :193), erasure rationale :202-204, reasoning :206-215, AddBrokerMessaging :222; EngagementBrokerConsumers.cs Register :34-42; CheckInsController.cs class [FeatureGate] :39, [Idempotent] :104, :128, :159, :194, [HasPermission] :105, :129, :213, sponsor-visits :158-173 ([FeatureGate] :160), room-visits :193-208 ([FeatureGate] :195), server-side resolution :179-180, EarnsPoints/PointsPaused doc :183-186; RecordRoomCheckInHandler.cs erased guard :66-69, grace read :74-76, EventNotPublished :80-81, pause gate :85-90, ask block :88-104, rule :92-99 asked at :98, failure :100-101, write :108-117, scope :112, response :125-133 (EarnsPoints/PointsPaused :131-132); appsettings.json Points :27-35; CheckInScan.razor.cs NotABadge block :224-233, outcome :230; CheckInConfiguration.cs indexes :49-63, sponsor index :59-63, scope filter constants :25-27; CheckInScope.cs :17, :20, :26; EngagementPermissions.cs:24; AttendeeCheckedIn.cs record :24-33, Scope :27, SponsorId :32; RoomCheckIn.razor NotPublished :81-83; user_engagement_export.proto points entry :107-124 (activity_type :114, reasoning :108-113), check-in :126-145 (scope :130, reasoning :127-129), poll vote :147-153, question upvote :155-160; SessionQuestionSubmittedPointsHandler.cs at-most-once :31-39, decline logging :40-46 and :104-111, Added filter :65-69, BestEffort :81-101, subject key :94.

Revision (2026-12-01)

Re-verified against current ADC source. The opaque credential, the scoped CheckIn aggregate, the ledger index and the points model are unchanged. Two surfaces were added.

  1. A badge can be reissued. AttendeeBadge.Regenerate() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:59) is reachable over HTTP. POST my-badge/regenerate on CheckInsController lets the attendee reissue their own credential and answers 200 with the new badge (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:100-105); POST badges/{userId}/regenerate does it for an attendee under engagement:checkin:manage and answers 204 (:121-127). Both are [NonIdempotent] (:101, :123), since each call rotates the credential and revokes the previous one. Both handlers share BadgeRegeneration.RegenerateAsync (.../Engagement.Application/CheckIns/UseCases/RegenerateBadge/BadgeRegeneration.cs:22), which refuses an erased user (ErasedUserGuard, :28-30) and a badge never issued (:38) before it calls Regenerate() (:40).
  2. Every room carries a check-in code. Room.Create issues one (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Events/Room.cs:80, RotateCheckInCode at :113), and Event.AddRoom builds its room through it (.../Conference.Domain/Events/Event.cs:397, Room.Create at :415); the 20261201170154_BackfillRoomCheckInCodes migration gives rooms created before then a code (MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Conference/Migrations/20261201170154_BackfillRoomCheckInCodes.cs:14). Room.AcceptsCheckInCode (Room.cs:174-183) always refuses a wrong code; a request with no code, or a room with no code, is accepted only while RoomCheckInSettings.RequireCode is off, and that setting defaults to false (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInSettings.cs:20).

ADR-071 (the framework halves this consumes: the QR component on /my-badge and the scanner capability behind /check-in), ADR-003 (the outbox path AttendeeCheckedIn and the two feedback events take, and the at-least-once delivery the unique index makes safe), ADR-021 (the broker-dedup sibling; the points ledger's unique index is a stronger, persisted form of the same guarantee), ADR-020 (engagement:checkin:manage and engagement:points:view-overview as capability grants rather than roles), ADR-031 (the four Engagement.* gates on this surface, including the two per-action ones, and the 404-not-403 posture), ADR-005 (the GDPR export the points ledger, the check-in history and the leaderboard opt-in now extend, and the anonymize-in-place rule EraseDisplayName() follows).