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

Onboarding guide

22. ADC Engagement Module (Session Bookmarks)

What this group covers. Engagement is the ADC bounded context that holds everything an attendee does at the conference beyond browsing the catalog. Five capability families live here, and they are worth naming up front because the chapter title only mentions the oldest one: the session-bookmark aggregate (the personal schedule), the QR badge check-in surface (badges, organizer scanning, the manual fallback, attendee self-service from printed room and sponsor codes, and the attendance rollup), the points economy (an append-only ledger plus an opt-in public leaderboard), the ticket roster (an organizer-uploaded TicketLeap roster, the invites it sends, the linking of tickets to accounts, the attendee's barcode claim, and the organizer insights reports), and the attendee-facing pages the module contributes to the Blazor UI (feedback forms, the badge, the points screens, and the now-next surface). Around those sit the shared module plumbing: use cases, EF persistence, the REST API, the cross-service gRPC contracts and adapters, and the extracted service host. The module also hosts the conference-day live layer (LivePolls and SessionQuestions), a surface large enough that its aggregates, use cases, controllers, wire payloads and pages are documented on their own in Group 23. What stays in this chapter is everything the rest of the module shares with that layer: the flags in EngagementFeatures, the capabilities in EngagementPermissions with the role map in EngagementPermissionGrants, the outbound publish queue behind ILiveChannelPublishQueue, the two UI helpers the conference-day pages share (LiveChannelSubscription and LiveBroadcastPatch), the browser-side client layer those pages call (ILiveEventUIService, ILivePollUIService and ISessionQuestionUIService with their implementations), the session catalog lookup behind ISessionLookupService, and the LivePolls table shapes (LivePollConfiguration, LivePollOptionConfiguration and LivePollVoteConfiguration), which sit beside the other EF configurations of the one database this module owns. One live-layer controller is documented here as well: LivePollVotingController (MMCA.ADC.Engagement.API/Controllers/LivePollVotingController.cs:37) is the attendee-facing half of the poll surface (open polls with live tallies, one poll's results, and casting a vote), split out of LivePollsController only so that controller stays within the repo's constructor-dependency ceiling. It keeps the same LivePolls route prefix, the same [FeatureGate(EngagementFeatures.LivePolls)] and the same plain [Authorize], so no URL, verb or authorization posture moved with the split, and it binds the caller from the token, never from the request (:20-34); the vote action carries IdempotentAttribute because the request names the option explicitly (set my vote to X, not toggle), so a retry over flaky conference wifi is safe to replay (:97-103). Read Group 02 for the entity primitives and primer §2 for the styles before you go deep here.

Five small aggregates, one shape. Every write in this module lands on an AuditableAggregateRootEntity<TIdentifierType> with private setters, private constructors, and a static Create factory returning Result<T> after a Result.Combine over a matching invariants helper. (A sixth aggregate root, ErasedUser, is not a capability of its own but the erasure record taught under Persistence below.) UserSessionBookmark (MMCA.ADC.Engagement.Domain/UserSessionBookmarks/UserSessionBookmark.cs:16) carries two scalar foreign keys, UserId and SessionId (:19, :22), and raises one UserSessionBookmarkChanged event with a DomainEntityState discriminator instead of separate Created and Deleted events (:57, :73, :88, documented in-code as BR-60); its Reactivate() (:68-76) undeletes a soft-deleted row and re-raises the Added variant, which is the domain half of the re-bookmarking rule BR-135. The comment at :55-56 is worth reading before you copy the event: the bookmark's identity is generated by the INSERT, so the event captures a zero id by value and consumers correlate on the user and the session instead. CheckIn (MMCA.ADC.Engagement.Domain/CheckIns/CheckIn.cs:28) is one aggregate for all three scopes of the CheckInScope enum, because the row, the idempotency rule, and the attendance query have the same shape for each and only the required target differs (:13-15); its CheckedInByUserId (:49) is what keeps a self-recorded scan distinguishable from an organizer's, and it is the one aggregate here that raises an integration event straight from its factory (:112). AttendeeBadge (MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:18) holds one opaque Guid credential per user (:24) and raises no domain event at all, since a badge existing is not a fact any other module reacts to (:12-15); Regenerate() (:59) revokes every printed or screenshotted copy, and the credential is minted with Guid.NewGuid() rather than Guid.CreateVersion7() precisely because a v7 value embeds a timestamp and orders monotonically, which is the one property a bearer credential must not have (:65-68). PointsEntry (MMCA.ADC.Engagement.Domain/Points/PointsEntry.cs:29) is an append-only ledger row with no mutators, so a total is always the sum of its entries (:12-13), and it snapshots the configured award at earn time (:39-40) so retuning the economy never rewrites history. LeaderboardOptIn (MMCA.ADC.Engagement.Domain/Points/LeaderboardOptIn.cs:23) stores the display name the attendee explicitly published (:40), which is why serving the board needs no call into Identity, and it keeps EraseDisplayName() (:115) deliberately separate from the inherited soft-delete Delete() (:108-114): leaving the board and erasing the name you published there are two different promises, and only the second is irreversible. The same overwrite is its IAnonymizable.Anonymize() (:122-126), so the row survives anonymized in place and the audit trail stays intact. CheckIn and PointsEntry additionally declare IAuditedEntity (CheckIn.cs:28, PointsEntry.cs:31), so their field-level change history is written by the audit-trail interceptor (ADR-075): an attendance assertion about a named person and a prize-bearing ledger are both things you want to be able to prove rather than merely assert.

The bookmark slice, end to end. BookmarksController (MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:37) is the thin REST edge: each action injects a handler and delegates, mapping Result failures to RFC 9457 Problem Details through ApiControllerBase. The POST does its own ownership bind first, because the owner arrives in the request body rather than in a query argument: a caller without the Organizer role may only create a bookmark whose UserId equals their user-identifier claim, otherwise the action returns Error.Forbidden (:63-70, ADR-033). It also carries IdempotentAttribute (:50), which is safe here for the reason stated in the doc comment: the request names the (user, session) pair explicitly and a duplicate already answers 409, so replaying a retried star is what the attendee meant (ADR-017). It then routes into CreateBookmarkHandler (MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/Create/CreateBookmarkHandler.cs:18), still the most instructive slice in the module: it first refuses an erased account through ErasedUserGuard (:30-34), then asks Conference's ISessionBookmarkValidationService whether the session may be bookmarked at all (:37, BR-49 and BR-91 across the service boundary), returns Error.Conflict on an existing active bookmark (:43-54, BR-21), loads any soft-deleted row through the repository's FindIncludingDeletedAsync (:57-61) and hands the create-or-reactivate decision to the pure, static BookmarkManagementDomainService (:64), so BR-135 lives in the domain instead of being smeared across the handler. The domain service is a static class with one CreateOrReactivate method over the pre-fetched row (MMCA.ADC.Engagement.Domain/UserSessionBookmarks/BookmarkManagementDomainService.cs:11, :20-35): it has no dependencies and no state, so there is no interface and no DI registration, and the handler calls it directly. Only a genuinely new entity is added to the repository (CreateBookmarkHandler.cs:61-64), and the save is wrapped in a catch filtered by the framework's injected IUniqueConstraintViolationDetector (:70), so a request that loses the insert race against the filtered unique index sees the same 409 the pre-check would have produced rather than a raw 500 (:70-82). That detector is the module's shared answer to "the database is the rule, the pre-check is only a courtesy": PointsAwarder, GetOrCreateMyBadgeHandler and SetLeaderboardParticipationHandler inject the identical abstraction. On the read side, GetUserBookmarksHandler (.../GetUserBookmarks/GetUserBookmarksHandler.cs:17) returns a paged, CreatedOn-descending PagedCollectionResult<T> of DTOs, with the page size clamped by PagingMath before anything touches the database (:31) and ordering plus OFFSET/FETCH pushed into SQL through IQueryableExecutor, the Id tie-break after CreatedOn making the ORDER BY total so bookmarks created in the same instant neither repeat nor vanish across pages (:60-70); GetBookmarkedSessionIdsHandler (.../GetBookmarkedSessionIds/GetBookmarkedSessionIdsHandler.cs:12) is the lightweight sibling the unified Sessions page turns into per-row filled or empty bookmark icons. Both list endpoints are scoped by the shared OwnerOrAdminFilter applied as a [ServiceFilter] (BookmarksController.cs:84, :105), configured for ADC through OwnerOrAdminFilterOptions in AddModuleEngagementAPI (MMCA.ADC.Engagement.API/DependencyInjection.cs:44-55): ClaimTypes.NameIdentifier as the owner claim, the userId query argument, and the Organizer bypass role. The DELETE keeps a separate inline, database-backed ownership check that returns 404 rather than 403 so it never leaks whether a bookmark exists (BookmarksController.cs:131-148), then runs the generic DeleteEntityCommand<TEntity, TIdentifierType> (:151), which soft-deletes.

Check-in: four ways in, one row out. CheckInsController (MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:44) exposes the whole surface behind [FeatureGate(EngagementFeatures.CheckIn)] and a plain [Authorize] (:41-42). An attendee fetches their own badge at GET my-badge with no permission at all (:64), because GetOrCreateMyBadgeHandler (.../GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:19) reads the identity from the token, refuses an erased account so a still-valid token cannot mint a fresh badge after erasure deleted the old one (:38-42), and mints on first use (:44-79), returning a MyBadgeDTO carrying nothing but the credential (:81-83). The QR itself is formatted by BadgePayload (MMCA.ADC.Engagement.Shared/CheckIns/Badges/BadgePayload.cs:12), one place that owns both the mmca-adc:badge: prefix (:15) and the parser (:30), so the display side and the check-in handler cannot drift. A badge can be reissued, which is the revocation path for a leaked or screenshotted QR: the attendee posts my-badge/regenerate for their own badge and an organizer posts badges/{userId}/regenerate for anyone's (CheckInsController.cs:100, :121-122), and both RegenerateMyBadgeHandler and RegenerateAttendeeBadgeHandler delegate to the one shared write in BadgeRegeneration (.../RegenerateBadge/BadgeRegeneration.cs:14), which refuses an erased account, answers a user with no badge the same not-found as the badge read, and replaces the credential so every earlier copy stops scanning (:9-13, :28-30). The organizer scan paths are gated by [HasPermission(EngagementPermissions.CheckInManage)] (CheckInsController.cs:154, :178, :262): CheckInAttendeeHandler (.../CheckInAttendee/CheckInAttendeeHandler.cs:19) resolves the scanned credential to a badge row and answers a malformed payload and an unknown-but-well-formed credential with the same error, since a scanner that could tell them apart would be an oracle for guessing credentials (:41-56), and ManualCheckInHandler covers the dead-phone fallback. Both then run the shared CheckInProcessor (MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:23), a static helper rather than an injected service so neither handler gains a dependency it does not own (:11-14). The processor is split in two halves on purpose: ExecuteAsync (:130) is the organizer path, which validates the target through Conference and lets the server's answer for the owning event win over the value the scanning client sent (:145-149), while RecordAsync (:60) is the write half every entry point shares, short-circuiting a repeat scan into a success carrying the original timestamp rather than a conflict (:74) and otherwise recording exactly one row via the RecordedCheckIn outcome struct (:38). The two self-service flows are separate handlers that reuse only that write half. RecordSponsorVisitHandler (.../RecordSponsorVisit/RecordSponsorVisitHandler.cs:38) and RecordRoomCheckInHandler (.../RecordRoomCheckIn/RecordRoomCheckInHandler.cs:48) take the attendee from the token, never the request, run the same ErasedUserGuard check before anything else (RecordSponsorVisitHandler.cs:60, RecordRoomCheckInHandler.cs:64-73), and each carries its own feature flag (CheckInsController.cs:209, :244) so a printed sponsor code and a printed room code can be retired independently. Because a self-recorded check-in awards points, both then apply the verified-participant rule through IVerifiedParticipantGate (RecordSponsorVisitHandler.cs:66, RecordRoomCheckInHandler.cs:75-79): VerifiedParticipantGate (MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantGate.cs:24) reads the confirmed email from the caller's own token, so the common case costs no cross-service call, and only when the token does not settle it looks for a live ticket linked to the account in this module's own database (:13-20); Engagement:RequireVerifiedParticipant in VerifiedParticipantSettings turns the rule off (MMCA.ADC.Engagement.Application/DependencyInjection.cs:62-65). The room flow is the sharpest piece of design here: only the room (and its printed check-in code) travels in the request, and the server resolves which session that room is hosting at the request instant plus a grace window this module owns and sends along (RecordRoomCheckInHandler.cs:81-86), so a shared link records nothing outside a session's window and nobody can name a session they are not standing in; an unknown room and an idle room answer identically so the response never confirms which room ids exist, while a transport failure still propagates so a Conference outage is not reported as an empty schedule (:87-88). Room switching needs no staff, because an attendee already checked in to an overlapping session is still checked in here, and the points question is settled by SessionTimeSlotPoints (MMCA.ADC.Engagement.Application/CheckIns/Services/SessionTimeSlotPoints.cs:29), the one statement of "session points once per time slot": a session check-in earns nothing when the attendee holds an earlier check-in for a different, overlapping session of the same event, and attendance itself is never affected (:10-14). "Earlier" is decided from the committed rows (an earlier CheckedInOn, or the same instant with a smaller id), never from handling order, so concurrent or out-of-order handling still lets exactly the slot's first check-in earn (:16-21, :71-76). Two callers ask it: the room handler asks before it writes and fails closed, reporting the answer as EarnsPoints and skipping the question entirely when session points are switched off, a test it reads from the same PointsSwitch the awarder uses (RecordRoomCheckInHandler.cs:95-114), and AttendeeCheckedInPointsHandler asks for every session check-in, door scans included, letting a Conference NotFound stand the award and throwing on any other failure so the delivery is retried rather than awarded in breach of the rule (.../IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:62-67, :87-111). GetAttendanceStatsHandler (.../GetAttendanceStats/GetAttendanceStatsHandler.cs:15) closes the loop for organizers, and both of its figures are computed in SQL: a CountAsync for the event scope and a CountByAsync grouped per session, so what crosses the wire is one row per session rather than one per check-in (:27-34). All of this is ADR-072; the camera half of the scanner is ADR-071.

Points: one write path, several adapters. Everything that earns goes through IPointsAwarder / PointsAwarder (MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:36), which takes an (activity, subjectKey) pair and knows nothing about events, sessions or sponsors. It asks PointsSwitch (MMCA.ADC.Engagement.Application/Points/Services/PointsSwitch.cs:16) what the activity is worth right now: the configured award from PointsSettings (MMCA.ADC.Engagement.Shared/Points/PointsSettings.cs:13), or 0 when that rule is configured to 0 or the whole game is off under the Points feature flag (PointsSwitch.cs:8-13). A 0 writes nothing rather than a zero-value ledger row (PointsAwarder.cs:50-60), and an erased account earns nothing either, one check that covers every adapter (:62-69); it pre-checks for an existing award purely to make the common duplicate path a clean no-op (:73-82); and it reads the unique-index violation as already awarded, not as a failure to retry (:93). The rule that matters is the index, not the code: the unique (UserId, ActivityType, SubjectKey) index in PointsEntryConfiguration (MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Points/PointsEntryConfiguration.cs:45-48) is simultaneously the idempotency guarantee and the anti-farming rule, because PointsSubjectKeys collapses N questions or N answers in one session onto one subject key. Four adapters feed it. Three are integration-event handlers built on ScopedIntegrationEventHandlerBase<TIntegrationEvent>: AttendeeCheckedInPointsHandler (.../IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:31) maps the wire scope string onto an earn rule and logs-and-skips a scope this build has never heard of rather than dead-lettering a message no retry could fix (:42-46, :65-99), while SessionFeedbackSubmittedPointsHandler and EventFeedbackSubmittedPointsHandler consume events Conference publishes. The fourth, SessionQuestionSubmittedPointsHandler (.../DomainEventHandlers/SessionQuestionSubmittedPointsHandler.cs:54), rides an in-process domain event instead, an explicit at-most-once trade-off documented in the type: a crash between the commit and the dispatch loses one small award and nothing else, and promoting it to an integration event later is a one-file change on each side (:31-40). Its doc comment is also the best worked example in the module of the id-by-value trap described above, and of why every field it needs now comes off the event rather than from a read-back (:22-30). A fifth handler earns nothing at all: UserDeletedPointsHandler (.../IntegrationEventHandlers/UserDeletedPointsHandler.cs:37) consumes Identity's UserDeleted and erases the published leaderboard name, reading with ignoreQueryFilters: true precisely because an attendee who already left the board still has a soft-deleted row carrying the name that must be erased (:53-61). It is not the only consumer of that event in this module, because the Identity-side erasure cannot reach across the database boundary: UserDeletedBookmarksHandler (MMCA.ADC.Engagement.Application/UserSessionBookmarks/IntegrationEventHandlers/UserDeletedBookmarksHandler.cs:22) deletes the account's session bookmarks, the promise PRIVACY.md section 5 makes (:10-13), and UserDeletedBadgeHandler (MMCA.ADC.Engagement.Application/CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandler.cs:22) deletes the attendee badge that carries the per-user credential while deliberately keeping the check-in records themselves (:10-13); the live layer's UserDeletedSessionQuestionsHandler and UserDeletedVotesHandler do the same for questions and votes. The two new handlers are the same shape line for line: each extends ScopedIntegrationEventHandlerBase<UserDeleted> (:25 in each), reads only active rows with tracking on, calls Delete() on each, skips the save entirely when nothing was deleted, and lets exceptions propagate (:33-58), so a redelivery under at-least-once delivery finds nothing and writes nothing, and a failed erasure is retried rather than acked away (:15-17).

Reading the points back. PointsController (MMCA.ADC.Engagement.API/Controllers/PointsController.cs:37) is a good study in designing an ownership problem out of existence: nothing on the surface takes a user id, so the three attendee endpoints resolve the caller from the token inside their handlers and there is no ownership check to get wrong (:25-29). GetMyPointsHandler serves the caller's own total and a page of the entries behind it; SetLeaderboardParticipationHandler (.../SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:32) takes the published display name from the caller's token claims server-side, which is why SetLeaderboardParticipationRequest carries only a boolean (:16-19), and rejoining reactivates the soft-deleted opt-in rather than accumulating dead rows (:22-24). GetLeaderboardHandler (.../GetLeaderboard/GetLeaderboardHandler.cs:28) builds the board from the opt-in list and the ledger with no call into Identity (:12-17), projecting the opt-ins to the two columns it needs through the private OptInRow record (:40-43, :85) and summing the ledger with one grouped SumByAsync in the database rather than pulling every row back to fold in memory (:50-59). Ranks are distinct and sequential with an ordinal name tie-break, so repeated reads return the same order (:18-24, :65-77). Only the organizer rollup carries a permission, [HasPermission(EngagementPermissions.PointsViewOverview)] (PointsController.cs:121), and even that view returns activity, points and timestamps without attendee identity (:114-119).

Tickets: a TicketLeap roster, from upload to account. Ticket (MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:30) is one row of an organizer-uploaded TicketLeap roster: it keeps the whitelisted columns only and exists to invite the ticket holder and to link the ticket to an account, while door admission stays with TicketLeap (:12-15, BR-268, BR-248). It is the module's third IAuditedEntity, because a disputed link (a barcode claimed by the wrong attendee) needs a record of the row before, and it implements IAnonymizable so the [Pii] holder fields (attendee name, order email, barcode) are stored redacted in the audit trail and overwritten when the linked account is erased, soft-deleted rows included (:16-27, :56-73, ADR-005). The REST surface is two controllers under one Tickets prefix, each behind [FeatureGate(EngagementFeatures.Tickets)] and [Authorize]. TicketRosterImportController (MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:36) owns the upload: a dry run answers 200 with the counts, a commit answers 202 with a queued import run whose progress a GET reports, and a second commit while the event's run is active answers 409 (:24-45). TicketsController (MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:44) owns the organizer's invites, link-existing-accounts run, summary, insights and delete, gated on EngagementPermissions.TicketsManage, plus the attendee's barcode claim and own tickets, which take the attendee from the token and need no permission (:26-41). A committed upload is not applied inside the request. ProcessTicketRosterImportHandler (MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportHandler.cs:29) runs as an internal command and applies the run in batches of 100 (:37) through the same TicketRosterApplier rules as the dry run; each batch commits together with the progress on TicketImportRun, so any replica can read it and a retried attempt resumes where the last one stopped, the per-ticket upsert making a twice-applied batch a no-op. After the last batch the run voids what the file no longer contains, links the holders who already have an account, and completes, which clears the staged roster; any failure ends the run as failed in a fresh scope and still answers success, so the queue does not retry a run that already ended (:13-27). Linking has one rule in one place: TicketLinker (MMCA.ADC.Engagement.Application/Tickets/Services/TicketLinker.cs:32), a static helper behind UserRegisteredTicketLinkHandler, UserEmailVerifiedTicketLinkHandler and ExistingAccountLinker, links per event the Live tickets whose attendee name matches the account, otherwise the address's only ticket for that event, otherwise nothing, leaving the tickets for a barcode claim (:9-18); it is idempotent under at-least-once delivery, never takes over a ticket linked to another account, and links nothing for an erased account (:25-30). The claim, ClaimTicketHandler (MMCA.ADC.Engagement.Application/Tickets/UseCases/ClaimTicket/ClaimTicketHandler.cs:34), is built not to be an existence oracle: an unknown barcode, a ticket linked to another account and a voided ticket all get the same NotFound, and each account has an attempt budget from TicketSettings counted in the shared cache before the lookup (:17-30). A second budget sits in front of the handler: TicketClaimRateLimiting (MMCA.ADC.Engagement.API/RateLimiting/TicketClaimRateLimiting.cs:30) is a named per-client-address policy that caps claims from one public address whichever accounts they come from, applied by [EnableRateLimiting] on the claim action (TicketsController.cs:133-135) and registered in AddModuleEngagementAPI (MMCA.ADC.Engagement.API/DependencyInjection.cs:62-64); it counts only public addresses, because the web UI's server-rendered calls all arrive from one private address and would otherwise share a single bucket (TicketClaimRateLimiting.cs:13-29). The organizer insights apply the small-number rule (BR-278) to a whole report at once: InsightSuppression (MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/InsightSuppression.cs:23) registers every count as a Cell and every published equation between cells as a relation, withholds a count of 1 or 2, and then withholds a complementary cell in any relation left with exactly one withheld value, so no count can be recovered by subtraction (:5-21). Across the process boundary, PendingTicketInvitationService (MMCA.ADC.Engagement.Application/Tickets/Services/PendingTicketInvitationService.cs:35) tells Identity whether an address still holds a standing invitation, so an invite link that expired before the invitee had an account can be re-issued, and its answer never carries the ticket id, the barcode or the order (:11-31). The organizer pages TicketRosterUpload, TicketRoster and TicketInsights and the attendee's MyTicketsPanel call the API through ITicketUIService and TicketService. The slice is [Rubric §11, Security] (the non-oracle claim and the redacted holder fields), [Rubric §29, Resilience] (the resumable batched import) and [Rubric §30, Compliance and Privacy] (anonymize on erasure).

Persistence. Engagement declares no context class of its own. The module contributes only its IEntityTypeConfiguration classes, and the framework's one sealed per-engine context over the common ApplicationDbContext (SQLServerDbContext today) builds the model from them and supplies auditing, soft-delete query filters and domain-event dispatch, one instance per physical database (ADR-006). Those configurations cover bookmarks, badges, check-ins, the three live-poll sets, the two question sets, the points ledger, the opt-ins, the erased-account records, and the ticket roster with its import runs (TicketConfiguration, TicketImportRunConfiguration). The newest set closes a gap the erasure handlers cannot: they only reach rows that exist when UserDeleted is handled, and an access token stays valid for its whole lifetime after the account is gone, so a late bookmark, badge, check-in, vote, upvote or question would otherwise carry an erased user id no erasure revisits (MMCA.ADC.Engagement.Domain/ErasedUsers/ErasedUser.cs:9-14). ErasedUser (ErasedUser.cs:20) is the record of that erasure, holding only UserId and ErasedOn and no other personal data (:16, :23, :26); the live layer's UserDeletedSessionQuestionsHandler writes it (MMCA.ADC.Engagement.Application/SessionQuestions/IntegrationEventHandlers/UserDeletedSessionQuestionsHandler.cs:108). ErasedUserConfiguration (.../ErasedUsers/ErasedUserConfiguration.cs:15) puts a unique index on UserId (:29-30), so a redelivered UserDeleted that raced the existence check fails rather than duplicates, and the same index serves the lookup every guarded write runs (:11-13). That lookup is ErasedUserGuard (MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:15), a static helper with one EnsureNotErasedAsync (:26) that runs an ExistsAsync over the read repository and answers Error.Forbidden with the one Engagement.AccountErased code (:18, :32-41); the bookmark, badge, sponsor-visit and room check-in handlers here call it first, as do the live layer's vote, upvote and question-submit handlers. The table shapes are where the module's business rules become enforceable, and every configuration derives from EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>. UserSessionBookmarkConfiguration (.../UserSessionBookmarkConfiguration.cs:17) makes BR-21 a filtered unique index over (UserId, SessionId) restricted to non-deleted rows (:31-34) and adds a SessionId-leading index the composite cannot serve (:36-39). CheckInConfiguration (.../CheckInConfiguration.cs:19) carries three filtered unique indexes, one per scope, with the scope literals kept side by side as named constants because an index filter is SQL and cannot read the enum (:22-26, :48-62); the sponsor one is the once-per-sponsor cap that makes a shared booth link worth nothing past the first scan (:58-62), and two more indexes serve the attendance rollup (:64-69). PointsEntryConfiguration adds the UserId-leading index that makes "my points" a seek (:50-52). The live-poll tables follow the same discipline even though their aggregates are taught in Group 23: LivePollVoteConfiguration (.../LivePolls/LivePollVoteConfiguration.cs:17) makes BR-225, one active vote per (LivePollId, UserId), a filtered unique index through the shared HasSoftDeleteFilter() helper (:34-37), which is the database-level guarantee behind the vote handler's create-or-reactivate dance (:12-15), and adds the (LivePollId, OptionId) index the tallies group by (:39-40). LivePollConfiguration (.../LivePolls/LivePollConfiguration.cs:16) indexes EventId for the Happening Now and organizer manage views (:34-35) and (SessionId, Status) for the session Live page and presenter view, the conference-day hot path that previously scanned (:37-41), and pins the Options navigation to PropertyAccessMode.Field so the encapsulated collection cannot silently stop materializing if the property changes shape (:43-50). LivePollOptionConfiguration (.../LivePolls/LivePollOptionConfiguration.cs:10) is the plain child-entity case: a required text column bounded by the domain's own LivePollInvariants.OptionTextMaxLength and the required FK back to its poll (:18-25). Cross-module identifiers (UserId, EventId, SessionId, SponsorId) are scalar columns throughout, never cross-database foreign keys (CheckInConfiguration.cs:16-17). The module owns ADC_Engagement and is its sole migrator, applying EF migrations idempotently at startup (MMCA.ADC.Engagement.Service/Program.cs:249-255, ADR-030; the one run that skips the schema step is design-time OpenAPI generation, and only in Development, which a production host can never be talked into, ADR-122), so events serialized into its own outbox during SaveChangesAsync never race another service's rows (ADR-003).

How Engagement talks to its neighbors. Engagement is both a client and a server on the gRPC mesh (ADR-007, ADR-008). As a server, its in-process BookmarkCountService (MMCA.ADC.Engagement.Application/UserSessionBookmarks/Services/BookmarkCountService.cs:11) answers "how many people bookmarked this session" for Conference's speaker pages, including a batched variant that replaces the caller's per-session fan-out with one grouped COUNT and back-fills a zero for every requested session that has none (:37-46). It goes on the wire through BookmarkCountsGrpcService (MMCA.ADC.Engagement.Service/Grpc/BookmarkCountsGrpcService.cs:31) and is consumed through the client-side BookmarkCountServiceGrpcAdapter (MMCA.ADC.Engagement.Contracts/BookmarkCountServiceGrpcAdapter.cs:14), which re-implements the same C# interface so calling code never knows it crossed a process. Read the trust-boundary note before copying the pattern: that endpoint is mapped deliberately without RequireAuthorization(), because the Conference callers serve [AllowAnonymous] output-cached endpoints and a cache-miss request from an anonymous visitor carries no bearer to forward; the exposure is bounded by the payload (aggregate counts, no PII, no user ids) and by an internal-only container ingress. The omission is now stated rather than implied with .AllowAnonymous(), because the framework's fallback authorization policy gates every endpoint that declares nothing and would otherwise turn the deliberate omission into a 401 on the public speaker pages (MMCA.ADC.Engagement.Service/Program.cs:257-270). The identical bridge carries the privacy export, and there the choice flips. UserEngagementExportService (MMCA.ADC.Engagement.Application/Exports/UserEngagementExportService.cs:21) projects a user's bookmarks, submitted questions, points ledger, check-in history, live-poll votes, session-question upvotes and leaderboard participation server-side into a UserEngagementExportDTO of ids and dates (:22-99), with soft-deleted rows excluded by the global query filter; check-ins are exported independently of the ledger, because a switched-off rule or a deduped repeat scan means the ledger is no proxy for the attendance record a data subject is entitled to (:50-52). The two live-layer rows ride the same projection: a UserEngagementPollVoteExportDTO (MMCA.ADC.Engagement.Shared/Exports/UserEngagementPollVoteExportDTO.cs:7) carries the poll, the chosen option and when, and a UserEngagementQuestionUpvoteExportDTO (MMCA.ADC.Engagement.Shared/Exports/UserEngagementQuestionUpvoteExportDTO.cs:7) carries the upvoted question and when, both ids and a date only; a retracted vote or a removed upvote is soft-deleted, so the filter keeps it out like every other kind (UserEngagementExportService.cs:66-78). It is served by UserEngagementExportGrpcService and consumed by Identity through UserEngagementExportServiceGrpcAdapter, and that endpoint does carry RequireAuthorization() because it returns personal data keyed by a raw user id (Program.cs:272-279, PRIVACY.md §7, ADR-076, ADR-005). Two more edges ride the same bridge, each with the authorization its caller can actually present: the invitation lookup Identity uses takes the service-only ServiceCaller policy, because its one caller (the anonymous sign-in link request) has no user to forward (Program.cs:281-286), and VerifiedParticipantGrpcService (MMCA.ADC.Engagement.Service/Grpc/VerifiedParticipantGrpcService.cs:22) serves IVerifiedParticipantService to Conference, whose session and event feedback writes pass the same verified-participant rule as the Engagement writes, under the default policy with the forwarded user bearer, answering only for the caller's own account (Program.cs:288-293); Conference consumes it through VerifiedParticipantServiceGrpcAdapter (MMCA.ADC.Engagement.Contracts/VerifiedParticipantServiceGrpcAdapter.cs:21), and in process VerifiedParticipantService answers it over the same gate (MMCA.ADC.Engagement.Application/DependencyInjection.cs:67-69). The Contracts-layer DependencyInjection (MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:21) is what swaps in-process for remote, one helper per interface (:41, :72, :100, :128): each registers the typed client and then Replaces (never TryAdds) any existing registration so the adapter wins (:31-37, :45-46); an extracted host that never discovers the Engagement module simply has no in-process registration, so the adapter is the only one (:33-36), and a helper must run after ModuleLoader.DiscoverAndRegister so an in-process registration is already in the container when Replace looks for it (:64-67).

The outbound live-channel path. Engagement never blocks a command on Notification. Handlers enqueue a post-commit broadcast as a LiveChannelPublishWorkItem (MMCA.ADC.Engagement.Application/Live/ILiveChannelPublishQueue.cs:19) through ILiveChannelPublishQueue (:49): the channel key, event name and pre-serialized payload, carrying no entity and no per-user data, plus an optional coalesce key and order (:7-24). The coalesce key is set only on a tally that a newer tally fully supersedes, a poll's results or a question's upvote count, with the two key builders on the record itself (:29-36); a structural broadcast leaves it null and is never coalesced. LiveChannelPublishQueue (MMCA.ADC.Engagement.Application/Live/LiveChannelPublishQueue.cs:29) is the single concrete channel, registered once as a singleton and exposed to handlers via the interface (MMCA.ADC.Engagement.Application/DependencyInjection.cs:53-54). Read its backpressure contract carefully. A keyed tally takes one slot per key until the drain publishes it, and a newer tally for the same key replaces the pending one (the higher CoalesceOrder wins) instead of queueing behind it, so a burst of votes on one poll costs one publish per drain pass and a tally flood cannot push the structural poll.opened or question.approved broadcasts out (:10-20, :89-108); the drain turns each slot back into the newest tally through Resolve (:125-134). Behind that, the channel is bounded at 1024 items (:34) with BoundedChannelFullMode.DropOldest and SingleReader (:56-63), so Enqueue returns void and never rejects an item while the host runs (it evicts the oldest rather than refusing the write; only a write after shutdown has completed the queue is refused, silently, :78-84), and a discarded broadcast is observable only through DroppedCount (:73), the itemDropped callback, and a warning log, with CoalescedCount (:76) counting the folded tallies. No delivery order is promised: the drain is FIFO over one replica's queue, but handlers enqueue after their own commits in no fixed order and every replica has its own queue, so a client relies on the tallies' monotonic TalliedAtTicks marker to ignore a stale one (:21-27). LiveChannelPublishProcessor (MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:43) is the single-reader BackgroundService drain, one of the module's two hosted services (MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:26-27), forwarding each resolved item to ILiveChannelPublisher (:128-133); the swallow is BestEffort's rather than a hand-rolled catch, so a peer that has quietly stopped accepting broadcasts is countable on the besteffort.dispatch.failed meter instead of being a warning nobody alerts on (:23-30). Shutdown drains rather than drops: StopAsync completes the queue first, then publishes whatever is still queued in FIFO order on a token of its own, the whole stop sharing one five-second budget well inside the 30-second Container Apps grace so a hung Notification peer cannot hold the host; the in-flight publish is cancelled and lost, and anything left when the budget runs out is logged and abandoned (:31-41, :52, :55-69). What actually gets published is taught in Group 23.

Keeping Conference's bookmark counts fresh. Bookmark counts are owned here but served by Conference, from an output cache in another process that this side has no handle on, so a count change reaches it as a broker message. UserSessionBookmarkCacheEvictionHandler (MMCA.ADC.Engagement.Application/UserSessionBookmarks/DomainEventHandlers/UserSessionBookmarkCacheEvictionHandler.cs:38) subscribes to the aggregate's own UserSessionBookmarkChanged rather than to a command handler, because the delete path runs on the framework's generic DeleteEntityCommand with no ADC handler to hook, and the domain event covers create, reactivate and delete in one class; deferred post-commit dispatch also means no eviction is ever requested for a bookmark that did not persist (:27-34). It does not publish anything itself, it only raises a flag (:54-57). BookmarkCacheEvictionSignal (MMCA.ADC.Engagement.Application/UserSessionBookmarks/Services/BookmarkCacheEvictionSignal.cs:25) is a capacity-one channel with BoundedChannelFullMode.DropWrite (:27-33), registered as a singleton per replica (MMCA.ADC.Engagement.Application/DependencyInjection.cs:73), so any number of requests made while one is pending collapse into it and Request() never blocks or fails a bookmark command (:38-42). The reason is load, stated in the type: every eviction drops the whole conference:sessions tag (the session list, the session reads and the batched counts together), and at a session changeover hundreds of stars in the same minute would otherwise keep that cache permanently cold (:11-19). BookmarkCacheEvictionProcessor (MMCA.ADC.Engagement.Infrastructure/Caching/BookmarkCacheEvictionProcessor.cs:35), the module's second hosted service, is the single reader: an idle processor broadcasts at once, so an isolated star still reaches a speaker's dashboard in about a broker round trip, and after each broadcast it waits a ten-second PacingWindow (:46) during which every further request folds into one trailing broadcast (:17-23, :56-79). The message is an OutputCacheEvictionRequested for the tag constant SessionsCacheTag (UserSessionBookmarkCacheEvictionHandler.cs:45), published through a scoped IEventBus inside BestEffort.ExecuteAsync, so a failed publish costs one warning and one metric and never stops the drain; Conference's 60-second TTL stays as the backstop for a dropped message or a request still pending at shutdown (BookmarkCacheEvictionProcessor.cs:25-29, :62-77, :82-85).

Module wiring, feature gating, and the extracted host. EngagementModule (MMCA.ADC.Engagement.API/EngagementModule.cs:12) is the IModule entry point discovered by ModuleLoader and registered in topological order; it declares a dependency on Conference with RequiresDependencies => true (:18, :21), and Register is a one-liner into AddEngagementModule (:24-25), which chains the Application, Infrastructure and API registrations in dependency order (MMCA.ADC.Engagement.API/DependencyInjection.cs:23-30). The Application registration is where the module's own services land: the bookmark aggregate's entity query service and generic delete handler (MMCA.ADC.Engagement.Application/DependencyInjection.cs:35-36; the bookmark domain service is static and needs no registration), the four cross-module services scoped (:39, :43, :47, :69), the live layer's LiveScopeMemo singleton beside the per-request LiveScopeGate (:56-60) and the verified-participant gate (:62-65), the awarder and its PointsSwitch scoped and registered by hand because they are plain services the convention scan does not see (:82-88), and everything conventional (handlers, mappers, validators, event handlers) discovered by ScanModuleApplicationServices<ClassReference>() (:92), which is where the per-layer ClassReference marker earns its keep. Each of the four layers declares its own AssemblyReference / ClassReference pair, and the design-time migrations factory reaches for the Infrastructure one, because the IEntityTypeConfiguration classes live in Infrastructure rather than Application. The module registers no disabled stubs: EngagementModule declares only its name, its dependency and Register (EngagementModule.cs:12-26), and a host that boots without it gets its cross-module interfaces from the gRPC adapters described above instead. Every capability has its own kill switch in EngagementFeatures (MMCA.ADC.Engagement.Shared/EngagementFeatures.cs:11): SessionBookmarks, LivePolls, CheckIn, SponsorVisits, RoomCheckIn, Points, SessionQA and Tickets (:23, :35, :47, :60, :72, :85, :97, :110), each turning its controller or route into a 404 without a deploy (and Points also zeroing every award through PointsSwitch). All eight are declared [FeatureFlag(FeatureFlagLifetime.Permanent, Owner = "ADC Engagement")] (:22 and the same attribute above each of the other seven), and an organizer flips one without a new revision through the stored overrides that AddReloadableFeatureFlags layers over configuration, served by AdminFeatureFlagsController at Admin/Engagement/FeatureFlags (MMCA.ADC.Engagement.Service/Program.cs:131-137), which is how the flag inventory is told these are shipped capability switches a conference chooses to run with or without, not rollout toggles waiting on a removal date (ADR-031); the two printed-QR switches say so explicitly, SponsorVisits naming the softer alternative of setting Points:SponsorVisit to 0 to keep the visit but stop the award (:49-58) and RoomCheckIn recording why it is separate at all, since the two printed surfaces are retired on their own schedules (:62-70). Authorization above authentication is capability-based, not role-based: EngagementPermissions (MMCA.ADC.Engagement.Shared/Authorization/EngagementPermissions.cs:9) declares four capabilities, engagement:live:manage, engagement:checkin:manage, engagement:points:view-overview and engagement:tickets:manage (:17, :24, :31, :38), plus an All list so the whole set can be granted in one call (:41). The live layer's three controllers read the manage right through LiveCallerRights (MMCA.ADC.Engagement.API/Authorization/LiveCallerRights.cs:21), which binds the caller's speaker id and the engagement:live:manage capability from the token, never from the request, through the same perm: policy a [HasPermission] endpoint uses, so any role granted the capability manages polls and moderates questions exactly like an Organizer (:10-20). The grant map itself is a separate named type, EngagementPermissionGrants (MMCA.ADC.Engagement.Shared/Authorization/EngagementPermissionGrants.cs:24), whose static Apply grants every Engagement capability to the Organizer role and to no other (:33-38); attendee-facing endpoints need no grant because they carry a plain [Authorize] with no capability, and a speaker's session-scoped rights come from the speaker-assignment check inside the handlers (BR-236) rather than from any permission declared here (:26-31). AddModuleEngagementAPI applies that map through services.AddPermissions(EngagementPermissionGrants.Apply) (MMCA.ADC.Engagement.API/DependencyInjection.cs:60, ADR-020). The reason it is a named map in the Shared contracts project rather than a lambda inside the registration is that two hosts apply the same binding: this module's own host, to gate its [HasPermission(...)] endpoints, and the token-minting Identity host, so an issued access token carries a permission claim for every Engagement capability the caller's role holds and not only for the modules the minting host happens to boot (EngagementPermissionGrants.cs:6-22). MMCA.ADC.Engagement.Service boots exactly this one module and is worth reading top to bottom as the reference shape for an extracted host. The start-up sequence every extracted service shares lives in MMCA.Common's AddMmcaServiceHost, and what stays in this file is what only Engagement decides (Program.cs:29-31, :59): the module assembly list is explicit, one assembly, with no AppDomain scan to fall back on (:63-66). Kestrel is the composed host's default, Http2-only on cleartext so cross-service gRPC clients negotiate h2c by prior knowledge, plus the optional HTTP/1.1-only health-probe listener (:19-24, ADR-012). PointsSettings, CheckInSettings, TicketSettings and VerifiedParticipantSettings are bound here rather than in the module, because the module registration takes no IConfiguration, and all four are deliberately not ValidateOnStart: a missing section binds working defaults (for the verified-participant rule, the safe default of on) and an explicit 0 is the documented points kill switch, so no value an organizer sets should stop this host from booting mid-conference (:88-114, a considered divergence from ADR-070). The scheduler and audit trail are wired next (:125, :129, ADR-074, ADR-075), and EngagementErrorResources contributes the module's error-code translations (:140, ADR-027). Composition itself runs through the host's ConfigurePipeline, a single ordered chain that registers the modules first and then, because Conference is disabled in this process, re-points Engagement's two Conference dependencies at gRPC clients, swaps the framework's no-op live-channel publisher for the Notification adapter, adds Identity's verified-user lookup client for the roster's account linking, and finally wires broker messaging (:149-231, ADR-014 closes and seals the decorator pipeline at the end of it). The paths that call Notification or Identity with no user in the request (the publish drain, the roster import) present a service token instead, registered after the composed call (:234-245). This host is not publisher-only: it consumes six integration events (MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:24-31, Program.cs:192-206): AttendeeCheckedIn, SessionFeedbackSubmitted and EventFeedbackSubmitted earn points-game points, UserDeleted erases the deleted account's Engagement rows, and UserRegistered and UserEmailVerified link pending tickets to the new account. The one UserDeleted registration runs every handler for that type, so it reaches the points, bookmark, badge and ticket erasure handlers here and the session-question and vote erasure handlers of the live layer alike (Program.cs:200-212). AttendeeCheckedIn is the novel one: it is published by this same service (the CheckIn factory raises it and the outbox captures it in the check-in transaction), so this is ADC's first broker self-consumption, and MMCA.Common's native broker transport handles it with no special casing: EngagementBrokerConsumers.Register subscribes the event to this host's one queue (MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:24-26), each RegisterIntegrationEventConsumer<TEvent> call binding the event's topic to that queue (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Messaging/Broker/IBrokerConsumerBuilder.cs:5-8, :26), so the publish goes to the event's topic (or exchange), the queue named by MessageBus:QueueName (mmca-adc-engagement) receives it, and the message leaves through the broker and comes back to this process; under the InProcess transport the WebApplicationFactory<Program> integration tests run on, it is delivered in process instead (Program.cs:185-190, :214-221). SelfHttpWarmupTask (MMCA.ADC.Engagement.Service/SelfHttpWarmupTask.cs:23) extends SelfHttpWarmupTaskBase and holds /health/ready not-ready until the routing, auth and middleware pipeline has been JITted (Program.cs:116-121, ADR-025); the four gRPC endpoints are mapped last (:270, :279, :286, :293).

The UI surfaces. EngagementUIModule (MMCA.ADC.Engagement.UI/EngagementUIModule.cs:22) implements IUIModule to contribute the module's Blazor assembly (:33), the invisible LiveEventListener layout component (:31), and six nav items declared as resource keys with the organizer ones carrying a RequiredRole so the shared NavMenu hides them from attendees (:21-29, ADR-027); their targets live in EngagementRoutePaths (MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:8), which also holds the two deep-link-only self-service routes that deliberately contribute no nav item at all (:29-32). The pages divide by actor. Attendees get MyBadge (Pages/CheckIns/MyBadge.razor.cs:15), which renders the opaque payload beside the account name as plain text so a human can confirm the badge belongs to its holder (:11-13), MyPoints, and the two QR landing pages SponsorVisit (Pages/CheckIns/Sponsors/SponsorVisit.razor.cs:22) and RoomCheckIn, which post the write themselves so the whole interaction is one scan with nothing to press; both keep the write off the prerender pass and behind a once-per-instance guard (SponsorVisit.razor.cs:16-19, :55-57) and branch their on-screen state off the server's stable error code carried back by SelfCheckInOutcome<TResult> (Services/CheckIns/SelfCheckInOutcome.cs:20) and named in CheckInErrorCodes (Services/CheckIns/CheckInErrorCodes.cs:8), because two of the three refusals share the same 404 status. Organizers get CheckInScan (Pages/CheckIns/CheckInScan.razor.cs:21), which loops the shared scanner where a camera exists and falls back to the AttendeeSearchPanel name and email search everywhere else (:16-19, :46), OrganizerAttendance and OrganizerPointsOverview. The two feedback pages, EventFeedback (Pages/Feedback/EventFeedback.razor.cs:20) and SessionFeedback (Pages/Feedback/SessionFeedback.razor.cs:19), render a dynamic question form whose definitions and answers belong to Conference, with per-question values held in a FeedbackAnswerModel (Pages/Feedback/FeedbackAnswerModel.cs:24) whose DataAnnotations are the single declaration of the 4000-character free-text rule (:31-35). Both submit the same way. Before anything is sent, the page flags every required question left unanswered, for every question type, because MudForm already blocks an empty required text field but not an unset rating (EventFeedback.razor.cs:188-203, :217-221, SessionFeedback.razor.cs:217-232, :246-250). It then collects every answered question and posts the whole form as one POST-as-upsert the server applies atomically, so a refusal wrote nothing, there is no partially saved state to report, and the form stays dirty for the same Submit button to retry; a form with nothing answered that passes the required check stays a local no-op rather than a request the batch endpoint would refuse as empty (EventFeedback.razor.cs:229-248, SessionFeedback.razor.cs:258-277, BR-107). The contracts say so on the batch member of IEventFeedbackUIService and its session sibling (Services/Feedback/IFeedbackUIService.cs:32-36, :66-70), and EventFeedbackService mints the idempotency key once, outside its retry pipeline, so a timed-out submit that retries is recognized by the server rather than re-applying the form (Services/Feedback/EventFeedbackService.cs:54-58). Behind the pages sit ordinary authenticated HTTP clients built on AuthenticatedServiceBase: the cross-module SessionBookmarkUIService (whose three bookmark HTTP calls sit in BookmarkApiClient, Services/Bookmarks/BookmarkApiClient.cs:21, shared with BookmarkCreateReplayHandler and BookmarkDeleteReplayHandler, which replay a toggle queued offline under the versioned write kinds and the per-user, per-session coalesce key of BookmarkOfflineWrites, Services/Bookmarks/BookmarkOfflineWrites.cs:5-23; each constructs the client rather than resolving it, because a shared registration would close a DI circle through the offline write queue, BookmarkApiClient.cs:10-14; the toggle service also feeds SessionReminderCoordinator and the pure SessionReminderPlanner, whose SessionReminder records carry a stable notification id so rescheduling replaces rather than duplicates, Services/HappeningNow/SessionReminderPlanner.cs:15, :39, :41-48, ADR-042), CheckInService, PointsService, AttendeeLookupService (which searches through the body of the Organizer-only POST users/search, so an email search term never travels in a URL where request telemetry would keep it, and answers its by-identifier lookup from a RosterSnapshot of up to five pages of 500 that a miss against a stale snapshot refreshes, Services/Lookups/AttendeeLookupService.cs:7-17, :161), and NowNextService behind INowNextService, which mirrors the Conference API's now-next wire shape locally rather than referencing Conference.Shared for one payload (Services/HappeningNow/INowNextService.cs:6-9). The conference-day pages taught in Group 23 get their client layer from here too, and it is the same shape. LivePollUIService (MMCA.ADC.Engagement.UI/Services/SessionLive/LivePollUIService.cs:14) and SessionQuestionUIService (Services/SessionLive/SessionQuestionUIService.cs:15) are AuthenticatedServiceBase clients over the Gateway's livepolls and sessionquestions routes (:19 in each), and their contracts ILivePollUIService (Services/SessionLive/ILivePollUIService.cs:15) and ISessionQuestionUIService (Services/SessionLive/ISessionQuestionUIService.cs:15) both open with the rule that keeps a live page calm: every member answers with a Result, so a server refusal is data the page renders rather than an exception, and only the caller's own cancellation still propagates (ILivePollUIService.cs:10-13, ISessionQuestionUIService.cs:10-13). Both also say in the contract that the API enforces the manage and moderation rights regardless of what the UI chooses to render (ILivePollUIService.cs:7-9, ISessionQuestionUIService.cs:7-9), which is the only safe way to write a doc comment about a permission a browser can be told to ignore. The one create-poll form, CreateLivePollForm (Components/CreateLivePollForm.razor.cs:17), is shared by the Happening Now Manage tab (an event-wide poll) and the session Live moderation panel (a session poll): it owns the draft question and its per-option OptionState rows (:137) and performs the create call, the host owns and reloads the poll lists, and the option count is bounded by the same LivePollDTO.MinOptions and MaxOptions the server validates (:5-16). LiveEventService behind ILiveEventUIService (Services/SessionLive/LiveEventService.cs:17, Services/SessionLive/ILiveEventUIService.cs:7) resolves the currently-live-or-next published event from the Conference API and computes its window with the same math the backend enforces, then degrades to null on any API failure so the live layer simply stays dormant instead of erroring a page (LiveEventService.cs:9-16, :38-42); the LiveEventContext record it returns (Services/SessionLive/LiveEventContext.cs:13) answers IsLiveAt and ToEventLocal for the pages, and its zone id always resolves because the Conference write path guards it (:20-31). SessionLiveUIService (Services/SessionLive/SessionLiveUIService.cs:10) is the smallest type in the chapter and the clearest one about module boundaries: it implements the ISessionLiveUIService extension point with a single line returning Engagement's own route (:13-14), so a Conference session page lights up its Live button only when this module is present. SessionLookupService behind ISessionLookupService (Services/Lookups/SessionLookupService.cs:13, Services/Lookups/ISessionLookupService.cs:19) is the enrichment client that turns session ids into the titles and times the bookmark surfaces display, projecting the Conference page into a session-keyed dictionary of the small SessionInfo record (ISessionLookupService.cs:9, SessionLookupService.cs:25-41); its contract carries the usage rule as well as the signature, because the catalog call is cheap to misuse: GetAllAsync is for a page that genuinely needs every session (the reminder planner, which schedules against every bookmarked one), and a single-session page must call GetByIdAsync rather than transfer the catalog to label one row (ISessionLookupService.cs:21-28). The comment above the fetch is worth keeping when you copy it: the base sessions endpoint serves one page capped at the framework's 500-row maximum over every edition's catalog sorted by start time, so a single page would silently drop the current event's sessions once the catalog passes 500; the lookup therefore walks the Id-sorted lookup URL with PagedReadAll until the reported total, as the Conference speaker and event lookups do (SessionLookupService.cs:20-25). One more UI type is easy to miss and easy to get wrong: CurrentEventNotificationScopeProvider (Services/Notifications/CurrentEventNotificationScopeProvider.cs:30) scopes ADC's notifications to event:{EventId}, caching a resolved key for five minutes because the bell polls every 30 seconds (:41), and it never answers null: on INotificationScopeProvider a null key means unscoped, which would widen an attendee's inbox to every event, so an instance that has never resolved an event answers with a well-formed key no row carries (:20-24, :35-39), failing to an empty inbox rather than to everyone's.

Rubric lens. This module is a compact end-to-end illustration of most of Part A. Five small aggregates whose rules live in factories and invariants are the [Rubric §4, Domain-Driven Design] story; the controller-handler-domain-service split and the one-slice-per-folder layout are [Rubric §5, Vertical Slice] and [Rubric §6, CQRS and Event-Driven], with the points adapters showing both dispatch styles (broker integration events and an in-process domain event) side by side and stating the trade-off in code. The gRPC adapters and Replace-based composition are [Rubric §7, Microservices Readiness] and [Rubric §9, API and Contract Design]; the per-service database, the filtered unique indexes carrying idempotency, anti-farming and one-vote-per-poll, and the pushed-down grouped COUNT and SUM in the attendance and leaderboard reads are [Rubric §8, Data Architecture] and [Rubric §12, Performance and Scalability]. Security ([Rubric §11]) is the recurring theme rather than a bolt-on: identity taken from the token instead of the body on every self-service path, the 404-not-403 delete, indistinguishable answers for a bad payload and an unknown credential, server-resolved room sessions, a verified-participant gate in front of every point-earning self-service write, a per-address budget on the ticket claim, a bearer credential minted from a non-monotonic Guid that the holder or an organizer can reissue, and one documented unauthenticated-by-necessity gRPC endpoint. The drop-oldest publish queue with its dropped-count meter and draining shutdown, and the coalesced, paced bookmark cache eviction, are [Rubric §29, Resilience] and [Rubric §13, Observability and Operability], as is the live client layer's Result-only surface and its dormant-rather-than-broken answer when the event lookup fails; per-capability feature flags plus a retunable points economy with per-rule kill switches are [Rubric §12, Performance & Scalability] and [Rubric §17, DevOps]; the export projection and the leaderboard name erasure are [Rubric §30, Compliance and Privacy]. The pages extend the story into Part B ([Rubric §18, UI Architecture], [Rubric §24, Forms/Validation/UX Safety] for the single-declaration answer model, and [Rubric §25, Navigation and IA] for the deep-link-only QR routes). Relevant ADRs, roughly in the order they surface above: ADR-075 (audit trail), ADR-033 (owner-or-admin filter), ADR-017 (request idempotency), ADR-001 (Mapperly mapping), ADR-072 and ADR-071 (badge check-in, points, and the scanner capability), ADR-006 and ADR-030 (database-per-service and sole migrator), ADR-003 (outbox), ADR-007 and ADR-008 (gRPC extraction and topology), ADR-076 and ADR-005 (data-subject export, soft-delete versus erasure), ADR-039 (best-effort live publish), ADR-020 (permission registry), ADR-014 (the sealed decorator pipeline the host closes), ADR-012 (Kestrel endpoint profile), ADR-070 (fail-fast configuration, and this module's documented exception to it), ADR-074 (scheduler), ADR-025 (warm-up and readiness), ADR-027 (resource-key navigation and error translations), and ADR-042 (device capabilities and reminder dispatch).

AssemblyReference

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/AssemblyReference.cs:5 · Level 0 · class (static)

One byte-identical copy per Engagement layer. This section covers the API and Application copies; the Domain, Infrastructure, Shared, and UI copies are the same type in another part of this chapter.

  • What it is: a tiny static class that exposes the assembly it lives in (Assembly) plus that assembly's simple name (AssemblyName), so anything that needs to say "scan the assembly this type belongs to" has a compiled, refactor-safe anchor instead of a namespace string.

    Type File:Line Notes (what differs)
    AssemblyReference (API) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/AssemblyReference.cs:5 namespace MMCA.ADC.Engagement.API (:3)
    AssemblyReference (Application) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/AssemblyReference.cs:5 namespace MMCA.ADC.Engagement.Application (:3)

    Nothing else differs: both files are eleven lines long and declare the same two fields at the same line numbers.

  • Depends on: System.Reflection.Assembly (BCL) only, imported at line 1 of each file. No first-party dependencies, which is why both copies sit at Level 0.

  • Concept, assembly-marker types for convention scanning. The framework-level explanation lives with the shared copy in AssemblyReference; these are the Engagement-local instances of the same idiom. [Rubric §2, Design Patterns] assesses whether recurring problems are solved with a recognized idiom: handing an Assembly to a scanner through a purpose-built token, rather than through some incidental business class, is that idiom. [Rubric §1, SOLID] (Dependency Inversion) applies too: registration and configuration code depends on this deliberate marker, not on typeof(SomeHandler).Assembly, so renaming or moving a real type never silently breaks a scan.

  • Walkthrough: two public static readonly fields, resolved once at type initialization and identical in both copies. Assembly (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/AssemblyReference.cs:7, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/AssemblyReference.cs:7) captures typeof(AssemblyReference).Assembly. AssemblyName (line 8 of each file) reads Assembly.GetName().Name ?? string.Empty, the null-coalesce keeping the field non-null under nullable-reference-type analysis even if the runtime reports no simple name. There are no methods and no other state.

  • Why it's built this way: each layer can be scanned from inside itself without a cross-layer reference, and a compiled typeof cannot go stale the way a hardcoded assembly-name string would. The Engagement module declares the pair once per scannable layer, which is why the same two type names recur across the chapter.

  • Where it's used: the convention scan the Application layer runs takes the companion ClassReference rather than the static class, because a static class cannot be a generic type argument (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92). The static handle is the shape used where an Assembly value is passed by hand, for example the design-time EF factories and the architecture-fitness map.

  • Caveats / not-in-source: neither of these two copies has a reader inside the Engagement API or Application projects themselves; they exist so that every layer carries the same anchor.


ClassReference

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/AssemblyReference.cs:11 · Level 0 · class

One byte-identical copy per Engagement layer. This section covers the API and Application copies.

  • What it is: the non-static companion to AssemblyReference, an empty instantiable class declared at the bottom of the same file. It supplies an assembly anchor for the APIs that need a generic type argument, which a static class can never satisfy.

    Type File:Line Notes (what differs)
    ClassReference (API) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/AssemblyReference.cs:11 namespace MMCA.ADC.Engagement.API
    ClassReference (Application) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/AssemblyReference.cs:11 namespace MMCA.ADC.Engagement.Application
  • Depends on: nothing first-party, and nothing from the BCL beyond object.

  • Concept: the companion half of the marker pattern, introduced at framework level under ClassReference. C# forbids a static class as a generic type argument, and the registration helper the modules use takes its marker as a type parameter, so a second, non-static token fills that slot without weakening AssemblyReference's static-ness. [Rubric §33, Developer Experience] assesses how much ceremony the inner loop costs: one conventional token per layer is the whole of it.

  • Walkthrough: public class ClassReference { } at line 11 of both files. No members, no behavior; its only meaningful property is the assembly it belongs to, read as typeof(ClassReference).Assembly by a scanner.

  • Why it's built this way: keeping the two forms separate sidesteps the static-class generic-argument restriction while leaving AssemblyReference impossible to instantiate by accident. Every layer declares its own copy so it scans itself with a local token.

  • Where it's used: the Application-layer copy is the one with a call site: services.ScanModuleApplicationServices<ClassReference>() in the Application DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92), which registers domain event handlers, DTO and request mappers, command and query handlers, and validators by convention.

  • Caveats / not-in-source: the API-layer copy has no reader in the repo; it exists to keep the per-layer convention uniform.


EngagementErrorResources

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Resources · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Resources/EngagementErrorResources.cs:9 · Level 0 · class (sealed)

  • What it is: an empty sealed class that serves as the resource anchor type for the Engagement module's localized error-code translations. It carries no members; its job is to name the .resx family that sits beside it.
  • Depends on: nothing first-party in code. Its behavioral partners are the shared ErrorLocalizer infrastructure (through the IErrorLocalizer contract) and the AddErrorResources<T>() host registration helper, both named in the type's doc comment.
  • Concept, resource-anchor types for per-module error localization. [Rubric §27, Internationalization] assesses whether user-facing strings are externalized and culture-resolved rather than hard-coded. The doc comment (EngagementErrorResources.cs:3-8) states the mechanism: the type's .resx siblings (EngagementErrorResources.resx for the invariant culture, EngagementErrorResources.es.resx for Spanish) are keyed by a domain error's Code, and the shared IErrorLocalizer resolves a failing Result's code to a translated message once the host registers this type via AddErrorResources<EngagementErrorResources>(). That is ADR-027 applied per module: the class is empty because a resource anchor only needs a stable full name from which the resource base name is computed.
  • Walkthrough: public sealed class EngagementErrorResources with an empty body (EngagementErrorResources.cs:9-11), no members. sealed because it is never meant to be subclassed; it exists purely as a typeof handle for the resource manager.
  • Why it's built this way: one anchor per module keeps error strings out of a single monolithic resource file, so each bounded context owns its own translation table (ADR-027). The type lives in the API layer because that is where errors become HTTP responses.
  • Where it's used: registered by the Engagement service host through AddErrorResources<EngagementErrorResources>(); read by the shared ErrorLocalizer when mapping a domain error code to a message. The codes it translates are the ones the handlers raise, for example CheckIns.Forbidden and CheckIns.BadgeConflict in GetOrCreateMyBadgeHandler and CheckIns.EventNotPublished in CheckInProcessor.
  • Caveats / not-in-source: the .resx files themselves and the host registration call live outside this .cs file; only the anchor type is verified here, the rest is quoted from its doc comment.

GetAttendanceStatsQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetAttendanceStats · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetAttendanceStats/GetAttendanceStatsQuery.cs:8 · Level 0 · record (sealed)

  • What it is: the read request behind the organizer dashboard's attendance rollup for one event: how many people arrived at the event, plus a count for each session that has at least one session-scoped check-in.
  • Depends on: the EventIdentifierType alias only (an identifier type alias linked solution-wide, see primer §4). Paired with GetAttendanceStatsHandler through the query contract, and answered as an AttendanceStatsDTO.
  • Concept, the CQRS query as an immutable record. This is a vertical-slice read: the query type and its handler live in the same UseCases/GetAttendanceStats/ folder. [Rubric §6, CQRS & Event-Driven] assesses whether reads and writes are modeled as distinct messages; this is a pure read, so the pipeline runs it without a transaction. [Rubric §5, Vertical Slice] assesses feature-folder cohesion, which the layout embodies. record class gives value equality and immutability for free, so the message is safe to pass and compare.
  • Walkthrough: public sealed record class GetAttendanceStatsQuery(EventIdentifierType EventId) (GetAttendanceStatsQuery.cs:8), one positional parameter and no body. The XML doc (GetAttendanceStatsQuery.cs:3-7) fixes the contract: an event-scoped arrival count plus a per-session count for every session that has at least one session-scoped check-in.
  • Why it's built this way: the whole request is one event id, so the record is a one-line declaration; naming the message explicitly still lets the query pipeline decorate it uniformly and keeps the read intent greppable.
  • Where it's used: constructed by CheckInsController on GET /api/checkins/stats (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:270) from a [FromQuery, Required] EventIdentifierType eventId argument (CheckInsController.cs:266), on an endpoint gated by [HasPermission(EngagementPermissions.CheckInManage)] (CheckInsController.cs:262), and dispatched through the injected IQueryHandler<in TQuery, TResult> (CheckInsController.cs:51).

GetMyBadgeQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetMyBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetMyBadge/GetMyBadgeQuery.cs:12 · Level 0 · record (sealed)

  • What it is: the read request for the caller's own existing badge. The doc comment (GetMyBadgeQuery.cs:3-6) names it the read path of GET /checkins/my-badge, the path that never mints.
  • Depends on: nothing first-party. Paired with GetMyBadgeHandler through IQueryHandler<in TQuery, TResult> and answered as a MyBadgeDTO.
  • Concept introduced, the deliberately empty query. [Rubric §11, Security] assesses whether a caller can reach data that is not theirs. The doc (GetMyBadgeQuery.cs:7-10) says the record is empty for the same reason as the mint command GetOrCreateMyBadgeCommand: the attendee is the caller, read from the token by the handler, never a client-supplied id. A message with no id field cannot be used to ask for someone else's badge. [Rubric §6, CQRS & Event-Driven] assesses whether reads and writes are distinct messages: splitting this read out of the mint command is what lets a read-only "View as" session, for which every command (the mint included) is refused, still read the attendee's badge (GetMyBadgeQuery.cs:4-6).
  • Walkthrough: public sealed record class GetMyBadgeQuery; (GetMyBadgeQuery.cs:12), no positional parameters and no body. record class keeps it consistent with the module's other request messages even though there is no state to compare.
  • Why it's built this way: the endpoint reads first and mints only on a miss, so the read needs its own message rather than a flag on the command; keeping it parameterless means the identity rule lives in exactly one place, the handler.
  • Where it's used: constructed as new GetMyBadgeQuery() in CheckInsController.GetMyBadgeAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:72) on [HttpGet("my-badge")] (CheckInsController.cs:64), dispatched through the injected IQueryHandler<GetMyBadgeQuery, Result<MyBadgeDTO>> (CheckInsController.cs:45); also built directly by the handler tests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/CheckIns/UseCases/GetMyBadgeHandlerTests.cs:27).

RecordedCheckIn

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:38 · Level 0 · record struct (internal readonly)

  • What it is: the two-field outcome of a check-in write, nested inside CheckInProcessor: whether a check-in for the same target already existed, and the timestamp that applies (the original one when it did, the newly written one when it did not).
  • Depends on: nothing first-party. Only bool and DateTimeOffset from the BCL. It is produced by CheckInProcessor.RecordAsync and consumed by the three writers that call it.
  • Concept introduced, the small internal result type that keeps a shared helper honest. A RecordAsync that returned only a timestamp would force each caller to re-derive "was this a repeat", and one that returned a full DTO would force every caller into the same response shape even though the room path, the sponsor path, and the organizer path each answer with a different DTO. This record struct is the middle ground: it carries exactly the two facts the shared write half knows, and each caller maps them into its own contract. [Rubric §9, API & Contract Design] assesses whether a contract carries what it means and nothing more, which is what two named components buy here (AlreadyRecorded, RecordedOn) over a bool/DateTimeOffset tuple. [Rubric §12, Performance & Scalability] is the reason it is a readonly record struct rather than a class: the value is created on every check-in, has no identity, and is never mutated, so it stays on the stack. [Rubric §15, Best Practices & Code Quality]: internal keeps it a module-private detail, so no API-layer contract can accidentally start depending on it.
  • Walkthrough: one declaration, internal readonly record struct RecordedCheckIn(bool AlreadyRecorded, DateTimeOffset RecordedOn) (CheckInProcessor.cs:38), with the per-parameter docs directly above it (CheckInProcessor.cs:35-37): AlreadyRecorded is true when a prior check-in for the same target was found, and RecordedOn is that prior check-in's timestamp, or the timestamp of the one just written. Both construction sites are inside RecordAsync: the short-circuit path builds new RecordedCheckIn(AlreadyRecorded: true, existing.CheckedInOn) (CheckInProcessor.cs:76) and the write path builds new RecordedCheckIn(AlreadyRecorded: false, checkIn.CheckedInOn) (CheckInProcessor.cs:112). Both use named arguments, so the boolean at the call site says what it means.
  • Why it's built this way: idempotency is the whole point of the check-in write (a repeat scan must not double count), so the outcome type has to make "this was a repeat" a first-class fact rather than something a caller infers. Returning the original timestamp on a repeat is what lets a UI show the attendee when they actually checked in rather than when they rescanned.
  • Where it's used: returned as Result<RecordedCheckIn> from CheckInProcessor.RecordAsync (CheckInProcessor.cs:60). Three call sites unwrap it: CheckInProcessor's own ExecuteAsync maps it onto a CheckInResultDTO (CheckInProcessor.cs:163-169), RecordRoomCheckInHandler maps it onto a RoomCheckInResultDTO and suppresses its log line when AlreadyRecorded is true (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:131-143), and RecordSponsorVisitHandler does the same into a SponsorVisitResultDTO (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:98-108).

EngagementModule

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/EngagementModule.cs:12 · Level 5 · class (sealed)

  • What it is: the IModule implementation for the Engagement bounded context, the type ModuleLoader discovers by reflection and uses to slot Engagement into the application in dependency order.
  • Depends on: IModule (the contract), ApplicationSettings (only because the contract's Register signature carries it, imported at EngagementModule.cs:4), and the API-layer DependencyInjection extension (AddEngagementModule).
  • Concept, the module descriptor and its declared dependency on Conference. [Rubric §7, Microservices Readiness] assesses whether a modular monolith can be split into services without a rewrite; a module that declares its dependencies behind a uniform contract is exactly that boundary. Engagement names Conference as a dependency (EngagementModule.cs:18) and sets RequiresDependencies => true (EngagementModule.cs:21), so the loader orders Conference before Engagement in its topological (Kahn) sort, and per the contract's doc the module will not start if Conference is disabled (MMCA.Common/Source/Core/MMCA.Common.Application/Modules/IModule.cs:19-23). When Engagement runs as its own service, Conference is not in-process and the cross-module contracts are satisfied by gRPC clients instead (ADR-007 / ADR-008). The module does not override RegisterDisabledStubs, so it inherits the contract's empty default (IModule.cs:34): a host where Engagement is disabled registers no Engagement stubs.
  • Walkthrough: four members implementing IModule.
    • Name => "Engagement" (EngagementModule.cs:15): the module's identity in the loader's graph.
    • Dependencies => ["Conference"] (EngagementModule.cs:18): the modules that must register first.
    • RequiresDependencies => true (EngagementModule.cs:21): declares the Conference dependency mandatory, not optional.
    • Register(...) (EngagementModule.cs:24-25): an expression body delegating the whole wiring to the parameterless services.AddEngagementModule() in the API DependencyInjection. The signature also receives an IConfigurationBuilder and an ApplicationSettings, neither of which this module uses.
  • Why it's built this way: keeping the module's shape (name, dependencies, register) behind one contract lets the loader treat every module uniformly, and lets a module run in-process or as an extracted service without changing its business code (ADR-007 / ADR-008). The doc comment (EngagementModule.cs:8-11) records that the module depends on Conference for session data.
  • Where it's used: instantiated and invoked by ModuleLoader during host startup; its Register routes into the API DependencyInjection.

GetMyBadgeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetMyBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetMyBadge/GetMyBadgeHandler.cs:17 · Level 9 · class (sealed)

  • What it is: the query handler for GetMyBadgeQuery. It returns the caller's existing badge credential without writing anything, or a NotFound failure when no badge has been issued yet (GetMyBadgeHandler.cs:11-16).
  • Depends on: IUnitOfWork and ICurrentUserService through its primary constructor (GetMyBadgeHandler.cs:17-19); the RequireUserId member of CurrentUserServiceExtensions (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35); the AttendeeBadge aggregate read through an IReadRepository<TEntity, TIdentifierType>; MyBadgeDTO; and Result / Error. It implements IQueryHandler<in TQuery, TResult> (GetMyBadgeHandler.cs:19).
  • Concept introduced, read first and mint only on a miss. [Rubric §6, CQRS & Event-Driven], [Rubric §11, Security]. The class doc (GetMyBadgeHandler.cs:11-16) states the split: the controller tries this read first and falls back to the mint command only for a caller allowed to write, so a "View as" session shows the attendee's badge read-only, or the "no badge yet" state, instead of the command refusal. The identity comes from the token (RequireUserId, line 29), never from the request, so no caller can read another attendee's credential. The comment at GetMyBadgeHandler.cs:43-44 adds the data-minimization rule: only the credential leaves the handler, exactly as from the mint command, so the QR code built from it stays opaque to anyone who scans it.
  • Walkthrough
    • BadgeNotIssuedCode = "CheckIns.BadgeNotIssued" (GetMyBadgeHandler.cs:22): a public constant so the tests (and any caller) can match the "no badge yet" outcome by code rather than by message.
    • HandleAsync (GetMyBadgeHandler.cs:25-27) resolves the caller with currentUserService.RequireUserId("CheckIns.Forbidden") (line 29) and returns its errors unchanged when there is no authenticated user (lines 30-33).
    • It reads the badge through GetReadRepository<AttendeeBadge, AttendeeBadgeIdentifierType>() with FirstOrDefaultAsync(b => b.UserId == userId, asTracking: false, ...) (GetMyBadgeHandler.cs:36-41): an untracked read, so nothing enters the change tracker.
    • A miss returns BadgeNotIssued(nameof(GetMyBadgeHandler)) as the failure (GetMyBadgeHandler.cs:45-46); a hit returns new MyBadgeDTO { Credential = badge.Credential } (line 47).
    • BadgeNotIssued(string source) (GetMyBadgeHandler.cs:53-57) is an internal static factory for that refusal: Error.NotFoundError with code BadgeNotIssuedCode, message "No badge has been issued for this account yet.", the caller-supplied source, and target nameof(MyBadgeDTO.Credential). Its doc (GetMyBadgeHandler.cs:50-52) records that it is shared with the badge reissue commands, so the read and the reissue paths refuse with the identical error while each still names its own handler as the source.
  • Why it's built this way: the badge endpoint must behave for both a real attendee (who gets a badge minted on first use) and a support session viewing as that attendee (who must never cause a write). Making the read a separate query with a typed NotFound gives the controller one clean signal to branch on, and leaves the mint command untouched.
  • Where it's used: injected into CheckInsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:45). GetMyBadgeAsync returns the badge on success (CheckInsController.cs:75-78); on a NotFound for a caller who is not a "View as" session it falls through to the GetOrCreateMyBadgeHandler mint (CheckInsController.cs:86-91), and otherwise surfaces the failure (CheckInsController.cs:80-84), which the badge page renders as its "no badge yet" state. Its BadgeNotIssued factory is also called by BadgeRegeneration (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/BadgeRegeneration.cs:38). Registered by the convention scan in the Application-layer DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92). Covered by GetMyBadgeHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/CheckIns/UseCases/GetMyBadgeHandlerTests.cs:17), including the cases that a caller never reads another attendee's badge (line 50) and that a missing user is refused (line 62).

CheckInProcessor

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:23 · Level 11 · class (internal static)

  • What it is: the check-in core every check-in entry point runs: validate the target, short-circuit a repeat check-in, otherwise record one. It is split into a write half (RecordAsync, shared by all four writers) and an organizer-path half (ExecuteAsync, which resolves the target through Conference first), plus one shared error factory.
  • Depends on: IUnitOfWork, Conference's IEventLiveValidationService, the CheckIn aggregate and its CheckInScope discriminator, CheckInResultDTO, CheckInErrorCodes for the shared error code, the read surface IEntityQuerier<TEntity, TIdentifierType> obtained through GetRepository, and Result / Error. Externals: System.Linq.Expressions (CheckInProcessor.cs:1) and TimeProvider.
  • Concept introduced, the static collaborator-passing helper. [Rubric §1, SOLID], [Rubric §14, Testability]. The class doc (CheckInProcessor.cs:10-22) explains the shape: it is a static helper rather than an injected service so no handler gains a dependency it does not own. Each caller passes the collaborators it already holds (IUnitOfWork, the validation service, a TimeProvider), which keeps the rule in one place without adding an interface, a registration, and a mock to every test. The cost is that it cannot be substituted in a unit test: a test of CheckInAttendeeHandler exercises this code too, so the handler tests are where its branches are covered.
  • Concept, idempotency as an application rule with a database backstop. [Rubric §6, CQRS & Event-Driven], [Rubric §29, Resilience & Business Continuity]. The RecordAsync remarks (CheckInProcessor.cs:43-50) state the full model: a repeat scan reports the original check-in instead of writing a second row or publishing a second integration event; the filtered unique indexes from CheckInConfiguration are the race backstop for two concurrent scans of the same badge, room or booth: the losing save is refused rather than duplicating, and the loser then reports the winner's row exactly as a repeat does. The unit of work classifies the refusal because it implements IUniqueConstraintViolationDetector (unitOfWork is IUniqueConstraintViolationDetector detector, CheckInProcessor.cs:95-96), and any other save failure propagates. Those indexes are one per scope: (UserId, EventId) (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:50-52), (UserId, SessionId) (:54-56), and (UserId, SponsorId) (:60-62), each IsUnique() with a soft-delete filter plus a scope filter, which is exactly the three-way split FindExistingAsync mirrors in LINQ.
  • Concept, the caller's event id is not trusted for a session check-in. [Rubric §8, Data Architecture]. ExecuteAsync takes the resolved event from the validation result, not from the request (CheckInProcessor.cs:148), and the comment above it (CheckInProcessor.cs:144-147) gives the failure mode it prevents: a stale event context on the organizer's screen would file the attendance under the wrong event, where the rollup GetAttendanceStatsHandler runs would never find it again.
  • Walkthrough
    • EventNotPublished(string source) (CheckInProcessor.cs:29-33): the shared "the owning event is not published" failure, Error.Validation with code CheckInErrorCodes.EventNotPublished (CheckInProcessor.cs:30) and target nameof(CheckIn.EventId). The code is a constant on CheckInErrorCodes, whose value is "CheckIns.EventNotPublished" (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInErrorCodes.cs:10), so a client can match the code against the Shared constant instead of repeating the string. The architecture error catalog lists it as a code deliberately shared by this class, the room check-in handler and the sponsor visit handler (MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Contracts/ErrorCatalogTests.cs:84). source is a parameter (documented at :26-28) so the error still names the entry point the caller used, which is why the two attendee-path handlers can raise the identical error from their own code.
    • RecordedCheckIn (CheckInProcessor.cs:38): the nested outcome type, covered in its own section above.
    • RecordAsync(...) (CheckInProcessor.cs:60-113): nine parameters, no state. It resolves the writable repository (line 71), looks for an existing check-in for the same target (line 73) and returns AlreadyRecorded: true with the original timestamp when it finds one (CheckInProcessor.cs:74-77); otherwise it calls CheckIn.Create(...) with timeProvider.GetUtcNow() (CheckInProcessor.cs:79-86), unwraps the factory result with createResult.TryGetValue(out var checkIn) and returns the factory's errors on failure (lines 87-88), and adds and saves inside a try (lines 90-94). The catch filter (lines 95-96) is the lost-race path: the comment (lines 98-104) explains that the attendee IS checked in, so the caller gets the same answer a sequential repeat gets rather than a raw 409. It re-reads the row untracked through FindExistingAsync (line 105); if the re-read finds nothing the violation is not this race and throw rethrows it unchanged (lines 106-107), otherwise it returns AlreadyRecorded: true with the winner's timestamp (line 109). [Rubric §29, Resilience & Business Continuity]. A clean insert returns AlreadyRecorded: false (line 112). Note it takes both sessionId and sponsorId as nullable parameters, so all three scopes go through this one write.
    • ExecuteAsync(...) (CheckInProcessor.cs:129-170): the organizer path. It validates the target first (lines 140-142), takes resolvedEventId from the validation result (line 148), delegates the write to RecordAsync with sponsorId: null (lines 150-159), propagates a write failure (lines 160-161), and maps the outcome onto a CheckInResultDTO carrying UserId, AlreadyCheckedIn, and CheckedInOn (CheckInProcessor.cs:164-169).
    • ValidateTargetAsync(...) (CheckInProcessor.cs:181-208): for a session scope it calls GetSessionLiveInfoAsync and returns the session's own EventId (lines 188-198); otherwise GetEventLiveInfoAsync and returns the requested event id (lines 200-207). Each path unwraps the Conference answer with TryGetValue (sessionLive at line 191, eventLive at line 201), returns the lookup errors unchanged on failure, and then runs the published check. The doc comment (CheckInProcessor.cs:172-180) records a deliberate v1 omission: the live window is not enforced, because an organizer scanning badges at the door or in the room works ahead of and behind the published clock, so a window check would reject legitimate check-ins; only the published and eligible facts gate the write.
    • EnsureEventIsPublished(bool isPublished) (CheckInProcessor.cs:210-213): success, or EventNotPublished(nameof(CheckInProcessor)).
    • FindExistingAsync(...) (CheckInProcessor.cs:221-237, a non-async method returning the repository's Task directly): a switch expression picks the scope-specific predicate (lines 230-235) and hands it to FirstOrDefaultAsync with asTracking: false (line 236), correct here because the existing row is only inspected, never mutated (which is also why the race path's re-read reports only the stored winner). The three predicate builders are SameSession (line 239), SameSponsor (line 242), and SameEvent (line 245); each pins c.Scope as well as the target id, so a read can never cross scopes. The doc (CheckInProcessor.cs:215-220) ties them back to the filtered unique indexes they mirror.
  • Why it's built this way: pulling the flow out of the handlers means the organizer scan path, the manual fallback, the room QR path, and the sponsor booth path cannot drift apart in their idempotency, timestamp, or event-resolution behavior, which for an attendance record is the difference between a defensible number and a guess. [Rubric §15, Best Practices & Code Quality]. Splitting RecordAsync out of ExecuteAsync is what lets the two attendee-driven paths share the write while doing their own target lookup, since each asks Conference a different question (CheckInProcessor.cs:15-21).
  • Where it's used: ExecuteAsync by CheckInAttendeeHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/CheckInAttendee/CheckInAttendeeHandler.cs:60) and ManualCheckInHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/ManualCheckIn/ManualCheckInHandler.cs:50). RecordAsync and EventNotPublished directly by RecordRoomCheckInHandler (RecordRoomCheckInHandler.cs:118 and :67) and RecordSponsorVisitHandler (RecordSponsorVisitHandler.cs:85 and :64), which resolve their own target first and then share this write half.
  • Caveats / not-in-source: ExecuteAsync takes no sponsorId and ValidateTargetAsync has only a session branch and an event branch, so a sponsor visit cannot be recorded through the organizer path even though CheckInScope admits it; the sponsor scope reaches RecordAsync only through RecordSponsorVisitHandler, whose own comment cites the once-per-sponsor filtered index as its race backstop (RecordSponsorVisitHandler.cs:81-83). The sessionId!.Value dereference at CheckInProcessor.cs:190 is guarded only by the caller passing a session id together with a session scope, not by anything in this file.

GetAttendanceStatsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetAttendanceStats · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetAttendanceStats/GetAttendanceStatsHandler.cs:16 · Level 11 · class (sealed)

  • What it is: the query handler for GetAttendanceStatsQuery. It answers the organizer dashboard with one event-scoped arrival count plus one row per session that has check-ins, as an AttendanceStatsDTO.
  • Depends on: IUnitOfWork through its primary constructor (GetAttendanceStatsHandler.cs:16). It reads the CheckIn aggregate through an IReadRepository<TEntity, TIdentifierType>, filters on CheckInScope, and builds SessionAttendanceDTO rows inside an AttendanceStatsDTO. It implements IQueryHandler<in TQuery, TResult> (GetAttendanceStatsHandler.cs:17).
  • Concept introduced, the persistence-neutral grouped count. [Rubric §12, Performance & Scalability] assesses whether a read pulls only what it needs. The class doc (GetAttendanceStatsHandler.cs:10-15) is explicit: both figures are read through the focused repository surface and both are computed in SQL, a COUNT for the event scope and a grouped COUNT per session, so what crosses the wire is one row per session rather than one per check-in. The member that makes this possible is CountByAsync, declared on the shared querier contract (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IRepository.cs:169-174); its remarks (IRepository.cs:158-163) name the problem it removes, that the Application layer references no EF Core and therefore has no IQueryable to group, which would otherwise force a handler to project every matching row out of the database and fold it in memory. [Rubric §3, Clean Architecture] is the reason the fix took that shape: the aggregate is expressed as a persistence-neutral member rather than by letting the handler see the provider. [Rubric §8, Data Architecture] shows in how the two scopes are distinguished: a single CheckIn table holds both event arrivals and session attendance, separated by the Scope discriminator rather than by two tables, and CheckInConfiguration indexes EventId and SessionId for exactly this read (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:65-70). [Rubric §6, CQRS & Event-Driven]: this is a pure read, resolved through GetReadRepository (line 25) rather than the writable repository, so nothing enters the change tracker.
  • Walkthrough
    • HandleAsync (GetAttendanceStatsHandler.cs:20-22) null-guards the query with ArgumentNullException.ThrowIfNull(query) (line 23).
    • It resolves the read repository for CheckIn (line 25).
    • The event figure is a server-side count: CountAsync(c => c.EventId == query.EventId && c.Scope == CheckInScope.Event, cancellationToken) (GetAttendanceStatsHandler.cs:28-30), which translates to a SQL COUNT and never materializes a row.
    • The session figures are a server-side GROUP BY: CountByAsync(c => c.SessionId!.Value, c => c.EventId == query.EventId && c.Scope == CheckInScope.Session && c.SessionId != null, cancellationToken) (GetAttendanceStatsHandler.cs:32-35) returns an IReadOnlyDictionary<SessionIdentifierType, int> holding one entry per session that has at least one session-scoped check-in of this event. The != null filter is what makes the SessionId!.Value key selector safe.
    • The rollup is built with a collection expression (GetAttendanceStatsHandler.cs:37-42): OrderBy(pair => pair.Key) (line 39) makes the output order deterministic (a dictionary has none), and each pair becomes a SessionAttendanceDTO { SessionId = pair.Key, Count = pair.Value } (line 40).
    • It returns Result.Success(new AttendanceStatsDTO { EventId = ..., EventAttendance = ..., SessionAttendance = ... }) (GetAttendanceStatsHandler.cs:44-49). There is no failure branch: with a valid event id the query always succeeds, and an event with no check-ins simply yields zero and an empty list.
  • Why it's built this way: pushing both aggregates into SQL keeps the response size proportional to the number of sessions rather than to the number of attendees, which is the difference that matters on a conference day; sorting by key in memory afterwards costs nothing and means two calls with the same data return rows in the same order, which matters for a dashboard and for snapshot-style tests.
  • Where it's used: dispatched from CheckInsController.GetAttendanceStatsAsync on GET /api/checkins/stats?eventId= (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:261-273), an endpoint gated by [HasPermission(EngagementPermissions.CheckInManage)] (CheckInsController.cs:262); registered by the convention scan in the Application-layer DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92).

SessionTimeSlotPoints

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/SessionTimeSlotPoints.cs:29 · Level 11 · class (internal static)

  • What it is: the one statement of the "session points once per time slot" rule. Its single method, HasEarlierOverlappingCheckInAsync, answers whether an attendee's session check-in is preceded by a check-in to a different session of the same event whose scheduled window overlaps this one (SessionTimeSlotPoints.cs:9-14, :52). Attendance is never affected; every check-in row is still written, and only the points award depends on the answer.
  • Depends on: IUnitOfWork, Conference's IEventLiveValidationService (for GetOverlappingSessionIdsAsync), the CheckIn aggregate and its CheckInScope discriminator, and Result. It reads through GetReadRepository and GetProjectedAsync (SessionTimeSlotPoints.cs:61-67).
  • Concept introduced, one rule asked from two places, with "earlier" decided from committed rows. [Rubric §6, CQRS & Event-Driven], [Rubric §14, Testability]. The class doc (SessionTimeSlotPoints.cs:9-27) says both the points award (every session check-in, door scans included) and the room-QR response, which tells the attendee, ask this one question, so they cannot drift. It is a static helper for the same reason as CheckInProcessor: each caller passes the collaborators it already holds, and what a lookup failure means is the caller's policy, so failures are returned unchanged. "Earlier" never depends on the order events happen to be handled in: a row is earlier when its CheckedInOn is strictly earlier, or equal with a smaller id (SessionTimeSlotPoints.cs:71-76), which keeps the outcome deterministic when two events are handled concurrently or out of order. The earliest check-in of a slot earns the points and every later overlapping one earns none.
  • Walkthrough
    • It projects only Id, SessionId and CheckedInOn for the attendee's session-scoped rows in this event (SessionTimeSlotPoints.cs:62-67), so no full entity is materialized.
    • The reference row is the attendee's committed row for sessionId when one exists (line 69). When it does not, because the room-QR path asks before it writes, the reference is a row about to be written at pendingCheckedInOn: an insert not yet made takes the largest id, so every other row at or before that instant counts as earlier (remarks at lines 35-40, local function IsEarlier at lines 73-76).
    • Candidates are the distinct other session ids whose rows are earlier (SessionTimeSlotPoints.cs:78-84). With none, the method returns Result.Success(false) and Conference is not called at all (lines 85-86).
    • Otherwise it asks Conference which candidates overlap sessionId (GetOverlappingSessionIdsAsync, lines 88-90), unwraps the answer with overlapping.TryGetValue(out var overlappingIds), and returns true when any id comes back, or the Conference failure unchanged (lines 92-94). [Rubric §3, Clean Architecture]: Conference answers only the schedule question, and the check-in history stays in Engagement.
  • Why it's built this way: a rule that two code paths evaluate separately will eventually disagree, and here a disagreement would tell an attendee one thing while the ledger records another. Deciding "earlier" from stored rows rather than from handling order makes the answer replay-safe under broker redelivery.
  • Where it's used: RecordRoomCheckInHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:102) and AttendeeCheckedInPointsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:92).

DependencyInjection

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:15 · Level 12 · class (static, extension block)

  • What it is: the Engagement module's API-layer composition root. It exposes two extension methods on IServiceCollection: the parameterless AddEngagementModule() chains the three layer registrations into one call, and AddModuleEngagementAPI() configures the shared ownership-authorization filter with ADC's vocabulary, declares the module's role-to-permission grants, and registers the ticket-claim rate limiter.
  • Depends on: the Application and Infrastructure registration extensions (AddModuleEngagementApplication on the Application-layer DependencyInjection and AddModuleEngagementInfrastructure), the shared OwnerOrAdminFilterOptions / OwnerOrAdminFilter, the auth vocabulary RoleNames, EngagementPermissionGrants (whose Apply method is handed straight to AddPermissions, and which in turn wraps EngagementPermissions fed into the IPermissionRegistry), TicketClaimRateLimiting for AddTicketClaimRateLimiting (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/RateLimiting/TicketClaimRateLimiting.cs:46, imported at DependencyInjection.cs:3), and System.Security.Claims.ClaimTypes from the BCL (DependencyInjection.cs:1).
  • Concept, C# extension(T) DI blocks composing a module top-down. The class body is an extension(IServiceCollection services) block (DependencyInjection.cs:17), the codebase-wide registration idiom (introduced in the primer): the members inside read as instance methods on any IServiceCollection. [Rubric §3, Clean Architecture] assesses whether layering is honored at composition time; AddEngagementModule registers Application, then Infrastructure, then API in dependency order (DependencyInjection.cs:25-27), so nothing binds before its dependencies exist. [Rubric §11, Security] assesses whether authorization is centralized and declarative: rather than hand-roll an ownership check, AddModuleEngagementAPI reuses MMCA.Common's OwnerOrAdminFilter and supplies only ADC's field names (ADR-033), then wires the module's permission grants through the shared registry (ADR-020) so the [HasPermission(...)]-gated endpoints resolve.
  • Walkthrough
    • AddEngagementModule() (DependencyInjection.cs:23) takes no parameters. It calls AddModuleEngagementApplication() (line 25), AddModuleEngagementInfrastructure() (line 26), then AddModuleEngagementAPI() (line 27), and returns services for chaining (line 29). This is the single method EngagementModule.Register invokes.
    • AddModuleEngagementAPI() (DependencyInjection.cs:42) does three things.
      • Configures OwnerOrAdminFilterOptions (DependencyInjection.cs:44-55) with OwnerClaimType = ClaimTypes.NameIdentifier (line 52), BypassRole = RoleNames.Organizer (line 53, the role that skips the ownership check), and OwnerParameterName = "userId" (line 54, the query argument the Bookmarks list endpoints bind). The comment above those three lines (DependencyInjection.cs:46-51) is the part worth reading twice: the token carries the user id in sub only, but the JWT bearer handler maps inbound sub onto ClaimTypes.NameIdentifier, so NameIdentifier is the claim type the principal actually carries by the time this filter runs; the raw sub form survives only where an identity is built straight from a token's claims (the Blazor client-side state provider), and those readers go through the claims-principal extensions instead of this filter. The filter itself is registered upstream by Common's AddAPI; this call injects only the module's vocabulary.
      • Calls AddPermissions(EngagementPermissionGrants.Apply) (DependencyInjection.cs:60), delegating the actual role-to-permission map to EngagementPermissionGrants rather than inlining Grant calls here. The comment above the call (DependencyInjection.cs:57-59) explains why: the map lives in a shared static class because the token-minting Identity host applies the same binding, since a token must carry the permission claims of every module, not only of the module the minting host boots. The doc comment (DependencyInjection.cs:32-40) lists what those grants back, the module's [HasPermission(...)]-gated endpoints across the live layer, check-in, the points overview and tickets, and records the complement: organizers hold every Engagement capability, while attendee-facing endpoints stay on a plain [Authorize] that carries no capability rather than on a permission gate. That is the split you see on CheckInsController, where the organizer stats endpoint carries [HasPermission(EngagementPermissions.CheckInManage)] (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:262) while the attendee's own-badge endpoint (CheckInsController.cs:64) carries no permission attribute and relies on the class-level [Authorize] (CheckInsController.cs:42).
      • Calls AddTicketClaimRateLimiting() (DependencyInjection.cs:64). The comment above it (DependencyInjection.cs:62-63) states what it adds: the per-client-address budget on POST /tickets/claim (S-ADC-identity-03), named by the claim action and applied by the service host's UseRateLimiter, so this registration only declares the policy and the host pipeline enforces it.
  • Why it's built this way: one AddEngagementModule entry point keeps the module's wiring in a single call the module loader can invoke; delegating ownership enforcement to a configured shared filter means that logic is written and tested once in Common (ADR-033); and centralizing the role grants in EngagementPermissionGrants rather than inlining them keeps the permission model auditable and reusable by the token-minting host (ADR-020). The doc comment (DependencyInjection.cs:32-40) is the authoritative note on which ADC value maps to which option.
  • Where it's used: AddEngagementModule is called by EngagementModule.Register; AddModuleEngagementAPI runs inside it. The configured OwnerOrAdminFilter guards the list endpoints on BookmarksController; the granted permissions gate the [HasPermission(...)] endpoints on CheckInsController, PointsController, TicketsController, TicketRosterImportController, and the live-layer controllers covered in group-23.
  • Caveats / not-in-source: AddModuleEngagementInfrastructure lives in the Infrastructure project and is covered by that layer's section, not here.

DependencyInjection

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:28 · Level 12 · class (static, extension block)

  • What it is: the Engagement module's Application-layer registration. Its single, parameterless extension method AddModuleEngagementApplication() registers the module's per-aggregate services (bookmarks, the two live-layer view builders, and the points awarder and switch), four cross-module services, the live-channel publish queue, the live-layer scope gate and its memo, the verified-participant gate and the bookmark cache-eviction signal explicitly, then convention-scans the assembly for everything uniform (handlers, mappers, validators, event handlers).
  • Depends on: the Engagement services it registers (IBookmarkCountService / BookmarkCountService, IUserEngagementExportService / UserEngagementExportService, IPendingTicketInvitationService / PendingTicketInvitationService, IVerifiedParticipantService / VerifiedParticipantService, IVerifiedParticipantGate / VerifiedParticipantGate, ILiveChannelPublishQueue / LiveChannelPublishQueue, LiveScopeMemo / LiveScopeGate, IPointsAwarder / PointsAwarder, PointsSwitch, BookmarkCacheEvictionSignal), the shared generic services (IEntityQueryService<TEntity, TEntityDTO, TIdentifierType> / EntityQueryService<TEntity, TEntityDTO, TIdentifierType>, the DeleteEntityCommand<TEntity, TIdentifierType> / DeleteEntityHandler<TEntity, TIdentifierType> pairing bound through ICommandHandler<in TCommand, TResult>), the live-layer types it also wires (LivePollResultsBuilder, SessionQuestion, SessionQuestionViewBuilder), and the ClassReference marker.
  • Concept, explicit registration plus convention scanning, with idempotent TryAdd. [Rubric §2, Design Patterns] assesses recognized composition idioms: this method mixes hand-written registrations (for services that need a specific lifetime or a closed generic the scanner cannot infer) with one convention scan for the many uniform types. [Rubric §33, Developer Experience] shows in ScanModuleApplicationServices<ClassReference>() (DependencyInjection.cs:92): a new use case is picked up as soon as its handler exists, with no registration edit, which is why none of GetMyBadgeHandler, GetOrCreateMyBadgeHandler or GetAttendanceStatsHandler appears by name here. Every explicit line uses TryAdd* rather than Add*, so a registration is a no-op when the same service was already contributed elsewhere, which keeps module wiring composable across hosts. [Rubric §15, Best Practices & Code Quality]: the comments in this file carry the reasoning that the call sites cannot, notably why the queue is registered twice, why the scope memo and the scope gate get different lifetimes, and why the points awarder is registered by hand.
  • Walkthrough
    • AddModuleEngagementApplication() (DependencyInjection.cs:32, inside the extension(IServiceCollection services) block at line 30) takes no parameters: it needs nothing from the host's settings.
    • Per-aggregate services for UserSessionBookmark: an EntityQueryService over UserSessionBookmarkDTO for its read surface (line 35), and a DeleteEntityHandler bound to ICommandHandler<DeleteEntityCommand<UserSessionBookmark, ...>, Result> (line 36), so delete reuses the framework's generic handler. No navigation populator is registered here for this or any other Engagement aggregate: Common's Application registration supplies an open-generic no-op INavigationPopulator<> default for every entity (MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.cs:58), and a module adds a closed registration only for an entity with a cross-data-source navigation (comment at lines 52-57 there), which no Engagement aggregate needs.
    • Cross-module services, each consumed by another module through a contract in the Engagement Shared project:
      • TryAddScoped<IBookmarkCountService, BookmarkCountService>() (line 39), the count Conference consumes.
      • TryAddScoped<IUserEngagementExportService, UserEngagementExportService>() (line 43), the Engagement half of the data-subject export that Identity aggregates across services (the comment at lines 41-42 cites PRIVACY.md section 12, [Rubric §30, Compliance/Privacy/Data Governance]).
      • TryAddScoped<IPendingTicketInvitationService, PendingTicketInvitationService>() (line 47), which per the comment at lines 45-46 answers which ticket invitation still stands for an address (BR-271), for the Identity module's re-issue of an expired invitation.
      • TryAddScoped<IVerifiedParticipantService, VerifiedParticipantService>() (line 69), which per the comment at lines 67-68 answers the verified-participant rule for the Conference module, whose session and event feedback writes pass it too (served over gRPC by the Engagement service).
    • Live-channel publish queue (DependencyInjection.cs:49-54): the concrete LiveChannelPublishQueue is registered as a singleton (line 53) and ILiveChannelPublishQueue is registered as a factory resolving that same instance (line 54). The double registration is deliberate and the comment above it (lines 49-52) explains why: handlers enqueue post-commit broadcasts (BR-229) instead of awaiting the gRPC publish inline, and the Infrastructure-hosted drain (LiveChannelPublishProcessor) needs the concrete type while handlers only need the interface, so both must share one instance.
    • Live-layer published-scope gate (DependencyInjection.cs:56-60): LiveScopeMemo is a singleton (line 59) and LiveScopeGate is scoped (line 60). The comment (lines 56-58) gives the reason for the split lifetimes: the gate (L105) is the live layer's one published-scope check, the memo is a per-replica memory of recent Conference answers shared by every request, and the gate is per request because the Conference client it calls is scoped. [Rubric §12, Performance & Scalability].
    • Verified-participant gate (DependencyInjection.cs:62-65): TryAddScoped<IVerifiedParticipantGate, VerifiedParticipantGate>() (line 65). Per the comment (lines 62-64) every vote, upvote, question and self-recorded check-in runs this rule (S-ADC-identity-02) before it writes, and the host-bound Engagement:RequireVerifiedParticipant setting turns it off. [Rubric §11, Security].
    • Bookmark cache-eviction signal (DependencyInjection.cs:71-73): BookmarkCacheEvictionSignal is registered as a singleton (line 73). Per the comment at lines 71-72 it is the coalescing flag between the bookmark domain-event handler and the Infrastructure-hosted BookmarkCacheEvictionProcessor, which paces the Conference cache-eviction broadcasts.
    • Live-layer LivePoll aggregate (DependencyInjection.cs:75-77): only the LivePollResultsBuilder projection helper (line 77). The comment (lines 75-76) records that every poll read goes through a dedicated handler, so no generic entity query service is registered for LivePoll.
    • Live-layer SessionQuestion aggregate (DependencyInjection.cs:79-80): only the SessionQuestionViewBuilder (line 80).
    • Points (gamification): TryAddScoped<IPointsAwarder, PointsAwarder>() (line 87) and TryAddScoped<PointsSwitch>() (line 88). The comment above them (lines 82-86) records two things worth reading: there is one write path into the ledger, so the check-in and feedback integration-event handlers and the session-question domain-event handler all resolve the awarder from their own scope and hand it an activity plus subject-key pair; and it is registered by hand because it is a plain service rather than a handler, so the convention scan below does not see it. PointsSwitch is likewise a plain service registered by hand.
    • services.ScanModuleApplicationServices<ClassReference>() (line 92): convention-scans this assembly for domain-event handlers, DTO and request mappers, command and query handlers, and validators (comment at DependencyInjection.cs:90-91), then the method returns services for chaining (line 94).
  • Why it's built this way: explicit TryAdd registrations pin the lifetimes and closed generics the scanner cannot infer, while the single scan removes the per-handler registration ceremony; together they keep module wiring short and additive. Passing the assembly marker ClassReference rather than a business type keeps the scan decoupled from any specific handler. The live-layer aggregates are registered here even though their behavior is taught in group-23, because a module registers all of its aggregates from one Application-layer entry point.
  • Where it's used: called by AddEngagementModule in the API DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:25), which is in turn invoked by EngagementModule.Register during host startup.

LiveChannelPublishWorkItem

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/ILiveChannelPublishQueue.cs:19 · Level 0 · record (sealed)

  • What it is: one pending best-effort live-channel broadcast, captured as an immutable record of three required fields and two optional coalescing fields. The first three are exactly the arguments a drain worker later hands to ILiveChannelPublisher.PublishAsync (ILiveChannelPublishQueue.cs:3-6); the last two tell the queue whether a newer broadcast may replace this one before it is sent.
  • Depends on: string and long, plus the LivePollIdentifierType and SessionQuestionIdentifierType aliases taken by its two key helpers (ILiveChannelPublishQueue.cs:29, :35). It is deliberately primitive-only so the item can sit in a queue with no entity, no DbContext, and no scope attached. Consumed by ILiveChannelPublishQueue and, on the other side, ILiveChannelPublisher.
  • Concept, the deferred-work message. [Rubric §12, Performance & Scalability] assesses whether slow out-of-process work is kept off the request path: representing a broadcast as data (rather than as an in-flight await) is what makes deferral possible at all. [Rubric §29, Resilience & Business Continuity] assesses failure containment: because the payload is pre-serialized into PayloadJson before enqueueing, the drain never needs the originating scope, its entities, or its DbContext, so a slow publish cannot pin request-scoped resources. The doc comment (ILiveChannelPublishQueue.cs:3-18) ties the type to BR-229 and ADR-039.
  • Concept introduced, the supersedable tally. Some broadcasts are tallies (a poll's results, a question's upvote count) that a newer tally makes worthless. CoalesceKey marks such an item: pending items with the same key are coalesced, latest wins, while the null default marks a structural broadcast that is never coalesced (ILiveChannelPublishQueue.cs:10-14). CoalesceOrder carries the tally's monotonic TalliedAtTicks marker, so when two pending tallies share a key the higher one is kept, because tallies are computed at dispatch and enqueued unordered (ILiveChannelPublishQueue.cs:15-18). The record only carries the marks; the coalescing itself is LiveChannelPublishQueue's job.
  • Walkthrough: a positional record (string ChannelKey, string EventName, string PayloadJson, string? CoalesceKey = null, long CoalesceOrder = 0) (ILiveChannelPublishQueue.cs:19-24). ChannelKey is the session or event channel key (the doc points at LivePollChannel, ILiveChannelPublishQueue.cs:7), EventName is the channel event name such as poll.results-changed (ILiveChannelPublishQueue.cs:8), and PayloadJson is the pre-serialized broadcast body, which the doc states never carries per-user data (ILiveChannelPublishQueue.cs:9). The two coalescing fields default, so a structural call site still passes three arguments. Two static helpers in the record body build the only keys in use: PollTallyKey(LivePollIdentifierType pollId) returns poll:{pollId}:results (ILiveChannelPublishQueue.cs:29-30) and QuestionUpvoteKey(SessionQuestionIdentifierType questionId) returns question:{questionId}:upvotes (ILiveChannelPublishQueue.cs:35-36), both formatted through string.Create with CultureInfo.InvariantCulture, so a key never varies with the thread culture.
  • Why it's built this way: a broadcast fans out to every subscriber of a channel, so the payload must be user-agnostic; encoding that rule in the doc of a single-purpose record keeps it visible at every construction site. Serializing eagerly also means the queue holds a small, immutable value rather than a live object graph. Keeping the key format in the record itself means the producers cannot spell a key two ways, which would silently defeat coalescing for that tally.
  • Where it's used: constructed as a structural broadcast (no coalesce key) by the live-layer command handlers after their commit, notably OpenLivePollHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/Open/OpenLivePollHandler.cs:110), CloseLivePollHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/Close/CloseLivePollHandler.cs:93), SubmitQuestionHandler (SubmitQuestionHandler.cs:225, :236), and ModerateQuestionHandler (ModerateQuestionHandler.cs:148, :158). The two post-commit domain-event handlers construct coalescible tallies: LivePollVoteChangedHandler passes PollTallyKey(poll.Id) and results.TalliedAtTicks (LivePollVoteChangedHandler.cs:81-86), and SessionQuestionUpvoteChangedHandler passes QuestionUpvoteKey(question.Id) and its talliedAtTicks (SessionQuestionUpvoteChangedHandler.cs:88-93). Drained by LiveChannelPublishProcessor, which passes each dequeued item through queue.Resolve before publishing (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:127-130).

GetOrCreateMyBadgeCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetOrCreateMyBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeCommand.cs:11 · Level 0 · record (sealed)

  • What it is: the request for "give me my badge", a parameterless command. The attendee it applies to is never stated in the message: the handler reads the caller from the token.
  • Depends on: nothing. It has no members at all. Paired with GetOrCreateMyBadgeHandler, which answers with a MyBadgeDTO.
  • Concept introduced, the deliberately empty message as a security property. [Rubric §11, Security] assesses whether authorization decisions are made from trusted inputs rather than from client-supplied ones. The doc comment says exactly why the record is empty (GetOrCreateMyBadgeCommand.cs:5-9): the attendee is the caller, read from the token by the handler, and carrying a user id in the body would make "whose badge do I get" a client-supplied value, which is precisely the input an attendee could change to obtain someone else's credential. Removing the parameter removes the attack rather than validating it away. [Rubric §9, API & Contract Design] shows in the pairing with the route: the endpoint is GET /api/checkins/my-badge with no id segment and no body (CheckInsController, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:64), so the contract has nowhere to put an identity even if a caller wanted to.
  • Concept, a command that reads. It is declared a command, not a query, because the first call for an attendee writes a new badge row; see the rationale under GetOrCreateMyBadgeHandler.
  • Walkthrough: public sealed record class GetOrCreateMyBadgeCommand; (GetOrCreateMyBadgeCommand.cs:11). One line, no positional parameters, no body.
  • Why it's built this way: an empty message still buys the uniform dispatch, decoration, and naming of the CQRS pipeline while carrying no attack surface. The alternative (a UserId parameter validated against the token) would give the same behavior with a check that can be forgotten.
  • Where it's used: constructed by CheckInsController.GetMyBadgeAsync (CheckInsController.cs:87, method at :49) and dispatched through the injected ICommandHandler<in TCommand, TResult> (CheckInsController.cs:46).

RegenerateMyBadgeCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/RegenerateMyBadgeCommand.cs:11 · Level 0 · record (sealed)

  • What it is: the request "reissue my badge", a parameterless command. A new credential replaces the old one, so a printed or screenshotted copy stops scanning (RegenerateMyBadgeCommand.cs:3-5, ADR-072).
  • Depends on: nothing. It has no members. Paired with RegenerateMyBadgeHandler, which answers with a MyBadgeDTO.
  • Concept: the deliberately empty message is introduced at GetOrCreateMyBadgeCommand, and the doc comment names that sibling as the model (RegenerateMyBadgeCommand.cs:6-9): the attendee is the caller, read from the token by the handler, so no request can name someone else's badge. [Rubric §11, Security] applies through that sibling: here the stake is higher, because a client-supplied id would let one attendee revoke another's badge.
  • Walkthrough: public sealed record class RegenerateMyBadgeCommand; (RegenerateMyBadgeCommand.cs:11). One line, no positional parameters, no body.
  • Why it's built this way: the organizer-side reissue, which must name a user, is a separate command (RegenerateAttendeeBadgeCommand) behind a permission; keeping the self-service command empty means the attendee path has no identity input to guard at all.
  • Where it's used: constructed by CheckInsController.RegenerateMyBadgeAsync on POST /checkins/my-badge/regenerate (CheckInsController, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:100, construction at :109) and dispatched through the injected ICommandHandler<in TCommand, TResult> closed over Result<MyBadgeDTO> (CheckInsController.cs:47).

ILiveChannelPublishQueue

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/ILiveChannelPublishQueue.cs:49 · Level 1 · interface

  • What it is: the one-method boundary between a command handler and the live-channel broadcast path. Handlers hand a LiveChannelPublishWorkItem to this queue instead of awaiting a gRPC publish inline.
  • Depends on: LiveChannelPublishWorkItem only. Its implementation is LiveChannelPublishQueue and its drain is LiveChannelPublishProcessor, which forwards to ILiveChannelPublisher.
  • Concept introduced, the non-blocking hand-off that decouples a hot path from a remote peer. The failure mode this exists to prevent is stated in the doc comment (ILiveChannelPublishQueue.cs:39-48): a hung (not refused) Notification peer would otherwise stall a user request for as long as the publish takes, because an inline await inherits the peer's latency. Enqueueing instead makes the handler's cost bounded and synchronous. [Rubric §29, Resilience & Business Continuity] assesses how a dependency's degradation propagates: here it cannot propagate at all, since a failed publish (including a full queue) is logged by the caller or drain and never fails the command (ILiveChannelPublishQueue.cs:46-47). [Rubric §1, SOLID] (ISP and DIP): the interface exposes exactly one method, and the Application layer depends on this abstraction rather than on the transport, so the concrete channel and the hosted drain both live outside the use-case code. [Rubric §13, Observability & Operability] shows in how the contract keeps a discard observable without burdening the caller: it hands callers nothing to branch on and points at the implementation's dropped-count warning instead (ILiveChannelPublishQueue.cs:54-55).
  • Walkthrough: a single member. void Enqueue(LiveChannelPublishWorkItem workItem) (ILiveChannelPublishQueue.cs:59) performs a non-blocking enqueue. Its doc (ILiveChannelPublishQueue.cs:51-56) pins the contract precisely: a tally carrying a coalesce key replaces a pending tally with the same key rather than queueing behind it (ILiveChannelPublishQueue.cs:52-53); the queue never rejects an item, because under backpressure it discards the OLDEST pending broadcast to make room, so there is nothing for a caller to branch on, and discards surface through the implementation's dropped-count warning rather than through a return value. A null work item throws ArgumentNullException (ILiveChannelPublishQueue.cs:58). There is no async variant, so the call cannot suspend the handler.
  • Why it's built this way: ADR-039 makes live-channel push best-effort, so the publish must be a side channel rather than a step of the command; ADR-121 is the decision record for this kind of ephemeral in-process work queue. The doc comment is explicit about what the design does NOT buy: delivery order is not guaranteed, because handlers enqueue post-commit in no fixed order and each replica drains its own queue, so clients rely on the payloads' monotonic markers instead (ILiveChannelPublishQueue.cs:44-45). Keeping the interface in the Application layer, with the drain in Infrastructure, keeps the transport dependency pointing inward only (Clean Architecture, [Rubric §3]).
  • Where it's used: constructor-injected into all four live-layer command handlers, OpenLivePollHandler (OpenLivePollHandler.cs:24), CloseLivePollHandler (CloseLivePollHandler.cs:22), SubmitQuestionHandler (SubmitQuestionHandler.cs:37), and ModerateQuestionHandler (ModerateQuestionHandler.cs:26), plus the two post-commit domain-event handlers (LivePollVoteChangedHandler.cs:40, SessionQuestionUpvoteChangedHandler.cs:41); registered against the singleton implementation in the Application-layer DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:54).

RegenerateAttendeeBadgeCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/RegenerateAttendeeBadgeCommand.cs:12 · Level 1 · record (sealed)

  • What it is: the command an organizer runs to reissue an attendee's badge, revoking a leaked copy the attendee reports at the desk (RegenerateAttendeeBadgeCommand.cs:6-10, ADR-072).
  • Depends on: IRequiresPermission and EngagementPermissions (RegenerateAttendeeBadgeCommand.cs:1-2), and the UserIdentifierType alias. Paired with RegenerateAttendeeBadgeHandler and validated by RegenerateAttendeeBadgeCommandValidator.
  • Concept, the permission checked twice. The permission marker is introduced at IRequiresPermission; this command is a sharp use of it. [Rubric §11, Security] assesses defense in depth on privileged operations. The doc says why the gate sits on the command as well as on the endpoint (RegenerateAttendeeBadgeCommand.cs:8-9): this is the one badge command that names a user other than the caller, so it must not depend on every dispatcher remembering the endpoint attribute. The endpoint carries the matching [HasPermission(EngagementPermissions.CheckInManage)] (HasPermissionAttribute, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:122).
  • Walkthrough: public sealed record class RegenerateAttendeeBadgeCommand(UserIdentifierType UserId) : IRequiresPermission (RegenerateAttendeeBadgeCommand.cs:12). UserId is the attendee whose badge to reissue (:11), and Permission => EngagementPermissions.CheckInManage (RegenerateAttendeeBadgeCommand.cs:15) is the marker's single member.
  • Why it's built this way: splitting the organizer path from the self-service RegenerateMyBadgeCommand keeps the only identity-bearing badge command behind a permission, while the attendee path has no identity input at all.
  • Where it's used: constructed by CheckInsController.RegenerateAttendeeBadgeAsync on POST /checkins/badges/{userId}/regenerate (CheckInsController.cs:121, construction at :132), dispatched through the injected ICommandHandler<in TCommand, TResult> closed over Result (CheckInsController.cs:48).

LiveChannelPublishQueue

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveChannelPublishQueue.cs:29 · Level 2 · class (sealed, partial)

  • What it is: the in-process implementation of ILiveChannelPublishQueue: a bounded System.Threading.Channels channel holding up to 1024 pending entries, a per-key slot map that coalesces tallies so a newer one replaces a pending one, and the reader handle plus Resolve step the hosted drain consumes.
  • Depends on: ILiveChannelPublishQueue and LiveChannelPublishWorkItem first-party; System.Threading.Channels (Channel, BoundedChannelOptions, BoundedChannelFullMode, ChannelReader<T>), Lock, Dictionary<string, LiveChannelPublishWorkItem> with StringComparer.Ordinal, ArgumentNullException and Interlocked from the BCL, and ILogger<LiveChannelPublishQueue> for the dropped-broadcast warning (LiveChannelPublishQueue.cs:1-2, :37, :41-42).
  • Concept introduced, bounded channels, an explicit backpressure policy, and latest-wins coalescing. An unbounded queue turns a slow consumer into a memory leak, so the capacity is fixed at 1024 (LiveChannelPublishQueue.cs:34). When it fills, BoundedChannelFullMode.DropOldest (LiveChannelPublishQueue.cs:59) discards the oldest item and still accepts the new one, which is why the write is never refused and Enqueue has no outcome to return. The class doc (LiveChannelPublishQueue.cs:6-28) layers coalescing on top: a work item carrying a CoalesceKey takes ONE slot per key until the drain publishes it, and a newer tally for the same key replaces the pending one instead of queueing behind it, so a burst of V votes on one poll costs one publish per drain pass rather than V, and a tally flood can no longer push structural broadcasts (poll.opened, poll.closed, question.approved) out of the queue (LiveChannelPublishQueue.cs:11-17). DropOldest remains the last resort when the drain itself is stuck, and then only the structural backlog beyond capacity is lost (LiveChannelPublishQueue.cs:17-19). The doc is also explicit that no delivery order is promised: the drain is FIFO over this replica's queue, but handlers enqueue after their own commits in no fixed order and every Engagement replica has its own queue, so clients drop a tally older than one they already hold by its TalliedAtTicks marker (LiveChannelPublishQueue.cs:22-26). [Rubric §12, Performance & Scalability] assesses bounded resource use under load, which the capacity plus coalescing gives: the work per drain pass scales with the number of active tallies, not the number of votes. [Rubric §29, Resilience & Business Continuity] assesses graceful degradation: a slow Notification peer degrades to fewer, fresher broadcasts, not to a stalled or ballooning host. The inline comment sizes the capacity for a conference-mode burst on a deployment scaled for about 400 concurrent users, reasoning that with tallies coalesced the queue holds the structural broadcasts plus one slot per active tally and only fills when Notification stops draining (LiveChannelPublishQueue.cs:31-33), which is [Rubric §31, Cost/FinOps] thinking applied to memory.
  • Walkthrough
    • private const int Capacity = 1024 (LiveChannelPublishQueue.cs:34), the bound, with the sizing rationale in the comment above it.
    • The slot state: _slotsLock, a Lock (LiveChannelPublishQueue.cs:41), guards _latestByKey, an ordinal dictionary from coalesce key to the newest pending tally (LiveChannelPublishQueue.cs:42). The comment above them states the invariant the rest of the class maintains: a key is present exactly while its slot entry is in the channel, so the drain's Resolve always finds what the slot stands for (LiveChannelPublishQueue.cs:39-40). Two counters follow, _droppedCount and _coalescedCount (LiveChannelPublishQueue.cs:44-45).
    • The _channel field (LiveChannelPublishQueue.cs:36) is created in the constructor (LiveChannelPublishQueue.cs:49-64) by Channel.CreateBounded<LiveChannelPublishWorkItem> (LiveChannelPublishQueue.cs:56-63) with three options: FullMode = BoundedChannelFullMode.DropOldest (line 59), SingleReader = true (line 60, matching the one hosted drain), and SingleWriter = false (line 61, because many concurrent request threads enqueue), plus the itemDropped: OnItemDropped callback (line 63). The comment above the call (:53-55) explains that this callback is the only way a DropOldest drop is observable, since TryWrite always succeeds under this mode.
    • public ChannelReader<LiveChannelPublishWorkItem> Reader => _channel.Reader (LiveChannelPublishQueue.cs:70) exposes only the read side to the drain worker, and its doc tells the reader to pass every item through Resolve before publishing it (LiveChannelPublishQueue.cs:66-69); the writer side stays private, so nothing outside this class can bypass Enqueue.
    • public long DroppedCount => Interlocked.Read(ref _droppedCount) (LiveChannelPublishQueue.cs:73) is the running total of broadcasts discarded under backpressure since startup, and public long CoalescedCount (LiveChannelPublishQueue.cs:76) the running total of tallies folded into a newer pending tally for the same key.
    • public void Enqueue(LiveChannelPublishWorkItem workItem) (LiveChannelPublishQueue.cs:85-116) null-guards (line 87). A structural item (no key) goes straight to _channel.Writer.TryWrite and returns (lines 89-93). A keyed tally takes the lock (lines 95-108): if a slot for its key is already queued, the map keeps whichever tally has the higher CoalesceOrder (>=, so an equal marker lets the later enqueue win, lines 100-101), _coalescedCount is incremented (line 103), and nothing is written to the channel. Otherwise the tally claims the key (line 107) and is written to the channel outside the lock (line 110); if that write is refused, which only happens after Complete() at shutdown, the key is released so no slot stays claimed that will never drain (lines 110-115). The remarks (LiveChannelPublishQueue.cs:78-84) record why the result is otherwise ignored: under DropOldest the write evicts rather than refusing, and a write after completion is refused silently because the host is stopping and the broadcast is best effort. It never blocks, which is the whole point of the contract.
    • public LiveChannelPublishWorkItem? Resolve(LiveChannelPublishWorkItem dequeued) (LiveChannelPublishQueue.cs:125-134) turns a dequeued item into the broadcast to publish: a structural item is returned as itself (lines 129-130), while a tally slot removes its key under the lock and returns the newest tally the key holds, or null when the slot is already empty (lines 132-133). Removing the key is what lets the next tally queue a new slot (LiveChannelPublishQueue.cs:118-124).
    • public void Complete() => _channel.Writer.TryComplete() (LiveChannelPublishQueue.cs:140, doc at :136-139) marks the queue complete at host shutdown so the drain worker sees a finite set of remaining items to flush. TryComplete makes it idempotent. The caller is the hosted drain, which invokes queue.Complete() on its stop path (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:59).
    • OnItemDropped (LiveChannelPublishQueue.cs:142-154) is the only place a discard becomes visible. If the dropped item was a tally slot it first frees the key, so the next tally queues a new slot instead of waiting on one that will never be drained (lines 144-150); then it increments _droppedCount (line 152) and emits the source-generated LogDropped warning naming the channel key, the event name, and the running total (LiveChannelPublishQueue.cs:156-159).
  • Why it's built this way: Channel<T> gives a lock-free, allocation-light producer/consumer queue in the BCL, so no third-party dependency is needed for a hand-off this simple. A channel cannot update a queued item in place, so the channel carries the slot (the first tally for a key) and the dictionary carries the value that slot will publish; Resolve joins the two at drain time. The Reader property and Resolve are why the class is registered twice in DI (once as the concrete type, once as the interface, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:53-54): handlers only need the interface, but the drain needs the concrete members, and both must resolve to the same singleton instance. The class is partial because LogDropped is a [LoggerMessage] source-generated method.
  • Where it's used: registered as a singleton in the Application-layer DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:53-54); its Reader and Resolve are consumed by LiveChannelPublishProcessor in the Infrastructure layer (LiveChannelPublishProcessor.cs:127-130), which is added with AddHostedService<LiveChannelPublishProcessor>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:26).
  • Caveats / not-in-source: the comment on the DI registration (DependencyInjection.cs:50-51) still says the drain forwards items "in FIFO order"; the class doc (LiveChannelPublishQueue.cs:22-26) and the interface doc (ILiveChannelPublishQueue.cs:44-45) are the current statement that no delivery order is promised.

RegenerateAttendeeBadgeCommandValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/RegenerateAttendeeBadgeCommandValidator.cs:8 · Level 2 · class (sealed)

  • What it is: the FluentValidation rule set for RegenerateAttendeeBadgeCommand: the attendee id must be present.
  • Depends on: FluentValidation's AbstractValidator<T> (RegenerateAttendeeBadgeCommandValidator.cs:1, :8) and the UserIdentifierType alias.
  • Concept: command validation in the pipeline is taught in group 06; this is a one-rule instance of it.
  • Walkthrough: an expression-bodied constructor (RegenerateAttendeeBadgeCommandValidator.cs:10-14) declares one rule: RuleFor(x => x.UserId).NotEqual(default(UserIdentifierType)) with the message "User ID is required." and the error code CheckIns.BadgeUserId.Required.
  • Why it's built this way: the default identifier is never a real user, so rejecting it up front answers a malformed route value with a validation error instead of a badge lookup that would answer not-found.
  • Where it's used: no source file outside its own names it. Not determinable from the lines read for this unit: which registration call discovers it (the module's ScanModuleApplicationServices<ClassReference>() at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92 is the module's convention scan, but its validator coverage was not opened here).

Entry<TInfo>

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveScopeMemo.cs:80 · Level 3 · record (private sealed, nested)

  • What it is: one remembered Conference answer together with the moment it expires, the value type of LiveScopeMemo's two dictionaries.
  • Depends on: Result (as Result<TInfo>) and long. Nested in, and only constructed by, LiveScopeMemo.
  • Concept: the answer memo is introduced at LiveScopeMemo; this record is its payload.
  • Walkthrough: private sealed record Entry<TInfo>(Result<TInfo> Answer, long ExpiresAtTicks) (LiveScopeMemo.cs:80). Answer is Conference's facts or its refusal; ExpiresAtTicks is an absolute UTC tick count computed at write time as now + Lifetime.Ticks (LiveScopeMemo.cs:77) and compared strictly against the current time on read (LiveScopeMemo.cs:57).
  • Why it's built this way: storing the absolute expiry makes the freshness check a single comparison, and a whole new immutable record is stored on every write (LiveScopeMemo.cs:77), so a concurrent reader never sees an answer paired with another answer's expiry. The type parameter lets one record serve both the SessionLiveInfo and the EventLiveInfo maps (LiveScopeMemo.cs:29-30).
  • Caveats / not-in-source: the simple name Entry is shared with unrelated nested records elsewhere (for example the inbox consume scope's Entry in group 04); they share nothing but the name.

LiveScopeMemo

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveScopeMemo.cs:20 · Level 4 · class (sealed)

  • What it is: the per-replica, short-lived memory behind LiveScopeGate: Conference's answer about a session or an event (its live facts, or its refusal) kept for a fixed window (LiveScopeMemo.cs:7-13).
  • Depends on: TimeProvider (primary constructor, LiveScopeMemo.cs:20), ConcurrentDictionary (LiveScopeMemo.cs:1), Result, SessionLiveInfo and EventLiveInfo from Conference's shared contracts (LiveScopeMemo.cs:2), the SessionIdentifierType and EventIdentifierType aliases, and its nested Entry<TInfo>.
  • Concept introduced, memoize the answer, never the outage. The doc states the trade (LiveScopeMemo.cs:10-12): a burst of votes, upvotes and list refetches in one session costs one Conference round trip per window instead of one per request, and only ANSWERS are kept, so after an outage the next request asks again. The memo itself stores whatever it is handed; the outage rule is enforced by its only writer, LiveScopeGate, which skips the write for an unavailable lookup (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveScopeGate.cs:71-74). [Rubric §12, Performance & Scalability] assesses whether hot paths avoid repeated remote work, and this collapses a per-request cross-module call into a per-window one. [Rubric §29, Resilience & Business Continuity] shows in what is not cached: a remembered outage would keep refusing for the whole window after Conference recovered. [Rubric §14, Testability]: expiry runs on the injected TimeProvider, so a test can move the clock instead of sleeping.
  • Walkthrough
    • public static readonly TimeSpan Lifetime = TimeSpan.FromSeconds(15) (LiveScopeMemo.cs:23). The doc explains the short window (LiveScopeMemo.cs:15-16): publishing an event or moving its dates is rare on conference day, and a change reaches the live layer at most Lifetime later.
    • private const int PruneThreshold = 2048 (LiveScopeMemo.cs:27); the comment (:25-26) says scopes are an event's sessions (hundreds at most), so pruning only bounds a long-running replica's growth.
    • Two maps, _sessions keyed by session id and _events keyed by event id (LiveScopeMemo.cs:29-30).
    • Four public members, a read and a write per scope kind: TryGetSession (:36), SetSession (:41), TryGetEvent (:47), SetEvent (:52). The Set docs say the value is "the facts or Conference's refusal; never an outage" (LiveScopeMemo.cs:40, :51).
    • The generic TryGet (LiveScopeMemo.cs:54-65) returns true only when an entry exists and its ExpiresAtTicks is later than timeProvider.GetUtcNow().UtcTicks (line 57); otherwise it returns false with default! (lines 63-64). An expired entry is never returned, only overwritten or pruned.
    • The generic Set (LiveScopeMemo.cs:67-78) reads the clock once (line 70); when the map holds PruneThreshold entries or more it first removes every expired one (lines 71-75), then stores a fresh Entry<TInfo> expiring Lifetime from now (line 77).
  • Why it's built this way: the memo is a singleton shared by every request, while the gate that reads it is scoped because the Conference client it calls is scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:56-58). It is per replica on purpose (LiveScopeMemo.cs:8): the staleness bound is the 15-second window, so replicas need not agree with each other, and no shared cache has to be reachable for the live layer to work.
  • Where it's used: registered as a singleton (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:59) and injected into LiveScopeGate (LiveScopeGate.cs:41).

LiveScopeGate

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveScopeGate.cs:39 · Level 5 · class (sealed, partial)

  • What it is: the live layer's one published-scope gate (L105), used by all seven sites that ask whether a session or an event is published, plus the verified-participant rule the live writes apply (LiveScopeGate.cs:8-13, :29-33).
  • Depends on: IEventLiveValidationService (Conference's live-facts lookups), LiveScopeMemo, IVerifiedParticipantGate, and ILogger<LiveScopeGate>, all through the primary constructor (LiveScopeGate.cs:39-43); it returns Result and builds an Error of ErrorType Unavailable, and reads SessionLiveInfo and EventLiveInfo.
  • Concept introduced, three outcomes and one documented answer per outcome. A remote "is this scope published?" lookup can come back as facts, as Conference's refusal, or as nothing at all, and the doc fixes the answer for each, for every site (LiveScopeGate.cs:14-28). Published: the site proceeds and reads any other facts it needs from the same answer. Unpublished, or refused (a NotFound or Invariant answer): an attendee-facing site answers the same NOT FOUND as an id that never existed, or an empty list, so no answer confirms that an unpublished scope exists; the one manager-facing site (creating a poll) passes the refusal on, because its caller is entitled to know (LiveScopeGate.cs:20-24). Conference unreachable: Unavailable, a 503 the client may retry, never a 500 and never "does not exist", and never memoized (LiveScopeGate.cs:25-26). The caller's own cancellation propagates as a cancellation (LiveScopeGate.cs:27). [Rubric §11, Security] assesses information leakage, and the identical not-found closes an existence oracle on unpublished content. [Rubric §29, Resilience & Business Continuity] assesses how a dependency outage surfaces: here as a retryable 503 rather than a false "not found" the client would trust. [Rubric §9, API & Contract Design] shows in the consistency: seven sites cannot drift apart on these answers because they share one implementation. [Rubric §13, Observability & Operability]: an outage logs a warning naming the scope and the first error code (LiveScopeGate.cs:159-163).
  • Walkthrough
    • public const string UnavailableCode = "Engagement.LiveScopeUnavailable" (LiveScopeGate.cs:46).
    • EnsureVerifiedParticipantAsync (LiveScopeGate.cs:57-58) delegates to verifiedParticipantGate.EnsureVerifiedAsync. Its doc (LiveScopeGate.cs:48-52) states the rule (S-ADC-identity-02): success for an account with a linked ticket or a confirmed email, or with the rule switched off, otherwise the forbidden Engagement.VerifiedParticipantRequired. Only the live writes ask; reads never do, so they stay open to every signed-in account (LiveScopeGate.cs:30-32).
    • GetSessionAsync (LiveScopeGate.cs:64-77) returns a remembered answer when the memo has one (lines 66-67); otherwise it calls GetSessionLiveInfoAsync (line 69), classifies the result with ToAnswer (line 70), and either logs the outage or stores the answer in the memo (lines 71-74). GetEventAsync (LiveScopeGate.cs:83-96) is the same shape for an event.
    • IsPublishedAsync(eventId, sessionId, ...) (LiveScopeGate.cs:106-123) asks about the session when a session id is given, otherwise about the event (doc :99-100). An outage is passed on as Result.Failure<bool> with the gate's errors (lines 115, 121); any other outcome becomes Result.Success(answer.IsSuccess && answer.Value!.IsPublished) (lines 116, 122), so a refused scope reads as unpublished.
    • IsUnavailable(Result answer) (LiveScopeGate.cs:128-132) is the static test every site uses: a failure carrying an error whose code equals UnavailableCode, compared ordinally.
    • Unavailable() (LiveScopeGate.cs:136-139) builds Error.Unavailable with that code, the message "The live session could not be checked right now. Please try again.", and source nameof(LiveScopeGate).
    • ToAnswer (LiveScopeGate.cs:145-155) is the classifier, with its rule in the comment above it (:141-144): a success passes through (lines 147-148); a failure first calls cancellationToken.ThrowIfCancellationRequested() (line 150), so a lookup that failed because the caller gave up stops as a cancellation; a failure carrying any NotFound or Invariant error is Conference's answer and is kept as given (lines 152-153); anything else becomes Unavailable() (line 154).
    • FirstCode (LiveScopeGate.cs:157) picks the first error code for the log, and two source-generated warnings, LogSessionLookupFailed and LogEventLookupFailed (LiveScopeGate.cs:159-163), close the class.
  • Why it's built this way: one gate means one lookup and one outcome mapping shared by every site, and with the memo in front of it the hot paths stop paying one Conference round trip (and two Conference reads) per request (LiveScopeGate.cs:11-13). The gate is scoped and the memo a singleton because the Conference client the gate calls is scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:56-58). It is partial for its [LoggerMessage] methods.
  • Where it's used: registered as scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:60) and injected into the seven sites: CastVoteHandler (CastVoteHandler.cs:23), ToggleUpvoteHandler (ToggleUpvoteHandler.cs:21), SubmitQuestionHandler (SubmitQuestionHandler.cs:34), CreateLivePollHandler (CreateLivePollHandler.cs:22), GetOpenPollsHandler (GetOpenPollsHandler.cs:23), GetSessionQuestionsHandler (GetSessionQuestionsHandler.cs:30), and GetPollResultsHandler (GetPollResultsHandler.cs:26).

GetOrCreateMyBadgeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.GetOrCreateMyBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:19 · Level 9 · class (sealed, partial)

  • What it is: the handler behind "show me my badge". It reads the caller's AttendeeBadge, mints one if this is the first call, and returns only the badge credential as a MyBadgeDTO.
  • Depends on: IUnitOfWork, ICurrentUserService, IUniqueConstraintViolationDetector, and ILogger<GetOrCreateMyBadgeHandler>, all injected through the primary constructor (GetOrCreateMyBadgeHandler.cs:19-23). It also calls the module's ErasedUserGuard (GetOrCreateMyBadgeHandler.cs:40). It reads and writes the AttendeeBadge aggregate through an IRepository<TEntity, TIdentifierType> (narrowed to IEntityQuerier<TEntity, TIdentifierType> for the read helper), uses the framework's RequireUserId caller guard, and returns Result / Error. It implements ICommandHandler<in TCommand, TResult> closed over Result<MyBadgeDTO> (GetOrCreateMyBadgeHandler.cs:23).
  • Concept introduced, get-or-create as a command, and losing the insert race on purpose. Three design decisions carry this handler.
    • It is a command, not a query, and the class doc says why (GetOrCreateMyBadgeHandler.cs:13-18): the first call writes, because an attendee opening their badge for the first time gets a credential created on the spot, and every later call returns that same credential, so a badge printed or screenshotted yesterday still scans today. [Rubric §6, CQRS & Event-Driven] assesses whether the read/write split reflects actual effects rather than the verb in the method name; classifying a lazily-minting read as a command is that distinction taken seriously, and it puts the call on the transactional side of the decorator pipeline.
    • The read-then-insert is a race, and the race is handled rather than prevented. The unique index on AttendeeBadge.UserId (AttendeeBadgeConfiguration, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/AttendeeBadgeConfiguration.cs:31-32, with the comment at :29-30 naming this handler as the reason it exists) is the actual guarantee; the handler's pre-check is only an optimization. [Rubric §8, Data Architecture] assesses whether invariants live where they can be enforced, and one-badge-per-attendee lives in the database. [Rubric §29, Resilience & Business Continuity] shows in the recovery: the comment at the catch site (GetOrCreateMyBadgeHandler.cs:64-66) states that the promise is one stable credential per attendee, so the winner's badge is returned rather than a failure the caller would retry into.
    • Recognizing that collision is delegated, not hand-rolled. The injected IUniqueConstraintViolationDetector answers "was this save rejected for violating a unique constraint" without the Application layer naming a provider type; its own remarks (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IUniqueConstraintViolationDetector.cs:9-30) record why the question is declared in Application and answered in Infrastructure, where SqlException.Number 2601 and 2627 are reachable, and note that a miss is safe rather than silent because an unclassified exception simply propagates. [Rubric §3, Clean Architecture] assesses whether the dependency rule holds at the awkward points, and this is one of them.
    • [Rubric §11, Security] runs through the whole method: the identity comes from currentUserService.RequireUserId(...) (GetOrCreateMyBadgeHandler.cs:30), never from the (empty) GetOrCreateMyBadgeCommand, and the response carries only the credential (line 83) because, as the comment says (lines 81-82), the DTO carries nothing that identifies the attendee, so the QR code built from it stays opaque to anyone who scans it.
  • Walkthrough
    • HandleAsync (GetOrCreateMyBadgeHandler.cs:26-30) starts with the caller guard currentUserService.RequireUserId("CheckIns.Forbidden") (line 30), the shared extension that collapses the read-then-null-check-then-fail block every per-user handler used to repeat (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35-46); the module supplies only the error code, because the framework cannot know it. A failure returns its errors unchanged (GetOrCreateMyBadgeHandler.cs:31-34), which is an ErrorType.Forbidden carrying the generic "Access denied." message.
    • It unwraps the caller id (line 36), then runs ErasedUserGuard.EnsureNotErasedAsync(unitOfWork, userId, nameof(GetOrCreateMyBadgeHandler), ...) (GetOrCreateMyBadgeHandler.cs:38-42) and returns its errors unchanged on failure. The comment at lines 38-39 gives the reason (marker L207): an erased account's still-valid token must not mint a fresh badge after erasure deleted the old one, because the UserId unique index only covers active rows. [Rubric §30, Compliance/Privacy/Data Governance] assesses whether erasure holds against a token that outlives it, and this guard is where the badge path answers that. The handler then resolves the badge repository (line 44) and reads the caller's badge through the private ReadBadgeAsync helper (line 45).
    • If no badge exists (line 47), AttendeeBadge.Create(userId) runs (line 49). Its result is unwrapped with createResult.TryGetValue(out var createdBadge) (GetOrCreateMyBadgeHandler.cs:50): a failed factory result is returned as-is (line 51), otherwise createdBadge becomes the badge (line 53).
    • The insert is wrapped in try (GetOrCreateMyBadgeHandler.cs:55-61): AddAsync (line 57), SaveChangesAsync (line 58), then the information-level LogBadgeIssued (line 60).
    • The catch (Exception exception) when (uniqueConstraintViolationDetector.IsUniqueConstraintViolation(exception)) filter (line 62) is the race path: it logs LogConcurrentDuplicate at debug (line 67), re-reads the badge (line 69), and only if the re-read still finds nothing returns Error.Conflict with code CheckIns.BadgeConflict, source nameof(GetOrCreateMyBadgeHandler), and target nameof(MyBadgeDTO.Credential) (GetOrCreateMyBadgeHandler.cs:72-76).
    • The single exit returns Result.Success(new MyBadgeDTO { Credential = badge.Credential }) (line 83), so a first-call mint and a repeat call answer with the identical shape.
    • ReadBadgeAsync (GetOrCreateMyBadgeHandler.cs:86-93) is a non-async method that returns the repository's Task directly, calling FirstOrDefaultAsync(b => b.UserId == userId, asTracking: false, ...) (lines 90-93): the read is untracked because it either returns an existing badge unchanged or is followed by a fresh insert. Its parameter is typed as the read-only IEntityQuerier<TEntity, TIdentifierType> (line 87), so the helper cannot write even though the caller passes it a full repository.
    • Two source-generated log methods close the file: LogBadgeIssued at information (GetOrCreateMyBadgeHandler.cs:95-96) and LogConcurrentDuplicate at debug (GetOrCreateMyBadgeHandler.cs:98-99). [Rubric §13, Observability & Operability]: the race is logged at debug because it is expected and benign, while a genuine issuance is worth an information-level record.
  • Why it's built this way: minting on demand means no badge table has to be pre-populated for every registered user, and returning the same credential forever means a printed or screenshotted badge keeps working. Treating the unique-constraint failure as "someone else already created what I wanted" turns the only concurrency hazard into a re-read, so the endpoint stays idempotent from the caller's point of view.
  • Where it's used: dispatched from CheckInsController.GetMyBadgeAsync on GET /api/checkins/my-badge (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:64-87); registered by the convention scan in the Application-layer DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92).

BadgeRegeneration

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/BadgeRegeneration.cs:14 · Level 10 · class (internal static)

  • What it is: the one write both badge reissue commands share: replace the credential of an existing badge and save, so every earlier copy of the badge stops scanning (BadgeRegeneration.cs:9-13).
  • Depends on: IUnitOfWork, ErasedUserGuard, the AttendeeBadge aggregate read through an IRepository<TEntity, TIdentifierType>, GetMyBadgeHandler's BadgeNotIssued error factory, and Result (BadgeRegeneration.cs:1-5).
  • Concept introduced, credential rotation as revocation. A QR badge is a bearer value, so the only way to revoke a leaked copy is to make the credential it encodes stop existing. AttendeeBadge.Regenerate() replaces Credential with a fresh Guid (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:59-61, :68), after which every printout and screenshot of the old code scans as unknown (ADR-072). [Rubric §11, Security] assesses whether a compromised credential can be invalidated, and this is that path. [Rubric §30, Compliance/Privacy/Data Governance] shows in the first step: an erased account is refused (marker L207), so a token that outlives erasure cannot rotate a badge back into use. [Rubric §15, Best Practices & Code Quality]: the two handlers share this one write rather than duplicating it.
  • Walkthrough: one method, RegenerateAsync(IUnitOfWork unitOfWork, UserIdentifierType userId, string source, CancellationToken cancellationToken) (BadgeRegeneration.cs:22-46).
    • It runs ErasedUserGuard.EnsureNotErasedAsync and returns its errors on failure (BadgeRegeneration.cs:28-30).
    • It reads the badge by UserId with asTracking: true (BadgeRegeneration.cs:32-36), tracked because the entity is about to be mutated and saved.
    • No badge returns GetMyBadgeHandler.BadgeNotIssued(source) (BadgeRegeneration.cs:37-38), the NotFound error with code CheckIns.BadgeNotIssued (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetMyBadge/GetMyBadgeHandler.cs:22, :53). Reissue never mints a badge: that is GetOrCreateMyBadgeHandler's job.
    • It calls badge.Regenerate() and returns that result's errors on failure (BadgeRegeneration.cs:40-42), saves (line 44), and returns the badge carrying its new credential (line 45).
  • Why it's built this way: the doc says a user with no badge answers the same "no badge issued" not-found as the badge read (BadgeRegeneration.cs:12-13), so the reissue endpoints add no new failure vocabulary. The source parameter keeps error attribution on the calling handler. A static helper needs no DI registration and holds no state.
  • Where it's used: called by RegenerateMyBadgeHandler (RegenerateMyBadgeHandler.cs:31-32) and RegenerateAttendeeBadgeHandler (RegenerateAttendeeBadgeHandler.cs:31-32).

RegenerateAttendeeBadgeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/RegenerateAttendeeBadgeHandler.cs:15 · Level 11 · class (sealed, partial)

  • What it is: the handler behind the organizer's desk-side reissue of an attendee's badge. It rotates the credential and deliberately does NOT return it (RegenerateAttendeeBadgeHandler.cs:10-14).
  • Depends on: IUnitOfWork, ICurrentUserService, and ILogger<RegenerateAttendeeBadgeHandler> through the primary constructor; it implements ICommandHandler<in TCommand, TResult> closed over RegenerateAttendeeBadgeCommand and Result (RegenerateAttendeeBadgeHandler.cs:15-18), and delegates the write to BadgeRegeneration.
  • Concept: credential rotation is introduced at BadgeRegeneration. What is specific here is who holds the result. [Rubric §11, Security]: the doc says the organizer never holds an attendee's bearer value, and the attendee sees the new code the next time they open their badge (RegenerateAttendeeBadgeHandler.cs:12-13). [Rubric §13, Observability & Operability]: the information log names both the attendee and the organizer who reissued it (RegenerateAttendeeBadgeHandler.cs:41-42), so a privileged action on another user's credential leaves an attributable record.
  • Walkthrough: HandleAsync (RegenerateAttendeeBadgeHandler.cs:21-39) null-guards the command (line 25), resolves the organizer with currentUserService.RequireUserId("CheckIns.Forbidden") and returns its errors on failure (lines 27-29), calls BadgeRegeneration.RegenerateAsync(unitOfWork, command.UserId, nameof(RegenerateAttendeeBadgeHandler), ...) and returns its errors on failure (lines 31-35), logs LogBadgeReissued(logger, command.UserId, caller.Value) (line 37), and returns Result.Success() (line 38). The permission itself is not checked here: it rides on the command's IRequiresPermission marker and on the endpoint attribute.
  • Why it's built this way: a non-generic Result makes "no credential in the response" a property of the type rather than of a mapping someone could change; the controller answers 204 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:137). The endpoint is marked [NonIdempotent] (NonIdempotentAttribute, CheckInsController.cs:123) because every call rotates the credential, so a retry only rotates it once more and there is no body worth replaying.
  • Where it's used: injected into CheckInsController (CheckInsController.cs:48) and dispatched from RegenerateAttendeeBadgeAsync on POST /checkins/badges/{userId}/regenerate (CheckInsController.cs:121-138).

RegenerateMyBadgeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RegenerateBadge · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RegenerateBadge/RegenerateMyBadgeHandler.cs:16 · Level 11 · class (sealed, partial)

  • What it is: the handler behind self-service badge reissue. It rotates the caller's own credential and returns the new one, so the badge page can show the new code at once (RegenerateMyBadgeHandler.cs:11-15).
  • Depends on: IUnitOfWork, ICurrentUserService, and ILogger<RegenerateMyBadgeHandler> through the primary constructor; it implements ICommandHandler<in TCommand, TResult> closed over RegenerateMyBadgeCommand and Result<MyBadgeDTO> (RegenerateMyBadgeHandler.cs:16-19), answers with a MyBadgeDTO, and delegates the write to BadgeRegeneration.
  • Concept: credential rotation is introduced at BadgeRegeneration, and the caller-from-token identity at GetOrCreateMyBadgeHandler. [Rubric §11, Security]: the attendee whose screen was photographed, or whose printout was left behind, revokes the copy without asking an organizer (RegenerateMyBadgeHandler.cs:13-15), and the response carries only the credential, exactly as from the badge read (RegenerateMyBadgeHandler.cs:39-40).
  • Walkthrough: HandleAsync (RegenerateMyBadgeHandler.cs:22-41) has no null guard because the empty command is never read. It resolves the caller with currentUserService.RequireUserId("CheckIns.Forbidden") and returns its errors on failure (lines 26-28), unwraps the id (line 30), calls BadgeRegeneration.RegenerateAsync(unitOfWork, userId, nameof(RegenerateMyBadgeHandler), ...) (lines 31-33), unwraps the badge with TryGetValue or returns the errors (lines 34-35), logs LogBadgeReissued at information (line 37, declared at :43-44), and returns Result.Success(new MyBadgeDTO { Credential = badge.Credential }) (line 40).
  • Why it's built this way: returning the new credential saves the client a second round trip to the badge read. The endpoint is marked [NonIdempotent] (NonIdempotentAttribute, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:101) because a replayed response would hand back a code a later reissue already revoked, while a retried reissue is harmless: it rotates once more and answers with the current code.
  • Where it's used: injected into CheckInsController (CheckInsController.cs:47) and dispatched from RegenerateMyBadgeAsync on POST /checkins/my-badge/regenerate (CheckInsController.cs:100-115), which answers 404 CheckIns.BadgeNotIssued for a caller with no badge yet (CheckInsController.cs:98).

GetLeaderboardQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetLeaderboard · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetLeaderboard/GetLeaderboardQuery.cs:12 · Level 0 · record (sealed)

  • What it is: the read request for the public points leaderboard. It is a parameterless record: the board has no page, no filter, and no caller-chosen size.
  • Depends on: nothing. It is paired with GetLeaderboardHandler through the CQRS query contract, and the board length it implies comes from PointsSettings, not from the message.
  • Concept, the empty message as a security decision. A query with no parameters looks like an oversight until you read why it has none: the doc comment (GetLeaderboardQuery.cs:5-10) records that the board is a single fixed-size list whose length comes from configuration (Points:LeaderboardSize), so "there is no parameter through which a caller could ask for more of the board than the organizer chose to publish". [Rubric §11, Security] assesses whether inputs that widen a disclosure exist at all; the cheapest way to make a knob untamperable is not to expose it. [Rubric §9, API & Contract Design] assesses whether a contract says what it means: an empty record is an honest statement that this read has exactly one shape. [Rubric §30, Compliance/Privacy/Data Governance] is in scope because what the board publishes is attendee display names, which is why the size question is a privacy question and not just a paging one.
  • Walkthrough: public sealed record class GetLeaderboardQuery; (GetLeaderboardQuery.cs:12), a declaration with no positional parameters and no body. Callers write new GetLeaderboardQuery().
  • Why it's built this way: keeping the size in configuration rather than in the message means an operator can shorten or lengthen the published board without a deploy and without a client being able to override it; keeping the type (rather than passing no message at all) keeps the read on the same IQueryHandler<in TQuery, TResult> pipeline as every other query.
  • Where it's used: constructed by PointsController's GET /api/points/leaderboard action (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:83), whose own doc restates the fixed-length rule (PointsController.cs:67-75), and handled by GetLeaderboardHandler. The controller test asserts the action takes no parameter other than the cancellation token (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Controllers/PointsControllerTests.cs:98).

GetMyPointsQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetMyPoints · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetMyPoints/GetMyPointsQuery.cs:14 · Level 0 · record (sealed)

  • What it is: the read request for the calling attendee's own points: their running total, their leaderboard status, and one page of the ledger entries behind the total. It carries paging arguments and nothing else.
  • Depends on: nothing first-party. Paired with GetMyPointsHandler, which produces a MyPointsDTO.
  • Concept, the deliberately absent user id. The most instructive thing about this record is a parameter it does not have. The doc comment (GetMyPointsQuery.cs:6-10) states it plainly: the attendee is the caller, read from the token by the handler, because "a user id in the query would make 'whose points do I get' a client-supplied value, which is exactly the input an attendee could change to read someone else's ledger". [Rubric §11, Security] assesses whether authorization decisions depend on trusted inputs: an identity that is never accepted from the client cannot be forged by the client, which is a stronger guarantee than any check placed after it. Contrast GetUserBookmarksQuery, which does carry a UserId and therefore needs the OwnerOrAdminFilter at the API edge to compare it against the caller's claim; this query removes the need for that comparison by removing the parameter.
  • Walkthrough: public sealed record class GetMyPointsQuery(int PageNumber = 1, int PageSize = 20) (GetMyPointsQuery.cs:14). Two positional parameters, both defaulted, so new GetMyPointsQuery() is the common call. The per-parameter docs (GetMyPointsQuery.cs:12-13) record where the safety lives: page numbers below 1 are treated as page 1, and the page size is "clamped into 1 to 100 by the handler", not by the record.
  • Why it's built this way: defaults keep the ordinary call trivial, and pushing the clamping into the handler means the ceiling holds for every caller including tests and any future in-process dispatcher, not only for requests that passed through the controller's [Range] attributes (PointsController.cs:55-56).
  • Where it's used: constructed by PointsController's GET /api/points/me action from the pageNumber/pageSize query arguments (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:60); the controller test asserts the arguments arrive on the query unchanged and that no user id is passed (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Controllers/PointsControllerTests.cs:43), and a separate reflection test asserts that no action on the controller takes a user id from the caller at all (PointsControllerTests.cs:219). Handled by GetMyPointsHandler.

GetPointsOverviewQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetPointsOverview · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetPointsOverview/GetPointsOverviewQuery.cs:8 · Level 0 · record (sealed)

  • What it is: the read request for the organizer rollup of the points game: participation, payout, the per-activity breakdown, and a tail of recent activity. Its one parameter says how long that tail should be.
  • Depends on: nothing first-party. Paired with GetPointsOverviewHandler, which produces a PointsOverviewDTO.
  • Concept: the same single-purpose query record introduced under GetBookmarkedSessionIdsQuery, here with one bounded knob. [Rubric §12, Performance & Scalability] assesses whether a caller can ask for an unbounded amount of data: RecentCount looks unbounded on the record, and the doc comment (GetPointsOverviewQuery.cs:7) points at where it is not, "clamped into 1 to 100 by the handler". Note what the query cannot ask for: there is no attendee filter, because the rollup is deliberately identity-free (see GetPointsOverviewHandler).
  • Walkthrough: public sealed record class GetPointsOverviewQuery(int RecentCount = 20) (GetPointsOverviewQuery.cs:8), one defaulted positional parameter. The summary (GetPointsOverviewQuery.cs:3-6) enumerates the four figures the rollup returns.
  • Why it's built this way: one query type per organizer screen keeps the read explicit, and defaulting RecentCount means the dashboard's ordinary call carries no arguments at all.
  • Where it's used: constructed by PointsController's GET /api/points/overview action (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:131), which is the one Points endpoint behind [HasPermission(EngagementPermissions.PointsViewOverview)] (PointsController.cs:122, ADR-020); the controller tests pin the pass-through of recentCount (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Controllers/PointsControllerTests.cs:144) and the permission gate (PointsControllerTests.cs:196).

OptInRow

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetLeaderboard · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetLeaderboard/GetLeaderboardHandler.cs:85 · Level 0 · record (private sealed, nested)

  • What it is: the projection shape for one opted-in attendee inside GetLeaderboardHandler: the attendee's id and the display name they published when they joined the board.
  • Depends on: the UserIdentifierType alias; string (BCL). Nothing else, which is the point.
  • Concept, the private projection record. A projection read needs a target type, and the choice of target is a design decision. Using an anonymous type (as GetBookmarkedSessionIdsHandler does) is fine when the shape is consumed one line later; naming the shape pays off when it is threaded through several LINQ stages, because the name documents what the two columns mean. Declaring it private and nested keeps it invisible outside the handler, so it can never be mistaken for a contract: nothing about it is a promise to any caller. [Rubric §12, Performance & Scalability] assesses reading only the columns you need, which is what a projection record makes explicit at the call site. [Rubric §15, Best Practices & Code Quality]: the type sits inside the only file entitled to change it.
  • Walkthrough: private sealed record class OptInRow(UserIdentifierType UserId, string DisplayName) (GetLeaderboardHandler.cs:85), two positional members, with per-parameter docs at :83-84 naming them as the attendee who joined the board and the name they published at opt-in.
  • Why it's built this way: record gives value semantics for free and sealed plus private keeps the shape local. The DisplayName carried here is the snapshot taken at opt-in, which is why the board can be rendered with no call into Identity at all.
  • Where it's used: the select argument of the LeaderboardOptIn projection read (GetLeaderboardHandler.cs:41), then read again for the user-id list that scopes the ledger sum (:48), for the ordering (:68-69), and for the final DTO projection (:71-76). It is the only projection row in this handler: the points side is summed by the database rather than projected, see GetLeaderboardHandler.

OverviewRow

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetPointsOverview · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetPointsOverview/GetPointsOverviewHandler.cs:101 · Level 1 · record (private sealed, nested)

  • What it is: the projection shape GetPointsOverviewHandler reads the ledger into: one row per points entry, carrying the six fields every figure in the organizer rollup is computed from.
  • Depends on: the UserIdentifierType and PointsEntryIdentifierType aliases, and PointsActivityType (which is why it sits at Level 1 rather than 0); DateTime and string (BCL).
  • Concept, the internal shape that carries more than the output does. This row deliberately holds a field that never leaves the handler. Its doc says so (GetPointsOverviewHandler.cs:91-94): the attendee id "is present here so the distinct participant count can be computed, and is dropped before anything leaves the handler". [Rubric §30, Compliance/Privacy/Data Governance] assesses data minimization at the boundary rather than in the query: you cannot count distinct participants without reading who they are, so the id is read, aggregated, and then discarded when the rows are projected into the identity-free PointsEntryDTO. Keeping the wider shape private is what makes that discard structural instead of a convention someone must remember. [Rubric §3, Clean Architecture]: the internal read model is not the published contract, and here they are two different types on purpose.
  • Walkthrough: private sealed record class OverviewRow(UserIdentifierType UserId, PointsEntryIdentifierType Id, PointsActivityType ActivityType, int Points, string SubjectKey, DateTime OccurredOnUtc) (GetPointsOverviewHandler.cs:101-107), each member documented at :96-101.
  • Why it's built this way: one projected pass over the ledger feeds all four rollup figures, so the row is the union of what those figures need rather than the intersection; the narrowing to a public shape happens once, at the end.
  • Where it's used: the select argument of the single PointsEntry read (GetPointsOverviewHandler.cs:41-47), then the source for the per-activity grouping (:54-62), the recent tail (:69-80), the distinct participant count (:85), and the total payout (:86).

GetPointsOverviewHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetPointsOverview · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetPointsOverview/GetPointsOverviewHandler.cs:24 · Level 8 · class (sealed)

  • What it is: the query handler behind the organizer points dashboard. One read of the ledger produces four figures: how many attendees are playing, how many points the game has paid out, the per-activity breakdown, and the most recent awards.
  • Depends on: IUnitOfWork (primary constructor, GetPointsOverviewHandler.cs:24), the PointsEntry aggregate, its own OverviewRow projection, and the published shapes PointsOverviewDTO, PointsActivityTotalDTO, PointsEntryDTO, plus PointsActivityType. Implements IQueryHandler<in TQuery, TResult> and returns Result.
  • Concept, the in-memory fold and the reason it is not a GROUP BY. The class doc states the constraint and the trade-off (GetPointsOverviewHandler.cs:18-21): the Application layer has no EF Core reference, so a SQL GROUP BY "is not available to it", and at conference scale (about 100 attendees) one projected pass over the entries is cheaper than the round trips a per-figure query set would cost, with a materialised rollup named as the scale lever if the population ever changes that. [Rubric §3, Clean Architecture] assesses whether the inner layers stay free of infrastructure: the missing GROUP BY is a direct consequence of that rule, and the code says so rather than pretending the shape is accidental. [Rubric §12, Performance & Scalability] assesses whether the chosen shape is sized to the real workload (the observed conference-day load, not an imagined one). [Rubric §30, Compliance/Privacy/Data Governance] assesses what an operator surface exposes: the recent tail is projected into PointsEntryDTO, which carries no user id, so "an organizer sees THAT points were earned and for what, never by whom" (GetPointsOverviewHandler.cs:13-15).
  • Walkthrough
    • private const int MaxRecentCount = 100 (GetPointsOverviewHandler.cs:28) is the ceiling the handler enforces "regardless of what the caller asks for" (:28).
    • HandleAsync (GetPointsOverviewHandler.cs:31-33) null-guards the query (line 36) and clamps the tail length with Math.Clamp(query.RecentCount, 1, MaxRecentCount) (line 38), so both a zero and an int.MaxValue request land inside 1 to 100.
    • One read: GetReadRepository<PointsEntry, PointsEntryIdentifierType>() (line 40) then GetProjectedAsync selecting an OverviewRow per entry with asTracking: false (:41-50). There is no where, because the rollup is over every attendee.
    • The per-activity breakdown groups the rows by ActivityType, orders by the enum key, and sums points and counts per group into PointsActivityTotalDTO (GetPointsOverviewHandler.cs:51-62).
    • The recent tail orders newest-first with the entry id as the tie-break, takes recentCount, and projects into PointsEntryDTO (:67-81). The comment (:65-66) explains the tie-break: entries stamped in the same instant keep a stable order "rather than shuffling between refreshes of the organizer dashboard".
    • The result assembles ParticipantCount from rows.Select(row => row.UserId).Distinct().Count() (line 85) and TotalPointsAwarded from rows.Sum(row => row.Points) (line 86), then returns Result.Success(...) over the PointsOverviewDTO (:83-89).
  • Why it's built this way: the participant count is the only figure that needs attendee identity, and it needs it only as a cardinality, so reading the id into a private row and never projecting it outward gives the organizer the number without the names. Doing all four aggregations over one materialized list keeps the database round trips at one regardless of how many figures the dashboard grows.
  • Where it's used: resolved by PointsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:41) and invoked from the permission-gated overview endpoint (PointsController.cs:130-132). Its behavior is pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Points/UseCases/GetPointsOverviewHandlerTests.cs, including the distinct-attendee count (:17), the empty-ledger zeros (:35), the per-activity rollup (:65), the recent tie-break (:116), and the tail clamp theory (:135).

GetMyPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetMyPoints · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetMyPoints/GetMyPointsHandler.cs:27 · Level 9 · class (sealed)

  • What it is: the query handler for GetMyPointsQuery. It reads the calling attendee's own ledger, sums it into a running total, reports whether they are on the leaderboard, and returns one page of entries.
  • Depends on: IUnitOfWork and ICurrentUserService (primary constructor, GetMyPointsHandler.cs:27-29), the PointsEntry and LeaderboardOptIn aggregates, PagingMath and the PageWindow it returns, and the MyPointsDTO / PointsEntryDTO shapes. Returns a Result and can produce an Error. Externals: none beyond the BCL.
  • Concept, scoping a read to the token instead of to a parameter. The class doc states the guarantee in its first sentence (GetMyPointsHandler.cs:13-15): the read is always scoped to the token's user id, "nothing in the query can widen it, so there is no parameter an attendee could tamper with to read another attendee's ledger". [Rubric §11, Security] assesses whether authorization is enforced where the data is fetched rather than only at the edge; here the filter predicate itself is built from the caller identity (:64), so even a mis-configured route cannot widen the result set. [Rubric §8, Data Architecture] assesses whether derived values are stored or computed: the doc (:17-22) explains that the total is summed on read rather than maintained on a user row, because "a materialised total can drift from its ledger, and a summed one cannot", with the materialised total named as the first scale lever if the population grows. [Rubric §12, Performance & Scalability] is the counterweight the same paragraph acknowledges: at about 100 attendees with a few dozen entries each, the sum is a trivial read.
  • Walkthrough
    • private const int MaxPageSize = 100 (GetMyPointsHandler.cs:32), the ceiling the handler enforces whatever the caller asks for (:31).
    • HandleAsync (GetMyPointsHandler.cs:35-37) null-guards the query (line 39), then resolves the caller with the shared guard currentUserService.RequireUserId("Points.Forbidden") (line 41). That extension member lives in MMCA.Common (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35) and collapses the read-then-null-check-then-fail block every per-user handler repeats: it returns Result.Success(userId) when the token carries a user, and otherwise one Error built from the module's code, the default message "Access denied.", and ErrorType.Forbidden (CurrentUserServiceExtensions.cs:43-45). The module supplies only the code, because the code names the module and the framework cannot know it (CurrentUserServiceExtensions.cs:21-24).
    • A failure short-circuits: return Result.Failure<MyPointsDTO>(caller.Errors) (GetMyPointsHandler.cs:42-45), which the controller renders as a 403 Problem Details response (PointsController.cs:53). On success the identifier is unwrapped (line 47).
    • Paging is clamped, not trusted: PagingMath.Clamp(query.PageNumber, query.PageSize, MaxPageSize) returns a PageWindow held in a local window (GetMyPointsHandler.cs:52; the signature is MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/PagingMath.cs:33), a readonly record struct carrying PageNumber, PageSize, Skip, and Take (MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/PageWindow.cs:23). The handler reads only window.Skip and window.Take. The comment (GetMyPointsHandler.cs:49-51) records exactly what the helper buys: it floors a non-positive page number or size and range-checks the offset in 64-bit, so a hostile page number near int.MaxValue "yields the empty page it holds instead of a negative skip" (the helper itself returns a window with Skip: 0, Take: 0 in that case, PagingMath.cs:44).
    • The ledger read projects straight into PointsEntryDTO with where: entry => entry.UserId == userId and asTracking: false (GetMyPointsHandler.cs:55-66).
    • A second read pulls the caller's leaderboard display names (GetMyPointsHandler.cs:70-75) and takes the first (:77). The comment (:68-69) notes that this read relies on the default query filter, so an opt-in the attendee soft-deleted by leaving the board correctly reports them as not on the leaderboard.
    • The page is ordered newest-first with the entry id as the tie-break, then skipped by window.Skip and taken by window.Take in memory (GetMyPointsHandler.cs:81-88); the comment (:79-80) gives the concrete reason (one badge scan fanning out into awards stamped in the same instant).
    • The result (GetMyPointsHandler.cs:90-98) sets Total from entries.Sum(...) over every entry rather than the page (the inline comment at :92-93 makes that explicit), IsOnLeaderboard from whether a display name was found, LeaderboardDisplayName, and Entries.
  • Why it's built this way: reading the caller from ICurrentUserService rather than from the message is what lets the endpoint skip an ownership filter entirely; routing that read through the shared RequireUserId guard keeps every module's denied-caller failure the same shape while leaving the error code module-specific; and clamping through the shared PagingMath rather than a local Math.Min keeps the arithmetic (including the 64-bit offset check) in one tested place used by every paged read in the codebase.
  • Where it's used: resolved by PointsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:38) and invoked from GET /api/points/me (PointsController.cs:59-61). Its paging and total semantics are pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Points/UseCases/GetMyPointsHandlerTests.cs: the total sums every entry even when one page is returned (:23), the page walk neither repeats nor drops (:76), hostile paging arguments clamp instead of throwing (:102), a page number beyond the ledger returns the empty page that page holds (:120), no current user returns forbidden (:141), and the read never returns another attendee's entries (:153).
  • Caveats / not-in-source: the ordering, skip, and take happen after materialization, so the read pulls all of the caller's entries and pages them in memory. That is the intended trade for a per-attendee ledger at conference scale (the class doc's scale note, GetMyPointsHandler.cs:16-23), not an oversight, but it is a different shape from the server-side paging in GetUserBookmarksHandler.

GetLeaderboardHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.GetLeaderboard · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetLeaderboard/GetLeaderboardHandler.cs:28 · Level 10 · class (sealed)

  • What it is: the query handler that builds the public leaderboard: the opted-in attendees with the highest points totals, ranked, truncated to the configured board length.
  • Depends on: IUnitOfWork and IOptions<PointsSettings> (primary constructor, GetLeaderboardHandler.cs:28-30), the LeaderboardOptIn and PointsEntry aggregates, its private projection OptInRow, and the published LeaderboardEntryDTO. Implements IQueryHandler<in TQuery, TResult>, returns Result. Externals: Microsoft.Extensions.Options (:1), StringComparer.Ordinal (BCL).
  • Concept, publishing a name only if its owner published it. The class doc (GetLeaderboardHandler.cs:13-16) is the design statement worth reading twice: only attendees who opted in appear, the name shown is "the snapshot they published at opt-in", and the handler "makes no call into Identity and reads no user record", so an attendee who never opted in is absent rather than present under a name they did not choose. [Rubric §30, Compliance/Privacy/Data Governance] assesses consent as a structural property rather than a checkbox: the board is built from the opt-in table outward, so non-participation is the default and cannot be undone by a bug in a filter. [Rubric §11, Security] assesses minimizing what a public surface can reveal: no Identity call means no user record is even in reach of this code path. A second design note (:19-23) covers ranking: ties keep distinct sequential ranks (1, 2, 3) rather than competition ranking (1, 1, 3), because the board is a fixed-length list of positions, and the tie-break is the published name compared ordinally so the order is "deterministic and repeatable across reads rather than dependent on whatever order the database returned". [Rubric §15, Best Practices & Code Quality] shows in that ordinal comparison: a culture-sensitive comparison would make the rendered order depend on the server's locale.
  • Concept, pushing the aggregate into the database with SumByAsync. The points side of this read is not folded in memory. SumByAsync (declared on the querier contract at MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IRepository.cs:186, which IReadRepository<TEntity, TIdentifierType> composes at IRepository.cs:332-333) is the persistence-neutral way to ask for a GROUP BY with SUM, so only one aggregate row per attendee crosses the wire instead of every ledger row. Its EF implementation groups with an element selector (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Repositories/EFReadRepository.cs:170-177) so the caller's expression tree reaches the provider intact. [Rubric §3, Clean Architecture] is what makes this member necessary at all: the Application layer references no EF Core, so a handler that wants a grouped aggregate has no IQueryable of its own to group (IRepository.cs:158-163). [Rubric §12, Performance & Scalability]: the contract returns decimal, so an int points column widens on the way in and narrows on the way out (GetLeaderboardHandler.cs:52-53, :61), which the code comment notes no ledger total can overflow.
  • Walkthrough
    • HandleAsync (GetLeaderboardHandler.cs:33-35) reads the opt-ins first: a read repository for LeaderboardOptIn (line 39), then GetProjectedAsync into OptInRow with asTracking: false (:40-43). The comment above it (:37-38) records why there is no "is active" predicate: the default query filter excludes soft-deleted rows, so leaving the board removes the attendee from this read for free.
    • An empty opt-in list short-circuits to an empty successful board (GetLeaderboardHandler.cs:45-46), so a conference where nobody opted in costs one query rather than two.
    • The user ids are collected (line 48) and used to scope the ledger aggregate: a read repository for PointsEntry (line 54) then SumByAsync(entry => entry.UserId, entry => entry.Points, where: entry => userIds.Contains(entry.UserId), ...) (:55-59). The comment (:50-53) states both halves of the reasoning: only the opted-in attendees' entries are summed, and the sum happens in the database, so "one grouped SUM comes back per attendee rather than every ledger row for the fold to add up".
    • The decimal sums are narrowed into an int totals dictionary (GetLeaderboardHandler.cs:61).
    • var boardSize = Math.Max(settings.Value.LeaderboardSize, 0) (line 63) floors a misconfigured negative size at zero, so a bad configuration value publishes nothing instead of throwing inside Take. The setting itself defaults to 10 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSettings.cs:41).
    • The board is composed with a collection expression (GetLeaderboardHandler.cs:65-77): order by total descending using totals.GetValueOrDefault(...) (line 68, so an opted-in attendee with no entries scores zero rather than being dropped), then by DisplayName with StringComparer.Ordinal (line 69), Take(boardSize) (line 70), and project each into a LeaderboardEntryDTO whose Rank is the positional index + 1 (:71-76).
    • return Result.Success(board) (line 79).
  • Why it's built this way: one narrow projected read for the opt-ins plus one grouped database aggregate for the totals keeps the round trips at two and keeps the ledger itself on the server; the opt-in table (not the ledger) drives the outer loop, which is what makes the consent rule structural. Reading the length from PointsSettings rather than from GetLeaderboardQuery is what keeps the published board size an organizer decision.
  • Where it's used: resolved by PointsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:39) and invoked from the parameterless GET /api/points/leaderboard endpoint (PointsController.cs:82-84). Its rules are pinned test by test in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Points/UseCases/GetLeaderboardHandlerTests.cs: a points-holder who never opted in is excluded (:18), an attendee who left the board is excluded (:33), nobody opted in yields an empty board (:47), ranks start at one in total order (:59), ties break on the ordinal published name (:78), an opted-in attendee with no points sits at zero (:94), the configured size truncates (:108), a zero or negative board size publishes nothing (:121, :135), and the name served is the one snapshotted at opt-in (:150).
  • Caveats / not-in-source: the aggregate is scoped with userIds.Contains(...) over a list built in memory, so the number of parameters in the translated SQL grows with the opted-in population. That is bounded by the conference-scale assumption stated in the class doc rather than by anything in this file. The final ordering, truncation, and ranking still happen in memory over one row per opted-in attendee.

GetMyTicketsQuery, GetTicketRosterImportQuery, GetTicketRosterSummaryQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.* · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetMyTickets/GetMyTicketsQuery.cs:10 · Level 0 · record (x3)

  • What it is: the three read-side query records of the ticket roster slice: "my tickets" for an attendee, the latest roster import run of an event, and an event's roster adoption funnel. Each is a sealed record class with no behavior.
Type File:Line Notes (what differs)
GetMyTicketsQuery MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetMyTickets/GetMyTicketsQuery.cs:10 parameterless (UC-51). The doc comment (GetMyTicketsQuery.cs:3-9) records that it deliberately carries no user id: the handler reads the caller from the token, so no parameter could widen the read to another attendee
GetTicketRosterImportQuery MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterImport/GetTicketRosterImportQuery.cs:8 one positional EventId (UC-48): the status the upload component polls while a run is active and reads on load to resume progress (GetTicketRosterImportQuery.cs:3-7)
GetTicketRosterSummaryQuery MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterSummary/GetTicketRosterSummaryQuery.cs:5 one positional EventId (UC-52), the event whose roster to summarize
  • Depends on: the EventIdentifierType alias (identifier type aliases are taught in the primer); nothing else first-party.
  • Concept: the CQRS query object, introduced with IQueryHandler<in TQuery, TResult>. [Rubric §11, Security] (assesses whether authorization is enforced by construction rather than by convention): GetMyTicketsQuery makes the "own tickets only" rule structural, because the only input that could name a user does not exist on the query.
  • Walkthrough: positional records, so equality and immutability come from the record; there are no members beyond the primary-constructor properties.
  • Where it's used: TicketsController builds new GetMyTicketsQuery() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:163) and new GetTicketRosterSummaryQuery(eventId) (TicketsController.cs:183); TicketRosterImportController builds new GetTicketRosterImportQuery(eventId) (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:134). Handled by GetMyTicketsHandler, GetTicketRosterImportHandler and GetTicketRosterSummaryHandler.

PendingTicket

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/PendingTicketInvitationService.cs:106 · Level 0 · class (private nested)

  • What it is: a private projection shape nested inside PendingTicketInvitationService that carries just the ticket fields the "which ticket announces" choice reads.
  • Depends on: the TicketIdentifierType and EventIdentifierType aliases; DateTimeOffset.
  • Concept: a query-local projection type. Its doc comment states the intent: "the barcode and the order never leave the query" (PendingTicketInvitationService.cs:105). [Rubric §30, Compliance/Privacy/Data Governance] (assesses data minimization in how personal data is read and moved): projecting into this shape keeps the barcode and order email out of memory once the filter has run.
  • Walkthrough: five required init properties: Id (PendingTicketInvitationService.cs:108), EventId (line 110), InvitedOn (line 112, non-nullable because the query filters on InvitedOn != null and projects InvitedOn!.Value at lines 53 and 60), FirstName (line 114) and LastName (line 116).
  • Where it's used: only inside its enclosing service, as the projection target (PendingTicketInvitationService.cs:49-56) and the input of ChooseAnnouncer (line 84).

TicketRosterCounts

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRosterCounts.cs:7 · Level 0 · class

  • What it is: an internal sealed mutable tally of the four per-row outcomes of one roster upload; every ticket of the file lands in exactly one, and the tally is accumulated across the batches of an import run (TicketRosterCounts.cs:3-6).
  • Depends on: nothing first-party.
  • Walkthrough: four int get/set properties: Added (TicketRosterCounts.cs:10, new to the roster), Updated (line 13, live tickets whose fields changed), Unchanged (line 16, identical rows, erased holders included) and Reinstated (line 19, voided tickets the file brought back).
  • Why it's built this way: a mutable accumulator passed by reference lets TicketRosterApplier count across several ApplyAsync calls (one per batch) without returning and merging partial tallies. Voided tickets are not counted here: VoidMissing returns its own count (TicketRosterApplier.cs:141).
  • Where it's used: incremented by TicketRosterApplier.ApplyToExisting and AddNewAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRosterApplier.cs:161-166,184,197), created by ImportTicketRosterHandler and ProcessTicketRosterImportHandler.

TicketRoster

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRoster.cs:11 · Level 1 · record

  • What it is: a parsed roster file (BR-268): the one source event name the file carried plus its ticket rows, already reduced to the whitelisted fields (TicketRoster.cs:5-8).
  • Depends on: TicketRosterEntry (the row type, from MMCA.ADC.Engagement.Domain.Tickets, TicketRoster.cs:1).
  • Walkthrough: positional SourceEventName (the ticketing platform's event name, exactly one per file, TicketRoster.cs:9) and Entries (IReadOnlyList<TicketRosterEntry>, in file order; ticket IDs and barcodes are unique within the file, TicketRoster.cs:10).
  • Why it's built this way: the uniqueness of ticket IDs and barcodes is a guarantee the parser establishes, and downstream code relies on it: TicketRosterApplier.ParkSwappedBarcodes builds a ToDictionary keyed on barcode that would throw on a duplicate (TicketRosterApplier.cs:117-118).
  • Where it's used: produced by ITicketRosterParser (implemented by TicketLeapRosterParser), staged by TicketRosterStaging, and applied by TicketRosterApplier.
  • Caveats / not-in-source: the Engagement UI also has a Blazor page named TicketRoster (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketRoster.razor.cs); the two share the #ticketroster anchor in _typemap.tsv, which points at the Level 10 page row.

TicketRosterStaging

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRosterStaging.cs:11 · Level 2 · class (static)

  • What it is: the JSON round-trip of a parsed TicketRoster staged on an active TicketImportRun, holding only the whitelisted fields and only until the run ends (TicketRosterStaging.cs:6-10).
  • Depends on: TicketRoster; System.Text.Json.
  • Walkthrough: one static readonly JsonSerializerOptions built from JsonSerializerDefaults.Web (TicketRosterStaging.cs:13). Serialize (line 18) is a one-liner. Deserialize (line 23) returns null for a null or whitespace input (lines 25-26, the staged column is purged when the run ends) and swallows a JsonException into null (lines 32-35), so an unreadable stage is "nothing usable" rather than a crash.
  • Why it's built this way: [Rubric §30, Compliance/Privacy/Data Governance] (assesses whether personal data is kept no longer and no wider than needed): the stage never holds more of the uploaded file than a Ticket keeps, because the parser has already discarded every other column.
  • Where it's used: StartTicketRosterImportHandler serializes into TicketImportRun.Create (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportHandler.cs:69); ProcessTicketRosterImportHandler reads it back (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportHandler.cs:92).

ITicketRosterParser

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/ITicketRosterParser.cs:10 · Level 3 · interface

  • What it is: the port that reads an organizer's roster export into whitelisted ticket rows (BR-268). Declared in Application and implemented in Infrastructure next to the ticketing platform whose export format it knows, so the import use case never sees a column name (ITicketRosterParser.cs:5-9).
  • Depends on: Result (as Result<TicketRoster>), TicketRoster; ReadOnlyMemory<byte>.
  • Concept: a Clean Architecture port. [Rubric §3, Clean Architecture] (assesses whether dependencies point inward and infrastructure details sit behind abstractions): the file format is an infrastructure concern, so Application owns only the contract.
  • Walkthrough: one member, ParseAsync(ReadOnlyMemory<byte> content, CancellationToken) (ITicketRosterParser.cs:19). Its contract (lines 12-18): every column outside the whitelist is discarded on read, the file must carry exactly one source event name, the bytes are already bounded by the caller, and a bad file answers a validation failure rather than throwing.
  • Where it's used: registered as TryAddSingleton<ITicketRosterParser, TicketLeapRosterParser>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:31); injected into ImportTicketRosterHandler (.../ImportTicketRoster/ImportTicketRosterHandler.cs:21) and StartTicketRosterImportHandler (StartTicketRosterImportHandler.cs:30).

TicketRosterApplier

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRosterApplier.cs:23 · Level 7 · class

  • What it is: the upsert rules of one roster upload over an event's tickets (BR-268), shared by the synchronous import (the dry run) and the batched import run so both apply the same rules: upsert on (EventId, ExternalTicketId), reinstate a voided ticket that comes back, void what the same source event's file no longer contains, and never recreate an erased holder (TicketRosterApplier.cs:7-11).
  • Depends on: Ticket, TicketRoster, TicketRosterEntry, TicketRosterCounts, IRepository<TEntity, TIdentifierType>, Result, Error.
  • Concept: an application-layer domain service built once per upload. [Rubric §4, DDD] (assesses whether business rules live in the domain model): the per-ticket transitions stay on the aggregate (Ticket.ApplyRosterEntry, Reinstate, Void, ParkBarcodeForImport, Ticket.Create), while this class owns only the set-level rules that need every row of the event at once.
  • Walkthrough:
    • KeyComparer (TicketRosterApplier.cs:25) is a static readonly StringComparer.OrdinalIgnoreCase; every ticket-ID and barcode key in the class (the dictionary, both hash sets, the file's ticket-ID set built by InFile at lines 152-153, and the swap test) compares through it.
    • Fields _byExternalId (TicketRosterApplier.cs:27) and _erasedTombstones (line 28).
    • Constructor (line 32) takes every row of the event, soft-deleted included. Existing is the non-deleted rows (line 36, exposed at line 47); _byExternalId indexes them case-insensitively by ticket ID (line 37); _erasedTombstones collects the ticket IDs of rows that are both deleted and anonymized (lines 40-43), because Ticket.Anonymize kept the upsert key.
    • FindBarcodeConflict (line 56): a barcode in the file held by an existing ticket that is not in the file would trip the (EventId, Barcode) unique index at save time, so it answers an Error.Conflict with code Ticket.Roster.BarcodeConflict naming the ticket and barcode (lines 69-73), or null. The held-outside barcode set uses KeyComparer (line 64), so a barcode differing only in case is a conflict too.
    • ApplyAsync (line 85) walks the entries (line 98): a known ticket ID goes to ApplyToExisting, otherwise AddNewAsync; the first failure short-circuits (lines 103-104). addNew = false is the dry run: rows are created and counted but never added to the repository (lines 192-193).
    • ParkSwappedBarcodes (line 120): for tickets in the file whose current barcode the file hands to a different ticket (a swap or a longer chain), it parks the barcode via ParkBarcodeForImport and returns how many were parked (lines 125-132), so batches can apply barcodes in any order without the unique index seeing one twice. Idempotent on resume.
    • VoidMissing (line 141) voids live tickets of the same SourceEventName (compared ordinally, line 147) that the file does not contain (lines 146-149); other source events of the same ADC event are left alone.
    • ApplyToExisting (line 155): applies the row, then counts Reinstated when Reinstate() returns true, else Updated or Unchanged by the changed flag (lines 161-166).
    • AddNewAsync (line 171): an erased tombstone counts as Unchanged and writes nothing (lines 182-186); otherwise Ticket.Create (line 188), optional AddAsync (lines 192-193), then the new ticket is tracked in _byExternalId so a later batch that repeats the ID upserts it (line 196), and Added is incremented (line 197).
  • Why it's built this way: one class for both paths guarantees the dry run and the real run cannot disagree. The tombstone rule is the erasure guarantee of ADR-005: a re-upload never writes an erased holder's name, address or a pending invite back (TicketRosterApplier.cs:12-16). [Rubric §30, Compliance/Privacy/Data Governance] applies for the same reason. Keys compare case-insensitively because the (EventId, ExternalTicketId) and (EventId, Barcode) unique indexes sit on a case-insensitive database collation: matching that here refuses a case-only clash by name instead of tripping an index at save time (TicketRosterApplier.cs:17-21).
  • Where it's used: ImportTicketRosterHandler (.../ImportTicketRoster/ImportTicketRosterHandler.cs:48), ProcessTicketRosterImportHandler (ProcessTicketRosterImportHandler.cs:105), and StartTicketRosterImportHandler for the barcode-conflict check only (StartTicketRosterImportHandler.cs:60).

GetTicketRosterImportHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterImport/GetTicketRosterImportHandler.cs:14 · Level 8 · class

  • What it is: returns an event's latest roster import run (UC-48) from the database, so every replica answers the same progress; a projection that never reads the staged roster (GetTicketRosterImportHandler.cs:9-13).
  • Depends on: IQueryHandler<in TQuery, TResult>, IUnitOfWork, IEntityQuerier<TEntity, TIdentifierType>, TicketImportRun, TicketRosterImportRunDTO, TicketRosterImportErrorCodes, GetTicketRosterImportQuery.
  • Walkthrough: NoRunCode re-exports TicketRosterImportErrorCodes.NoRun (line 18). HandleAsync (line 21) gets the read repository (line 28) and projects every run of the event into TicketRosterImportRunDTO (status, total, processed, the five outcome counts, LinkedExistingAccounts, ErrorCode; lines 29-46), then picks the highest RunId in memory with MaxBy (line 48). No run answers Error.NotFoundError(NoRunCode, ...) (line 50).
  • Why it's built this way: reading progress from the database rather than from process memory is the multi-replica answer; the upload component reads NotFound as "nothing to resume" (GetTicketRosterImportHandler.cs:11-12). [Rubric §12, Performance & Scalability] (assesses whether reads stay cheap at scale): the projection keeps the large staged JSON column off the wire.
  • Where it's used: injected into TicketRosterImportController (TicketRosterImportController.cs:39).
  • Caveats / not-in-source: the projection loads every run of the event and picks the latest in memory; how many runs an event accumulates is not determinable from source.

GetTicketRosterSummaryHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetRosterSummary · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterSummary/GetTicketRosterSummaryHandler.cs:15 · Level 8 · class

  • What it is: returns one event's roster adoption funnel (UC-52): Live tickets, invited, linked, voided, and how many distinct order emails an invite run would email now (GetTicketRosterSummaryHandler.cs:9-14).
  • Depends on: IQueryHandler<in TQuery, TResult>, IUnitOfWork, IEntityQuerier<TEntity, TIdentifierType>, Ticket, TicketStatus, TicketRosterSummaryDTO.
  • Walkthrough: four CountAsync calls (lines 28, 31, 34, 37): Live; Live with InvitedOn != null; Live with LinkedUserId != null; Voided. CountPendingInvitesAsync (line 55) projects only OrderEmail for Live, unlinked, never-invited tickets with an email (lines 61-66) and de-duplicates ordinally in memory (line 69). The DTO is assembled at lines 42-50.
  • Why it's built this way: the counts run as SQL COUNTs and only the pending email strings cross the wire (GetTicketRosterSummaryHandler.cs:12-13). The pending filter mirrors the send-invites eligibility "before the per-run cap" (lines 53-54), so the number shown is the number a run would pick up. [Rubric §12, Performance & Scalability] applies.
  • Where it's used: injected into TicketsController (TicketsController.cs:48).

PendingTicketInvitationService

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/PendingTicketInvitationService.cs:35 · Level 8 · class

  • What it is: the Engagement implementation of the cross-module IPendingTicketInvitationService contract (BR-271): it answers the invitation that still stands for an address, so Identity can re-issue one whose link expired before the invitee had an account (PendingTicketInvitationService.cs:11-13).
  • Depends on: IUnitOfWork, IEntityQuerier<TEntity, TIdentifierType>, IEventLiveValidationService (Conference's event name and first day), Ticket, PendingTicket, PendingTicketInvitationDTO; ILogger<T>.
  • Walkthrough: GetPendingInvitationAsync (line 41) normalizes the email via Ticket.NormalizeEmail and returns null for an unusable one (lines 43-45). It projects into PendingTicket the Live, unlinked, invited tickets whose OrderEmail matches (lines 48-61). ChooseAnnouncer (line 84) picks the most recently invited event (ties by highest ticket id, lines 86-90), then within it the earliest ticket that names both attendee names (lines 92-96). Event details come from GetEventLiveInfoAsync (line 68); a failure, blank name or default start date logs a warning and answers null (lines 69-73). The DTO uses Ticket.FallbackFirstName/FallbackLastName for a blank name (lines 75-79, NameOrFallback at line 99).
  • Why it's built this way: the remarks (PendingTicketInvitationService.cs:15-31) explain each choice: voided, claimed or linked tickets hold no invitation; the announcer rule matches SendTicketInvitesHandler so the re-issue reads like the original; nothing is answered when the event cannot be named, so the caller sends nothing rather than an invitation without its event; and the answer never carries the ticket id, barcode or order. [Rubric §7, Microservices Readiness] (assesses whether modules talk through contracts that survive extraction): Identity depends only on the Shared contract. [Rubric §13, Observability & Operability]: the warning uses a source-generated [LoggerMessage] (line 102) and logs the event id, never the address (line 34).
  • Where it's used: registered TryAddScoped<IPendingTicketInvitationService, PendingTicketInvitationService>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:47); there is no disabled stub, since EngagementModule registers only AddEngagementModule() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/EngagementModule.cs:24-25), and a host without Engagement resolves the interface through TicketInvitationServiceGrpcAdapter instead (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:105). Exposed across the process boundary by TicketInvitationGrpcService.

TicketImportRunGuard

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketImportRunGuard.cs:14 · Level 8 · class (static)

  • What it is: refuses a roster write while the event's import run is still queued or running (UC-48): a second commit, a "Delete roster" and an invite run all answer the same conflict (TicketImportRunGuard.cs:8-13).
  • Depends on: IUnitOfWork, TicketImportRun, TicketRosterImportStatus, TicketRosterImportErrorCodes, Error.
  • Walkthrough: AlreadyRunning(source) (line 19) builds the Error.Conflict with code TicketRosterImportErrorCodes.AlreadyRunning and target "EventId" (lines 20-24). RefuseWhileImportingAsync (line 32) runs one ExistsAsync for a run of the event in Queued or Running (lines 38-41) and returns the conflict or null (line 43).
  • Why it's built this way: the doc comment names the hazards: a delete would race a run still upserting, an invite run would read a roster still being written. The refusal is bounded because a stalled run is ended by its expiry backstop (TicketImportRunGuard.cs:11-12, see ExpireTicketRosterImportHandler). [Rubric §29, Resilience & Business Continuity] (assesses whether concurrent and failed operations leave consistent state) applies.
  • Where it's used: DeleteTicketRosterHandler (.../DeleteRoster/DeleteTicketRosterHandler.cs:30), SendTicketInvitesHandler (.../SendTicketInvites/SendTicketInvitesHandler.cs:48), and StartTicketRosterImportHandler (StartTicketRosterImportHandler.cs:104, AlreadyRunning directly).

GetMyTicketsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetMyTickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetMyTickets/GetMyTicketsHandler.cs:18 · Level 9 · class

  • What it is: returns the tickets linked to the caller (UC-51), voided ones included so an attendee can see a ticket a later roster dropped; the read is always scoped to the token's user id (GetMyTicketsHandler.cs:12-15).
  • Depends on: IQueryHandler<in TQuery, TResult>, IUnitOfWork, ICurrentUserService, MyTicketProjection, MyTicketDTO, GetMyTicketsQuery.
  • Walkthrough: HandleAsync calls RequireUserId("Ticket.Forbidden") and returns its failure unchanged (lines 29-31); projects with MyTicketProjection.Selector filtered on LinkedUserId == userId (lines 35-38); orders by EventId then TicketId into an IReadOnlyList (lines 40-43).
  • Why it's built this way: [Rubric §11, Security]: pairing a parameterless query with a token-derived filter means there is no input an attacker could change to read another attendee's tickets.
  • Where it's used: TicketsController (TicketsController.cs:47,163).

TicketLinker

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketLinker.cs:32 · Level 9 · class (static)

  • What it is: the one place the BR-272 linking rules live. Per event, among the Live tickets carrying an address: link every unlinked ticket whose attendee name matches the account; otherwise link the address's only ticket for that event; otherwise link nothing and wait for a barcode claim (BR-273) (TicketLinker.cs:8-17).
  • Depends on: IUnitOfWork, ErasedUserGuard, Ticket, TicketStatus, TicketLinkMethod; TimeProvider.
  • Walkthrough:
    • LinkVerifiedEmailAsync (line 43): normalizes the address and returns 0 for an unusable email or a default user id (lines 52-54); returns 0 for an erased account via ErasedUserGuard.EnsureNotErasedAsync (lines 56-58); loads the address's Live tickets with tracking (lines 61-65); groups by EventId and calls LinkOrderTickets per event (lines 69-72); saves only when something was linked (lines 74-77).
    • LinkOrderTickets (line 94): the shared, non-saving core. It links each selected ticket that is still unlinked through Ticket.LinkTo(userId, TicketLinkMethod.VerifiedEmail, linkedOn) (lines 104-108).
    • SelectTicketsToLink (line 114): unlinked name matches via AttendeeNameMatches (lines 119-122); if none, the single ticket when the event has exactly one, else empty (line 127).
  • Why it's built this way: the rule runs per event because an address can hold tickets for several ADC events, and every name match is linked because one person often holds two tickets of the same event under the same name (TicketLinker.cs:18-22). It is idempotent because both triggering integration events can announce the same proof under at-least-once delivery, and a ticket linked to another account is never taken over (lines 24-28). Refusing an erased account (L207) follows ADR-005. Making LinkOrderTickets the shared core means the per-account and event-wide paths can never disagree on which ticket an account receives (lines 82-86). [Rubric §10, Messaging & Integration] (assesses idempotent consumers under at-least-once delivery) applies.
  • Where it's used: UserEmailVerifiedTicketLinkHandler (.../IntegrationEventHandlers/UserEmailVerifiedTicketLinkHandler.cs:33), UserRegisteredTicketLinkHandler (.../IntegrationEventHandlers/UserRegisteredTicketLinkHandler.cs:39), and ExistingAccountLinker (ExistingAccountLinker.cs:90).

ExistingAccountLinker

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/ExistingAccountLinker.cs:29 · Level 10 · class (static partial)

  • What it is: links one event's roster tickets to accounts that already hold a confirmed address (BR-277). Event-driven linking only fires when an account proves an address, so a roster uploaded after its holders registered would otherwise link almost nothing (ExistingAccountLinker.cs:11-15).
  • Depends on: TicketLinker, ErasedUserGuard, IVerifiedUserLookupService, VerifiedUserDTO, TicketAccountLinkResultDTO, IUnitOfWork, Ticket, Result, Error; TimeProvider, ILogger.
  • Walkthrough:
    • LookupUnavailableCode = "Ticket.LinkExisting.LookupUnavailable" (line 32).
    • LinkEventAsync (line 42) loads the event's Live tickets with an order email, tracked (lines 50-56). It drops anonymized tickets and groups by order email, keeping only orders with at least one unlinked ticket but keeping all of that order's tickets, because "the only ticket of the address" counts every one (lines 58-66). An empty set answers zero counts (lines 68-69).
    • LookUpAccountsAsync (line 104) calls Identity in chunks of IVerifiedUserLookupService.MaxEmailsPerCall (line 114; the constant is 500 at MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Shared/Users/IVerifiedUserLookupService.cs:22), keying results by normalized email (line 119). Any non-cancellation exception rethrows a pending cancellation (line 126), logs, and answers an Error.Unavailable (an ErrorType.Unavailable error, MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/Error.cs:125) with LookupUnavailableCode (lines 128-133): all or nothing, classified as a transient dependency outage rather than a generic failure.
    • Back in LinkEventAsync, erased user ids are fetched in one call (lines 75-78). Per order: no account or an erased one adds the unlinked tickets to noAccount (lines 84-88); otherwise TicketLinker.LinkOrderTickets links and the remaining unlinked tickets count as leftForBarcode (lines 90-91). Saves only when something was linked (lines 94-97) and returns Linked/LeftForBarcode/NoAccount via Counts (line 139).
  • Why it's built this way: reusing TicketLinker.LinkOrderTickets applies exactly the BR-272 rules (ExistingAccountLinker.cs:17-22). The all-or-nothing lookup means an organizer never reads a partial link as the whole roster's answer (lines 24-27). The guarded broad catch keeps caller cancellation from turning into an upstream-outage answer (line 125). [Rubric §29, Resilience & Business Continuity] (assesses graceful handling of a dependency outage) and [Rubric §7, Microservices Readiness] (Identity reached only through its Shared contract) apply; erased accounts link nothing per ADR-005.
  • Where it's used: the organizer's explicit run, LinkExistingAccountsHandler (.../LinkExistingAccounts/LinkExistingAccountsHandler.cs:35, UC-55), and the end of a committed import in ProcessTicketRosterImportHandler (ProcessTicketRosterImportHandler.cs:129).

AdoptionCell

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:394 · Level 0 · record (private nested, sealed)

  • What it is: one grouped row of the A2 adoption report: the day a ticket was invited, the day it was linked to an account (either may be null), both on the event's clock, and how many tickets share that pair (GetRosterInsightsHandler.cs:393-394).
  • Depends on: nothing first-party; BCL DateOnly.
  • Concept: an in-memory carrier for a SQL GROUP BY result row. The grouped-read shape is taught at GetRosterInsightsHandler; this record only gives the anonymous key a name once it leaves the query.
  • Walkthrough: built in BuildAdoptionAsync from each CountByAsync group, converting the database's DateTime? day to DateOnly? through ToDay (GetRosterInsightsHandler.cs:141,353). SumByDay folds cells into per-day totals (:341-342), and cells carrying both days feed the invite-to-link gap distribution behind the median (:167-170).
  • Why it's built this way: the database returns a few rows per day pair rather than one row per ticket, so every A2 figure (the day series, the cumulative share, the median) is folded from a small list in memory.
  • Where it's used: only inside GetRosterInsightsHandler.

EventCheckInRow

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:535 · Level 0 · record (private nested, sealed)

  • What it is: one event-scope check-in reduced to who and when: the account id and the check-in instant (GetEngagementInsightsHandler.cs:532-535). Its doc states the account id never leaves the handler.
  • Depends on: nothing first-party; uses the UserIdentifierType alias.
  • Concept: the one place the engagement report projects activity rows instead of aggregating them; see GetEngagementInsightsHandler.
  • Walkthrough: projected straight from CheckIn rows whose scope is CheckInScope.Event (GetEngagementInsightsHandler.cs:190-193); the list becomes Activity.EventCheckIns and its user ids become CheckedIn (:138-139). BuildArrivals filters the rows with EventClock.IsWithinEvent and buckets them with HalfHourOf (:330-331).
  • Why it's built this way: the B4 arrival curve needs each check-in's time, which a count cannot carry; the class doc on the handler records this as the single exception to aggregate-only reads, bounded at one event check-in per attendee (GetEngagementInsightsHandler.cs:40-42).
  • Where it's used: only inside GetEngagementInsightsHandler.

GetEngagementInsightsQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsQuery.cs:8 · Level 0 · record (sealed)

  • What it is: the query for one event's roster-plus-activity insights, reports B1 to B4, carrying only the event id (GetEngagementInsightsQuery.cs:3-8).
  • Depends on: nothing first-party; the EventIdentifierType alias.
  • Concept: a CQRS query record handled by an IQueryHandler<in TQuery, TResult>. [Rubric §6, CQRS & Event-Driven] assesses whether reads and writes are modeled separately; the doc records why this read is split from its sibling: it is separate from GetRosterInsightsQuery "so the slower activity reads never hold up the roster" (GetEngagementInsightsQuery.cs:4-5).
  • Walkthrough: one positional member, EventId (GetEngagementInsightsQuery.cs:8).
  • Where it's used: handled by GetEngagementInsightsHandler; constructed by TicketsController for GET insights/engagement and for the B-series CSV export (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:221,229-230,279).

GetRosterInsightsQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsQuery.cs:5 · Level 0 · record (sealed)

  • What it is: the query for one event's roster-only insights, reports A1 to A6, carrying only the event id (GetRosterInsightsQuery.cs:3-5).
  • Depends on: nothing first-party; the EventIdentifierType alias.
  • Concept: same shape as GetEngagementInsightsQuery.
  • Walkthrough: one positional member, EventId (GetRosterInsightsQuery.cs:5).
  • Where it's used: handled by GetRosterInsightsHandler; constructed by TicketsController for GET insights/roster, which requires the EngagementPermissions.TicketsManage permission, and for the A-series CSV export (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:197-198,205-206,270).

Holders

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:540 · Level 0 · record (private nested, sealed)

  • What it is: the linked holders of an event, as account-id sets per ticket type (ordered by type) and one set of every holder (GetEngagementInsightsHandler.cs:537-542).
  • Depends on: nothing first-party; BCL SortedDictionary and HashSet, the UserIdentifierType alias.
  • Concept: the roster side of the in-memory join described at GetEngagementInsightsHandler.
  • Walkthrough: ReadHoldersAsync groups the Live, linked Ticket rows by (ticket type, account) in SQL (GetEngagementInsightsHandler.cs:165-168), fills a SortedDictionary keyed by type with StringComparer.Ordinal (:94-104), and builds All as the union of the per-type sets (:106). An account holding tickets of two types therefore appears in both ByType sets but once in All.
  • Why it's built this way: the ordinal sorted dictionary gives every per-type table (B1, B2, B3 and B4) a stable ticket-type order without a separate sort.
  • Where it's used: inside GetEngagementInsightsHandler by Engagement, BuildTicketedVsPresent, BuildSponsorReachAsync, SplitByType and BuildArrivals (GetEngagementInsightsHandler.cs:77-81,274,290,348,323).

NameComparer

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:403 · Level 0 · class (private nested, sealed)

  • What it is: an IEqualityComparer<(string First, string Last)> that compares attendee names ignoring case, "matching the database collation" (GetRosterInsightsHandler.cs:402-403).
  • Depends on: nothing first-party; BCL IEqualityComparer<T>, StringComparer.OrdinalIgnoreCase, HashCode.
  • Walkthrough: a singleton Instance (GetRosterInsightsHandler.cs:405); Equals compares both parts with StringComparison.OrdinalIgnoreCase (:393-395); GetHashCode combines the case-insensitive hashes of both parts (:397-400), so equal names hash equally.
  • Why it's built this way: the A5 name grouping is done in SQL per (order email, first, last), then regrouped in memory by name only (GetRosterInsightsHandler.cs:313-324). Without a case-insensitive comparer, names the database grouped together could split again in memory.
  • Caveats / not-in-source: that the Engagement database collation is case-insensitive is the doc's claim; the collation itself is not visible in this file.
  • Where it's used: only BuildHealthAsync in GetRosterInsightsHandler (GetRosterInsightsHandler.cs:321).

OrderTally

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:397 · Level 0 · record (private nested, sealed)

  • What it is: one order of the Live roster, keyed by order email, with its ticket count, unlinked count, and the unlinked tickets invited at least 3 and 7 days ago (GetRosterInsightsHandler.cs:396-397).
  • Depends on: nothing first-party.
  • Walkthrough: ReadOrdersAsync regroups the SQL groups per email with StringComparer.OrdinalIgnoreCase and sums each tally (GetRosterInsightsHandler.cs:204-215). BuildFollowUp splits single-ticket from multi-ticket orders (:221-227), BuildGroupOrders treats Tickets > 1 as a group order (:232), and BuildDomainMix weighs each email's domain by its tickets (:253-257).
  • Why it's built this way: the email is the only order key the roster carries here; it stays inside the handler and only counts and domains leave (GetRosterInsightsHandler.cs:180-181).
  • Where it's used: only inside GetRosterInsightsHandler, wrapped in RosterOrders.

PersonalWebmailDomains

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/PersonalWebmailDomains.cs:10 · Level 0 · class (internal static)

  • What it is: the fixed list of consumer mailbox domains that report A6 counts as personal webmail rather than a company domain (PersonalWebmailDomains.cs:5-10).
  • Depends on: nothing first-party; BCL FrozenSet<string>.
  • Walkthrough: All is a 26-entry lowercase set (from aol.com to zoho.com) frozen with StringComparer.Ordinal (PersonalWebmailDomains.cs:13-19); Contains(domain) is a lookup into it (:24). Ordinal comparison is safe because order emails are stored lowercase, which is why DomainOf does no case folding (GetRosterInsightsHandler.cs:383-388).
  • Why it's built this way: the doc records the deliberate bias: a domain missing from the list is reported as a company domain, so the list errs toward the large providers a United States attendee would plausibly order from (PersonalWebmailDomains.cs:6-8). A frozen set suits a read-only list hit once per distinct domain.
  • Where it's used: BuildDomainMix in GetRosterInsightsHandler (GetRosterInsightsHandler.cs:261-262).

SponsorName

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:373 · Level 0 · record (private nested, sealed)

  • What it is: a sponsor's display name for the B3 sponsor-reach report, plus whether Conference actually supplied it; when it did not, the name is "Sponsor {id}" (GetEngagementInsightsHandler.cs:370-373).
  • Depends on: nothing first-party.
  • Concept: the degrade-instead-of-fail rule for cross-service lookups described at GetEngagementInsightsHandler: the handler doc lists "sponsor names fall back to ids" among the lookups that never fail the report (GetEngagementInsightsHandler.cs:45-47).
  • Walkthrough: two positional members, Name and Resolved (GetEngagementInsightsHandler.cs:373). ReadSponsorNamesAsync makes one IEventLiveValidationService.GetSponsorLiveInfoAsync call per visited sponsor, in id order; Resolved is true only when the call succeeded with a non-blank SponsorName, otherwise the name is built with the invariant culture from the id (:332-347).
  • Why it's built this way: carrying the flag beside the name lets the report say how it degraded instead of silently showing ids: EngagementInsightsDTO.SponsorNamesResolved is true only when every sponsor's name resolved (GetEngagementInsightsHandler.cs:96), and each row carries its own NameResolved (:487-488).
  • Where it's used: only inside GetEngagementInsightsHandler: held by SponsorCells (:466), mapped to SponsorReachDTO (:487-488), and used as the name-order key for sponsors whose visitor count is withheld (:154-157).

FunnelCell

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:391 · Level 1 · record (private nested, sealed)

  • What it is: one A1 group: a ticket type, whether invited, how the ticket was linked (null when unlinked), and its ticket count (GetRosterInsightsHandler.cs:390-391).
  • Depends on: TicketLinkMethod.
  • Walkthrough: built from each CountByAsync group in BuildFunnelAsync (GetRosterInsightsHandler.cs:92); Funnel sums the cells into a TicketTypeFunnelDTO: linked is any non-null LinkMethod, with separate verified-email and barcode counts (:104-119). The same cells fold once per type and once in total (:93-101).
  • Where it's used: only inside GetRosterInsightsHandler.

RosterOrders

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:400 · Level 1 · record (private nested, sealed)

  • What it is: the Live roster's orders as OrderTally rows plus the count of tickets with no order email (GetRosterInsightsHandler.cs:399-400).
  • Depends on: OrderTally.
  • Walkthrough: returned by ReadOrdersAsync (GetRosterInsightsHandler.cs:217), where WithoutEmail sums the groups whose email is null (:203). HandleAsync reads it once and feeds A3, A4 and A6 from it (:62,74-77); A4 reports WithoutEmail as TicketsWithoutEmail (:238).
  • Where it's used: only inside GetRosterInsightsHandler.

Activity

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:545 · Level 1 · record (private nested, sealed)

  • What it is: the event's activity reduced to per-account sets: the event check-in rows, who checked in, session check-ins per account, who bookmarked, gave session or event feedback, voted, asked a question, the visitors per sponsor, and where the session scope came from (GetEngagementInsightsHandler.cs:544-555). Not to be confused with the Conference aggregate of the same name, Activity.
  • Depends on: EventCheckInRow, SessionScopeSource; the UserIdentifierType and SponsorIdentifierType aliases.
  • Walkthrough: assembled once by ReadActivityAsync (GetEngagementInsightsHandler.cs:213-223) from separate aggregated reads over CheckIn (:114-132), UserSessionBookmark (:187-201), PointsEntry for feedback (:206-224), LivePollVote for votes (:226-243) and SessionQuestion for questions (:245-253).
  • Why it's built this way: the handler doc notes the read repository surface has no join, so each table is aggregated in SQL to one row per account and intersected with the holder sets here (GetEngagementInsightsHandler.cs:37-40).
  • Where it's used: only inside GetEngagementInsightsHandler.

Cell

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/InsightSuppression.cs:91 · Level 1 · class (internal nested in InsightSuppression, sealed)

  • What it is: one count of an insights report, registered with an InsightSuppression plan. It holds the exact value, which "never leaves the server", and publishes an InsightCount instead (InsightSuppression.cs:90-91,100-101).
  • Depends on: InsightCount.
  • Concept: the unit of the two-phase register-then-publish suppression taught at InsightSuppression.
  • Walkthrough:
    • The constructor is internal and takes the value, an optional denominator cell and a registration order (InsightSuppression.cs:93-98); only InsightSuppression.Count calls it, passing the current cell count as the order (:32-37).
    • Value is the exact count (:101). IsWithheld is true when the value is small or the cell is complementary (:104); InsightCount.IsSmall means 1 or 2 (count is > 0 and < SmallNumberThreshold, threshold 3, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/InsightCount.cs:24,85), so a zero is never withheld.
    • IsComplementary has an internal setter (InsightSuppression.cs:107), set only by InsightSuppression.Apply (:83). Order is the deterministic tie-break (:110), and the denominator is private (:112).
    • ToInsightCount (:116-128) publishes in three steps: a small value goes out through InsightCount.Of(Value) (:118-119); a complementary cell goes out as InsightCount.Complementary() (:121-122), which sets both IsSuppressed and IsComplementary (InsightCount.cs:80); any other cell carries its rate against the denominator, unless the denominator is withheld and the value is non-zero, in which case the rate is dropped (InsightSuppression.cs:124-127).
  • Why it's built this way: a rate whose denominator is withheld would give the denominator back (count divided by rate), so it is dropped; a zero count keeps its rate of 0 because that says nothing about the denominator (InsightSuppression.cs:19-20,124). Keeping Value on the cell and emitting only InsightCount means the exact number cannot reach a DTO by accident.
  • Where it's used: every count cell of GetEngagementInsightsHandler (EngagementCells, PresentCells, SponsorCells, ArrivalCells and SplitByType, GetEngagementInsightsHandler.cs:351-365), and the A6 domain-mix cells of GetRosterInsightsHandler (GetRosterInsightsHandler.cs:274-278,290). The rate drop is pinned by ToInsightCount_WithAWithheldDenominator_DropsTheRate (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/InsightSuppressionTests.cs:89).

InsightSuppression

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/InsightSuppression.cs:23 · Level 2 · class (internal sealed)

  • What it is: the small-number rule (BR-278) applied over one whole report, so that a withheld count cannot be recovered by subtraction from the counts that are published (InsightSuppression.cs:5-23).
  • Depends on: Cell, InsightCount.
  • Concept introduced, complementary cell suppression. Withholding every count of 1 or 2 (primary suppression) is not enough on its own: if a report publishes a total of 9 and parts of 7 and "fewer than 3", the reader subtracts and gets 2. Complementary suppression closes that by also withholding a second cell in every equation that has exactly one withheld member, so subtraction leaves a sum of two unknowns rather than a single count (InsightSuppression.cs:11-15). [Rubric §30, Compliance/Privacy/Data Governance] assesses whether personal data is minimized and its disclosure controlled; here the attendee-insight reports are aggregate-only and the plan guarantees that no response or export carries a count of 1 or 2, directly or by arithmetic (GetEngagementInsightsHandler.cs:26-32).
  • Walkthrough:
    • Two lists: the registered cells and the relations (InsightSuppression.cs:25-26).
    • Count(value, denominator) registers a Cell whose order is its registration index and returns it, so the caller can relate it and publish it later (:32-37).
    • RelateSum(left, right) records that the left cells add up to the right cells, but only when the exact values really do (:52-53); the members are the distinct union of both sides, and a relation of one cell is not kept (:55-57). An equation that does not hold is no equation, because a total over ticket types an account can hold two of is a union, not a sum (:9-10).
    • Apply() is a fixed-point loop (:61-88). For every relation with exactly one withheld cell (:69-70) it picks a partner: the smallest non-withheld cell with a value above 0, ties broken by registration order (:75-79). A relation with no such partner is skipped, since its other cells are all zero and it gives nothing away (:72-74,80-81). The partner is marked complementary and the loop repeats until a full pass changes nothing (:83-87). Each change withholds a cell that was not withheld before, so the loop ends after at most one pass per cell.
  • Why it's built this way: the suppression is decided over the whole report before any cell is published, which is why callers register every count, then every equation, then call Apply (GetEngagementInsightsHandler.cs:74-86). Picking the smallest exact count loses the least information, and the order tie-break makes the same data always withhold the same cells (InsightSuppression.cs:72-74). Only exact non-zero cells are picked, so a complementary cell is always 3 or more and is published as InsightCount.Complementary rather than "fewer than 3" (:17-18).
  • Where it's used: GetEngagementInsightsHandler builds one plan for B1 to B4 (GetEngagementInsightsHandler.cs:76-86), and RelateCells registers every equation the report publishes: a B1 row against its B2 complement, each column against its total, each B3 sponsor and B4 bucket against its split, and the B4 columns against the B1 and B2 check-in counts (:105-143). GetRosterInsightsHandler builds a second, smaller plan for the A6 domain mix (GetRosterInsightsHandler.cs:271-281), whose comment notes that TicketsWithEmail is published as a plain number and is never picked because it is larger than both of its parts. Covered by five facts in InsightSuppressionTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/InsightSuppressionTests.cs:15,35,51,72,89).
  • Caveats / not-in-source: each report builds its own plan, so equations that would span the A series and the B series are not related to each other. Whether any such cross-report equation exists is not determinable from these files.

EngagementCells

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:376 · Level 3 · record (private nested, sealed)

  • What it is: one row of the B1 engagement table over a set of holders, as unpublished Cells: the ticket type name and eight counts, from linked holders to asked a question (GetEngagementInsightsHandler.cs:375-385).
  • Depends on: InsightSuppression, Cell, Activity, TicketTypeEngagementDTO; the UserIdentifierType alias.
  • Concept: the register-then-publish pattern of InsightSuppression, applied to one table row.
  • Walkthrough:
    • Columns lists the eight column selectors, each of which adds up over the ticket types (GetEngagementInsightsHandler.cs:387-398).
    • Create registers LinkedHolders as the holder count with no denominator, then the seven activity counts with LinkedHolders as their denominator (:400-417). Six of them count the holders in the matching Activity set through CountIn, a set intersection count (:529-530); SessionCheckIns sums each holder's session check-ins instead (:411), so it counts check-ins, not people.
    • ToDTO publishes every cell through ToInsightCount (:419-430).
  • Why it's built this way: holding cells rather than numbers lets the handler relate the row to the rest of the report before anything is published. Columns exists so RelateCells can relate each all-types cell to its per-type cells in one loop (:121-122); the plan then drops a column whose total is a union rather than a sum, as with an account holding two ticket types (:105-106).
  • Where it's used: only inside GetEngagementInsightsHandler: one row per ticket type plus an all-types row with an empty type name (:77-78), related in RelateCells (:116-122,135-142), and published as ByTicketType and AllTicketTypes (:97-98).

PresentCells

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:434 · Level 3 · record (private nested, sealed)

  • What it is: the B2 ticketed-versus-present cells: linked holders never checked in, per ticket type and in total, and checked-in accounts holding no linked ticket (GetEngagementInsightsHandler.cs:433-437).
  • Depends on: InsightSuppression, Cell, Holders, Activity, TicketedVsPresentDTO, TicketTypeCountDTO.
  • Concept: same register-then-publish shape as EngagementCells.
  • Walkthrough: Create registers one cell per ticket type (holders minus those checked in), keeping every type including a zero (GetEngagementInsightsHandler.cs:439-444); then the same count over all holders, and the checked-in accounts not in Holders.All (:446-449). None of the cells has a denominator, so B2 carries no rates. ToDTO maps the per-type cells to TicketTypeCountDTO rows and publishes the two totals (:452-460).
  • Why it's built this way: the per-type rows complement the B1 rows one to one, which is why a zero type keeps its row here (:441), unlike SplitByType, which omits types with none (:349-365). RelateCells looks each B1 row's partner up by type name (:117), and relates the total to the per-type rows (:123) and the without-linked-ticket count to the B4 arrival buckets (:133-134).
  • Where it's used: only inside GetEngagementInsightsHandler: built at :79, related at :117-118,123,133-134, published as TicketedVsPresent (:99).

SponsorCells

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:464 · Level 3 · record (private, sealed, nested in GetEngagementInsightsHandler)

  • What it is: one B3 sponsor-reach row held as unpublished suppression cells: the sponsor's id and SponsorName, its distinct visitors, the visitors split by the ticket types they hold, and the visitors holding no linked ticket (GetEngagementInsightsHandler.cs:463-469).
  • Depends on: InsightSuppression (its Cell), SponsorName, Holders, SponsorReachDTO; the SponsorIdentifierType and UserIdentifierType aliases.
  • Concept: the register-then-publish pattern taught at GetEngagementInsightsHandler: a row is built from cells registered in the report's one plan, and becomes a DTO only after the plan has decided which cells to withhold.
  • Walkthrough
    • Create (GetEngagementInsightsHandler.cs:471-482): registers UniqueVisitors as plan.Count(visitors.Count) (:480), the per-type split through the handler's SplitByType, which keeps only the types with at least one visitor (:481, :351-365), and WithoutLinkedTicket as the visitors outside holders.All (:482). No cell carries a denominator, so none publishes a rate.
    • ToDTO (GetEngagementInsightsHandler.cs:484-492): copies the id, unpacks the name into SponsorName and NameResolved (:487-488), and publishes each cell with ToInsightCount.
  • Why it's built this way: keeping the exact Value on the cell until ToDTO lets the handler order and relate rows by their true counts while publishing only what the plan allows.
  • Where it's used: built once per visited sponsor, in sponsor-id order, by HandleAsync (GetEngagementInsightsHandler.cs:80-83); each row's total is related to its split in RelateCells (:126-127); OrderSponsors publishes exact counts first and withheld ones by name (:147-159).

EventClock

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/EventClock.cs:21 · Level 4 · record (internal, sealed)

  • What it is: the clock both insight reports bucket days and half hours in: a basis, a UTC offset in minutes, and the event's UTC window when known (EventClock.cs:6-25).
  • Depends on: IEventLiveValidationService (Conference's live-info lookup, returning EventLiveInfo), InsightTimeBasis; the EventIdentifierType alias.
  • Concept introduced, deriving a zone offset without a zone id. The doc explains that Conference does not give Engagement the event's IANA zone id, but its live info carries the event's first day in the event's zone and the UTC instant that day starts; their difference is the event's offset on its first day, exact for event-day buckets and at most an hour off for a day across a daylight-saving change (EventClock.cs:9-12). [Rubric §29, Resilience & Business Continuity] assesses whether a dependency failure degrades rather than breaks; here a failed or empty lookup yields UTC buckets with the basis reported, instead of a failed report (EventClock.cs:12-14,50-51).
  • Walkthrough
    • MaxOffsetMinutes = 14 * 60 (EventClock.cs:28): the widest real offset; a larger derived value is treated as bad data.
    • Utc (EventClock.cs:31): the fallback clock, offset 0, no window. Offset and WindowKnown are derived properties (:34,37).
    • ResolveAsync (EventClock.cs:44-63): calls GetEventLiveInfoAsync; failure or null returns Utc (:49-51). The window instants are re-stamped DateTimeKind.Utc (:54-55). A default StartDate keeps UTC but keeps the window (:56-57). Otherwise the offset is the first day at midnight minus the window start, rounded away from zero (:59), and falls back to UTC (still with the window) when its magnitude exceeds 14 hours (:60-62).
    • HalfHourOf (EventClock.cs:68-73): floors the shifted time to :00 or :30 and stamps it as a DateTimeOffset at the clock's offset.
    • IsWithinEvent (EventClock.cs:78-79): true when the window is unknown, otherwise a half-open [start, end) test.
  • Why it's built this way: a fixed offset is enough for a conference that spans a few days, and the degradation is visible in the response rather than silent: both handlers copy Basis and UtcOffsetMinutes into their DTOs, and the engagement one also copies WindowKnown (GetRosterInsightsHandler.cs:70-71, GetEngagementInsightsHandler.cs:92-94).
  • Where it's used: GetRosterInsightsHandler (A2 day buckets: the clock has no day method of its own, so A2 adds UtcOffsetMinutes inside the SQL grouping, GetRosterInsightsHandler.cs:131-136) and GetEngagementInsightsHandler (B4 arrivals, through ArrivalCells, which filters with IsWithinEvent and groups with HalfHourOf, GetEngagementInsightsHandler.cs:510-511).

ArrivalCells

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:496 · Level 5 · record (private, sealed, nested in GetEngagementInsightsHandler)

  • What it is: one B4 arrival-curve bucket held as unpublished suppression cells: the half hour it starts at, its event check-ins, those check-ins split by ticket type, and the ones by accounts holding no linked ticket (GetEngagementInsightsHandler.cs:496-500).
  • Depends on: InsightSuppression (its Cell), EventClock, EventCheckInRow, Holders, ArrivalBucketDTO.
  • Concept: the same register-then-publish shape as SponsorCells, applied to time buckets on the event's clock.
  • Walkthrough
    • Create (GetEngagementInsightsHandler.cs:502-518): keeps the event check-ins inside the event window (clock.IsWithinEvent, :510), groups them by clock.HalfHourOf (:511), orders the buckets by start (:512), and registers per bucket the total, the per-type split through SplitByType (types with no arrival in the bucket are omitted) and the check-ins outside holders.All (:513-517).
    • ToDTO (GetEngagementInsightsHandler.cs:520-526): publishes StartsAt and each cell through ToInsightCount.
  • Why it's built this way: the buckets are where the handler's one stated exception to "no raw activity rows" pays off: B4 needs each event check-in's time, so the (account, time) pairs are projected and bucketed here (GetEngagementInsightsHandler.cs:40-42).
  • Where it's used: built by HandleAsync (GetEngagementInsightsHandler.cs:84); RelateCells relates each bucket to its split and the bucket columns to the B1 and B2 check-in counts (:128-129,131-142); published by HandleAsync as Arrivals (:101).

TicketInsightsCsv

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/TicketInsightsCsv.cs:24 · Level 6 · class (static)

  • What it is: renders one table of the ticket insights (A1 to A6 or B1 to B4) as CSV, plus the file name and the byte encoding of the download (TicketInsightsCsv.cs:11-24).
  • Depends on: TicketInsightsReport, RosterInsightsDTO, EngagementInsightsDTO and their nested DTOs, InsightCount, CsvWriter; BCL FrozenDictionary, StringWriter, CultureInfo, Encoding.
  • Concept: the export conventions of ADR-078: RFC 4180 quoting, CRLF rows, invariant number formatting, a UTF-8 byte order mark so Excel reads accented text, and # comment rows for notes (TicketInsightsCsv.cs:11-21). Quoting and the CRLF ending come from the shared CsvWriter (MMCA.Common/Source/Core/MMCA.Common.Shared/Serialization/CsvWriter.cs:61,121), not from this class. [Rubric §30, Compliance/Privacy/Data Governance] assesses whether privacy rules hold at every output; a suppressed cell is written as InsightCount.SuppressedText, a complementary one as InsightCount.ComplementaryText, and the DTOs already carry no number for either, so the file cannot leak one (TicketInsightsCsv.cs:17-19,296-297).
  • Walkthrough
    • Constants (TicketInsightsCsv.cs:26-33): ContentType = "text/csv", the total-row label "All ticket types", and the "No linked ticket" label.
    • Dispatch tables (TicketInsightsCsv.cs:36-55): two frozen dictionaries mapping each report to its writer, A1 to A6 over the roster DTO and B1 to B4 over the engagement DTO. IsRosterReport is a key lookup into the first (:60).
    • FileName (TicketInsightsCsv.cs:70-73): ticket-insights-{report}-event-{id}-{yyyyMMddTHHmmssZ}.csv, with ReportName lowering the first letter of the enum member and throwing on an undefined value (:264-271).
    • ToUtf8WithByteOrderMark (TicketInsightsCsv.cs:78-82): preamble plus UTF-8 bytes.
    • Render overloads (TicketInsightsCsv.cs:88-95,101-108): null-check, look up the writer, and throw ArgumentOutOfRangeException for a report from the other family.
    • Table writers (TicketInsightsCsv.cs:110-261): one per report, each writing its rows with CsvWriter.WriteRow into an invariant-culture StringWriter (:112-113). A1 and B1 append the total row relabeled with AllTicketTypes (:114,200); A2 writes the median as a trailing # comment row, or n/a (:131-134); B4 stamps each bucket as yyyy-MM-dd'T'HH:mmzzz (:250).
    • Formatters (TicketInsightsCsv.cs:273-297): invariant integers, Dec rounding away from zero to a fixed number of decimals, UTC timestamps, and Count/Percent/Average that print the withheld text for a withheld cell (Withheld picks the complementary or the suppressed text, :296-297) and an empty field when a rate is absent (percent to one decimal, average to two).
  • Why it's built this way: putting rendering in the Application layer keeps the controller to a report dispatch and a file result, and the dispatch dictionaries make "is this a roster report" answerable without a parallel switch.
  • Where it's used: TicketsController's GET insights/export, which picks the handler with IsRosterReport, renders, and returns the BOM-prefixed bytes with ContentType and FileName (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:247-290); covered by TicketInsightsCsvTests in the Engagement Application test project.

GetRosterInsightsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:33 · Level 8 · class (sealed)

  • What it is: builds the roster-only ticket insights of one event: A1 funnel by ticket type, A2 adoption over time, A3 follow-up queue, A4 group orders, A5 roster health and A6 email domain mix (GetRosterInsightsHandler.cs:13-15).
  • Depends on: IUnitOfWork (for the IEntityQuerier<TEntity, TIdentifierType> read surface over Ticket), IEventLiveValidationService (through EventClock), NewestRosterTicketSpecification, PersonalWebmailDomains, InsightCount, InsightSuppression, TicketStatus, TicketLinkMethod, RosterInsightsDTO and its parts (TicketTypeFunnelDTO, AdoptionTrendDTO, FollowUpQueueDTO, GroupOrdersDTO, RosterHealthDTO, EmailDomainMixDTO), Result; BCL TimeProvider.
  • Concept introduced, aggregate-only reporting over grouped reads. [Rubric §30, Compliance/Privacy/Data Governance] assesses whether personal data is minimized at the boundary; the class doc states nothing leaving the handler names a holder or returns an email address or account id, and A6's small-number rule is applied on the server (GetRosterInsightsHandler.cs:16-20). [Rubric §12, Performance & Scalability] assesses whether reads scale with the data; every read is a SQL GROUP BY/COUNT through CountByAsync, so the database returns grouped rows rather than ticket rows (:21-27), in line with the narrow read contract of ADR-055.
  • Walkthrough
    • Constants (GetRosterInsightsHandler.cs:40-47): TopDomainCount = 10, ReminderDays = 3, LateReminderDays = 7.
    • HandleAsync (GetRosterInsightsHandler.cs:50-80): takes now from TimeProvider, gets the ticket querier with GetReadRepository, resolves the EventClock, then runs the funnel, adoption, order and health reads in sequence and returns Result.Success with the DTO (:56-79).
    • A1 BuildFunnelAsync (GetRosterInsightsHandler.cs:82-103): one CountByAsync keyed by (ticket type, invited, link method) over Live tickets, folded per type in ordinal order and once in total through Funnel (:105-120).
    • A2 BuildAdoptionAsync (GetRosterInsightsHandler.cs:124-179): groups by invite day and link day with the clock's offset added inside the projection (:131-139), returns an empty DTO when no rows (:144-145), walks every day from the first to the last event and accumulates the linked count and share (:154-166), and computes MedianDaysInviteToLink with WeightedMedian over the invite-to-link gaps (:168-178,360-381).
    • Orders ReadOrdersAsync (GetRosterInsightsHandler.cs:183-219): one grouping by (order email, linked, invited at least 3 days, invited at least 7 days); the inline comment notes a never-invited ticket compares false on both in SQL and in memory (:197). Rows are regrouped per email into OrderTally and wrapped in RosterOrders.
    • A3 BuildFollowUp (GetRosterInsightsHandler.cs:222-228): unlinked, invited tickets split by single-ticket and multi-ticket orders at both thresholds.
    • A4 BuildGroupOrders (GetRosterInsightsHandler.cs:231-248): group order totals plus a tickets-per-order histogram.
    • A6 BuildDomainMix (GetRosterInsightsHandler.cs:254-295): per-domain ticket totals; personal webmail versus company; the top ten company domains among those at or above InsightCount.SmallNumberThreshold (3), the rest folded into OtherCompanyDomains (:264-269). The cells add up (tickets with email = personal + company, company = top domains + Other), so every cell is registered in one InsightSuppression plan with those two sums related, and the plan is applied before any cell is published, so a withheld "Other" or personal count is never left to subtraction (:250-253,272-282). TicketsWithEmail stays a plain number: the plan never picks it, since it is larger than both parts whenever one is withheld (:272-273,286).
    • A5 BuildHealthAsync (GetRosterInsightsHandler.cs:299-348): one grouping by (status, erased, nameless) over every ticket of the event, where erased means the barcode starts with Ticket.AnonymizedBarcodePrefix (:304-312); one grouping by (order email, first, last) over named Live tickets, regrouped by name with NameComparer to count duplicate names (:314-325); two reads through NewestRosterTicketSpecification for the last added and last changed timestamps (:326-333).
    • Helpers: Percent rounds to one decimal and returns 0 for an empty whole (GetRosterInsightsHandler.cs:350-351); DomainOf takes the text after the last @ (:384-388).
  • Why it's built this way: the doc notes a roster is at most a few thousand tickets and the email-keyed groupings track the number of orders (GetRosterInsightsHandler.cs:24-27), so regrouping in memory is cheap while no individual row is ever returned to the caller.
  • Where it's used: injected into TicketsController as IQueryHandler<GetRosterInsightsQuery, Result<RosterInsightsDTO>> and called by GET insights/roster and the A-series export (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:51,205,270); covered by GetRosterInsightsHandlerTests.

GetEngagementInsightsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.GetTicketInsights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:54 · Level 11 · class (sealed)

  • What it is: builds the roster-plus-activity insights of one event over its linked holders: B1 engagement, B2 ticketed versus present, B3 sponsor reach and B4 arrival curve (GetEngagementInsightsHandler.cs:21-24).
  • Depends on: IUnitOfWork (read repositories over Ticket, CheckIn, UserSessionBookmark, PointsEntry, LivePoll, LivePollVote and SessionQuestion), IEventLiveValidationService, ISessionBookmarkValidationService, EventClock, PointsSubjectKeys, InsightCount, InsightSuppression, SessionScopeSource, EngagementInsightsDTO and its parts (TicketTypeEngagementDTO, TicketedVsPresentDTO, SponsorReachDTO, ArrivalBucketDTO); the private Holders, Activity, EventCheckInRow, SponsorName, EngagementCells, PresentCells, SponsorCells and ArrivalCells; BCL TimeProvider.
  • Concept introduced, one suppression plan over the whole report. The aggregate-only rule taught at GetRosterInsightsHandler applies here to every count cell, but a withheld 1 or 2 is not safe on its own when the report also publishes the totals it adds up to: the missing cell could be recovered by subtraction. So every count passes through one InsightSuppression plan that knows every equation the report publishes (a B1 row against its B2 complement, each B1 and B2 column against its total, a B3 sponsor or B4 bucket against its split, the B4 columns against the B1 and B2 check-in counts), keeps the ones the exact values satisfy, and withholds complementary cells until none gives a withheld count away; sponsors with a withheld count are listed after the exact ones in name order, so row order does not leak either (GetEngagementInsightsHandler.cs:26-34). The handler also does an in-memory join without a join operator: the roster and the activity tables share the Engagement database, but the read surface has no join, so each table is aggregated in SQL to one row per account and the per-ticket-type split is folded here (:37-43). [Rubric §29, Resilience & Business Continuity]: cross-service lookups degrade instead of failing the report, and the DTO says how (:45-47).
  • Walkthrough
    • HandleAsync (GetEngagementInsightsHandler.cs:62-103): resolves the clock, reads holders, activity and sponsor names (:69-72); registers every count first (B1 rows per type and in total, B2, B3 per sponsor in id order, B4 buckets), relates them, and applies the plan before any cell is published (:74-86); then assembles the DTO from each row's ToDTO, including EventWindowKnown, SessionScope and SponsorNamesResolved (true only when every sponsor name resolved, :96).
    • RelateCells (GetEngagementInsightsHandler.cs:107-143): one RelateSum per published equation, grouped as the class doc lists them; per the comment, the plan keeps only the ones the exact values satisfy, because a holder of two ticket types makes a total a union (:105-106).
    • OrderSponsors (GetEngagementInsightsHandler.cs:147-159): exact visitor counts descending then by id, followed by the withheld sponsors by name (case-insensitive) then id.
    • ReadHoldersAsync (GetEngagementInsightsHandler.cs:162-183): see Holders.
    • ReadActivityAsync (GetEngagementInsightsHandler.cs:186-224): projects event-scope check-ins as EventCheckInRow (:190-193); one grouping by (scope, sponsor, account) over session and sponsor check-ins yields session check-ins per account and visitors per sponsor (:195-208); then sessions, feedback, bookmarks, votes and questions.
    • ReadSessionIdsAsync (GetEngagementInsightsHandler.cs:228-261): asks Conference for the event's session ids; on failure falls back to the distinct session ids Engagement has seen in check-ins, questions and polls, and reports SessionScopeSource.LocalActivity (:232-234,236-260).
    • ReadBookmarkersAsync (GetEngagementInsightsHandler.cs:263-277): returns empty for no sessions, otherwise the distinct users bookmarking any of them.
    • ReadFeedbackAsync (GetEngagementInsightsHandler.cs:282-300): reads feedback from the points ledger, one entry per feedback keyed to its subject through PointsSubjectKeys, split into session and event feedback givers (:297-299).
    • ReadVotersAsync / ReadAskersAsync (GetEngagementInsightsHandler.cs:302-319,321-329): the event's poll ids then the distinct voters, and the distinct question askers.
    • ReadSponsorNamesAsync (GetEngagementInsightsHandler.cs:332-347): one GetSponsorLiveInfoAsync per visited sponsor; a failed or blank name becomes Sponsor {id} with Resolved = false in a SponsorName (:340-343).
    • SplitByType / ToCountDTOs (GetEngagementInsightsHandler.cs:351-365,367-368): registers one cell per ticket type with a nonzero count (a missing type is an exact zero), then publishes them.
    • Row records: B1 EngagementCells (:376-431, each measure registered with the linked-holders cell as denominator, :406-416), B2 PresentCells (:434-461, every type keeps its row, zero included, :441-444), B3 SponsorCells and B4 ArrivalCells.
  • Why it's built this way: splitting B1 to B4 from A1 to A6 keeps the slower activity reads off the roster request (GetEngagementInsightsQuery.cs:4-5), and folding sets in memory keeps raw activity rows in the database, the one stated exception being the event check-in times B4 needs (GetEngagementInsightsHandler.cs:40-42).
  • Where it's used: injected into TicketsController as IQueryHandler<GetEngagementInsightsQuery, Result<EngagementInsightsDTO>> and called by GET insights/engagement and the B-series export (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:52,229,279); covered by GetEngagementInsightsHandlerTests.

GetBookmarkedSessionIdsQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.GetBookmarkedSessionIds · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/GetBookmarkedSessionIds/GetBookmarkedSessionIdsQuery.cs:5 · Level 0 · record (sealed)

  • What it is: the read request for "which sessions has this user bookmarked", a single-parameter query carrying only the UserId. Its handler answers with a map from session id to bookmark id, so a listing page can render per-row bookmark state.
  • Depends on: the UserIdentifierType alias (an identifier type alias linked solution-wide, see primer §2); paired with GetBookmarkedSessionIdsHandler through the CQRS query contract.
  • Concept, the CQRS query as an immutable record. This is a vertical-slice read: the query type and its handler live in the same UseCases/GetBookmarkedSessionIds/ folder. [Rubric §6, CQRS & Event-Driven] assesses whether reads and writes are modeled as distinct messages; this is a pure read, so it carries no validator and no transaction (the query pipeline skips both, see the decorator order in IQueryHandler<in TQuery, TResult>). [Rubric §5, Vertical Slice] assesses feature-folder cohesion, which this layout embodies. The record shape gives value equality and immutability for free, so the query is a safe, comparable message.
  • Walkthrough: public sealed record GetBookmarkedSessionIdsQuery(UserIdentifierType UserId) (GetBookmarkedSessionIdsQuery.cs:5), one positional parameter and no body. The XML doc (GetBookmarkedSessionIdsQuery.cs:3-4) states the intent: the set of session ids the user has bookmarked, keyed by session id to bookmark id.
  • Why it's built this way: a dedicated query type keeps the read intent explicit and lets the IQueryHandler<in TQuery, TResult> pipeline decorate it uniformly; carrying just the UserId keeps the request minimal.
  • Where it's used: constructed by BookmarksController's GET /api/bookmarks/session-ids action from the userId query argument (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:154) and dispatched to GetBookmarkedSessionIdsHandler; the resulting map drives the star indicator per row on the unified Sessions page. The record's property round-trip is pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/UserSessionBookmarks/UseCases/GetBookmarkedSessionIdsHandlerTests.cs:39.

BookmarkCacheEvictionSignal

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/Services/BookmarkCacheEvictionSignal.cs:25 · Level 0 · class (sealed)

  • What it is: a coalescing "Conference's bookmark-count cache is stale" flag, built on a capacity-one Channel<bool>. Any number of Request() calls made while one is pending collapse into that one pending request.
  • Depends on: System.Threading.Channels only (Channel, BoundedChannelOptions, BoundedChannelFullMode, ChannelReader<T>; BookmarkCacheEvictionSignal.cs:1). No first-party types, which is why it is Level 0.
  • Concept introduced, a flag instead of a queue, so the consumer sets the rate. Every eviction drops the whole conference:sessions tag (session list, session reads and batched counts together), and at a session changeover hundreds of attendees star sessions within the same minute, so one broadcast per star would keep that cache permanently cold and send every session read to Conference's database (BookmarkCacheEvictionSignal.cs:11-18). A bounded channel of capacity 1 with BoundedChannelFullMode.DropWrite (:28-30) makes a write against a full channel a no-op, so the processor's pacing, not the bookmark rate, sets the eviction rate. Contrast LiveChannelPublishQueue, which uses DropOldest because every broadcast carries distinct content; here every request means the same thing, so dropping the new one loses nothing. [Rubric §12, Performance & Scalability] assesses protecting a downstream store from write-driven thundering herds, which the coalescing gives. [Rubric §29, Resilience & Business Continuity]: a bookmark command can never be slowed or failed by the cache signal (:21-22).
  • Walkthrough
    • The _channel field (BookmarkCacheEvictionSignal.cs:27-33) is Channel.CreateBounded<bool>(new BoundedChannelOptions(1) { FullMode = DropWrite, SingleReader = true, SingleWriter = false }): one hosted reader, many concurrent request-thread writers.
    • public ChannelReader<bool> Reader => _channel.Reader (:36) is the read side the hosted processor consumes; the writer stays private.
    • public void Request() => _channel.Writer.TryWrite(true) (:42) marks the cache stale. A request made while one is pending is absorbed into it, because the pending broadcast will cover it (:38-41). The result of TryWrite is deliberately ignored.
  • Why it's built this way: the payload is a bool because the signal carries no information beyond "stale"; the channel is used for its wake-up semantics, not as a data pipe. Registered as a singleton, so there is one flag per replica (:21).
  • Where it's used: writer side is UserSessionBookmarkCacheEvictionHandler, which takes it by constructor (UserSessionBookmarkCacheEvictionHandler.cs:38) and calls Request() on every bookmark change; reader side is BookmarkCacheEvictionProcessor in Infrastructure, registered with AddHostedService<BookmarkCacheEvictionProcessor>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:27). Registered as a singleton in MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:73. The pattern is recorded in ADR-121 (ephemeral in-process work queue).

AssemblyReference

MMCA.ADC.Engagement.Domain, MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Domain, MMCA.ADC.Engagement.Infrastructure · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/AssemblyReference.cs:5, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:5 · Level 0 · class (static)

One byte-identical copy per Engagement layer. This section covers the Domain and Infrastructure copies together; the API and Application copies are covered earlier in this chapter.

  • What it is: a two-field static class whose only job is to hand out the Assembly it was compiled into, plus that assembly's simple name, so anything that needs to say "scan the assembly this type lives in" gets a compiled anchor instead of a hand-typed assembly-name string.

    Type File:Line Notes (what differs)
    AssemblyReference (Domain) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/AssemblyReference.cs:5 namespace MMCA.ADC.Engagement.Domain (:3); no consumer anywhere in the repo today
    AssemblyReference (Infrastructure) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:5 namespace MMCA.ADC.Engagement.Infrastructure (:3); this is the copy the design-time migrations factory consumes

    The Engagement module carries four copies of this file (API, Application, Domain, Infrastructure). Each is eleven lines long and declares the same two fields at lines 7 and 8; only the namespace on line 3 differs. What actually distinguishes them is which assembly typeof(AssemblyReference).Assembly resolves to, and therefore which call sites can use them.

  • Depends on: System.Reflection (BCL), imported at line 1 of each file. Nothing first-party, which is why both copies sit at Level 0 even though one of them lives in the module's outermost non-presentation layer.

  • Concept: the framework-level explanation of assembly-marker types lives with the shared copy in AssemblyReference; these are the Engagement Domain and Infrastructure instances of that idiom. [Rubric §2, Design Patterns] assesses whether a recurring problem is solved with a recognized, uniform idiom rather than an ad-hoc one each time: every layer of every ADC module exposes the same pair of fields, so "point a scanner at this layer" has exactly one spelling across the repo. [Rubric §1, SOLID] (Dependency Inversion) is the other half: the migrations host depends on a marker declared for that purpose, not on some real EF configuration class it happens to know about, so renaming or deleting an entity configuration can never silently empty a scan.

  • Walkthrough: two public static readonly fields per copy, both resolved once at type initialization.

    • Assembly (AssemblyReference.cs:7) is typeof(AssemblyReference).Assembly. Because the marker is declared inside its own project, the Infrastructure copy resolves to the MMCA.ADC.Engagement.Infrastructure assembly, the one holding the ten EntityConfiguration classes under MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/, and the Domain copy resolves to the assembly holding the module's aggregates.
    • AssemblyName (AssemblyReference.cs:8) is Assembly.GetName().Name ?? string.Empty. The null-coalesce is what keeps the field non-null under nullable-reference-type analysis, since AssemblyName.Name is declared nullable even though a loaded assembly always reports one.
  • Why it's built this way: a typeof cannot go stale the way a string literal can, and because each layer declares its own copy, a scan can be aimed at one layer without that layer's consumers taking a reference to any other. The four-copy shape is deliberate duplication of a token, not duplicated logic: there is no behavior here to keep in sync, which is also why an unused copy costs nothing.

  • Where it's used: the Infrastructure copy is the one the EF Core design-time factory points at when it tells the module's SQLServerDbContext where to find entity configurations: options.AddConfigurationAssembly(typeof(MMCA.ADC.Engagement.Infrastructure.AssemblyReference).Assembly) at MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Engagement/DesignTimeSQLServerDbContextFactory.cs:37, the per-service migrations project that owns the ADC_Engagement database (ADR-006). That call site names the type through its full namespace, which is why the Infrastructure copy specifically is load-bearing: swapping in the Domain copy would point the scan at an assembly with no configurations in it. There are four such per-service migrations projects under MMCA.ADC/Source/Hosting/ (Conference, Engagement, Identity, Notification), one per database.

  • Caveats / not-in-source: the Domain copy has no consumer at all. The architecture-fitness map does not use either marker: MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/AdcArchitectureMap.cs:44 pins the Domain assembly with a real aggregate type (typeof(Engagement.Domain.UserSessionBookmarks.UserSessionBookmark).Assembly) and :46 pins Infrastructure with Assembly.Load("MMCA.ADC.Engagement.Infrastructure"), a name string. So the marker's only production consumer today is the one design-time factory line above.

ClassReference

MMCA.ADC.Engagement.Domain, MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Domain, MMCA.ADC.Engagement.Infrastructure · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/AssemblyReference.cs:11, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:11 · Level 0 · class

One byte-identical copy per Engagement layer. This section covers the Domain and Infrastructure copies; the API and Application copies are covered earlier in this chapter.

  • What it is: an empty, instantiable class declared at the bottom of the same file as the static marker above, existing purely so the assembly can be named in a generic type argument.

    Type File:Line Notes (what differs)
    ClassReference (Domain) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/AssemblyReference.cs:11 namespace MMCA.ADC.Engagement.Domain (:3); declared for symmetry, no call site today
    ClassReference (Infrastructure) MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:11 namespace MMCA.ADC.Engagement.Infrastructure (:3); declared for symmetry, no call site today
  • Depends on: nothing. public class ClassReference { } is the whole declaration in both files.

  • Concept: the companion half of the marker pattern, introduced at framework level under ClassReference. C# forbids a static class as a generic type argument, so a registration helper shaped as Scan<TAssemblyMarker>() cannot accept AssemblyReference; the empty non-static class fills that slot without weakening the static one. [Rubric §33, Developer Experience] assesses how much ceremony the inner loop costs: because every layer of every module carries the identical pair, a developer adding a module writes the same two lines and gets both call shapes for free.

  • Walkthrough: no members. The only meaningful property of either copy is the assembly it belongs to, which a scanner reads as typeof(ClassReference).Assembly inside the generic helper.

  • Why it's built this way: co-locating both markers in one file makes the pair a single copy-paste unit when a new layer is created, and keeps the "which one do I pass?" answer purely mechanical (static handle for typeof(...).Assembly, empty class for <TMarker>).

  • Where it's used: neither of these two copies is referenced anywhere in the repository. The generic-marker call site in the Engagement module is the Application copy, services.ScanModuleApplicationServices<ClassReference>() at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92, which is what discovers the module's domain-event handlers, mappers, command/query handlers, and validators by convention. The Domain layer has nothing to scan for, and the Infrastructure layer registers its one hosted service explicitly instead (see DependencyInjection below).

  • Caveats / not-in-source: both copies are unreferenced. They exist so the marker file is identical in every layer, not because something consumes them; nothing in the build fails if either is deleted. Read nothing here as saying they are wired up.

GetUserBookmarksQuery

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.GetUserBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/GetUserBookmarks/GetUserBookmarksQuery.cs:8 · Level 0 · record (sealed)

  • What it is: the read request for a user's bookmarked sessions as a paged list, with an optional event filter. Unlike GetBookmarkedSessionIdsQuery, which returns a lightweight id map, this query yields full bookmark DTOs plus pagination metadata.
  • Depends on: the UserIdentifierType and EventIdentifierType aliases (see primer §2); paired with GetUserBookmarksHandler.
  • Concept, a paged query with defaulted parameters. [Rubric §9, API & Contract Design] assesses whether list endpoints expose paging and filtering as first-class inputs; this query does, defaulting PageNumber to 1 and PageSize to 10 so a caller can omit both. [Rubric §12, Performance & Scalability] assesses whether list reads are bounded: the doc comment (GetUserBookmarksQuery.cs:7) records the 500-item ceiling from BR-11, and the handler, not the record, enforces it. The optional EventIdentifierType? filter (BR-58, GetUserBookmarksQuery.cs:5) is resolved through a Session lookup that lives in another module, which is why the handler reaches into Conference.
  • Walkthrough: public sealed record GetUserBookmarksQuery(UserIdentifierType UserId, EventIdentifierType? EventId, int PageNumber = 1, int PageSize = 10) (GetUserBookmarksQuery.cs:8-12). Four positional parameters: the required UserId, the nullable EventId filter, and the two paging knobs with defaults. The XML doc (GetUserBookmarksQuery.cs:3-7) ties each parameter to its business rule.
  • Why it's built this way: defaulted paging parameters keep the common call simple while still allowing explicit paging; making EventId nullable models "all events" as the absence of a filter rather than as a magic value. The UserId is a real parameter here (unlike on GetMyPointsQuery) because an Organizer is allowed to read another attendee's bookmark list, which is exactly why the endpoint needs an ownership filter at the edge.
  • Where it's used: constructed by BookmarksController's GET /api/bookmarks action (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:101) behind [ServiceFilter(typeof(OwnerOrAdminFilter))] (BookmarksController.cs:91, ADR-033); handled by GetUserBookmarksHandler, which returns a PagedCollectionResult<T> of UserSessionBookmarkDTO.

ImportTicketRosterCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ImportTicketRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/ImportTicketRosterCommand.cs:15 · Level 0 · record (sealed)

  • What it is: the request to dry-run one TicketLeap roster export against an ADC event: report the counts a commit would produce, write nothing (ImportTicketRosterCommand.cs:3-7).
  • Depends on: the EventIdentifierType alias (primer §2) and the BCL ReadOnlyMemory<byte>. Paired with ImportTicketRosterHandler and ImportTicketRosterCommandValidator.
  • Concept, a dry run as its own command. [Rubric §6, CQRS & Event-Driven] assesses whether intent is modeled as distinct messages. The dry run and the commit share one upload endpoint but are two commands: this one answers synchronously with counts, while the commit is StartTicketRosterImportCommand, which queues a durable TicketImportRun (ImportTicketRosterCommand.cs:5-6). Both apply the same TicketRosterApplier rules, so the preview cannot drift from the result.
  • Walkthrough: public sealed record ImportTicketRosterCommand(EventIdentifierType EventId, ReadOnlyMemory<byte> Content) (ImportTicketRosterCommand.cs:15-17). EventId is the ADC event the roster is for; Content is the raw CSV bytes (:13-14).
  • Why it's built this way: the content is a ReadOnlyMemory<byte> following the session-asset upload precedent: the size is already capped at TicketRosterLimits.MaxFileBytes by the controller and the validator, so one buffer serves both the validator and the parser with no second copy (ImportTicketRosterCommand.cs:8-12).
  • Where it's used: built by TicketRosterImportController when POST /tickets/roster arrives with dryRun = true (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:102-106); validated by ImportTicketRosterCommandValidator and handled by ImportTicketRosterHandler.

TicketRosterEntry

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketRosterEntry.cs:15 · Level 0 · record (sealed)

  • What it is: the whitelisted fields of one ticket row in a roster upload: everything a Ticket keeps from the TicketLeap export, and nothing else (TicketRosterEntry.cs:3-7).
  • Depends on: nothing first-party; six string fields, the last nullable.
  • Concept introduced, the whitelist as a type. [Rubric §30, Compliance/Privacy/Data Governance] assesses data minimization. A TicketLeap export carries far more columns than ADC needs; because the parser can only hand the domain this record, any column not named here never reaches the database. The parser also resolves the buyer-name and order-email fallbacks before it builds one, so the aggregate only sees the values it stores (TicketRosterEntry.cs:5-7).
  • Walkthrough: public sealed record TicketRosterEntry(string ExternalTicketId, string Barcode, string TicketTypeName, string AttendeeFirstName, string AttendeeLastName, string? OrderEmail) (TicketRosterEntry.cs:15-21). The parameter docs (:8-14) record that the attendee names fall back to the buyer's when blank, and that OrderEmail comes from (Order) Email Address, else Buyer Email, else null.
  • Why it's built this way: as a record it compares by value, which Ticket.ApplyRosterEntry uses directly: it rebuilds an entry from its stored fields and compares it with the normalized incoming one, so "did anything change" is one ordinal record equality (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:155-156).
  • Where it's used: produced by TicketLeapRosterParser; consumed by Ticket.Create / ApplyRosterEntry, by TicketInvariants.EnsureEntryIsValid, and by TicketRosterApplier and TicketRoster in Application. MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Privacy/PiiConventionTests.cs references it as well.

ImportTicketRosterCommandValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ImportTicketRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/ImportTicketRosterCommandValidator.cs:11 · Level 1 · class (sealed)

  • What it is: the FluentValidation validator for ImportTicketRosterCommand: an event id and a non-empty upload no larger than the roster cap.
  • Depends on: FluentValidation's AbstractValidator<T> (external), ImportTicketRosterCommand, TicketRosterLimits.
  • Concept: the validation decorator runs this before the handler (see primer §2). [Rubric §24, Forms/Validation/UX Safety] assesses whether bad input is refused with a clear, stable reason; each rule carries both a message and a machine-readable error code.
  • Walkthrough
    • EventId must not equal default(EventIdentifierType), code Ticket.Roster.EventIdRequired (ImportTicketRosterCommandValidator.cs:15-18).
    • Content has two chained Must rules that share the code Ticket.Roster.InvalidUpload: not empty (:20-23), and at most TicketRosterLimits.MaxFileBytes bytes, with the message computing the megabyte figure from the constant (:24-26). The cap is 2 * 1024 * 1024 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketRosterLimits.cs:11).
  • Why it's built this way: the controller already reads the file against the same cap (TicketRosterImportController.cs:77-84), so this is the second gate that keeps the command safe when dispatched by anything other than that endpoint.
  • Where it's used: discovered by the module's convention scan; pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/Validation/TicketValidatorTests.cs.

TicketRosterImportReport

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ImportTicketRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/TicketRosterImportReport.cs:13 · Level 4 · record (sealed)

  • What it is: a roster dry run expressed in the framework's shared import-report shape plus the roster's own counts. It stays on the server and maps to the response contract with ToResult() (TicketRosterImportReport.cs:6-12).
  • Depends on: ImportReportDTO (its base record, carrying the dry-run flag, the row count and the Added, Updated and Unchanged counts), TicketRosterImportResultDTO, the EventIdentifierType alias.
  • Concept, an internal report beside a frozen public contract. [Rubric §9, API & Contract Design] assesses whether a public contract stays stable while internals evolve. The roster reuses the shared ImportReportDTO shape internally, but the wire keeps its own TicketRosterImportResultDTO, because installed clients read totalInFile, not the shared totalRows (TicketRosterImportReport.cs:9-11). ADR-078 mentions this type.
  • Walkthrough
    • Required EventId (:16), required SourceEventName, the TicketLeap Event Name the file carried (:19), required Voided (:22) and Reinstated (:25), and an optional LinkedExistingAccounts (:28).
    • ToResult() (:32-44) copies every count onto the response record, renaming the inherited TotalRows to TotalInFile (:37).
  • Where it's used: built and mapped by ImportTicketRosterHandler (ImportTicketRosterHandler.cs:66-79).

TicketImportRun

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketImportRun.cs:26 · Level 5 · class (sealed)

  • What it is: the aggregate root for one committed roster import: the durable record the background processor applies the roster from in batches, and the progress every replica reads (Processed of Total). One run per event is active at a time (TicketImportRun.cs:9-12).
  • Depends on: AuditableAggregateRootEntity<TIdentifierType>, IAnonymizable, PiiAttribute, TicketRosterImportStatus, TicketRosterImportErrorCodes, Result and Error.
  • Concept introduced, a long-running job as an aggregate. [Rubric §29, Resilience & Business Continuity] assesses whether long work survives a crash. The import is too large for one request, so the commit creates this row and an internal command carrying only the run id; the processor resumes at Processed after any restart (:48). AbandonAfter is 30 minutes (:37), far above a real run and the processor's 5-minute lease, so an expiry backstop can fail a run whose processor died for good without cutting off a slow one (:31-36). ADR-086 mentions this type.
  • Concept, holder data that lives only while the run does. [Rubric §30, Compliance/Privacy/Data Governance]. The staged roster is the run's only holder data and carries [Pii] (:79-80). Every way a run ends (Complete, Fail, Anonymize) clears it, so a finished run keeps counts and an error code, never names (:13-19). The class is deliberately not IAuditedEntity: an audit row of the staged roster would be a second copy of the file the purge could not reach (:20-23, ADR-005).
  • Walkthrough
    • State: EventId, Status, Total, Processed, the outcome counts Added / Updated / Unchanged / Voided / Reinstated / LinkedExistingAccounts, ErrorCode, LastProgressOn (:40-73), and StagedRoster (:80).
    • IsActive is true while Queued or Running (:83); IsAbandonedAt(now) is active and idle for at least AbandonAfter (:88).
    • Create(eventId, total, stagedRoster, now) (:99-119) refuses a default event, a negative total or a blank roster with Ticket.Import.Invalid, else returns a Queued run.
    • RecordBatch(...) (:128-137) moves to Running, advances Processed (capped at Total) and adds the batch's counts, so progress and counts move together.
    • Complete(voided, linkedExistingAccounts, now) (:143-151) sets Succeeded, Processed = Total, records the final counts and clears the roster.
    • Fail(errorCode, now) (:157-169) clears the roster first, then returns false for a run that is no longer active, so a finished run is left alone; otherwise it records Failed and the code.
    • Anonymize() (:176-180) clears the roster idempotently; counts and status stay because they name nobody.
  • Where it's used: created by StartTicketRosterImportHandler, advanced by ProcessTicketRosterImportHandler, expired by ExpireTicketRosterImportHandler; mapped by TicketImportRunConfiguration (migration 20261103150907_AddTicketImportRuns); its [Pii] marking is checked by MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Privacy/PiiConventionTests.cs.

Ticket

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:30 · Level 6 · class (sealed)

  • What it is: the aggregate root for one ticket of an organizer-uploaded TicketLeap roster. It keeps only the whitelisted columns, and exists to invite the ticket holder (BR-270) and to link the ticket to an account (BR-272, BR-273); door admission stays with TicketLeap (Ticket.cs:12-15).
  • Depends on: AuditableAggregateRootEntity<TIdentifierType>, IAnonymizable, IAuditedEntity, PiiAttribute, TicketRosterEntry, TicketInvariants, TicketStatus, TicketLinkMethod, Email, the Identity-owned integration event TicketHolderInvited, and Result. BCL: System.Globalization (:1).
  • Concept, a rich aggregate with guarded transitions. [Rubric §4, DDD] assesses whether invariants live in the aggregate. Every state change is a named method that refuses an illegal transition with a Result or reports a no-op as false, so a re-run never double-applies (the factory and invariant pattern of ADR-129).
  • Concept, erasure that survives a re-upload. [Rubric §30, Compliance/Privacy/Data Governance]. The attendee names, the order email and the barcode carry [Pii] (:57-73), so the audit trail stores them redacted, and the class is IAuditedEntity because a disputed link needs a record of the row before (:16-19, ADR-075). Anonymize overwrites them when the linked account is erased (ADR-005), and an erased ticket then ignores later roster uploads, so re-importing the same file never writes the holder back.
  • Walkthrough
    • Constants: FallbackFirstName = "Ticket" and FallbackLastName = "Holder" for invites that name nobody (:36, :39); AnonymizedBarcodePrefix = "deleted-" (:42); ImportParkedBarcodePrefix = "import-parked-" (:45).
    • State: EventId, SourceEventName, ExternalTicketId (the upsert key), Barcode (the claim key), TicketTypeName, the attendee names, OrderEmail (:48-73); IsAnonymized is derived from the barcode prefix, not stored (:79); then Status, InvitedOn, LinkedUserId, LinkedOn, LinkMethod (:82-94).
    • Create(eventId, sourceEventName, entry) (:114-128) normalizes first (trim every field, lowercase a well-formed email, keep a malformed one trimmed so the invariant refuses it; Normalize, :378-388), then combines the event, source-name and entry invariants, and returns a Live ticket.
    • ApplyRosterEntry(sourceEventName, entry) (:137-164) returns Success(false) for an anonymized ticket (:143-144), validates the normalized entry, and compares by ordinal record equality (:155-156), so a casing change on a name counts as a change. It leaves Status alone.
    • ParkBarcodeForImport() (:174-181) moves the barcode to import-parked-{Id} so two tickets can swap barcodes across batches without the unique (EventId, Barcode) index ever seeing a value twice; never on an erased ticket.
    • Void() (:185-192) and Reinstate() (:196-203) flip Live / Voided and return whether anything moved.
    • MarkInvited(invitedOn) (:212-225) accepts only a Live, unlinked, not yet invited ticket with an order email, else Ticket.NotEligibleForInvite.
    • AnnounceInvitation(eventName, eventStart) (:237-266) raises TicketHolderInvited before the save so the outbox captures it in the same transaction as the InvitedOn stamp (ADR-003), substituting the fallback names for blanks (:257-263).
    • LinkTo(userId, method, linkedOn) (:277-310): relinking to the same account is a no-op success (:285-286); a ticket linked elsewhere is Ticket.LinkedToAnotherAccount (:288-295); a non-Live ticket is Ticket.NotLive (:297-304). Unlink() (:314-323) clears the link.
    • Anonymize() (:337-344) blanks the names, clears the email and sets the barcode to deleted-{Id}, keeping the ticket id and invite stamp so a later upload finds this row instead of creating a fresh ticket that would invite the erased holder again. AttendeeNameMatches (:353-359) and the static NormalizeEmail (:367-374) serve linking.
  • Where it's used: applied by TicketRosterApplier (dry run and committed run), invited by SendTicketInvitesHandler, linked by ClaimTicketHandler, TicketLinker and ExistingAccountLinker, soft-deleted by DeleteTicketRosterHandler, mapped by TicketConfiguration. Pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Domain.Tests/Tickets/TicketTests.cs.

TicketInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketInvariants.cs:12 · Level 6 · class (static)

  • What it is: the bounds and guard methods for Ticket, one place that both the aggregate and the EF mapping read their lengths from.
  • Depends on: CommonInvariants, EmailInvariants, Email, ClaimTicketRequest, TicketRosterEntry, TicketLinkMethod, Result, Error.
  • Concept: the per-aggregate invariants class introduced with CommonInvariants (ADR-068, ADR-129). [Rubric §15, Best Practices & Code Quality] assesses single sources of truth: BarcodeMaxLength is defined as ClaimTicketRequest.BarcodeMaxLength (:21), so the claim request and the stored column cannot disagree, and OrderEmailMaxLength reuses EmailInvariants.MaxLength (:33).
  • Walkthrough
    • Bounds: SourceEventNameMaxLength = 200 (:15), ExternalTicketIdMaxLength = 100 (:18), BarcodeMaxLength (:21), TicketTypeNameMaxLength = 200 (:24), NameMaxLength = 100, which matches the bound Identity's invite consumer applies so a stored name always travels unchanged (:26-30), and OrderEmailMaxLength (:33).
    • EnsureEventIdIsValid (:39-40) and EnsureUserIdIsValid (:113-114) reject a default id; EnsureLinkMethodIsDefined (:120-121) rejects an undefined enum value.
    • EnsureSourceEventNameIsValid (:46-54) requires 1 to 200 characters.
    • EnsureEntryIsValid(entry, source) (:64-107) combines every rule so a caller sees all violations at once: ticket id and barcode required and bounded (the upsert and claim keys), type and names bounded only, and the order email checked by the private EnsureOrderEmailIsValid (:123-137), which accepts null and otherwise requires the length bound and a successful Email.Create.
  • Where it's used: Ticket.Create, ApplyRosterEntry and LinkTo; the lengths feed TicketConfiguration, TicketLeapRosterParser and ClaimTicketRequestValidator.

GetBookmarkedSessionIdsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.GetBookmarkedSessionIds · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/GetBookmarkedSessionIds/GetBookmarkedSessionIdsHandler.cs:12 · Level 8 · class (sealed)

  • What it is: the query handler that answers GetBookmarkedSessionIdsQuery, returning a read-only dictionary mapping each of a user's bookmarked session ids to its bookmark id. This is the lightweight lookup a listing page uses to decide which rows render as bookmarked, and which bookmark id a delete would target.
  • Depends on: IUnitOfWork (constructor-injected, GetBookmarkedSessionIdsHandler.cs:12-13), the UserSessionBookmark aggregate it reads, the IReadRepository<TEntity, TIdentifierType> it obtains from it, and Result. It implements IQueryHandler<in TQuery, TResult>.
  • Concept, a projection read that never materializes the entity. [Rubric §12, Performance & Scalability] assesses whether reads pull only the columns they need; this handler projects, so the SQL selects two columns rather than whole rows. It resolves a read repository through GetReadRepository (GetBookmarkedSessionIdsHandler.cs:20) rather than the writable one, which signals intent and is also the DI-safe way to obtain a repository: injecting IRepository<TEntity, TIdentifierType> directly into a handler is the trap the persistence chapter warns about. [Rubric §6, CQRS & Event-Driven] and [Rubric §5, Vertical Slice]: the handler sits beside its query in the same use-case folder and returns a Result rather than throwing.
  • Walkthrough
    • The primary constructor injects IUnitOfWork (GetBookmarkedSessionIdsHandler.cs:12-13); the class closes the query-handler interface over Result<IReadOnlyDictionary<SessionIdentifierType, UserSessionBookmarkIdentifierType>> (:13).
    • HandleAsync (GetBookmarkedSessionIdsHandler.cs:16-18) obtains the read repository for UserSessionBookmark (line 20), then calls GetProjectedAsync with select: b => new { b.SessionId, b.Id } and where: b => b.UserId == query.UserId (:22-25), so only the two ids for that user come back. The projection target is an anonymous type here rather than a named record, because it is consumed on the very next line.
    • It materializes the pairs into a dictionary keyed by SessionId with value Id (GetBookmarkedSessionIdsHandler.cs:27) and wraps it in Result.Success<IReadOnlyDictionary<...>> (line 29). There is no failure branch: this read cannot fail, so the Result is always a success.
  • Why it's built this way: the caller only needs "is this session bookmarked, and under which bookmark id", so projecting to a two-field shape and returning a dictionary avoids loading full aggregates and gives O(1) per-row lookups while rendering. The doc comment (GetBookmarkedSessionIdsHandler.cs:8-11) names the consumer explicitly: the unified Sessions page's per-row star state. Soft-deleted bookmarks are excluded by the global query filter, so a removed bookmark simply stops appearing without a predicate here.
  • Where it's used: dispatched from BookmarksController's GET /api/bookmarks/session-ids action (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:153-155) through the IQueryHandler<in TQuery, TResult> pipeline. Covered by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/UserSessionBookmarks/UseCases/GetBookmarkedSessionIdsHandlerTests.cs:13, which asserts the read repository is the one requested.
  • Caveats / not-in-source: the anonymous projection target is why that test verifies the repository call rather than the returned map; the test's own comment records that a mocked GetProjectedAsync cannot produce an anonymous type (GetBookmarkedSessionIdsHandlerTests.cs:20-21).

BookmarkCountService

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/Services/BookmarkCountService.cs:11 · Level 8 · class (sealed)

  • What it is: the in-process implementation of the cross-module IBookmarkCountService, answering "how many active bookmarks does each of these sessions have?" for the Conference module in one batched call. It has a single method, GetBookmarkCountsForSessionsAsync (BookmarkCountService.cs:14-36).
  • Depends on: IUnitOfWork, UserSessionBookmark, IBookmarkCountService. Externals: LINQ and System.Collections.Generic.
  • Concept, the cross-module read boundary. [Rubric §7, Microservices Readiness] assesses whether modules talk through explicit, extractable contracts rather than direct references. Conference must show a per-session bookmark count but must not reference Engagement's domain; it depends only on IBookmarkCountService, which lives in MMCA.ADC.Engagement.Shared. In process this class satisfies that contract; once Engagement runs as its own service, BookmarkCountServiceGrpcAdapter satisfies it over the wire and no Conference call site changes. This is one direction of the bidirectional Conference/Engagement pair (Engagement in turn calls Conference's ISessionBookmarkValidationService).
  • Concept introduced, the batch method that keeps the caller from fanning out. [Rubric §12, Performance and Scalability] assesses whether read paths avoid N+1 round trips. The conference-day session list needs a count per session, and asking one session at a time would issue one COUNT per row, so the contract offers only the batched shape. GetBookmarkCountsForSessionsAsync pushes one grouped COUNT for the whole set, "so the caller never fans out per session" as the comment puts it (BookmarkCountService.cs:26-30), and then guarantees a complete result map, so the caller never has to distinguish "zero bookmarks" from "session missing from the response" (:32-35).
  • Walkthrough
    • The primary constructor injects only IUnitOfWork (:11). Note that no repository is constructor-injected: repositories are resolved per call off the unit of work, which is the framework's rule.
    • GetBookmarkCountsForSessionsAsync(sessionIds, cancellationToken) (:14-36): guards null with ArgumentNullException.ThrowIfNull (:18), short-circuits an empty request to an empty dictionary without touching the database (:19-22), then takes the read repository via unitOfWork.GetReadRepository<UserSessionBookmark, UserSessionBookmarkIdentifierType>() (:24) and calls its CountByAsync(b => b.SessionId, b => sessionIds.Contains(b.SessionId), cancellationToken) (:27-30), which returns the grouped counts per session. The count runs in the database with no rows materialized, and the soft-delete global query filter means only active bookmarks count. The final projection walks the requested ids Distinct() and builds the dictionary, using GetValueOrDefault to fill a 0 for any session the grouped result omitted (:33-35).
    • The grouped count lives behind the repository's CountByAsync, so this Application-layer class composes no IQueryable and needs no EF Core dependency or executor abstraction of its own. [Rubric §3, Clean Architecture].
  • Why it's built this way: exposing one purpose-built count method (rather than letting Conference query bookmarks) keeps the read cheap and the coupling to a single stable signature, which is what makes the gRPC swap a thin adapter. The batch method is paired with a schema decision: UserSessionBookmarkConfiguration adds a SessionId-leading index precisely because counting by SessionId alone cannot seek the (UserId, SessionId) composite (UserSessionBookmarkConfiguration.cs:35-37).
  • Where it's used: registered TryAddScoped by the Engagement Application DI (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:39); wrapped for the wire by BookmarkCountsGrpcService; consumed by Conference's GetSessionBookmarkCountsHandler (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Speakers/UseCases/GetSessionBookmarkCounts/GetSessionBookmarkCountsHandler.cs:17). In the extracted Conference host the Engagement module is never discovered, so this class is not registered there; the Contracts DI helper registers BookmarkCountServiceGrpcAdapter with Replace as the only IBookmarkCountService binding (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:32-36, :46). Pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/UserSessionBookmarks/Services/BookmarkCountServiceTests.cs.

ImportTicketRosterHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ImportTicketRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/ImportTicketRosterHandler.cs:19 · Level 8 · class (sealed)

  • What it is: the handler for ImportTicketRosterCommand. It dry-runs one roster upload over an event's tickets through the same TicketRosterApplier rules the committed import run applies (upsert on (EventId, ExternalTicketId), void the source event's tickets the file no longer contains, reinstate voided tickets that come back) and returns the counts (ImportTicketRosterHandler.cs:11-18).
  • Depends on: IUnitOfWork, ITicketRosterParser and Conference's IEventLiveValidationService (primary constructor, :19-22); it implements ICommandHandler<in TCommand, TResult> over Result<TicketRosterImportResultDTO>, reads Ticket, and uses TicketRosterApplier, TicketRosterCounts and TicketRosterImportReport.
  • Concept, one rule set for preview and commit. [Rubric §14, Testability] and [Rubric §15, Best Practices & Code Quality]: the preview is only trustworthy if it runs the commit's code. The handler holds no roster rules of its own; it calls the shared applier with addNew: false (:55-62), which the applier documents as "false for a dry run" (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketRosterApplier.cs:81), and never saves, so its counts are the counts the committed run reports (ImportTicketRosterHandler.cs:15-16). [Rubric §7, Microservices Readiness]: the event-existence check crosses to Conference through an interface, not a join (ADR-006).
  • Walkthrough
    • Guards a null command (:29), then asks Conference for the event; a NotFound surfaces as-is (:31-34).
    • Parses the CSV through ITicketRosterParser and returns its errors on failure (:36-38).
    • Loads every ticket of the event with ignoreQueryFilters: true (:42-47), because an erased holder's anonymized ticket survives "Delete roster" as a soft-deleted tombstone and a re-upload must not recreate it (ADR-005, :40-41).
    • Builds the applier over those rows (:48) and refuses a file whose barcodes conflict (:50-52).
    • Applies the entries into a fresh TicketRosterCounts (:54-64), then builds a TicketRosterImportReport with DryRun = true and Voided = applier.VoidMissing(roster) (:66-77) and returns report.ToResult() (:79).
  • Where it's used: injected into TicketRosterImportController and called on the dryRun branch of POST /tickets/roster (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:37, :102-108); the commit branch goes to StartTicketRosterImportHandler instead. Pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/ImportTicketRosterHandlerTests.cs.
  • Caveats / not-in-source: the class doc says the handler "walks untracked copies" (:15); whether GetAllAsync returns tracked or untracked entities is decided by the repository implementation, not this file. Not determinable from source here: whether any pipeline decorator saves the unit of work after this command.

GetUserBookmarksHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.GetUserBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/GetUserBookmarks/GetUserBookmarksHandler.cs:17 · Level 9 · class (sealed)

  • What it is: the query handler for GetUserBookmarksQuery. It returns a page of a user's bookmarked sessions as DTOs, newest first, with an optional event filter resolved across the module boundary.
  • Depends on: IUnitOfWork, the cross-module ISessionBookmarkValidationService, IQueryableExecutor, and UserSessionBookmarkDTOMapper (all primary-constructor injected, GetUserBookmarksHandler.cs:17-21), plus PagingMath. It reads the UserSessionBookmark aggregate, produces UserSessionBookmarkDTOs, and returns a PagedCollectionResult<T> carrying PaginationMetadata. Externals: System.Linq.Expressions (:1).
  • Concept, server-side paging plus a cross-module lookup instead of a join. [Rubric §12, Performance & Scalability] assesses whether counting, ordering, and paging happen in the database rather than in memory; every step here does. [Rubric §7, Microservices Readiness] assesses cross-service reads: the event filter cannot be a SQL join because sessions live in the Conference database (ADR-006), so the handler fetches the event's session ids through ISessionBookmarkValidationService (a gRPC client once extracted, ADR-007) and filters on that id set. [Rubric §29, Resilience & Business Continuity] shows in how a Conference outage is handled: the code comment (GetUserBookmarksHandler.cs:40-42) states that a failure across the gRPC boundary propagates as a Result failure "so the request degrades gracefully instead of a raw 500".
  • Walkthrough
    • HandleAsync (GetUserBookmarksHandler.cs:24-26) first clamps the page: var window = PagingMath.Clamp(query.PageNumber, query.PageSize, 500) (line 31) is the BR-11 cap mechanism, and the comment above it (:28-30) records that it also floors a non-positive page number or size and range-checks the offset in 64-bit. The result is a PageWindow (MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/PageWindow.cs:23, a readonly record struct of PageNumber, PageSize, Skip, Take), which the handler keeps whole rather than deconstructing.
    • It resolves the read repository via GetReadRepository (line 33) and declares an Expression<Func<UserSessionBookmark, bool>> filter (line 36) so the predicate is built once and used by both the count and the page query.
    • When query.EventId.HasValue (line 38) it calls sessionValidationService.GetSessionIdsByEventAsync(...) across the module boundary (:43-44), unwraps the result with TryGetValue(out var sessionIds) and returns Result.Failure with the propagated sessionIdsResult.Errors when there is no value (:45-46), materializes the unwrapped sessionIds into a list (line 48, no null-forgiving Value! access), and filters bookmarks to that user and that session-id set (line 50, BR-58). Otherwise the filter is just b => b.UserId == query.UserId (line 54).
    • It counts server-side with bookmarkRepo.CountAsync(filter, cancellationToken) (line 58, translated to SQL COUNT), then orders and pages server-side by pushing TableNoTracking.Where(filter).OrderByDescending(b => b.CreatedOn).ThenByDescending(b => b.Id).Skip(window.Skip).Take(window.Take) through IQueryableExecutor.ToListAsync (:63-70, translated to SQL ORDER BY plus OFFSET/FETCH). The Id tie-break is load-bearing and commented as such (:60-62): OFFSET/FETCH needs a total row order, or bookmarks created in the same instant "would otherwise repeat or vanish across pages".
    • It maps the page with UserSessionBookmarkDTOMapper.MapToDTOs (line 72), builds new PaginationMetadata(totalCount, window.PageSize, window.PageNumber) (line 73) from the same clamped window that drove the read, so the metadata describes what was actually returned (and window.PageSize stays the clamped request even when Take is the 0 sentinel for an unreachable offset, MMCA.Common/Source/Core/MMCA.Common.Application/Services/Query/PagingMath.cs:44), and returns Result.Success(new PagedCollectionResult<UserSessionBookmarkDTO>(dtos, metadata)) (line 75).
  • Why it's built this way: pushing count, order, skip, and take into the database keeps the read bounded and cheap even for a user with many bookmarks; resolving the event filter through a service interface (never a cross-database foreign key) is what makes the module independently deployable (ADR-006 and ADR-007). TableNoTracking keeps the paged read off the change tracker, and the whole read still honors the soft-delete query filter, so a deleted bookmark simply is not in the page or the count.
  • Where it's used: dispatched from BookmarksController's GET /api/bookmarks action (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:100-102), whose ownership is guarded by the OwnerOrAdminFilter configured for the module (BookmarksController.cs:91, ADR-033). Pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/UserSessionBookmarks/UseCases/GetUserBookmarksHandlerTests.cs, which covers the event-filter path (:140), the failure propagation when the session lookup fails (:161), the over-large page size (:199, :310), the page number beyond the reachable offset (:230), and the negative page number and page size (:250, :269).
  • Caveats / not-in-source: whether ISessionBookmarkValidationService resolves to an in-process implementation or a gRPC client depends on the host composition, not on this file. This handler now takes the read repository via GetReadRepository (GetUserBookmarksHandler.cs:33), matching GetBookmarkedSessionIdsHandler; the read itself still goes through TableNoTracking.

AssemblyReference

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:5 · Level 0 · class (static)

  • What it is: the assembly-marker type for the Engagement Infrastructure assembly: a stable typeof(...) handle on the assembly that holds the module's EF entity configurations, so tooling and tests never hard-code an assembly name string.
  • Depends on: System.Reflection only (AssemblyReference.cs:1). No first-party types.
  • Concept: the assembly-marker pattern is taught once under AssemblyReference, ClassReference in the Conference Domain chapter, and the module system chapter explains why every layer of every module ships the pair. What is specific to this layer is which assembly the handle names: the one that carries the Engagement entity configurations (for example CheckInConfiguration), which is exactly what the migrations tooling and the persistence fitness tests need to locate.
  • Walkthrough: two public static readonly fields. Assembly = typeof(AssemblyReference).Assembly (AssemblyReference.cs:7), and AssemblyName (:8), the simple name with a ?? string.Empty fallback so the field is never null.
  • Why it's built this way: a typeof() handle survives an assembly rename that a literal name would not, so a rename breaks the build at the call site instead of silently dropping the entity configurations from a scaffolded model.
  • Where it's used: the Engagement design-time migrations factory feeds it to EF model building with options.AddConfigurationAssembly(typeof(MMCA.ADC.Engagement.Infrastructure.AssemblyReference).Assembly) (MMCA.ADC/Source/Hosting/MMCA.ADC.Migrations.SqlServer.Engagement/DesignTimeSQLServerDbContextFactory.cs:37), which is how dotnet ef migrations add for ADC_Engagement sees this layer's configurations. The architecture tier builds the Engagement model from the same handle in DeleteBehaviorConventionTests (MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Domain/DeleteBehaviorConventionTests.cs:86-87). No other reference in MMCA.ADC/Source names this layer's marker.
  • Caveats / not-in-source: how the running Engagement service host discovers these configurations at startup (whether through this marker or through module-assembly scanning in MMCA.Common) is not visible from this file: not determinable from source within this unit's reads.

EngagementPermissions

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Authorization · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Authorization/EngagementPermissions.cs:9 · Level 0 · class (static)

  • What it is: the module's capability vocabulary: four permission strings plus an All list. Endpoints are gated on these capabilities rather than on role names, so "who can do what" is decided in one grant map instead of being spelled out across controllers.
  • Depends on: nothing first-party; only IReadOnlyList<string> and a collection expression from the BCL. The consumers are elsewhere: HasPermissionAttribute on the controllers, EngagementPermissionGrants for the role binding, and IPermissionRegistry behind the grants.
  • Concept, permission-based authorization instead of role checks. The framework machinery (the attribute, the registry, Grant) is taught under PermissionRegistry and decided in ADR-020; the module-specific idea worth teaching here is the shape of the vocabulary. The class doc (EngagementPermissions.cs:4-7) makes two commitments: endpoints require capabilities, not roles, with the role-to-permission binding declared in EngagementPermissionGrants, and the values are stable string identifiers because they may end up in tokens or logs. That second point is why these are not an enum: the wire and the log are part of the contract. [Rubric §11, Security] assesses whether authorization is expressed as least-privilege capability rather than as an identity shortcut, and whether the grant surface is small enough to audit; four constants and one Grant call is that surface. [Rubric §9, API and Contract Design] applies to the naming: engagement:tickets:manage is module:resource:action, so a permission is self-describing wherever it surfaces. [Rubric §15, Best Practices & Code Quality] shows in All: adding a fifth capability grants it to organizers automatically, because the grant map spreads the list rather than enumerating members.
  • Walkthrough: four constants and a derived list. Each constant's doc comment records not just what it grants but what deliberately does not need it, which is the more useful half.
    • LiveManage = "engagement:live:manage" (EngagementPermissions.cs:17): the narrowest of the four. It gates only reading the event-wide live poll manage list, every poll of an event in any status. The comment (:11-16) records what it deliberately does not gate: authoring, opening, closing and deleting polls and moderating session Q&A are granted by the handlers to the Organizer role and to a session's assigned speakers for that session (BR-236). The controller states the same boundary from the other side: the per-session manage list is "Deliberately NOT behind" this permission so assigned speakers get the real list rather than an organizer-only 403 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/LivePollsController.cs:172-177).
    • CheckInManage = "engagement:checkin:manage" (:24): scan an attendee badge, record a manual check-in, read the attendance rollup. The comment (:19-23) records why fetching your own badge is authenticated-only: an attendee needs no capability to see their own QR.
    • PointsViewOverview = "engagement:points:view-overview" (:31): read the organizer points rollup (participation, payouts per activity, recent activity). Again the comment (:26-30) states the boundary: an attendee's own points and the opt-in leaderboard are authenticated-only, and only the organizer rollup is gated.
    • TicketsManage = "engagement:tickets:manage" (:38): manage an event's ticket roster, meaning upload and delete the TicketLeap roster, send the ticket-holder invites, link existing accounts, and read the roster summary and insights (BR-269). The comment (:33-37) keeps the attendee side open: claiming a ticket by barcode and reading your own tickets are authenticated-only.
    • All (:40-47) is a public static IReadOnlyList<string> (:41) initialized from a collection expression listing the four constants. It is a get-only property over an immutable-facing interface, so a caller can enumerate it but not append to it.
  • Why it's built this way: the four-capability split follows the same rule as the flag list, but along a different axis: a capability exists where an organizer-only action would otherwise have to be spelled as a role check inside a controller. Everything an attendee does to their own data stays on plain authenticated access plus the ownership filter, which is why there is no engagement:bookmarks:* capability at all: bookmark ownership is enforced by OwnerOrAdminFilter (ADR-033), configured with ADC's ownership vocabulary in the module's own API registration (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:44-55, Organizer as the bypass role at :54), not by a permission. Where speakers need rights, the rule lives in the handlers (BR-236), which is why LiveManage gates a single organizer read.
  • Where it's used: granted by EngagementPermissionGrants.Apply, which AddModuleEngagementAPI registers with services.AddPermissions(EngagementPermissionGrants.Apply) (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:60) and the Identity service's TokenPermissionGrants also calls (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Authorization/TokenPermissionGrants.cs:57). Consumed as attribute arguments at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:122 (PointsViewOverview), LivePollsController.cs:159 (LiveManage), CheckInsController.cs:154, :129, :213 (CheckInManage), and TicketsController.cs:65, :94, :170, :193, :217, :243, :294 plus TicketRosterImportController.cs:60, :125 (TicketsManage). Outside the module, the Identity host's verified-user lookup refuses a caller that holds TicketsManage neither as a claim nor through its roles (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Grpc/VerifiedUserLookupGrpcService.cs:46-47). Pinned by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Authorization/EngagementPermissionGrantsTests.cs, which builds the real registry from AddModuleEngagementAPI() (:27) and asserts that organizers hold every capability (:32), that "Admin" holds none because it is not an ADC role (:49), and that attendees (:61) and content editors (:73) hold none.
  • Caveats / not-in-source: whether a given caller actually presents the Organizer role depends on token issuance in the Identity module, not on anything in this file. The poll and Q&A moderation actions that LiveManage does not gate live on SessionQuestionsController and the live-poll controllers, covered in the live-layer chapter.

CheckInErrorCodes

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInErrorCodes.cs:7 · Level 0 · static class

  • What it is: the three stable error codes the check-in handlers emit and the self-service QR landing pages branch on, declared once in the Shared project that both sides reference.
  • Depends on: nothing (three const string fields). Consumed together with SelfCheckInOutcome<TResult>, which carries the code back from the transport layer.
  • Concept introduced, the error code as a client-facing contract. [Rubric §9, API & Contract Design] assesses whether failures are expressed in a form a client can branch on. HTTP status codes are not enough here: "nothing is scheduled in this room" is a not-found error (RecordRoomCheckInHandler.cs:164-165), so a page choosing its state from the status alone cannot tell it apart from a feature that is off or a target that does not exist. A stable machine-readable code in the ProblemDetails body is the distinguishing signal, and it must never be a human-readable message, because that message is localized and would break the branch in any non-English locale. The placement is the second half of the contract. The type doc (CheckInErrorCodes.cs:3-6) says the codes are shared by the handlers that emit them and the pages that read them "so a rename on one side fails the build on the other": one declaration site means neither a handler nor a page spells a code out inline, so a typo is a compile error rather than a silently unreachable branch.
  • Walkthrough (CheckInErrorCodes.cs:7-23):
    • EventNotPublished = "CheckIns.EventNotPublished" (:10): the owning event is not published yet, so nothing is being recorded for it.
    • NoCurrentSession = "CheckIns.NoCurrentSession" (:16): nothing is scheduled in the scanned room at this instant. The member comment (:12-15) records the security decision folded into it: an unknown room answers the same way by design, so the state never confirms which room identifiers exist.
    • RoomCodeRejected = "CheckIns.RoomCodeRejected" (:22): the scanned room code is missing or no longer current because an organizer issued a new one (:18-21), so the attendee is asked to scan the code posted at the room door.
  • Why it's built this way: the deliberate absence is as informative as the presence. There is no constant for "feature disabled" or "unknown target": those fall through to the pages' generic unavailable state (RoomCheckIn.razor.cs:139, SponsorVisit.razor.cs:123). Refusing to name them is what keeps a printed code from confirming which sponsors or rooms exist (ADR-072).
  • Where it's used: emitted by CheckInProcessor for the shared not-published failure (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:30) and by RecordRoomCheckInHandler for a rejected room code and an empty room (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:169, :165). Read by RoomCheckIn, which maps all three codes onto page states (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Rooms/RoomCheckIn.razor.cs:136-138), and by SponsorVisit, which maps only EventNotPublished (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Sponsors/SponsorVisit.razor.cs:123), since a sponsor visit has no room code.
  • Caveats / not-in-source: a code shared at compile time still crosses the wire as a string, so a client built against an older Shared assembly sees a new code as unknown and falls into its generic state. That degradation is a consequence of the pattern-match fallback (RoomCheckIn.razor.cs:159), not something a test pins.

CheckInResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInResultDTO.cs:8 · Level 0 · record class

  • What it is: the response body of both organizer check-in endpoints, who the badge resolved to, whether this was a repeat, and when the check-in was recorded.
  • Depends on: the UserIdentifierType alias (module-specific global using, see primer §2). Externals: BCL DateTimeOffset.
  • Concept, a repeat is a success, not a conflict. [Rubric §9, API & Contract Design] assesses how a write's idempotent semantics are expressed to clients. The obvious design answers 409 on a second scan; this one answers 200 with AlreadyCheckedIn = true (CheckInResultDTO.cs:3-7). The reason is operational: the organizer scanning a lanyard needs the attendee's identity on screen either way, and at a door a second scan is a normal event rather than a client error to correct. Encoding the repeat as data on a success means the calling UI has one code path, and the status code stops carrying business meaning. CheckInsController states the same rule at its POST (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:94-145).
  • Walkthrough (CheckInResultDTO.cs:8-18): three required init members. UserId (line 11) is the attendee the credential resolved to, which is the whole point of the scan response, since the organizer scans an opaque code and needs a person back. AlreadyCheckedIn (line 14) is the repeat flag. CheckedInOn (line 17) is the recorded time and, on a repeat, deliberately the original time rather than "now", so the UI can say "already checked in at ...". CheckInProcessor fills it from the existing row on the repeat branch (.../CheckIns/Services/CheckInProcessor.cs:62-67) and from the new entity otherwise (:78-83).
  • Why it's built this way: required + init makes every field non-optional at construction and the value immutable afterwards, so no handler can return a partially filled outcome. The type carries no session or event id because the caller supplied those; only the facts the server discovered travel back.
  • Where it's used: returned by CheckInAttendeeHandler and ManualCheckInHandler through CheckInProcessor, surfaced by CheckInsController on POST and POST manual (CheckInsController.cs:148, :89), and consumed client-side by ICheckInUIService/CheckInService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/CheckIns/ICheckInUIService.cs:27, :33) into CheckInScan's result list (CheckInScan.razor.cs:217).

CheckInScope

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInScope.cs:11 · Level 0 · enum

  • What it is: what a single check-in row attests to, arrival at the event, attendance of one session, or a visit to one sponsor booth.
  • Depends on: nothing. It is the discriminator every other type in this family branches on.
  • Concept, one aggregate with a scope discriminator, and why the numbers are frozen. [Rubric §4, DDD] assesses whether the model reflects the domain's real distinctions rather than inventing tables per surface, and [Rubric §8, Data Architecture] how storage encodes those distinctions. The three scopes share a row shape, an idempotency rule and an attendance query, and differ only in which target is required, so they live on one CheckIn aggregate rather than three (CheckInScope.cs:4-5). The cost is one persistence constraint that is easy to miss: the uniqueness rules are filtered unique indexes, and an index filter is SQL, so it cannot read the enum. CheckInConfiguration therefore names the numbers literally, "[Scope] = 0", "[Scope] = 1", "[Scope] = 2" (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:25-27), and pairs each with its target: unique on (UserId, EventId) for the event scope (:50), on (UserId, SessionId) for the session scope (:55), on (UserId, SponsorId) for the sponsor scope (:61). That is why the type doc calls the numbers load-bearing (CheckInScope.cs:7-8): a scope is added, never renumbered, or the shipped indexes silently start guarding the wrong rows.
  • Walkthrough (CheckInScope.cs:11-27): Event = 0 (line 17), arrival at the event itself, documented (:13-16) as the optional info-desk activation scan the organizer scan page offers, which earns the event check-in points; Session = 1 (20), the scope the conference-day scanning flow uses; Sponsor = 2 (26), a booth visit recorded by the attendee themselves after scanning a printed deep-link QR, which is the one scope where the recording user and the visiting user are the same person (:22-25).
  • Why it's built this way: the conference runs door and arrival check-in through TicketLeap, so Event is deliberately not a door process here, a point CheckInsController repeats where a reader is most likely to assume otherwise (CheckInsController.cs:33-35). Event is instead an opt-in activation scan at the info desk: CheckInScan offers it beside Session (CheckInScan.razor:50-51), and the points handler turns an Event-scoped check-in into the event check-in award (AttendeeCheckedInPointsHandler.cs:122). Keeping the activation scan on the same aggregate costs one number and keeps every check-in behind one idempotency rule.
  • Where it's used: on the CheckIn entity and in every predicate that finds an existing row (CheckInProcessor.cs:231-246, which routes each scope to its own same-row predicate); in the attendee-driven writes, where RecordRoomCheckInHandler records an ordinary Session row (.cs:112) and RecordSponsorVisitHandler a Sponsor row (.cs:81); in the request DTOs CheckInAttendeeRequest and ManualCheckInRequest; in the attendance query (GetAttendanceStatsHandler.cs:29, :34); and as the toggle value on CheckInScan, which offers only Session and Event (CheckInScan.razor:50-51, defaulting to Session at CheckInScan.razor.cs:68), since a sponsor visit is self-recorded and never scanned by an organizer.
  • Caveats / not-in-source: the enum never travels on the integration event; see CheckInScopeNames for the wire form and why. The CheckInsController class doc still describes Event scope as kept "for a future info-desk or points-activation use" (CheckInsController.cs:34-35), while the enum doc (CheckInScope.cs:13-16) and the scan page treat it as a live, optional activation scan; the enum doc is the one that matches the running UI.

CheckInSettings

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInSettings.cs:11 · Level 0 · sealed class

  • What it is: the module's check-in policy options, bound from the "CheckIns" configuration section. Today it holds exactly one knob, the room self check-in grace window.
  • Depends on: no first-party types. Externals: the options pattern (Microsoft.Extensions.Options, bound at the host).
  • Concept, the options class as a policy boundary. [Rubric §17, DevOps & Deployment] assesses whether configuration is typed and injected rather than read ad hoc, and [Rubric §7, Microservices Readiness] whether a module owns its own policy. Both are visible in one decision here: the grace window lives in Engagement, not Conference. Conference answers "which session is this room hosting"; this module decides "how early does that count" and passes its own number into the cross-module call (CheckInSettings.cs:6-9, and RecordRoomCheckInHandler.cs:48-52). Had the number lived in Conference, retuning check-in behavior would mean redeploying a service that has no stake in it.
  • Walkthrough (CheckInSettings.cs:11-22): SectionName (line 14) is the const "CheckIns", kept next to the type so the binding call cannot mistype it. RoomCheckInGraceMinutes (line 21) is an init-only int defaulting to 15, with the rationale in its own doc comment: attendees scan while the previous talk is clearing out, so a zero-grace window would reject the whole pre-session queue.
  • Why it's built this way: the binding is deliberately not ValidateOnStart. The Engagement service host states the reason inline: a missing "CheckIns" section binds the grace window to a working default, which is not a misconfiguration worth refusing to boot over mid-conference (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:165-170). The default living on the property, rather than in an appsettings file, is what makes that stance safe. [Rubric §29, Resilience & Business Continuity]: the failure mode of bad configuration here is a slightly wrong window, not a dead host.
  • Where it's used: registered with services.AddOptions<CheckInSettings>().Bind(...) (Program.cs:169-170) and injected as IOptions<CheckInSettings> into RecordRoomCheckInHandler (.cs:28), which passes settings.Value.RoomCheckInGraceMinutes to IEventLiveValidationService.GetCurrentRoomSessionInfoAsync (.cs:51-53). No other handler reads it.
  • Caveats / not-in-source: covered by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Shared.Tests/CheckIns/CheckInSettingsTests.cs. Whether a deployed environment overrides the 15-minute default is a configuration fact, not a source fact: not determinable from this file.

ClassReference

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/AssemblyReference.cs:11 · Level 0 · class

  • What it is: an empty, non-static marker class declared beside this layer's AssemblyReference (AssemblyReference.cs:5), a handle for registration APIs that take a type rather than an Assembly.
  • Depends on: nothing.
  • Concept: cross-reference ClassReference, where the pattern is introduced. It is non-static because a C# static class is not a legal generic type argument, which is the shape ScanModuleApplicationServices<ClassReference>() needs.
  • Walkthrough: the whole declaration is one line, public class ClassReference { } (AssemblyReference.cs:11).
  • Why it's built this way: shipping the pair in every layer keeps the layer-parallel convention uniform, so any layer can be handed to a generic type-keyed scanner without adding a type later.
  • Where it's used: the Infrastructure ClassReference has no call site in MMCA.ADC/Source today. The consumed Engagement sibling is the Application layer's, at services.ScanModuleApplicationServices<ClassReference>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92); this layer's DependencyInjection registers its services explicitly instead.
  • Caveats / not-in-source: whether an architecture rule requires the pair in every project is not visible from this file: not determinable from source within this unit's reads.

SessionAttendanceDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Attendance · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Attendance/SessionAttendanceDTO.cs:6 · Level 0 · record class

  • What it is: one row of the attendance rollup, a session and how many attendees are checked in to it.
  • Depends on: the SessionIdentifierType alias. Externals: none.
  • Concept: a leaf row type of a composed read model; the rollup concept itself is taught at AttendanceStatsDTO. [Rubric §9, API & Contract Design]: the row carries an identifier and a count, no session title, so the reporting surface joins names itself rather than making the Engagement service reach into Conference for display text on every rollup.
  • Walkthrough (SessionAttendanceDTO.cs:6-13): two required init members, SessionId (line 9) and Count (line 12). Rows are produced by grouping a SessionId-only projection in memory and ordering by session identifier (GetAttendanceStatsHandler.cs:37-44), which is why AttendanceStatsDTO documents the list as ordered by session identifier.
  • Where it's used: only inside AttendanceStatsDTO.SessionAttendance; the OrganizerAttendance page turns the list into display rows via BuildSessionRowsAsync (.../UI/Pages/CheckIn/OrganizerAttendance.razor.cs:75), which is where session titles are attached (SessionAttendanceRow).
  • Caveats / not-in-source: sessions with zero check-ins never appear, since the projection only sees recorded rows.

BadgePayload

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Badges · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Badges/BadgePayload.cs:12 · Level 0 · static class

  • What it is: the one definition of what a badge QR code contains, a namespaced prefix plus an opaque credential, shared by the display side that encodes it and the check-in side that decodes it.
  • Depends on: no first-party types. Externals: BCL Guid, CultureInfo.InvariantCulture, and [NotNullWhen(true)] from System.Diagnostics.CodeAnalysis (BadgePayload.cs:1-2).
  • Concept, the shared wire format as code, not convention. [Rubric §9, API & Contract Design] assesses whether a payload contract is stated once and enforced, rather than re-implemented per caller. Two independent surfaces touch this format, the attendee's badge page (which builds the string it renders as a QR) and the organizer's scan path (which parses whatever the camera read), and they live in different layers. Putting the prefix and both directions in one static class means neither can drift: the encoder cannot invent a prefix the decoder does not strip. [Rubric §11, Security] assesses whether untrusted input is validated at the boundary and whether payloads leak more than they must. Both apply here. The payload is deliberately opaque: it carries a credential, never a user id, a name or an email, so a photographed badge tells the photographer nothing, and the server remains the sole authority on which attendee a credential belongs to (BadgePayload.cs:6-11). Scanned text is treated as hostile: parsing is Try-shaped and every ill-formed input returns false rather than throwing (BadgePayload.cs:22-29).
  • Walkthrough:
    • Prefix (line 15) is the const "mmca-adc:badge:". Its job is namespacing: a scanner pointed at a conference lanyard also sees vendor QRs, Wi-Fi codes and session deep links, and the prefix is what tells this one apart.
    • Format(Guid credential) (line 20) concatenates the prefix with the credential in the "D" format under CultureInfo.InvariantCulture, so the encoded text is byte-identical regardless of the device's locale.
    • TryExtractCredential(string? payload, out Guid credential) (lines 30-46) is the decoder and the guard in one. It zeroes the out parameter first (32), rejects null/blank (33-36), trims (38), strips the prefix case-insensitively when present (39-42), and finally requires both a parseable Guid and a non-empty one (44-45). Two details are load-bearing. The prefix is optional on the way in, so an organizer can type a bare credential when a camera fails, and credential != Guid.Empty closes the hole where the literal all-zeros GUID would otherwise parse as a valid badge.
  • Why it's built this way: a badge has to survive a printed lanyard, a phone screenshot and a hand-typed fallback, so the format is plain text with one prefix rather than a signed or encrypted token. The security posture is that the credential itself is the only secret, and the server checks it; the accepted trade-off (a badge image is shareable) is the same one the sponsor deep link documents at RecordSponsorVisitHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:27-34).
  • Where it's used: MyBadge renders BadgePayload.Format(badge.Credential) into its QR (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/MyBadge.razor.cs:70); CheckInScan calls TryExtractCredential to reject unrelated codes before it spends a round trip (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:251); and CheckInAttendeeHandler calls the same method server-side on the value that actually arrives (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/CheckInAttendee/CheckInAttendeeHandler.cs:43). The client check is a UX shortcut; the server check is the one that counts.
  • Caveats / not-in-source: nothing in the payload is signed or expiring, so replay protection comes entirely from the idempotency rule downstream (see CheckInProcessor) and from the organizer holding the scanner. Covered by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Shared.Tests/CheckIns/BadgePayloadTests.cs.

MyBadgeDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Badges · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Badges/MyBadgeDTO.cs:7 · Level 0 · record class

  • What it is: the caller's own badge as the API returns it, a single opaque credential and nothing else.
  • Depends on: no first-party types. Externals: BCL Guid.
  • Concept, minimum disclosure by shape. [Rubric §11, Security] assesses whether a response carries only what the caller needs, and [Rubric §30, Compliance/Privacy/Data Governance] whether personal data is kept out of artifacts that get photographed and shared. A badge QR is printed, screenshotted and held up to strangers' cameras, so the DTO deliberately holds no name, no email and no user id (MyBadgeDTO.cs:3-6). The QR is built client-side from this credential by BadgePayload.Format, so the resolution from credential to attendee happens only on the server. The endpoint reinforces the same rule from the other side: the identity comes from the token, never the request, so no caller can ask for someone else's credential (CheckInsController.cs:42-44).
  • Walkthrough (MyBadgeDTO.cs:7-11): one required init member, Credential (line 10), the Guid minted on the AttendeeBadge aggregate.
  • Why it's built this way: a record with one field looks like ceremony over a bare Guid, but it gives the endpoint a JSON object it can extend (an expiry, a display hint) without breaking clients that already parse the body, which a bare scalar response would not.
  • Where it's used: returned by GetOrCreateMyBadgeHandler (.../GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:74, note the comment at :72-73 making the disclosure rule explicit) via GET my-badge on CheckInsController (.cs:45-48); read client-side by CheckInService (.../UI/Services/CheckInService.cs:37) and rendered by MyBadge.
  • Caveats / not-in-source: the DTO has no expiry field, and the handler's contract is one stable credential per attendee for the life of the badge (GetOrCreateMyBadgeHandler.cs:11-16), so a badge screenshotted yesterday still scans today. Rotation is not modeled anywhere in this type.

CheckInAttendeeRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInAttendeeRequest.cs:8 · Level 1 · record class

  • What it is: the organizer scanning request, a scanned or typed badge credential plus what the check-in attests to and its target.
  • Depends on: CheckInScope, BadgePayload (which parses the Credential string), and the EventIdentifierType / SessionIdentifierType aliases.
  • Concept, the scope-conditional request. [Rubric §24, Forms/Validation/UX Safety] and [Rubric §9, API & Contract Design] assess whether input rules are declared once and enforced before business logic runs. This DTO carries a discriminator and two possible targets, which is exactly the shape where "which field is required" gets re-litigated in every handler. It is stated once instead, in CheckInAttendeeRequestValidator: Credential not empty (CheckIn.Credential.Required), Scope IsInEnum (CheckIn.Scope.Invalid), EventId non-default (CheckIn.EventId.Required), and SessionId NotNull only .When(x => x.Scope == CheckInScope.Session) (.../CheckInAttendee/CheckInAttendeeRequestValidator.cs:11-34). The validator comment at line 28 is the rule worth memorizing: the event stays required whatever the scope, only the session is scope-conditional (the request's own doc now says "required for every scope", CheckInAttendeeRequest.cs:16). Every rule attaches a stable WithErrorCode so clients branch on a code rather than parse prose.
  • Walkthrough (CheckInAttendeeRequest.cs:8-21): Credential (line 11), the raw scanned text, deliberately a string rather than a Guid so a prefixed payload and a hand-typed bare code both bind, with BadgePayload.TryExtractCredential doing the parsing server-side (CheckInAttendeeHandler); Scope (14); EventId (17), required for every scope; and the nullable SessionId (20), required when the scope is Session.
  • Why it's built this way: the event id the client sends is not the last word. For a session check-in CheckInProcessor's target validation asks Conference for the session's live info and returns its owning event as the value to record (CheckInProcessor.cs:181-197), because a stale event context on the organizer's screen would otherwise file the attendance under an event where the rollup would never find it again. This is a good illustration of a request field being accepted for routing but not trusted as truth.
  • Where it's used: bound by POST on CheckInsController ([HttpPost] at .cs:103, body at :111) behind the CheckInManage permission (:105), handled by CheckInAttendeeHandler, and built client-side by CheckInScan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:267-272), which sends SessionId only when the scope toggle is on Session.

ManualCheckInRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/ManualCheckInRequest.cs:7 · Level 1 · record class

  • What it is: the organizer's manual check-in fallback body, used when a badge cannot be scanned (no camera on the head, a dead phone, or an attendee found by name search instead).
  • Depends on: CheckInScope and the UserIdentifierType / EventIdentifierType / SessionIdentifierType aliases.
  • Concept: structurally the twin of CheckInAttendeeRequest with the credential replaced by a UserId; see that section for the scope-conditional validation concept. The two validators are line-for-line parallel apart from the first rule, ManualCheckInRequestValidator opening with UserId NotEqual(default(UserIdentifierType)) and error code CheckIn.UserId.Required (.../ManualCheckIn/ManualCheckInRequestValidator.cs:13-16) where the scan validator requires a non-empty credential.
  • Walkthrough (ManualCheckInRequest.cs:7-20): UserId (line 10), Scope (13), EventId (16), nullable SessionId (19).
  • Why it's built this way: keeping the fallback as its own DTO and endpoint (rather than an optional-credential variant of the scan request) is what makes the two paths independently authorizable and independently auditable, while CheckInProcessor keeps the actual rules stated once for both (CheckInProcessor.cs:10-22, where ExecuteAsync is named as the organizer path for scan and manual fallback alike). [Rubric §15, Best Practices & Code Quality]: two thin entry points over one shared core beats one entry point with a mode flag. Like the scan request, EventId is documented as "required for every scope" (ManualCheckInRequest.cs:15).
  • Where it's used: bound by POST manual on CheckInsController ([HttpPost("manual")] at .cs:127, body at :135) behind the CheckInManage permission (:129), handled by ManualCheckInHandler, and built by CheckInScan's fallback path (CheckInScan.razor.cs:292-297).

AttendanceStatsDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Attendance · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Attendance/AttendanceStatsDTO.cs:7 · Level 1 · record class

  • What it is: one event's attendance rollup for the organizer dashboard, the event-scoped arrival count plus one SessionAttendanceDTO row per session that has at least one session-scoped check-in.
  • Depends on: SessionAttendanceDTO and the EventIdentifierType alias. Externals: BCL IReadOnlyList<T>.
  • Concept, the purpose-built read model. [Rubric §6, CQRS & Event-Driven] assesses whether reads are served by shapes designed for the question being asked rather than by generic entity lists, and [Rubric §12, Performance & Scalability] whether the work sits where it is cheapest. This DTO is the answer to exactly one screen. GetAttendanceStatsHandler builds it from two focused repository calls on the read repository (unitOfWork.GetReadRepository<CheckIn, ...>, .cs:25): a CountAsync for the event scope (:27-29), and a SessionId-only projection filtered in SQL by event, scope and a present session id (:31-35), grouped and counted in memory (:37-44). No CheckIn entity is ever materialized, and the projection stays small by construction, one small value per recorded check-in of the event (.cs:9-14).
  • Walkthrough (AttendanceStatsDTO.cs:7-17): three required init members. EventId (line 10) echoes the queried event. EventAttendance (13) is the count of distinct attendees at the event scope, which is distinct by construction because the filtered unique index permits one event-scoped row per attendee (CheckInConfiguration.cs:49-51). SessionAttendance (16) is the ordered per-session list.
  • Why it's built this way: session titles are not in this payload, so Engagement answers the rollup without a synchronous Conference read on a dashboard refresh, which keeps the cross-service dependency off the hot path (ADR-007, ADR-008). The page joins names once it has the list.
  • Where it's used: returned by GetAttendanceStatsHandler for a GetAttendanceStatsQuery, surfaced by GET stats?eventId= on CheckInsController (.cs:154-161) behind the CheckInManage permission (:157); fetched client-side by CheckInService (.../UI/Services/CheckInService.cs:87) and held by the OrganizerAttendance page (.../UI/Pages/CheckIn/OrganizerAttendance.razor.cs:29).
  • Caveats / not-in-source: sponsor-scoped visits are counted in neither figure; the query filters on CheckInScope.Event and CheckInScope.Session only (GetAttendanceStatsHandler.cs:29, :33).

EngagementPermissionGrants

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Authorization · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Authorization/EngagementPermissionGrants.cs:24 · Level 3 · class (static)

  • What it is: the module's role-to-permission grant map: the one place that says which role holds EngagementPermissions.All.
  • Depends on: EngagementPermissions (the capability list it grants), AdministrationPermissions (the framework's ManageFeatures constant it adds), and PermissionRegistryBuilder / RoleNames, the framework registry-builder and the Identity module's role vocabulary.
  • Concept, one grant map shared by both the owning service and the token minter. [Rubric §11, Security] assesses whether a role-to-capability binding is stated once and consumed everywhere it must hold, rather than restated and risking drift. Apply is a plain static void(PermissionRegistryBuilder) (:38) rather than an extension method or an instance method, which is what lets it be passed as a delegate: DependencyInjection's Engagement API layer registers it with services.AddPermissions(EngagementPermissionGrants.Apply) (MMCA.ADC.Engagement.API/DependencyInjection.cs:60), and the Identity service's TokenPermissionGrants.ApplyAll calls it directly alongside the other three modules' maps (MMCA.ADC.Identity.Service/Authorization/TokenPermissionGrants.cs:57). Both call sites run the identical method, so the capability set a request is authorized against at the owning service and the capability set a token is minted with cannot diverge.
  • Walkthrough (EngagementPermissionGrants.cs:24-44): one public method, Apply(PermissionRegistryBuilder permissions) (:38), which null-checks its argument (:40) and makes one call: permissions.Grant(RoleNames.Organizer, [.. EngagementPermissions.All, AdministrationPermissions.ManageFeatures]) (:42), spreading the four-item capability list plus the framework's feature-flag capability onto the Organizer role. The summary (:26-31) records the two paths this class deliberately leaves alone: attendee-facing endpoints are authenticated-only [Authorize] with no capability, and a speaker's session-scoped rights flow through the speaker-assignment check in the handlers (BR-236), not through a grant here. The remarks (:32-36) explain the extra item: ManageFeatures gates this service's feature-flag administration (ADR-031) and is named beside the spread rather than folded into EngagementPermissions.All because it is the framework's constant, not ADC's.
  • Why it's built this way: a token is minted once, at login, by the Identity host, so the Identity host's registry has to hold the union of every module's grants even though it boots only the Identity module; see TokenPermissionGrants's remarks (TokenPermissionGrants.cs:14-25) for why. Keeping the map in its own class rather than inlining the Grant call in AddModuleEngagementAPI is what makes that reuse possible: a method the Engagement API layer calls for itself is also a method the Identity service can call for the same binding, with no second Grant line anywhere to fall out of sync. Keeping ManageFeatures out of All keeps the ADC vocabulary ADC-only while still letting one grant line carry the framework capability the module's own admin endpoint needs.
  • Where it's used: called from AddModuleEngagementAPI (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:57-60, the module's own composition) and from TokenPermissionGrants.ApplyAll (MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Authorization/TokenPermissionGrants.cs:53-59, the token-minting host's composition). Its ManageFeatures grant is what opens AdminFeatureFlagsController, whose base class FeatureFlagsControllerBase gates every action on features:manage (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/AdminFeatureFlagsController.cs:16-17, :25). EngagementPermissionGrantsTests builds the real registry through AddModuleEngagementAPI() (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Authorization/EngagementPermissionGrantsTests.cs:27) and asserts Organizer holds every Engagement capability (:32), that "Admin" holds none because it is not an ADC role at all (:49, ADC's RoleNames declares only Organizer, ContentEditor and Attendee), and that Attendee (:61) and ContentEditor (:73) each hold none.
  • Caveats / not-in-source: Apply grants exactly one role, RoleNames.Organizer; ADC has no Admin role to grant a second time. Whether EngagementPermissionGrantsTests also asserts the ManageFeatures grant is not visible in the lines read here; the usage list shows the grant is pinned by architecture tests (MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Api/PermissionCoverageTests.cs, AuditViewGrantTests.cs), whose exact assertions are not determinable from this brief.

CheckInScopeNames

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInScopeNames.cs:9 · Level 9 · static class

  • What it is: the wire names for CheckInScope, plus the one function that maps an enum value to its name. It is what the AttendeeCheckedIn integration event carries instead of the enum.
  • Depends on: CheckInScope. Externals: none.
  • Concept, strings on the wire, enums in the model. [Rubric §6, CQRS & Event-Driven] assesses how state changes are announced across a boundary, and [Rubric §7, Microservices Readiness] whether that announcement survives independent deployment of producer and consumer. An enum serialized as a number is a version trap: consumers deserialize whatever integer arrives, so adding or reordering a member changes the meaning of already-published messages, and a consumer built before the change reads the new value as a member it thinks it knows. Sending the name makes a new scope purely additive: an old consumer sees an unrecognized string and can log-and-skip, which is exactly what the points handler does (CheckInScopeNames.cs:3-8, and AttendeeCheckedIn.cs:10-13). Note the deliberate asymmetry with persistence: the database stores the numbers (and the filtered unique indexes hard-code them, CheckInConfiguration.cs:22-26) because it is one deployment unit with the code, while the broker carries strings because it is not. Integration events and the outbox are taught in Group 04 and ADR-003.
  • Walkthrough (CheckInScopeNames.cs:9-30): three consts, Event (line 11), Session (14), Sponsor (17), each string equal to its member name. ToName(CheckInScope scope) (lines 22-28) is a switch expression over the three known members with a fallback of scope.ToString() (line 27), so a member added to the enum without a const here still produces its name rather than a number or a throw.
  • Why it's built this way: the mapping is a static class rather than an extension or a converter because both ends need the raw constants, not just the conversion. The producing side calls ToName once, inside the CheckIn factory, so the event is raised in the same transaction as the row and the outbox captures both (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/CheckIns/CheckIn.cs:112-119). The consuming side compares against the constants with StringComparison.Ordinal, never parses back to the enum.
  • Where it's used: CheckIn.Create builds the AttendeeCheckedIn payload with CheckInScopeNames.ToName(checkIn.Scope) (CheckIn.cs:114); AttendeeCheckedInPointsHandler maps each name to an earn rule, Event to an event-check-in award, Session to a session award only when a session id is present, Sponsor to a sponsor award only when a sponsor id is present, and anything else to a warning-logged no-op (.../Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:68-97, warning at :99).
  • Caveats / not-in-source: there is no TryParse counterpart, so nothing in source converts a wire name back to a CheckInScope; consumers branch on the string. Covered by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Shared.Tests/CheckIns/CheckInScopeNamesTests.cs.

DependencyInjection

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:13 · Level 8 · class (static)

One DependencyInjection per Engagement layer. This section is the Infrastructure layer's; the API, Application, UI, and Contracts layers each have their own, covered elsewhere in this chapter.

  • What it is: the Engagement Infrastructure layer's registration extension. It is among the smallest of the module's composition roots: one method that registers two hosted services and the ticket roster file parser.
  • Depends on: IServiceCollection, AddHostedService and TryAddSingleton (Microsoft.Extensions.DependencyInjection and its .Extensions namespace, DependencyInjection.cs:1-2), BookmarkCacheEvictionProcessor from the layer's Caching namespace (:4, :27), LiveChannelPublishProcessor from its Live namespace (:5, :26), and the ITicketRosterParser port from the Application layer (:3) with its TicketLeapRosterParser implementation from the layer's Tickets.TicketLeap namespace (:6, :31).
  • Concept: this is the standard extension(IServiceCollection) registration idiom used throughout the codebase, taught once in the primer under C# extension(T) types; the extension(IServiceCollection services) block at DependencyInjection.cs:15 is what makes AddModuleEngagementInfrastructure() read as an instance method on the collection. What is worth teaching here is the division of labor the file records. Its doc comment (:17-22) is explicit that the queue and the eviction signal are registered by the Application layer and only the two hosted workers are registered here, and that is exactly what the code does: MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:53-54 registers LiveChannelPublishQueue as a singleton and aliases ILiveChannelPublishQueue onto the same instance, and :58 registers the BookmarkCacheEvictionSignal coalescing flag, while this file registers only the readers. [Rubric §3, Clean Architecture] assesses whether the dependency direction survives composition: the producer side of that boundary (the queue and its interface) is an Application-layer concern that command handlers enqueue to, and the consumer side (a BackgroundService that resolves ILiveChannelPublisher out of a scope) is infrastructure, so the split is not arbitrary tidiness. [Rubric §5, Vertical Slice] applies to the whole per-layer pattern: each layer of the slice declares its own wiring and the host calls one method. [Rubric §12, Performance and Scalability] is the reason the worker exists at all: the queue takes the broadcast off the command hot path, so a slow Notification peer cannot lengthen a poll-vote request.
  • Walkthrough: one method, four statements.
    • public IServiceCollection AddModuleEngagementInfrastructure() (DependencyInjection.cs:24) sits inside the extension(IServiceCollection services) block (:15).
    • services.AddHostedService<LiveChannelPublishProcessor>() (:26) is the first registration. AddHostedService means the host starts it with the application and stops it on shutdown; the processor is a BackgroundService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:32-35) whose ExecuteAsync drains the queue with await foreach (var workItem in queue.Reader.ReadAllAsync(stoppingToken)...) (:41). Because it is registered exactly once there is one reader, which is what preserves per-session FIFO ordering (:11-14); the processor resolves the publisher per item from a fresh scope (:50-51) because the gRPC adapter is registered scoped, and wraps each publish in BestEffort.ExecuteAsync (:45) so a down peer is counted on the besteffort.dispatch.failed meter (MMCA.Common/Source/Core/MMCA.Common.Application/Services/Resilience/BestEffort.cs:110) instead of crashing the host, which is the posture the class doc records at LiveChannelPublishProcessor.cs:23-30.
    • services.AddHostedService<BookmarkCacheEvictionProcessor>() (:27) is the second. The processor is a BackgroundService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Caching/BookmarkCacheEvictionProcessor.cs:35-39) and the single reader of the signal: ExecuteAsync (:52) waits on signal.Reader.WaitToReadAsync (:56), empties the capacity-one flag (:60), publishes OutputCacheEvictionRequested for Conference's sessions cache tag through IEventBus from a fresh scope inside BestEffort.ExecuteAsync (:62-77), then waits PacingWindow, a ten-second static readonly (:46, :79). A burst of stars therefore collapses into one trailing broadcast per window per replica, with Conference's own TTL as the backstop (:16-23).
    • services.TryAddSingleton<ITicketRosterParser, TicketLeapRosterParser>() (:31) is the third. The comment (:29-30) calls it the roster import's file reader (BR-268), "the one place that knows TicketLeap's export columns", and stateless, so one instance serves every request. TryAdd leaves an earlier registration in place, so a host or test that registered its own parser first keeps it.
    • return services (:33) for fluent chaining, matching every other registration extension in the repo.
  • Why it's built this way: registering the drain here rather than in the Application layer keeps the hosted-service dependency (and the scope factory, and the publisher resolution) out of the layer that command handlers compile against, which is what lets the Application project stay free of hosting concerns. The parser follows the same direction for a different reason: the Application layer owns the ITicketRosterParser port the import handlers call, and only this layer knows the vendor file format, so a change to TicketLeap's export columns touches one Infrastructure class. Keeping the method to these registrations is itself the design statement: this module's infrastructure has no repositories and no clients to register, only entity configurations that are discovered by assembly scan (see AssemblyReference), the two workers, and the one vendor-format adapter. ADR-039 is the decision record for the live-channel push path the worker serves.
  • Where it's used: called exactly once, from the module's API-layer composition: services.AddModuleEngagementInfrastructure() at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:26, the middle of the three-line AddEngagementModule() chain (Application at :25, Infrastructure at :26, API at :27). That method in turn is what EngagementModule.Register calls (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/EngagementModule.cs:24-25), so both workers start in any host where the module loader registers Engagement.
  • Caveats / not-in-source: nothing in this file makes the registration conditional, so both workers start even in a host where every Engagement feature flag is off. That is harmless (the channel and the signal simply never receive work), but it is worth noting that the flags in EngagementFeatures gate HTTP routes, not hosted services.

ParticipantErrorCodes

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Participants/ParticipantErrorCodes.cs:7 · Level 0 · static class

  • What it is: the error code of the verified-participant rule (S-ADC-identity-02), kept in *.Shared so the UI can tell the attendee what to do instead of showing a generic refusal (ParticipantErrorCodes.cs:3-6).
  • Depends on: nothing first-party. Externals: BCL string.
  • Concept, an error code is a cross-layer contract. [Rubric §9, API & Contract Design] assesses whether a failure is something a client can act on rather than only display. The refusal is a Forbidden whose code is this constant, and the remedy is written into the contract itself: the attendee links a ticket or confirms the address, then retries (:8-12). Because the constant lives in the Shared assembly, the two servers that raise it and the pages that interpret it compare against one string rather than duplicated literals. The Engagement. prefix holds even when the Conference module raises the code for a feedback submission, which marks the rule's owner rather than the caller (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Participants/FeedbackParticipantGate.cs:70-73).
  • Walkthrough (ParticipantErrorCodes.cs:7-14): one member, public const string VerifiedParticipantRequired = "Engagement.VerifiedParticipantRequired" (line 13). Being const, it can appear as a constant pattern in a switch arm, which is how the pages consume it.
  • Where it's used: re-exported as VerifiedParticipantGate.VerifiedParticipantRequiredCode (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantGate.cs:30) and raised by VerifiedParticipantGate (:52-55) for the Engagement writes; raised by FeedbackParticipantGate (FeedbackParticipantGate.cs:70-73) for Conference's session and event feedback; matched client-side by the RoomCheckIn page into CheckInState.NotVerified (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Rooms/RoomCheckIn.razor.cs:157) and by the SponsorVisit page into VisitState.NotVerified (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Sponsors/SponsorVisit.razor.cs:124). The switch behind the rule is VerifiedParticipantSettings.

RoomCheckInRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Rooms · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Rooms/RoomCheckInRequest.cs:8 · Level 0 · record class

  • What it is: the body of the attendee's room self check-in: the room id, plus the check-in code its printed QR carries, and nothing more (RoomCheckInRequest.cs:3-7).
  • Depends on: the RoomIdentifierType alias. Externals: BCL string.
  • Concept, the anti-abuse property is what the DTO leaves out. [Rubric §11, Security] assesses whether a client can assert facts it should not be trusted with. Two values are conspicuously absent: the attendee (taken from the token) and the session (resolved server-side from the room plus the configured grace window). Because the session is never client-supplied, nobody can claim attendance at a session they are not standing in, and a shared room link records nothing outside that session's window (RecordRoomCheckInHandler.cs:20-25). The one extra value it does carry is proof of presence, the room's code from its printed QR (RecordRoomCheckInHandler.cs:146-152). How strictly that proof is demanded is Conference's switch, RoomCheckInSettings.RequireCode (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInSettings.cs:20): a wrong code is always refused, while a missing code (and any request against a room with no code) is refused only once that switch is on (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Events/EventLiveValidationService.cs:310-316, decided by Room.AcceptsCheckInCode, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Events/Room.cs:174-182, which compares with CryptographicOperations.FixedTimeEquals). This is the same "the request carries the least it can" discipline as SponsorVisitRequest; a request DTO's security value is often in the fields it refuses to accept.
  • Walkthrough (RoomCheckInRequest.cs:8-19): required init RoomId (line 11), the room whose printed QR was scanned, and the optional string? CheckInCode (line 17), the room's code from the scanned QR. The code is nullable on purpose: a wrong code is always refused, but the code is only required once the Conference service enforces it (RequireCode), and until then a request without one is accepted (:13-16). RoomCheckInRequestValidator applies two structural rules, RoomId GreaterThan(0) with error code CheckIn.RoomId.Required (.../RecordRoomCheckIn/RoomCheckInRequestValidator.cs:14-17) and CheckInCode MaximumLength(RoomCheckInCodeDTO.CodeMaxLength) (64, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInCodeDTO.cs:18) with error code CheckIn.CheckInCode.TooLong (RoomCheckInRequestValidator.cs:19-22), running in the validating decorator before the handler (see the CQRS decorator pipeline). Whether the code is correct is not a validator concern: before any lookup the handler runs the verified-participant gate, since a self-recorded check-in awards points (RecordRoomCheckInHandler.cs:75-79, refusal code in ParticipantErrorCodes), then passes the code to Conference's GetCurrentRoomSessionInfoAsync (:84-86) and turns Conference's Room.CheckInCodeRejected failure (RoomCheckInCodeDTO.RejectedErrorCode, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInCodeDTO.cs:24) into a validation error CheckIns.RoomCodeRejected (.../CheckIns/CheckInErrorCodes.cs:22) targeted at CheckInCode (RecordRoomCheckInHandler.cs:160-172).
  • Why it's built this way: the request doubles as the command type, so the controller hands the deserialized body straight to ICommandHandler<RoomCheckInRequest, Result<RoomCheckInResultDTO>> (CheckInsController.cs:53, :248-252) with no request-to-command translation layer. [Rubric §5, Vertical Slice]: the DTO, its validator and its handler sit in one use-case folder.
  • Where it's used: posted to POST room-visits (CheckInsController.cs:242), which is [Idempotent] (:243) and gated by the RoomCheckIn feature flag (:244), with no organizer permission; built client-side by CheckInService.RecordRoomCheckInAsync, which takes the room id and the scanned code and sends both (.../UI/Services/CheckIns/CheckInService.cs:105-112), from the RoomCheckIn page.
  • Caveats / not-in-source: RequireCode has no initializer, so it is off by default: the installed mobile build sends no code, and while the switch is off a check-in with the right code or no code is accepted and only a wrong code is refused (RoomCheckInSettings.cs:13-20). Whether production has turned it on is configuration, not determinable from source.

RoomCheckInResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.Rooms · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Rooms/RoomCheckInResultDTO.cs:9 · Level 0 · record class

  • What it is: the outcome of a room self check-in, naming back the session the server resolved plus the same repeat flag and timestamp the organizer paths use.
  • Depends on: the SessionIdentifierType alias. Externals: BCL DateTimeOffset, string.
  • Concept, echo back what the server decided. [Rubric §9, API & Contract Design]. Because RoomCheckInRequest deliberately does not name a session, the attendee has no way to know what they were checked into unless the response says so. SessionId plus SessionTitle close that loop in one round trip, which is the same one-round-trip reasoning SponsorVisitResultDTO applies to the sponsor name. The repeat semantics are inherited verbatim from CheckInResultDTO, and the type doc adds the case that only exists here: an organizer may have already scanned this attendee into the same session at the door, so AlreadyCheckedIn covers a repeat by any path (RoomCheckInResultDTO.cs:3-8).
  • Walkthrough (RoomCheckInResultDTO.cs:9-41): four required init members plus two defaulted points flags. SessionId (line 12) and SessionTitle (15) come from Conference's room lookup (RoomSessionInfo, consumed at RecordRoomCheckInHandler.cs:73-92, :136-137). AlreadyCheckedIn (18) is outcome.AlreadyRecorded from the shared CheckInProcessor.RecordAsync core (.cs:117-138), the same predicate the organizer paths use so a self check-in and a prior door scan collapse onto one row. CheckedInOn (21) carries the original time on a repeat. EarnsPoints (line 47, default true) says whether the check-in earns session points: session points are awarded once per time slot, so it is false when the attendee already holds an EARLIER check-in to another session whose scheduled window overlaps this one, and the check-in is still recorded; on a repeat it reports the value for the existing row. PointsPaused (line 57, default false) is set when the Points:SessionCheckIn kill switch is 0 or below, so no session check-in earns any; then EarnsPoints is false and the attendee is told points are paused rather than that the slot's points were already earned. Both defaults make a payload that predates the fields read as the old behavior. The handler computes them before the write (.cs:97-113): pointsPaused from GetPointsFor(PointsActivityType.SessionCheckIn) <= 0, and only when not paused it asks SessionTimeSlotPoints.HasEarlierOverlappingCheckInAsync, failing closed (nothing written) if Conference cannot answer (.cs:109-110).
  • Why it's built this way: the flow writes an ordinary Session-scoped CheckIn; only CheckedInByUserId differs, it is the attendee rather than an organizer (RecordRoomCheckInHandler.cs:27-31). Keeping the row identical is what lets the points award, the attendance rollup and the export posture apply unchanged, and it is why this DTO differs from CheckInResultDTO only in the fields the attendee needs to see (the session echo and the two points flags). Room switching works without staff for the same reason: an overlapping earlier check-in never blocks the new one, it only turns EarnsPoints off (.cs:30-35).
  • Where it's used: returned by RecordRoomCheckInHandler (.cs:134-142) through POST room-visits (CheckInsController.cs:242); wrapped client-side in a SelfCheckInOutcome<TResult> by CheckInService (.../UI/Services/CheckIns/CheckInService.cs:66-69) and rendered by the RoomCheckIn page (.../UI/Pages/CheckIns/Rooms/RoomCheckIn.razor.cs:46), whose PointsLine picks the paused, earns-points or no-points-this-time-slot message from the two flags (.razor.cs:141-149).
  • Caveats / not-in-source: when no session is running in the room the caller gets a 404 CheckIns.NoCurrentSession instead of this DTO, and an unknown room answers identically on purpose so the response cannot be used to probe which room ids exist (RecordRoomCheckInHandler.cs:78-86, :145-149).

SponsorVisitRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.SponsorVisits · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/SponsorVisits/SponsorVisitRequest.cs:7 · Level 0 · record class

  • What it is: the body of a sponsor booth visit, one sponsor id.
  • Depends on: the SponsorIdentifierType alias. Externals: none.
  • Concept: the same "only the target travels" shape as RoomCheckInRequest. [Rubric §11, Security]: the attendee is always the authenticated caller, so this endpoint can only ever record the caller's own visit, and a client cannot file a visit for someone else (SponsorVisitRequest.cs:3-6, and the endpoint's own statement at CheckInsController.cs:104-112).
  • Walkthrough (SponsorVisitRequest.cs:7-11): one required init member, SponsorId (line 10). SponsorVisitRequestValidator applies GreaterThan(0) with error code CheckIn.SponsorId.Required (.../RecordSponsorVisit/SponsorVisitRequestValidator.cs:11-15).
  • Where it's used: posted to POST sponsor-visits (CheckInsController.cs:192), gated by the SponsorVisits feature flag (:114), authenticated but with no organizer permission; built client-side by CheckInService.RecordSponsorVisitAsync (.../UI/Services/CheckInService.cs:56) from the SponsorVisit landing page, and handled by RecordSponsorVisitHandler.

SponsorVisitResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.SponsorVisits · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/SponsorVisits/SponsorVisitResultDTO.cs:12 · Level 0 · record class

  • What it is: the outcome of a sponsor booth visit, the sponsor (id and display name), whether the attendee had already visited, and when.
  • Depends on: the SponsorIdentifierType alias, and mirrors CheckInResultDTO's repeat contract. Externals: BCL DateTimeOffset, string.
  • Concept, denormalize one field to save a round trip. [Rubric §12, Performance & Scalability] assesses whether a surface's data needs are met with the fewest calls, and [Rubric §9, API & Contract Design] how much a response should carry. SponsorName rides back on the DTO precisely so the landing page can render a confirmation card without a follow-up Conference lookup (SponsorVisitResultDTO.cs:7-10). The handler already holds the name from the validation call, so including it costs nothing on the server and removes a whole request from a phone on conference Wi-Fi. The repeat semantics are the same as everywhere else in this family: a second scan is a success carrying AlreadyVisited, not a 409 (.cs:3-6).
  • Walkthrough (SponsorVisitResultDTO.cs:12-25): four required init members, SponsorId (line 15), SponsorName (18), AlreadyVisited (21), VisitedOn (24). RecordSponsorVisitHandler fills the name from SponsorLiveInfo on both branches (.cs:88-94 for the repeat, :114-120 for the new visit), and the repeat branch carries the original CheckedInOn.
  • Why it's built this way: the visit row is an ordinary Sponsor-scoped CheckIn whose CheckedInByUserId equals its UserId, which is what keeps a self-recorded visit distinguishable from an organizer scan on the same table (RecordSponsorVisitHandler.cs:15-19). The uniqueness backstop for two concurrent scans is the filtered unique index on (UserId, SponsorId) WHERE [Scope] = 2 (.cs:75-77, index at CheckInConfiguration.cs:60-62).
  • Where it's used: returned by RecordSponsorVisitHandler through POST sponsor-visits (CheckInsController.cs:168); wrapped in a SelfCheckInOutcome<TResult> by CheckInService (.../UI/Services/CheckInService.cs:53-56) and rendered by the SponsorVisit page (.../UI/Pages/Sponsors/SponsorVisit.razor.cs:37).

UserEngagementBookmarkExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementBookmarkExportDTO.cs:7 · Level 0 · record (sealed)

  • What it is: one session-bookmark row inside a user's Engagement data export: which session they saved and when.
  • Depends on: the SessionIdentifierType alias (solution-wide global using, see primer §2). It is a member of UserEngagementExportDTO.
  • Concept, ids and dates only. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether a data-subject access path returns the subject's own data and nothing else. This record is the smallest expression of that rule: a bookmark is a personal-schedule entry, so the export carries the session id and the creation date, never the session's title, speaker, or any content owned by somebody else (UserEngagementBookmarkExportDTO.cs:4-5). The concept is taught once on UserEngagementExportDTO; the other export rows follow the same rule.
  • Walkthrough (UserEngagementBookmarkExportDTO.cs:7-14): required SessionIdentifierType SessionId (line 10) and required DateTime CreatedOn (line 13). Both are required, so a projection that forgets a column is a compile error rather than a silently empty export field.
  • Where it's used: projected server-side from UserSessionBookmark by UserEngagementExportService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Exports/UserEngagementExportService.cs:29-32); serialized by UserEngagementExportGrpcService (UserEngagementExportGrpcService.cs:59-63) and rehydrated from the wire by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:37-41).

UserEngagementSubmittedQuestionExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementSubmittedQuestionExportDTO.cs:7 · Level 0 · record (sealed)

  • What it is: one submitted session question inside a user's Engagement data export: the question id, the session it was asked in, the text the user wrote, and the submission date.
  • Depends on: the SessionQuestionIdentifierType and SessionIdentifierType aliases (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/MMCA.ADC.Engagement.GlobalUsings.IdentifierType.cs:12). It is a member of UserEngagementExportDTO.
  • Concept, cross-reference: the ids-and-dates rule is the one introduced on UserEngagementBookmarkExportDTO. This row is the documented exception: it also carries the question text, because the subject authored it, so it is the subject's own content rather than content owned by someone else (UserEngagementSubmittedQuestionExportDTO.cs:3-6). [Rubric §30, Compliance, Privacy & Data Governance]: a data-subject access response that listed a question id without the words the user wrote would leave out the personal data itself. The text is exported "as stored", so a question that was erased carries its placeholder rather than the original wording (:15-16, and the service summary at UserEngagementExportService.cs:17-18).
  • Walkthrough (UserEngagementSubmittedQuestionExportDTO.cs:7-20): required SessionQuestionIdentifierType QuestionId (line 10), required SessionIdentifierType SessionId (line 13), required string Text (line 16), required DateTime CreatedOn (line 19, UTC).
  • Where it's used: projected from SessionQuestion by UserEngagementExportService, Text = q.Text included (UserEngagementExportService.cs:34-38); serialized by UserEngagementExportGrpcService (UserEngagementExportGrpcService.cs:64-68) and rebuilt by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:42-46).

UserEngagementPollVoteExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementPollVoteExportDTO.cs:7 · Level 0 · record (sealed)

  • What it is: one live-poll vote inside a user's Engagement data export: which poll, which option, and when the vote was cast.
  • Depends on: the LivePollIdentifierType and LivePollOptionIdentifierType aliases only.
  • Concept, cross-reference: the export-row rule (ids plus dates, no content authored by others) is the one taught on UserEngagementBookmarkExportDTO. [Rubric §30, Compliance, Privacy & Data Governance]: the conference-day live layer holds votes as personal data, so the access response lists them.
  • Walkthrough (UserEngagementPollVoteExportDTO.cs:7-17): required LivePollIdentifierType LivePollId (line 10), required LivePollOptionIdentifierType OptionId (line 13), required DateTime CreatedOn (line 16, UTC).
  • Where it's used: projected from LivePollVote by UserEngagementExportService (UserEngagementExportService.cs:70-74); carried on UserEngagementExportDTO.PollVotes; rebuilt from the gRPC response by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:70).

UserEngagementQuestionUpvoteExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementQuestionUpvoteExportDTO.cs:7 · Level 0 · record (sealed)

  • What it is: one session-question upvote inside a user's Engagement data export: which question the user upvoted and when.
  • Depends on: the SessionQuestionIdentifierType alias only.
  • Concept, cross-reference: same export-row rule as UserEngagementBookmarkExportDTO. It carries the question id, never the question text, so no content authored by another user appears. [Rubric §30, Compliance, Privacy & Data Governance].
  • Walkthrough (UserEngagementQuestionUpvoteExportDTO.cs:7-14): required SessionQuestionIdentifierType QuestionId (line 10), required DateTime CreatedOn (line 13, UTC).
  • Where it's used: projected from SessionQuestionUpvote by UserEngagementExportService (UserEngagementExportService.cs:76-80); carried on UserEngagementExportDTO.QuestionUpvotes; rebuilt by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:76).

VerifiedParticipantSettings

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Participants/VerifiedParticipantSettings.cs:8 · Level 0 · sealed class

  • What it is: the configuration switch for the verified-participant rule (S-ADC-identity-02), bound from the Engagement section so an organizer can turn the rule off without a code change, for example during a load test that writes as synthetic attendees (VerifiedParticipantSettings.cs:3-7).
  • Depends on: nothing first-party; read through IOptions<VerifiedParticipantSettings>. Externals: Microsoft.Extensions.Options at the consumer.
  • Concept, a fail-safe default. [Rubric §11, Security] assesses whether a control defaults to the protected state. RequireVerifiedParticipant initializes to true (line 22), and the Engagement host binds the section deliberately without ValidateOnStart, because a missing Engagement section then binds the default, which is the safe value (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:110-114). A misconfigured deployment therefore enforces the rule rather than silently dropping it. [Rubric §13, Observability & Operability]: the opposite direction, relaxing the rule, is a configuration change, not a release.
  • Walkthrough (VerifiedParticipantSettings.cs:8-22): SectionName = "Engagement" (line 11), the section the host binds; bool RequireVerifiedParticipant { get; init; } = true (line 22). Its summary names what the switch governs (:13-21): poll votes, question upvotes, submitted questions, and the self-recorded room check-ins and sponsor visits that award points. A verified participant is an account with a linked ticket or a confirmed email; with the switch off, a free account nobody has verified votes, upvotes and earns points like an attendee.
  • Why it's built this way: one switch governs two modules. Conference's session and event feedback submissions do not read this class; they ask Engagement through IVerifiedParticipantService, and Engagement answers with its own switch (:19-21, and the Conference gate's summary at FeedbackParticipantGate.cs:18-20). Keeping the setting on the module that owns the ticket rows means there is no second copy of the flag to drift.
  • Where it's used: bound in the Engagement service host (Program.cs:113-114); read by VerifiedParticipantGate (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantGate.cs:27), which returns success at once when the switch is off or the caller's own token does not mark the address unconfirmed, and otherwise looks for a Live ticket linked to the account (:42-48). The gate is registered for every vote, upvote, question and self-recorded check-in (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:62-65).
  • Caveats / not-in-source: an IOptions<T> with no binding still yields a default instance, so a host that never binds the section enforces the rule. Which hosts other than the Engagement service bind it is not determinable from the usage sites read for this section.

UserEngagementCheckInExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementCheckInExportDTO.cs:11 · Level 1 · record (sealed)

  • What it is: one check-in record inside a user's Engagement data export: what the attendee was checked in to, under which scope, and when.
  • Depends on: CheckInScope (imported from MMCA.ADC.Engagement.Shared.CheckIns, UserEngagementCheckInExportDTO.cs:1) and the EventIdentifierType / SessionIdentifierType / SponsorIdentifierType aliases.
  • Concept, attendance is not a projection of the ledger. [Rubric §30, Compliance, Privacy & Data Governance] assesses completeness of a data-subject access response. It would be tempting to derive attendance from the points entries, and it would be wrong: PointsAwarder writes nothing when a rule is configured to 0 (PointsAwarder.cs:49-59) and treats a repeat scan as a clean no-op (PointsAwarder.cs:73-82), so a check-in that earned no points still leaves a distinct attendance record the subject is entitled to see. The export therefore reads CheckIn directly, and the reason is written both on this record (UserEngagementCheckInExportDTO.cs:6-9) and at the call site (UserEngagementExportService.cs:52-54).
  • Walkthrough (UserEngagementCheckInExportDTO.cs:11-27): required CheckInScope Scope (line 14), the discriminator; required EventIdentifierType EventId (line 17), always set for every scope; SessionIdentifierType? SessionId (line 20) and SponsorIdentifierType? SponsorId (line 23), each nullable and set only for the matching scope; required DateTimeOffset CheckedInOn (line 26). Note this is the one export row that uses DateTimeOffset rather than DateTime, matching the aggregate's own timestamp (UserEngagementExportService.cs:63).
  • Why it's built this way: one flattened record with nullable scope-specific ids beats three parallel collections, because the export document then reads as a single chronological attendance history regardless of scope, and the reader disambiguates on Scope.
  • Where it's used: projected from CheckIn by UserEngagementExportService (UserEngagementExportService.cs:55-66); carried on UserEngagementExportDTO.CheckIns; mapped across the wire by UserEngagementExportGrpcService (UserEngagementExportGrpcService.cs:80-95) and back by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:58-69). The nullable ids are what the two proto3 mapping comments are about: an absent target travels as 0 and is mapped back to null on arrival (UserEngagementExportGrpcService.cs:87-90, UserEngagementExportServiceGrpcAdapter.cs:65-67).

UserEngagementPointsEntryExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementPointsEntryExportDTO.cs:9 · Level 1 · record (sealed)

  • What it is: one awarded points entry inside a user's Engagement data export: what was earned, what it was earned on, and when.
  • Depends on: PointsActivityType (imported from MMCA.ADC.Engagement.Shared.Points, UserEngagementPointsEntryExportDTO.cs:1) and PointsSubjectKeys for the meaning of SubjectKey.
  • Concept, cross-reference: the export-row rule is the one taught on UserEngagementBookmarkExportDTO. Worth contrasting with its API twin: this record deliberately drops the entry Id that PointsEntryDTO carries (an export is portable data, not a handle the subject can call back with) and reports the audit CreatedOn rather than OccurredOnUtc. [Rubric §30, Compliance, Privacy & Data Governance].
  • Walkthrough (UserEngagementPointsEntryExportDTO.cs:9-22): required PointsActivityType ActivityType (line 12), required int Points (line 15), SubjectKey defaulted to string.Empty (line 18), required DateTime CreatedOn (line 21). SubjectKey is the one non-required member, so a row projected without it still reads as an empty string rather than a null.
  • Where it's used: projected from PointsEntry by UserEngagementExportService (UserEngagementExportService.cs:40-50); carried on UserEngagementExportDTO.PointsEntries; mapped over the wire by UserEngagementExportGrpcService (UserEngagementExportGrpcService.cs:71-79) and back by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:49-57).

UserEngagementTicketExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementTicketExportDTO.cs:9 · Level 1 · record (sealed)

  • What it is: one roster ticket linked to the user, inside their Engagement data export: the imported TicketLeap fields the ticket holds about them and how and when it was linked to their account (UserEngagementTicketExportDTO.cs:5-8, BR-274).
  • Depends on: TicketLinkMethod (imported from MMCA.ADC.Engagement.Shared.Tickets, UserEngagementTicketExportDTO.cs:1) and the EventIdentifierType alias. It is a member of UserEngagementExportDTO.
  • Concept, data held about the subject is exported even when the subject did not author it. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether the access response covers everything the system holds about a person. The other export rows follow the ids-and-dates rule taught on UserEngagementBookmarkExportDTO; this one deliberately carries names, an email and vendor ids, because those fields were imported from the TicketLeap roster about the user, so they are the user's personal data rather than content owned by somebody else. Two scoping rules decide which tickets appear, both stated at the projection (UserEngagementExportService.cs:82-84): only tickets linked to the user (t.LinkedUserId == userId, :100), since an unlinked ticket is not attributable to an account; and voided tickets included, since the imported fields are data held about the user whatever the ticket's status.
  • Walkthrough (UserEngagementTicketExportDTO.cs:9-40): required EventIdentifierType EventId (line 12); the imported TicketLeap fields, all required string: SourceEventName (15), ExternalTicketId (18), TicketTypeName (21), AttendeeFirstName (24), AttendeeLastName (27); two nullable values, string? OrderEmail (30, null when the order carried none) and DateTimeOffset? InvitedOn (33, null when no invite was sent); then the link facts, required TicketLinkMethod LinkMethod (36) and required DateTimeOffset LinkedOn (39). The two link members are non-nullable here although they are nullable on the Ticket aggregate: the projection unwraps them with !.Value (UserEngagementExportService.cs:97-98), which is safe only because the filter admits linked tickets alone.
  • Why it's built this way: the record mirrors the imported roster row closely enough that the subject can recognize their own ticket without a lookup, and it stays flat so it crosses the gRPC boundary as one message per ticket. The proto mapping is explicit in both directions: the server sends an absent email or invite as the empty string and the link method as its persisted integer (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/UserEngagementExportGrpcService.cs:116-123), and the adapter maps the empty string back to null and casts the integer back losslessly because those numeric values are never renumbered (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/UserEngagementExportServiceGrpcAdapter.cs:90-97).
  • Where it's used: projected from Ticket by UserEngagementExportService (UserEngagementExportService.cs:85-101); carried on UserEngagementExportDTO.Tickets; mapped over the wire by UserEngagementExportGrpcService (UserEngagementExportGrpcService.cs:107-125) and back by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:81-98).

UserEngagementExportDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementExportDTO.cs:11 · Level 2 · record (sealed)

  • What it is: the whole portable export of the personal data the Engagement module holds for one user: bookmarks, submitted questions, the points ledger, check-in history, live-poll votes, question upvotes, linked roster tickets, and leaderboard participation.
  • Depends on: UserEngagementBookmarkExportDTO, UserEngagementSubmittedQuestionExportDTO, UserEngagementPointsEntryExportDTO, UserEngagementCheckInExportDTO, UserEngagementPollVoteExportDTO, UserEngagementQuestionUpvoteExportDTO, UserEngagementTicketExportDTO.
  • Concept introduced, the per-module export document. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether a real data-subject access and portability path exists rather than a policy promise. Identity owns the aggregated user export document but owns none of Engagement's data, so each module publishes its own export shape and its own read contract (IUserEngagementExportService); Identity's EngagementUserDataExportSection stitches this document into the whole (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/ExportUserData/EngagementUserDataExportSection.cs:31-47). [Rubric §7, Microservices Readiness]: because the document lives in *.Shared and the contract is an interface, the aggregation works identically whether Engagement is in-process or a separate service.
  • Concept, "active footprint" is the export's definition of current. Every collection is read through the EF global soft-delete filter, so soft-deleted rows are excluded (UserEngagementExportService.cs:16-17). The visible consequence is stated on the service: an opt-in the user has since left reports as not on the leaderboard rather than as a historical membership. That is the erasure model of ADR-005 showing through on the access path.
  • Walkthrough (UserEngagementExportDTO.cs:11-42): Bookmarks (line 14), SubmittedQuestions (line 17), PointsEntries (line 20), all IReadOnlyList<...> defaulted to []; CheckIns (line 26), carried separately from the ledger for the reason given on UserEngagementCheckInExportDTO (UserEngagementExportDTO.cs:22-25); PollVotes (line 29) and QuestionUpvotes (line 32), the conference-day live-layer rows, also [] by default; Tickets (line 35), the roster tickets linked to the user (BR-274), also []; IsOnLeaderboard (line 38) and LeaderboardDisplayName (line 41), the latter null when the user never opted in. Every collection defaulting to [] is what makes an empty document (the disabled-module stub, or a user with no Engagement footprint) safe to enumerate.
  • Why it's built this way: ids plus dates keep the document cheap to build and cheap to ship across a service boundary. The type summary draws the content line precisely (UserEngagementExportDTO.cs:3-10): beyond ids and dates the document carries only the user's own content (submitted question text, the leaderboard display name) and, for a ticket, the imported TicketLeap fields about the user, so no content authored by other users ever appears and the export can be handed to the subject without a redaction pass. The nullable LeaderboardDisplayName is a documented contract the gRPC adapter honors explicitly: proto3 scalars carry no null, so the server emits the empty string and the adapter maps it back to null (UserEngagementExportServiceGrpcAdapter.cs:101-106).
  • Where it's used: built by UserEngagementExportService (UserEngagementExportService.cs:112-123); returned by IUserEngagementExportService; serialized by UserEngagementExportGrpcService and rebuilt by UserEngagementExportServiceGrpcAdapter (UserEngagementExportServiceGrpcAdapter.cs:35-107); consumed by Identity's ExportUserDataHandler through its Engagement section.

IUserEngagementExportService

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/IUserEngagementExportService.cs:14 · Level 3 · interface

  • What it is: the cross-module contract for reading one user's Engagement-owned personal data. One method, one document out.
  • Depends on: UserEngagementExportDTO, the UserIdentifierType alias, and ServiceContractAttribute from MMCA.Common.Shared.Abstractions (IUserEngagementExportService.cs:1).
  • Concept, the extraction-ready cross-module interface. [Rubric §7, Microservices Readiness] assesses whether modules talk through explicit contracts that survive being pulled apart, and [Rubric §3, Clean Architecture] assesses dependency direction. The interface lives in *.Shared, the only Engagement assembly a foreign module is allowed to reference, so Identity's export handler depends on a contract and never on Engagement's domain entities or DbContext. The doc comment names the pattern explicitly (IUserEngagementExportService.cs:5-12): it is the same shape as IBookmarkCountService, an in-process implementation inside the Engagement service and a gRPC adapter in MMCA.ADC.Engagement.Contracts everywhere else (ADR-007, ADR-008).
  • Concept introduced in this chapter, [ServiceContract] as an enforced marker. The interface carries [ServiceContract] (IUserEngagementExportService.cs:13), the same marker IBookmarkCountService carries (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/UserSessionBookmarks/IBookmarkCountService.cs:10). It is not documentation: an architecture fitness rule scans every mapped assembly for types wearing it and fails the build if such a type depends on the producing service's Domain, Application, or Infrastructure (MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/ServiceContractAttribute.cs:3-14). [Rubric §34, Architecture Governance & Documentation] assesses whether an architectural rule is asserted or merely written down; this one is a test (ADR-015). The attribute carries no properties: it is a bare marker with only a parameterless constructor (ServiceContractAttribute.cs:22-31).
  • Walkthrough (IUserEngagementExportService.cs:14-26): one member, Task<UserEngagementExportDTO> GetUserEngagementExportAsync(UserIdentifierType userId, CancellationToken cancellationToken) (line 25). The method summary lists everything the document now covers, ending with "linked roster tickets", and points at UserEngagementExportDTO as the authoritative shape (:16-21). Two details are deliberate. The CancellationToken has no default, so every caller passes one through explicitly. The return is a bare Task<T> rather than a Result<T>: there is no expected business failure here (an unknown user simply yields an empty document), so a transport fault is an exception, which is exactly what lets the aggregating handler degrade that one section instead of failing the whole export (EngagementUserDataExportSection.cs:13-17).
  • Why it's built this way: a single coarse method (rather than one per collection) keeps the wire contract to one round trip and one proto message, and keeps the interface stable as the export grows: the points ledger, check-ins, leaderboard participation, and linked roster tickets were all added to UserEngagementExportDTO without touching this signature.
  • Where it's used: implemented in-process by UserEngagementExportService, served over the wire by UserEngagementExportGrpcService, and satisfied remotely by UserEngagementExportServiceGrpcAdapter. The consumer is Identity's EngagementUserDataExportSection (EngagementUserDataExportSection.cs:20), behind ExportUserDataHandler.

IVerifiedParticipantService

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Participants/IVerifiedParticipantService.cs:12 · Level 3 · interface

  • What it is: the cross-module contract through which the Conference module asks Engagement whether the calling account is a verified participant, so Conference's feedback writes pass the same rule the Engagement writes pass (IVerifiedParticipantService.cs:5-10).
  • Depends on: Result<T>, the UserIdentifierType alias, and ServiceContractAttribute from MMCA.Common.Shared.Abstractions (IVerifiedParticipantService.cs:1, :11).
  • Concept, ask the owner instead of re-implementing the rule. [Rubric §7, Microservices Readiness] assesses whether modules cooperate through explicit contracts that survive extraction. The rule's linked-ticket half reads Engagement's ticket rows, which Conference cannot reach across the database boundary (ADR-006), so the question travels to the owner (:7-9). The contract has the same shape as IUserEngagementExportService, where the [ServiceContract] marker is taught: an in-process implementation inside the Engagement service and a gRPC adapter in MMCA.ADC.Engagement.Contracts everywhere else (ADR-007).
  • Concept, a failure is never a "no". [Rubric §29, Resilience & Business Continuity] assesses what a caller does when a dependency is down. Unlike the export contract's bare Task<T>, this method returns Result<bool>, and its contract separates the two outcomes: false is an answer, a failure means the answer could not be obtained (:22-25). The remote adapter turns every RpcException, structured trailers or not, into a failure Result rather than throwing (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/VerifiedParticipantServiceGrpcAdapter.cs:40-46), which lets FeedbackParticipantGate fall back to the email half alone: it neither fails open nor blocks confirmed accounts during an Engagement outage, and it logs the fallback as a warning (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Participants/FeedbackParticipantGate.cs:23-27, :47-54).
  • Walkthrough (IVerifiedParticipantService.cs:12-29): one member, Task<Result<bool>> IsVerifiedParticipantAsync(UserIdentifierType userId, CancellationToken cancellationToken) (line 26), with no default on the token. The answer is true when Engagement:RequireVerifiedParticipant is off, when the caller's token does not mark the address unconfirmed, or when the account holds a live linked ticket (:14-19). userId must be the calling account (:15-16). The in-process VerifiedParticipantService runs the module's own IVerifiedParticipantGate and maps the gate's only failure, its forbidden refusal, to Success(false), so it never returns a failure itself (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantService.cs:22-25).
  • Why it's built this way: [Rubric §11, Security]: the question is about the caller's own account, never someone else's. The email half reads the request principal, which across the service boundary is the end user's forwarded bearer (VerifiedParticipantService.cs:10-12); the gate treats a principal for another account as proving nothing (VerifiedParticipantGate.cs:58-70); and VerifiedParticipantGrpcService rejects a request for any other user with PermissionDenied (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/VerifiedParticipantGrpcService.cs:33-35), mapped with the default (user) authorization policy rather than a service token (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:288-293).
  • Where it's used: implemented in-process by VerifiedParticipantService (registered with TryAddScoped, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:67-69); served by VerifiedParticipantGrpcService; satisfied remotely by VerifiedParticipantServiceGrpcAdapter, which AddEngagementVerifiedParticipantClient registers with Replace (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:128-133) and the Conference service host calls (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:362). The consumer is Conference's FeedbackParticipantGate, which asks only for a caller whose token marks the address unconfirmed (FeedbackParticipantGate.cs:44-50).

LeaderboardEntryDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/LeaderboardEntryDTO.cs:7 · Level 0 · record (sealed)

  • What it is: one row of the public points leaderboard: a rank, a display name, and a total. It is the entire wire shape of GET /api/points/leaderboard.
  • Depends on: nothing first-party. Three primitives only (int, string, int).
  • Concept, the opt-in projection as a privacy boundary. [Rubric §11, Security] assesses whether a surface exposes only what the actor consented to expose, and [Rubric §30, Compliance, Privacy & Data Governance] assesses whether personal data flows are deliberate. The board is the one Engagement surface that shows one attendee's data to another attendee, and this record is what makes that safe: it carries no user id, no email, and no name from Identity. DisplayName (LeaderboardEntryDTO.cs:13) is the snapshot the attendee published when they opted in, and GetLeaderboardHandler builds the board purely from the LeaderboardOptIn rows plus the ledger, making no call into Identity (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetLeaderboard/GetLeaderboardHandler.cs:12-17). An attendee who never opted in is absent rather than present under a name they did not choose.
  • Walkthrough (LeaderboardEntryDTO.cs:7-17): Rank (line 10), an int starting at 1; DisplayName (line 13), defaulted to string.Empty so the record is never constructed into a null name; Points (line 16). All three are init-only, so a board row is immutable once the handler has built it.
  • Why it's built this way: Rank is carried on the wire rather than inferred from list position because the handler assigns distinct sequential ranks (1, 2, 3) rather than competition ranking (1, 1, 3), with the published name compared ordinally as the tie-break (GetLeaderboardHandler.cs:18-24, :65-77). That decision belongs to the server, so the client renders the number it is given instead of recomputing a different one.
  • Where it's used: returned by PointsController.GetLeaderboardAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:79), produced by GetLeaderboardHandler (GetLeaderboardHandler.cs:71-76), and consumed client-side by PointsService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Points/PointsService.cs:42-55) for the MyPoints page.

PointsActivityType

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsActivityType.cs:18 · Level 0 · enum

  • What it is: the closed set of things an attendee can do to earn points. Six values, each an earn rule.
  • Depends on: nothing. It is consumed by PointsEntry, PointsSettings, and every points DTO in this chapter.
  • Concept, the enum whose numbers are a persisted contract. [Rubric §8, Data Architecture] assesses whether stored values carry deliberate, stable semantics. This enum is not a UI label set: the numeric value is written to the ActivityType column of every ledger row and is one third of the unique index (UserId, ActivityType, SubjectKey) that makes an award idempotent (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Points/PointsEntryConfiguration.cs:45-48). Renumbering a member would silently re-point historical rows at a different rule, which is exactly what the type documentation forbids (PointsActivityType.cs:4-5). [Rubric §15, Best Practices & Code Quality]: the constraint is written into the type rather than left as tribal knowledge.
  • Concept, reserving 0 instead of defining it. Numbering starts at 1 on purpose so that a defaulted column or a payload that never set the field cannot read as a real earn rule (PointsActivityType.cs:11-15). That is a deliberate violation of the analyzer rule "enums should have zero value", so the file carries a targeted SuppressMessage for CA1008 whose Justification states the reason inline (PointsActivityType.cs:17). [Rubric §15, Best Practices & Code Quality] assesses whether analyzer deviations are justified in place rather than blanket-disabled; this is the pattern to copy. The invariant that rejects the unset value is PointsEntryInvariants.EnsureActivityTypeIsDefined, which delegates to CommonInvariants.EnsureEnumIsDefined with the PointsEntry.ActivityType.Invalid error code (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/PointsEntryInvariants.cs:50-51).
  • Walkthrough (PointsActivityType.cs:20-36): EventCheckIn = 1 (line 21), the optional info-desk activation scan; SessionCheckIn = 2 (line 24), the primary conference-day earn mechanic; SessionFeedback = 3 (line 27); EventFeedback = 4 (line 30); QuestionAsked = 5 (line 33), awarded once per session rather than once per question; SponsorVisit = 6 (line 36), awarded once per sponsor from the sponsor's printed QR.
  • Why it's built this way: the doc remarks record a domain fact the numbering alone would not convey (PointsActivityType.cs:6-10): the conference runs door and arrival check-in through TicketLeap, so EventCheckIn is an optional activation scan and not a door process, which is why SessionCheckIn is the mechanic the economy is tuned around (see the values in PointsSettings).
  • Where it's used: stored on PointsEntry; switched over by PointsSettings.GetPointsFor; passed to IPointsAwarder.AwardAsync by every points handler (AttendeeCheckedInPointsHandler, SessionQuestionSubmittedPointsHandler, SessionFeedbackSubmittedPointsHandler, EventFeedbackSubmittedPointsHandler); carried on PointsEntryDTO, PointsActivityTotalDTO, and UserEngagementPointsEntryExportDTO. It also crosses the gRPC boundary as a bare int in both directions, and both sides carry a comment saying the numeric stability is what makes the cast lossless (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/UserEngagementExportGrpcService.cs:73-75, MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/UserEngagementExportServiceGrpcAdapter.cs:51-53).

SetLeaderboardParticipationRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/SetLeaderboardParticipationRequest.cs:8 · Level 0 · record (sealed)

  • What it is: the request body for joining or leaving the public leaderboard. One boolean, nothing else.
  • Depends on: nothing first-party.
  • Concept, the request shape as the security control. [Rubric §11, Security] assesses whether a surface can be misused by a caller who controls the payload, and [Rubric §9, API & Contract Design] assesses contracts that make the wrong call impossible to express. The published display name is resolved from the caller's token principal server-side by SetLeaderboardParticipationHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:76) and is deliberately absent from this record (SetLeaderboardParticipationRequest.cs:4-6). A DisplayName property here would let any caller publish a name they do not own on the one surface whose purpose is showing names to other attendees. The endpoint likewise takes no user id, so there is no ownership argument to check and none to get wrong (PointsController.cs:91-99).
  • Walkthrough (SetLeaderboardParticipationRequest.cs:8-12): a single bool Participate { get; init; } (line 11). true joins, false leaves, and the handler branches on exactly that (SetLeaderboardParticipationHandler.cs:54-56).
  • Why it's built this way: making it a record rather than a bare bool parameter leaves room for the request to grow (a future opt-in preference) without changing the route shape, and it matches the ICommandHandler<TCommand, TResult> signature the controller dispatches to (PointsController.cs:40).
  • Where it's used: bound by PointsController.SetLeaderboardParticipationAsync from the body of PUT /api/points/me/leaderboard-participation (PointsController.cs:100-113); constructed client-side by PointsService (PointsService.cs:46); handled by SetLeaderboardParticipationHandler.

PointsActivityTotalDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsActivityTotalDTO.cs:7 · Level 1 · record (sealed)

  • What it is: the rollup of one earn rule across every attendee: how much it paid out and how many times it fired.
  • Depends on: PointsActivityType. It is a member of PointsOverviewDTO.
  • Concept, the two-number rollup. [Rubric §9, API & Contract Design] assesses whether a read model answers the question its consumer actually asks. Total points alone would not tell an organizer whether a mechanic was popular or merely expensive, so the row carries both the payout and the count: SessionCheckIn paying 4,000 across 400 awards and EventCheckIn paying 4,000 across 160 awards are different facts about the room. [Rubric §30, Compliance, Privacy & Data Governance]: the rollup is aggregate by construction, so the organizer view carries no attendee identity.
  • Walkthrough (PointsActivityTotalDTO.cs:7-17): ActivityType (line 10), TotalPoints (line 13), AwardCount (line 16), all init-only.
  • Where it's used: built by GetPointsOverviewHandler by grouping the projected ledger rows by activity and ordering by the enum value (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetPointsOverview/GetPointsOverviewHandler.cs:51-62), carried on PointsOverviewDTO.PerActivity, rendered by OrganizerPointsOverview.

PointsEntryDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsEntryDTO.cs:7 · Level 1 · record (sealed)

  • What it is: one awarded entry from the points ledger, as seen on the wire: id, activity, points, subject, and when it happened.
  • Depends on: PointsActivityType, PointsSubjectKeys (for the meaning of SubjectKey), and the PointsEntryIdentifierType alias (int, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/MMCA.ADC.Engagement.GlobalUsings.IdentifierType.cs:11).
  • Concept, the append-only ledger row and its snapshot value. [Rubric §8, Data Architecture] assesses whether history is preserved rather than recomputed. Points is what the rules said at award time, not what the current configuration would pay (PointsEntryDTO.cs:4-5, and the same statement on the writer, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:13-18). Retuning the economy mid-conference therefore changes the next award and never rewrites an attendee's history, which is what makes a total explainable.
  • Concept, the DTO that deliberately omits the owner. [Rubric §30, Compliance, Privacy & Data Governance] and [Rubric §11, Security]. There is no UserId on this record, and that absence is load-bearing: the same type serves the caller's own ledger (where the owner is the caller by construction) and the organizer's recent-activity tail (where the owner must not be disclosed). GetPointsOverviewHandler projects a private OverviewRow that does carry the user id, uses it only for the distinct participant count, and drops it before anything leaves the handler (GetPointsOverviewHandler.cs:91-107, :72-80, :84).
  • Walkthrough (PointsEntryDTO.cs:7-23): Id (line 10), declared required, so a projection that forgets to copy the entry id fails to compile instead of shipping a default 0 that would break the id tie-break in the ledger sort (both producers set it explicitly, GetMyPointsHandler.cs:58, GetPointsOverviewHandler.cs:74); ActivityType (line 13); Points (line 16), the snapshot; SubjectKey (line 19), defaulted to string.Empty, holding the event: / session: / sponsor: key built by PointsSubjectKeys; OccurredOnUtc (line 22), a UTC DateTime.
  • Why it's built this way: OccurredOnUtc is separate from the row's audit CreatedOn because an award can be written by a handler reacting to an event that happened earlier; the ledger sorts on the earn instant, with the id as the tie-break so awards stamped in the same instant keep a stable order across pages (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetMyPoints/GetMyPointsHandler.cs:79-88).
  • Where it's used: MyPointsDTO.Entries via GetMyPointsHandler (GetMyPointsHandler.cs:55-66) and PointsOverviewDTO.RecentEntries via GetPointsOverviewHandler (GetPointsOverviewHandler.cs:66-80).

PointsSubjectKeys

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSubjectKeys.cs:11 · Level 1 · class (static)

  • What it is: the one place that formats the subject key scoping an award to the thing it was earned on. Three factories (event:, session:, sponsor:) plus the column-length constant they must fit.
  • Depends on: NotificationScopeKey from MMCA.Common.Shared.Notifications (PointsSubjectKeys.cs:2), and the module identifier aliases EventIdentifierType, SessionIdentifierType, SponsorIdentifierType (solution-wide global using, see primer §2). Externals: System.Globalization and string.Create (PointsSubjectKeys.cs:1, :32).
  • Concept introduced, the idempotency key built in one place. [Rubric §8, Data Architecture] assesses whether the schema's guarantees have a single owner in code, and [Rubric §1, SOLID] assesses single responsibility. An award is idempotent because of the unique index on (UserId, ActivityType, SubjectKey) (PointsEntryConfiguration.cs:45-48). That index only works if every producer of a subject key formats it identically: session:42 and Session: 42 are different rows and therefore two awards for one attendance. This class exists so no call site ever hand-formats the string (PointsSubjectKeys.cs:7-9): one shape, one culture, one place to change it. [Rubric §15, Best Practices & Code Quality].
  • Concept, the format is shared with the notification scope key rather than re-derived. The event- and session-scoped keys are not formatted here at all: ForEvent and ForSession delegate to NotificationScopeKey.ForEvent / NotificationScopeKey.ForSession in MMCA.Common (PointsSubjectKeys.cs:20, :26). That is deliberate, because the two subsystems already agreed on the same string. The framework type owns the format, the event/session prefixes, and the regex that guards it, ^(event|session):[0-9]+$, which the notification hub enforces before a client may join a live group (MMCA.Common/Source/Core/MMCA.Common.Shared/Notifications/NotificationScopeKey.cs:20-55, :32). Delegating means a points key and a live-channel key for the same session are byte-identical and cannot drift apart. [Rubric §15, Best Practices & Code Quality] and [Rubric §6, CQRS & Event-Driven Design]: the shared format lives in the framework, and the ADC-specific extension of it (the sponsor scope, which the notification pattern does not know about) stays in the module.
  • Walkthrough
    • MaxLength = 64 (PointsSubjectKeys.cs:14): the ceiling the column accepts. Both halves of the system read this same constant, the EF configuration through HasMaxLength(PointsSubjectKeys.MaxLength) (PointsEntryConfiguration.cs:38-40) and the domain through PointsEntryInvariants.EnsureSubjectKeyIsValid, which range-checks 1 to MaxLength through CommonInvariants.EnsureStringLengthIsWithin (PointsEntryInvariants.cs:36-44), so a truncating schema and a permissive validator cannot drift apart.
    • ForEvent(eventId) (PointsSubjectKeys.cs:19-20) and ForSession(sessionId) (:25-26): thin forwards to NotificationScopeKey, so the event:{id} and session:{id} shapes have exactly one definition in the codebase.
    • ForSponsor(sponsorId) (PointsSubjectKeys.cs:31-32): the one key formatted locally, string.Create(CultureInfo.InvariantCulture, $"sponsor:{sponsorId}"). There is no sponsor scope in the notification pattern, so this scope is Engagement's own. string.Create with an explicit CultureInfo.InvariantCulture is the deliberate choice over plain interpolation: an id formatted under a culture with non-ASCII digits or different separators would produce a key that never matches the one written yesterday. The framework methods it forwards to make the same choice for the same reason (NotificationScopeKey.cs:16-18).
  • Why it's built this way: the subject key is the half of the idempotency rule that varies per activity, so it has to be data rather than a column. Encoding the scope as a prefix (event:, session:, sponsor:) keeps one column serving three scopes without a discriminator column, and keeps the key human-readable in a support query.
  • Where it's used: AttendeeCheckedInPointsHandler picks the scope per check-in (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:125, :81, :92); SessionFeedbackSubmittedPointsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/SessionFeedbackSubmittedPointsHandler.cs:42), EventFeedbackSubmittedPointsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/EventFeedbackSubmittedPointsHandler.cs:40), and SessionQuestionSubmittedPointsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/DomainEventHandlers/SessionQuestionSubmittedPointsHandler.cs:94) each build theirs the same way. The value ends up on PointsEntryDTO and UserEngagementPointsEntryExportDTO.

MyPointsDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/MyPointsDTO.cs:7 · Level 2 · record (sealed)

  • What it is: the caller's own points view: the running total, their leaderboard status and published name, and a page of the entries behind the total.
  • Depends on: PointsEntryDTO.
  • Concept, the always-caller-scoped read model. [Rubric §11, Security] assesses whether a read can be widened by a hostile caller. This DTO has no user id on it, and neither does the route that returns it: GetMyPointsHandler resolves the attendee through ICurrentUserService.RequireUserId("Points.Forbidden") and returns that failure verbatim when the token carries no user id (GetMyPointsHandler.cs:41-45). The paging arguments select how much of the caller's own ledger comes back, never whose ledger it is (PointsController.cs:45-49), and they are clamped through PagingMath.Clamp against a MaxPageSize of 100 rather than trusted (GetMyPointsHandler.cs:31-32, :48-51).
  • Concept, total summed on read rather than materialized. [Rubric §12, Performance & Scalability] assesses whether a read cost is proportionate to the workload. Total is the sum of every entry the caller owns, computed per request (GetMyPointsHandler.cs:90-94), not a counter maintained on a user row. The handler documents the trade explicitly (GetMyPointsHandler.cs:16-23): at conference scale (about 100 attendees, a few dozen entries each) the summed read is trivial and it removes the class of bug where a materialized total drifts from its ledger. The named scale lever, if the population ever grows, is a materialized total updated by the awarder, and it would change only that handler and PointsAwarder.
  • Walkthrough (MyPointsDTO.cs:7-20): Total (line 10), summed over every entry and not just the returned page; IsOnLeaderboard (line 13); LeaderboardDisplayName (line 16), nullable, null when the caller is not on the board; Entries (line 19), an IReadOnlyList<PointsEntryDTO> defaulted to [] and returned newest first.
  • Why it's built this way: carrying the leaderboard status on the same document the points page already fetches means the UI renders the join/leave toggle without a second round trip; the opt-in read relies on the soft-delete query filter, so an attendee who left the board correctly reports as not on it (GetMyPointsHandler.cs:68-77). IsOnLeaderboard is derived from displayName is not null rather than carried as its own column, so the flag and the name can never disagree (GetMyPointsHandler.cs:95-96).
  • Where it's used: returned by PointsController.GetMyPointsAsync from GET /api/points/me (PointsController.cs:50-66); fetched client-side by IPointsUIService / PointsService (PointsService.cs:20-31) for the MyPoints page.

PointsOverviewDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsOverviewDTO.cs:12 · Level 2 · record (sealed)

  • What it is: the organizer rollup of the points game: how many attendees are playing, what has been paid out, the per-activity breakdown, and a tail of recent activity.
  • Depends on: PointsActivityTotalDTO, PointsEntryDTO.
  • Concept, the cross-attendee read that carries no attendee. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether a privileged view exposes more personal data than its purpose needs. This is the only points surface that reads across every attendee, and it is built so there is nothing to leak: RecentEntries carries entry ids, activity, points, and timestamps only (PointsOverviewDTO.cs:6-10), so an organizer sees THAT points were earned and for what, never by whom. Who earned what stays with the attendee and with the leaderboard names those attendees chose to publish. [Rubric §11, Security]: the endpoint is additionally gated by [HasPermission(EngagementPermissions.PointsViewOverview)] on top of the controller-level [Authorize] (PointsController.cs:35, :120-121), the permission model of ADR-020.
  • Walkthrough (PointsOverviewDTO.cs:12-25): ParticipantCount (line 15), distinct attendees with at least one entry; TotalPointsAwarded (line 18); PerActivity (line 21), the PointsActivityTotalDTO breakdown, defaulted to []; RecentEntries (line 24), newest first, defaulted to [].
  • Why it's built this way: GetPointsOverviewHandler reads the ledger once and folds every figure in memory rather than issuing a query per number (GetPointsOverviewHandler.cs:17-21, :41-50): the Application layer has no EF Core reference, so a SQL GROUP BY is not available to it, and at conference scale one projected pass is cheaper than the round trips a per-figure query set would cost. The requested tail length is clamped with Math.Clamp(query.RecentCount, 1, MaxRecentCount) against a ceiling of 100 (GetPointsOverviewHandler.cs:27-28, :38). [Rubric §12, Performance & Scalability]: the trade is documented along with the materialized-rollup lever that would replace it.
  • Where it's used: returned by PointsController.GetPointsOverviewAsync from GET /api/points/overview (PointsController.cs:114-136); rendered by OrganizerPointsOverview (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Points/OrganizerPointsOverview.razor.cs:40).

PointsSettings

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSettings.cs:13 · Level 9 · class (sealed)

  • What it is: the configuration object for the points economy: what each earn rule pays and how long the public leaderboard is. Bound from the Points configuration section.
  • Depends on: PointsActivityType. Externals: the options binder (Microsoft.Extensions.Options), through the host's AddOptions<PointsSettings>().Bind(...).
  • Concept introduced, configuration as an operational control, not just a default. [Rubric §29, Resilience, Reliability & Business Continuity] assesses how configuration is bound and consumed, and [Rubric §29, Resilience, Reliability & Business Continuity] assesses whether an operator can degrade a feature without a deploy. A value of 0, or a missing configuration entry (which binds to 0), is a deliberate per-rule kill switch: PointsAwarder reads GetPointsFor(activity) and returns success without writing anything when the value is not positive (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:49-59), so one earn rule can be turned off mid-conference while the rest keep earning, and the ledger is not polluted with zero-value entries (PointsSettings.cs:7-10).
  • Concept, deliberately not ValidateOnStart. The Engagement host binds these options without eager validation, and the inline comment states why (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:138-140): a missing Points section binds every award to the defaults below, and an explicit 0 is the documented kill switch, so there is no value an organizer could set that should stop this host from booting mid-conference. The same comment also explains why the binding lives in the host rather than in AddEngagementModule: the module registration takes no IConfiguration (Program.cs:134-137). Contrast the pattern with CheckInSettings, bound the same way immediately after for the same reason (Program.cs:144-149). [Rubric §13, Observability & Operability]: the failure mode chosen here is "boot and keep serving", not "refuse to start".
  • Walkthrough
    • SectionName = "Points" (PointsSettings.cs:16): the constant the host binds against, so the section name is not duplicated as a literal at the call site (Program.cs:141-142).
    • Six int award properties with defaults: EventCheckIn = 25 (line 18), SessionCheckIn = 10 (line 21), SessionFeedback = 15 (line 24), EventFeedback = 15 (line 27), QuestionAsked = 5 (line 30), SponsorVisit = 20 (line 37). The deployed appsettings.json sets exactly these same values (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/appsettings.json:26-34), so the checked-in defaults are the live economy.
    • SponsorVisit carries the longest doc comment of the six (PointsSettings.cs:33-37) and it is the interesting one: the deep link an attendee scans is shareable, so the once-per-sponsor cap enforced by the subject key plus a bounded value is what makes passing the URL around worthless.
    • LeaderboardSize = 10 (line 40): how many rows the public board shows. GetLeaderboardHandler reads it through Math.Max(settings.Value.LeaderboardSize, 0) before Take(...) (GetLeaderboardHandler.cs:63, :70), so a negative configured value yields an empty board rather than an exception.
    • GetPointsFor(activity) (PointsSettings.cs:49-59): a switch expression over PointsActivityType with a _ => 0 arm (line 57), so an undefined activity is treated exactly like a configured 0 and awards nothing.
  • Why it's built this way: init-only properties keep the bound options immutable after startup, and putting GetPointsFor on the settings object rather than in the awarder means the "what is this worth" lookup has one home; the awarder is left holding only the idempotency and persistence concerns. Keeping the type in *.Shared (not Application) is what lets the host bind it without referencing the Application layer.
  • Where it's used: bound by the Engagement service host (Program.cs:141-142); injected as IOptions<PointsSettings> into PointsAwarder (PointsAwarder.cs:32, :46) and GetLeaderboardHandler (GetLeaderboardHandler.cs:30, :63).
  • Caveats / not-in-source: whether a live production deployment overrides any of these values through environment configuration is not determinable from source; the repository shows only the checked-in appsettings.json values, which match the class defaults.

ClaimTicketRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/ClaimTicketRequest.cs:7 · Level 0 · record

  • What it is: the body of an attendee's barcode claim (BR-273, UC-50): the event and the barcode printed on the TicketLeap ticket. The account is never part of the request; the handler takes it from the token (ClaimTicketRequest.cs:3-6).
  • Depends on: nothing first-party beyond the EventIdentifierType alias (ClaimTicketRequest.cs:20).
  • Concept: a Shared-layer contract that also owns a number. [Rubric §9, API & Contract Design] assesses whether contracts are explicit and stable; here the request is a record class with required/init members (ClaimTicketRequest.cs:17,20), and it carries the one declaration of the barcode length so every layer agrees on it. [Rubric §11, Security] assesses whether identity comes from a trusted source; leaving the user id out of the body means a caller cannot claim on someone else's behalf.
  • Walkthrough: BarcodeMaxLength = 100 (ClaimTicketRequest.cs:14) is declared here because Shared is the lowest layer every consumer reaches (ClaimTicketRequest.cs:9-13). EventId (ClaimTicketRequest.cs:17) and Barcode (ClaimTicketRequest.cs:20) are both required.
  • Why it's built this way: writing the limit once removes drift between the UI input cap, the validator and the domain. TicketInvariants re-exports the same constant (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketInvariants.cs:21), and ClaimTicketRequestValidator enforces it through that alias (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ClaimTicket/ClaimTicketRequestValidator.cs:23-24).
  • Where it's used: bound from the body of TicketsController.ClaimAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:142-143), handled by ClaimTicketHandler as an ICommandHandler<ClaimTicketRequest, Result<MyTicketDTO>> (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ClaimTicket/ClaimTicketHandler.cs:40,46-47), and sent by the UI TicketService.

SendTicketInvitesRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/SendTicketInvitesRequest.cs:6 · Level 0 · record

  • What it is: the organizer's request to email one invite per eligible order email of an event's roster (BR-270, UC-49) (SendTicketInvitesRequest.cs:3-5).
  • Depends on: the EventIdentifierType alias only.
  • Concept: same request-record shape as ClaimTicketRequest; the new element is a dry-run switch that turns a side-effecting command into a preview.
  • Walkthrough: EventId is required (SendTicketInvitesRequest.cs:9); DryRun (SendTicketInvitesRequest.cs:12) is optional and defaults to false, and when set the run reports counts without sending anything (SendTicketInvitesRequest.cs:11).
  • Why it's built this way: mail sent cannot be recalled, so the organizer can see the count first; the result echoes the flag back in TicketInvitesResultDTO.
  • Where it's used: bound by TicketsController.SendInvitesAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:72-73), validated by SendTicketInvitesRequestValidator, handled by SendTicketInvitesHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/SendTicketInvites/SendTicketInvitesHandler.cs:38,41-42).

TicketAccountLinkResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketAccountLinkResultDTO.cs:9 · Level 0 · record

  • What it is: the outcome of linking an event's roster to accounts that already exist with a confirmed address (BR-277, UC-55). Every Live, unlinked ticket carrying an order email lands in exactly one of the three counts (TicketAccountLinkResultDTO.cs:3-8).
  • Depends on: the EventIdentifierType alias.
  • Concept: a partitioning result DTO. [Rubric §9, API & Contract Design] assesses whether a response explains itself; the three buckets add up to the population considered, so an organizer can see why a ticket was not linked rather than only how many were.
  • Walkthrough: EventId (TicketAccountLinkResultDTO.cs:12); Linked (TicketAccountLinkResultDTO.cs:15), the tickets this run linked; LeftForBarcode (TicketAccountLinkResultDTO.cs:22), tickets whose order email belongs to an account but sit on a multi-ticket order where none (or not this one) carries the account's name, so they wait for a barcode claim (BR-273); NoAccount (TicketAccountLinkResultDTO.cs:25), tickets whose order email has no account with a confirmed address. All are required.
  • Why it's built this way: the doc comment records the idempotency property: a re-run reports zero linked, because the rules that linked nothing the first time link nothing the second (TicketAccountLinkResultDTO.cs:6-7).
  • Where it's used: produced by ExistingAccountLinker (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/ExistingAccountLinker.cs:42), returned by LinkExistingAccountsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/LinkExistingAccounts/LinkExistingAccountsHandler.cs:26,29) and TicketsController.LinkExistingAccountsAsync (TicketsController.cs:101), and read by ITicketUIService for the TicketRoster page.

TicketInvitesResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketInvitesResultDTO.cs:6 · Level 0 · record

  • What it is: the counts an invite run reports back, for a real run or a dry run.
  • Depends on: the EventIdentifierType alias.
  • Concept: the response half of SendTicketInvitesRequest. [Rubric §31, Cost/FinOps] assesses whether consumption of metered resources is bounded; Remaining makes the per-run cap from TicketSettings visible instead of silently truncating the send.
  • Walkthrough: EventId (TicketInvitesResultDTO.cs:9); DryRun (TicketInvitesResultDTO.cs:12) echoes the request flag; Sent (TicketInvitesResultDTO.cs:15) counts distinct order emails sent (or that would be); TicketsCovered (TicketInvitesResultDTO.cs:18) counts the tickets those invites cover, since one buyer may hold several; Remaining (TicketInvitesResultDTO.cs:21) counts eligible order emails left over by the cap for the next run.
  • Why it's built this way: the cap is applied per distinct email (SendTicketInvitesHandler.cs:16,54), so the DTO separates emails from tickets to keep both numbers honest.
  • Where it's used: returned by SendTicketInvitesHandler (SendTicketInvitesHandler.cs:38,41) and TicketsController.SendInvitesAsync (TicketsController.cs:72); shown on the TicketRoster page through ITicketUIService.

TicketLinkMethod

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketLinkMethod.cs:9 · Level 0 · enum

  • What it is: how a roster ticket came to be linked to an account: by a verified order email (BR-272) or by a barcode claim (BR-273) (TicketLinkMethod.cs:3-7).
  • Depends on: nothing first-party.
  • Concept: a persisted enum with no zero member. [Rubric §8, Data Architecture] assesses whether stored values stay stable over time; the numbers are persisted, so a method is added and never renumbered (TicketLinkMethod.cs:4-5), and zero is reserved as "unset" so a defaulted field never resolves to a real method. The CA1008 suppression records this and names PointsActivityType as the precedent (TicketLinkMethod.cs:8).
  • Walkthrough: VerifiedEmail = 1 (TicketLinkMethod.cs:12), Barcode = 2 (TicketLinkMethod.cs:15).
  • Why it's built this way: an unlinked ticket carries no method at all (TicketLinkMethod.cs:5-6), so a zero member would be a lie waiting to be persisted.
  • Where it's used: passed to Ticket.LinkTo(userId, method, linkedOn) (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:277); TicketLinker links with VerifiedEmail (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketLinker.cs:105) and ClaimTicketHandler with Barcode (ClaimTicketHandler.cs:95); GetRosterInsightsHandler splits the linked count by method (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:116-117); and MyTicketDTO exposes it to the attendee.

TicketRosterImportErrorCodes

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Imports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Imports/TicketRosterImportErrorCodes.cs:7 · Level 0 · class (static)

  • What it is: the machine-readable error codes of a roster import run (UC-48), shared by the API that sets them and the upload component that words them in the selected language. None carries holder data (TicketRosterImportErrorCodes.cs:3-6).
  • Depends on: nothing.
  • Concept: error codes as a cross-tier contract. [Rubric §27, i18n] assesses whether user-facing text is localized rather than baked into server responses; the server sends a stable code and the UI maps it to a resource key, so the wording follows the user's language.
  • Walkthrough: four const string codes: AlreadyRunning = "Ticket.Import.AlreadyRunning" (TicketRosterImportErrorCodes.cs:10), Failed (TicketRosterImportErrorCodes.cs:13), Abandoned (TicketRosterImportErrorCodes.cs:16, the run stopped making progress and was ended by its backstop), and NoRun (TicketRosterImportErrorCodes.cs:19).
  • Why it's built this way: the server-side owners re-export the codes rather than restating the strings: TicketImportRun.AbandonedErrorCode (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketImportRun.cs:29), StartTicketRosterImportHandler.AlreadyRunningCode (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportHandler.cs:37), ProcessTicketRosterImportHandler.FailedCode (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportHandler.cs:40) and GetTicketRosterImportHandler.NoRunCode (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterImport/GetTicketRosterImportHandler.cs:18).
  • Where it's used: TicketImportRunGuard raises AlreadyRunning (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketImportRunGuard.cs:21); the UI maps codes to resource keys in TicketRosterUpload (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketRosterUpload.razor.cs:45,264) and TicketRoster (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketRoster.razor.cs:38).

TicketRosterImportResultDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketRosterImportResultDTO.cs:8 · Level 0 · record

  • What it is: the outcome of a synchronous roster upload (BR-268, UC-48): what the upload did, or for a dry run what it would do. Every ticket in the file lands in exactly one of Added, Updated, Unchanged or Reinstated; Voided counts tickets of the same source event the file no longer contains (TicketRosterImportResultDTO.cs:3-7).
  • Depends on: the EventIdentifierType alias.
  • Concept: a reconciliation report. [Rubric §9, API & Contract Design]: the partition is stated in the contract itself, so a consumer can check TotalInFile against the four per-ticket buckets.
  • Walkthrough: EventId (TicketRosterImportResultDTO.cs:11), SourceEventName (TicketRosterImportResultDTO.cs:14, the TicketLeap Event Name from the file), DryRun (TicketRosterImportResultDTO.cs:17), TotalInFile (TicketRosterImportResultDTO.cs:20), then Added, Updated, Unchanged, Voided, Reinstated (TicketRosterImportResultDTO.cs:23-35), all required. LinkedExistingAccounts (TicketRosterImportResultDTO.cs:42) is optional: the tickets a committed upload linked to accounts already holding a confirmed address (BR-277), zero for a dry run and zero when the account lookup was unavailable, in which case the organizer's "Link existing accounts" run retries it (TicketRosterImportResultDTO.cs:37-41).
  • Why it's built this way: LinkedExistingAccounts is not required because the linking step is best-effort after the roster is written; the field defaulting to zero keeps the upload result valid when that step is skipped.
  • Where it's used: returned by ImportTicketRosterHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/ImportTicketRosterHandler.cs:22,25) via TicketRosterImportReport, exposed by TicketRosterImportController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:37), and shown by TicketRosterUpload. The committed-run counterpart is TicketRosterImportRunDTO.

TicketRosterImportStatus

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Imports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Imports/TicketRosterImportStatus.cs:7 · Level 0 · enum

  • What it is: the lifecycle states of a background roster import run.
  • Depends on: nothing.
  • Concept: a small state-machine enum. [Rubric §4, DDD] assesses whether aggregates guard their own transitions; TicketImportRun is the only writer of these values, moving Queued -> Running -> Succeeded or to Failed (TicketImportRun.cs:114,130,145,165).
  • Walkthrough: Queued = 0 (TicketRosterImportStatus.cs:10, recorded and waiting for the background processor), Running = 1 (TicketRosterImportStatus.cs:13, applying batches while the processed count moves), Succeeded = 2 (TicketRosterImportStatus.cs:16, counts final), Failed = 3 (TicketRosterImportStatus.cs:19, stopped early; the error code says why and a re-upload completes it).
  • Why it's built this way: Queued is zero, so a defaulted run is the not-yet-started state. Queued and Running together define "active" both on the aggregate (TicketImportRun.cs:83) and on TicketRosterImportRunDTO.
  • Where it's used: TicketImportRun, TicketImportRunGuard, StartTicketRosterImportHandler, and the polling loop in TicketRosterUpload (TicketRosterUpload.razor.cs:220,249).

TicketRosterLimits

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketRosterLimits.cs:8 · Level 0 · class (static)

  • What it is: the size bounds for a roster upload (BR-268), shared by the endpoint, the command validators and the upload page so all three refuse the same file (TicketRosterLimits.cs:3-7).
  • Depends on: nothing.
  • Concept: one constant enforced at every tier. [Rubric §11, Security] assesses input bounding at the edge; [Rubric §24, Forms/Validation/UX Safety] assesses whether the client refuses what the server would. The same number drives Kestrel's request cap, the stream read, the validator and the client pre-check.
  • Walkthrough: MaxFileBytes = 2 * 1024 * 1024 (2 MB, TicketRosterLimits.cs:11); MaxRequestBytes = MaxFileBytes + 65536 (TicketRosterLimits.cs:14), the file plus headroom for the multipart form fields.
  • Why it's built this way: a TicketLeap export of a few thousand tickets is well under a megabyte, so the cap only stops a wrong file, never a real roster (TicketRosterLimits.cs:5-6). The request headroom keeps a file at exactly the limit from being rejected by the request-size cap before the controller can answer with a clear message. The Conference module's SessionAssetLimits follows the same two-constant shape (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/SessionAssets/SessionAssetLimits.cs:11,20).
  • Where it's used: [RequestSizeLimit(TicketRosterLimits.MaxRequestBytes)] and the bounded read in TicketRosterImportController (TicketRosterImportController.cs:59,78,81); ImportTicketRosterCommandValidator (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ImportTicketRoster/ImportTicketRosterCommandValidator.cs:24-25) and StartTicketRosterImportCommandValidator (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportCommandValidator.cs:24-25); the client pre-check and OpenReadStream cap in TicketRosterUpload (TicketRosterUpload.razor.cs:96,111,121).

TicketRosterSummaryDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketRosterSummaryDTO.cs:7 · Level 0 · record

  • What it is: the headline counts of an event's ticket roster for the organizer page.
  • Depends on: the EventIdentifierType alias.
  • Concept: a read-model DTO; see TicketRosterImportResultDTO for the count-contract shape.
  • Walkthrough: EventId (TicketRosterSummaryDTO.cs:10); Tickets (TicketRosterSummaryDTO.cs:13), Live tickets; Invited (TicketRosterSummaryDTO.cs:16), Live tickets an invite was sent for; Linked (TicketRosterSummaryDTO.cs:19), Live tickets linked to an account; Voided (TicketRosterSummaryDTO.cs:22); PendingInvites (TicketRosterSummaryDTO.cs:28), distinct order emails an invite run would email now (Live, unlinked, not yet invited, carrying an email), before the per-run cap: the number on the "Send invites (N)" button (TicketRosterSummaryDTO.cs:24-27).
  • Why it's built this way: PendingInvites is reported before the cap so the button shows the true backlog; the cap's effect is reported afterwards by TicketInvitesResultDTO.Remaining.
  • Where it's used: computed by GetTicketRosterSummaryHandler with one count per bucket filtered on TicketStatus (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetRosterSummary/GetTicketRosterSummaryHandler.cs:16,19,29-38), returned by TicketsController.GetSummaryAsync (TicketsController.cs:178), and rendered by TicketRoster.

TicketSettings

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketSettings.cs:7 · Level 0 · class (sealed)

  • What it is: the options class for the ticket roster (BR-270), bound from the "Tickets" configuration section so an organizer retunes the invite cap without a code change (TicketSettings.cs:3-6).
  • Depends on: nothing first-party; bound through Microsoft.Extensions.Options.
  • Concept: options with working defaults. [Rubric §31, Cost/FinOps] and [Rubric §11, Security] both apply: the invite cap keeps a run under the shared mail relay's daily quota, and the claim budgets throttle barcode guessing twice over: per account, and per public client address so a batch of throwaway accounts behind one address shares one budget (S-ADC-identity-03). The binding deliberately omits ValidateOnStart (contrast the fail-fast stance in ADR-070): a missing section binds the defaults, which are a working value rather than a misconfiguration (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:104-108).
  • Walkthrough: SectionName = "Tickets" (TicketSettings.cs:10). MaxInvitesPerRun = 200 (TicketSettings.cs:17) leaves headroom under the relay's daily limit of 300 for confirmation and password-reset mail (TicketSettings.cs:12-16). MaxClaimAttemptsPerUser = 10 (TicketSettings.cs:24) within ClaimAttemptWindowMinutes = 60 (TicketSettings.cs:30); an attendee claims one or two tickets, so the budget only bites on someone working through barcodes (TicketSettings.cs:19-23). The same window length serves both budgets (TicketSettings.cs:26-29). MaxClaimAttemptsPerClientIp = 10 (TicketSettings.cs:41) caps claims from one public address whichever accounts they come from; a private or loopback address (the web UI's server-rendered calls reach the service from inside the deployment) is not attributable to one client and stays bounded by the per-account budget alone, and zero or less switches the per-address budget off (TicketSettings.cs:32-40). Attendees on one venue network share one public address, so the comment advises raising it for conference day if the venue claims tickets in bulk.
  • Why it's built this way: the numbers are operational, not domain rules, so they live in configuration with documented defaults instead of in invariants.
  • Where it's used: bound at Program.cs:107-108; SendTicketInvitesHandler reads the cap as Math.Max(0, settings.Value.MaxInvitesPerRun) (SendTicketInvitesHandler.cs:36,54); ClaimTicketHandler counts attempts in the shared cache over the window and fails with TooManyRequests past the per-account limit (ClaimTicketHandler.cs:38,67-72); TicketClaimRateLimiting configures its named policy from the bound settings (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/RateLimiting/TicketClaimRateLimiting.cs:49-50) and partitions each request into a fixed window of MaxClaimAttemptsPerClientIp per ClaimAttemptWindowMinutes keyed on the public address, or no limiter when either value is zero or less or the address is not attributable (TicketClaimRateLimiting.cs:63,70-75).

TicketStatus

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketStatus.cs:7 · Level 0 · enum

  • What it is: whether a roster ticket still appears in the organizer's latest upload of its source event (BR-268) (TicketStatus.cs:3-6).
  • Depends on: nothing.
  • Concept: a persisted two-state enum; numbers are added, never renumbered (TicketStatus.cs:5), the same stability rule as TicketLinkMethod. Here zero is a real value, because every ticket has a status from creation.
  • Walkthrough: Live = 0 (TicketStatus.cs:10), in the latest upload; Voided = 1 (TicketStatus.cs:13), a later upload of the same source event no longer contains it.
  • Why it's built this way: voiding instead of deleting keeps an attendee's link and history if the ticket comes back; Ticket toggles between the two states and short-circuits when already there (Ticket.cs:102,187-190,198-201).
  • Where it's used: almost every roster query filters on Live: GetTicketRosterSummaryHandler (GetTicketRosterSummaryHandler.cs:29-38), ExistingAccountLinker (ExistingAccountLinker.cs:54), TicketLinker (TicketLinker.cs:63), PendingTicketInvitationService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/PendingTicketInvitationService.cs:58), SendTicketInvitesHandler (SendTicketInvitesHandler.cs:116) and GetRosterInsightsHandler (GetRosterInsightsHandler.cs:89,337). The attendee sees it on MyTicketDTO.

MyTicketDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/MyTicketDTO.cs:7 · Level 1 · record

  • What it is: one ticket linked to the caller (UC-51): what the attendee needs to recognize the ticket, never the order email or the barcode (MyTicketDTO.cs:3-6).
  • Depends on: TicketStatus and TicketLinkMethod (hence Level 1), plus the TicketIdentifierType and EventIdentifierType aliases.
  • Concept: a data-minimizing projection. [Rubric §30, Compliance/Privacy/Data Governance] assesses whether personal data leaves the server only where needed; the DTO omits the two fields that could be replayed or harvested (order email, barcode) even though the caller owns the ticket.
  • Walkthrough: TicketId (MyTicketDTO.cs:10), EventId (MyTicketDTO.cs:13), SourceEventName (MyTicketDTO.cs:16), TicketTypeName (MyTicketDTO.cs:19), AttendeeFirstName / AttendeeLastName (MyTicketDTO.cs:22,25), Status (MyTicketDTO.cs:28), LinkMethod (MyTicketDTO.cs:31) and LinkedOn (MyTicketDTO.cs:34); all required.
  • Why it's built this way: the projection is an expression (MyTicketProjection.Selector, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/DTOs/MyTicketProjection.cs:15), so EF selects only these columns; see manual DTO mapping in ADR-001.
  • Where it's used: returned by GetMyTicketsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetMyTickets/GetMyTicketsHandler.cs:20,23) and by a successful barcode claim in ClaimTicketHandler (ClaimTicketHandler.cs:40,46); exposed by TicketsController.ClaimAsync and GetMineAsync (TicketsController.cs:142,160); rendered by MyTicketsPanel via ITicketUIService.

TicketRosterImportRunDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Imports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Imports/TicketRosterImportRunDTO.cs:8 · Level 1 · record

  • What it is: one committed roster import run (UC-48), as the upload component polls it: server-side progress (Processed of Total), the outcome counts so far, and on a failed run the machine-readable error code. It carries no ticket holder data (TicketRosterImportRunDTO.cs:3-7).
  • Depends on: TicketRosterImportStatus (hence Level 1), the TicketImportRunIdentifierType and EventIdentifierType aliases; ErrorCode holds one of TicketRosterImportErrorCodes.
  • Concept: a polled progress contract for long-running work. [Rubric §12, Performance & Scalability] assesses whether long operations leave the request path; the commit returns this DTO immediately and the client polls it while the background processor applies the roster in batches. [Rubric §19, State Management]: the client derives its "importing" state from the server's IsActive instead of keeping its own flag (TicketRosterUpload.razor.cs:88).
  • Walkthrough: RunId, EventId, Status, Total, Processed are required (TicketRosterImportRunDTO.cs:11,14,17,20,23). The outcome counts Added, Updated, Unchanged (erased holders included), Voided, Reinstated and LinkedExistingAccounts are optional ints (TicketRosterImportRunDTO.cs:26-41), since they fill in as the run proceeds. ErrorCode is nullable (TicketRosterImportRunDTO.cs:44). IsActive (TicketRosterImportRunDTO.cs:47) is a computed property: Status is Queued or Running, mirroring TicketImportRun.IsActive (TicketImportRun.cs:83).
  • Why it's built this way: the counts mirror TicketRosterImportResultDTO so the synchronous and the background paths report the same numbers; keeping IsActive on the contract puts the one definition of "still running" where both server and client read it.
  • Where it's used: mapped by TicketImportRunMapping; returned by StartTicketRosterImportHandler (StartTicketRosterImportHandler.cs:34,40) and GetTicketRosterImportHandler (GetTicketRosterImportHandler.cs:15,21); exposed by TicketRosterImportController (TicketRosterImportController.cs:38-39,129); polled by TicketRosterUpload (TicketRosterUpload.razor.cs:163,220).

AdoptionDayDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/AdoptionDayDTO.cs:4 · Level 0 · record

  • What it is: one calendar-day row of report A2 (adoption over time): how many Live tickets had an invite sent and how many were linked to an account on that day, plus the running linked total.
  • Depends on: nothing first-party; DateOnly from the BCL.
  • Concept: a plain read-model row; the report family and its small-number rule are introduced on InsightCount and RosterInsightsDTO. This row carries raw integers rather than InsightCount cells.
  • Walkthrough: Day (AdoptionDayDTO.cs:7), InvitesSent (:10), AccountsLinked (:13), CumulativeLinked (:16) and CumulativePercentLinked (:19), all init-only on a sealed record class (:4). The handler fills one row per day from the first to the last day that saw an invite or a link, so a quiet day in between still gets a zero row (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:148-165). CumulativePercentLinked is a 0-100 percentage to one decimal over the event's current Live ticket total (GetRosterInsightsHandler.cs:61,163,350-351), not a 0-1 rate.
  • Why it's built this way: days are cut on the event's clock (see InsightTimeBasis), so an invite sent late in the evening lands on the organizer's day, not the UTC one (GetRosterInsightsHandler.cs:130-135).
  • Where it's used: the Days list of AdoptionTrendDTO (AdoptionTrendDTO.cs:10); rendered by TicketInsightsCsv for the A2 export.

FollowUpQueueDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/FollowUpQueueDTO.cs:9 · Level 0 · record

  • What it is: report A3, the follow-up queue as four counts: Live tickets invited at least 3 (or 7) days ago and still unlinked, split by single-ticket versus multi-ticket orders (FollowUpQueueDTO.cs:3-8).
  • Depends on: nothing first-party.
  • Concept: the split is operational. Per the type's own doc comment, a single-ticket order is a reminder-email candidate, while a ticket of a multi-ticket order is a barcode-claim candidate because one order email cannot tell which holder it is (FollowUpQueueDTO.cs:5-7). The 7-day counts are a subset of the 3-day counts (FollowUpQueueDTO.cs:7).
  • Walkthrough: SingleTicketOrders3Days (:12), MultiTicketOrders3Days (:15), SingleTicketOrders7Days (:18), MultiTicketOrders7Days (:21). The thresholds are handler constants ReminderDays = 3 and LateReminderDays = 7 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:43,46), measured back from TimeProvider now (GetRosterInsightsHandler.cs:188-189); BuildFollowUp sums per-order tallies with Tickets == 1 versus Tickets > 1 (GetRosterInsightsHandler.cs:221-226).
  • Where it's used: RosterInsightsDTO.FollowUp (RosterInsightsDTO.cs:32); exported by TicketInsightsCsv as A3.

InsightCount

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/InsightCount.cs:21 · Level 0 · record

  • What it is: one count cell of a ticket insights report under the BR-278 small-number rule: a count of 1 or 2 is withheld, while 0 and 3 or more are reported exactly, so an aggregate can never single out one person (InsightCount.cs:3-8). A cell can also be withheld as a complementary cell: a count of 3 or more hidden because, beside a total or a complement, it would let a suppressed count be recovered by subtraction (InsightCount.cs:10-13).
  • Depends on: nothing first-party; Math.Round with MidpointRounding.AwayFromZero from the BCL.
  • Concept introduced, server-side small-number suppression. [Rubric §30, Compliance/Privacy/Data Governance] assesses whether personal data is minimized and protected by design. Here the rule runs when the cell is created, in the factory, so a suppressed cell holds no number at all: neither the API response nor a CSV export ever carries the real value (InsightCount.cs:6-8). A client cannot un-hide what was never sent. [Rubric §9, API & Contract Design] assesses whether contracts make invalid states hard to express; the three factories are the only places that set the flags consistently with Count and Rate.
  • Walkthrough:
    • Constants: SmallNumberThreshold = 3 (InsightCount.cs:24), SuppressedText = "fewer than 3" (:27) and ComplementaryText = "withheld" (:30), the texts both the report UI and the CSV write in place of a small count and a complementary cell respectively.
    • State: Count is int?, null when suppressed (:33); IsSuppressed (:39), true for a small count and for a complementary cell; IsComplementary (:45), always paired with IsSuppressed; Rate is decimal? (:52), the count per unit of the cell's denominator (a 0-1 share for a percentage cell, a per-holder average for a total), rounded to four decimals.
    • Of(int count) (:57-60): suppressed cell when the count is small, else an exact cell with no rate.
    • Of(int count, int denominator) (:69-76): suppressed cell (rate suppressed with it) when small; otherwise Rate = count / denominator rounded to 4 places away from zero, and a zero or negative denominator yields 0 rather than a division error (:74).
    • Complementary() (:80): a cell with IsSuppressed and IsComplementary both set and no Count or Rate.
    • IsSmall(int count) (:85): count is > 0 and < SmallNumberThreshold, so zero is deliberately exact.
  • Why it's built this way: zero carries no re-identification risk and "nobody did X" is useful to an organizer, so only 1 and 2 are withheld (InsightCount.cs:4-5,85). Suppressing the rate with the count closes the obvious back door of recomputing the count from rate times denominator (InsightCount.cs:16-18). Hiding one cell is not enough when the report also publishes a total over it, so a second, complementary cell is withheld; because that cell is always 3 or more it gets its own text rather than claiming "fewer than 3" (InsightCount.cs:10-13). The cell only carries the flag: deciding which cells are complementary is InsightSuppression's job, which withholds the smallest exact non-zero cell of any relation left with exactly one withheld cell and builds it through Complementary() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/InsightSuppression.cs:11-18,121-122). The threshold is also reused outside the cell: the A6 domain list drops any company domain under it before taking the top ten (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:263-268).
  • Where it's used: every count cell of A6 (EmailDomainMixDTO, EmailDomainCountDTO) and of the B reports (TicketTypeCountDTO, TicketTypeEngagementDTO, SponsorReachDTO, ArrivalBucketDTO), built by GetRosterInsightsHandler and GetEngagementInsightsHandler. TicketInsightsCsv writes ComplementaryText for a complementary cell and SuppressedText for any other withheld cell, in both count and rate columns (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/TicketInsightsCsv.cs:281-297); the UI displays the matching localized label through InsightCountValue (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightCountValue.razor:8). Unit-tested in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Shared.Tests/Tickets/Insights/InsightCountTests.cs.
  • Caveats / not-in-source: BR-278 itself is defined in the ADC specifications guide, not in code; the code is the only enforcement point verified here.

InsightTimeBasis

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/InsightTimeBasis.cs:9 · Level 0 · enum

  • What it is: which clock a ticket insights report bucketed its days and half hours in: Utc = 1 (InsightTimeBasis.cs:12) or EventUtcOffset = 2 (:15), the event's UTC offset on its first day.
  • Depends on: nothing first-party.
  • Concept: the report tells its reader which clock it used instead of silently guessing. Conference does not hand Engagement an IANA time-zone id, only the event's first day and the UTC instant it starts, from which the offset follows (InsightTimeBasis.cs:3-7). 0 is reserved as unset so a defaulted field never resolves to a real basis, with a justified CA1008 suppression (InsightTimeBasis.cs:8).
  • Walkthrough: the internal EventClock resolves it through IEventLiveValidationService: a failed lookup, a missing first day, or a derived offset beyond 14 hours all fall back to Utc with offset 0; otherwise EventUtcOffset with the computed minutes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/EventClock.cs:44-63).
  • Why it's built this way: degrade rather than fail. A Conference outage turns the reports UTC-bucketed and labelled as such (EventClock.cs:12-14). The offset is exact on event day and at most an hour off for a day across a daylight-saving change (EventClock.cs:10-12).
  • Where it's used: RosterInsightsDTO.TimeBasis (RosterInsightsDTO.cs:17) and the matching property of EngagementInsightsDTO.

OrderSizeCountDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/OrderSizeCountDTO.cs:4 · Level 0 · record

  • What it is: one bar of the A4 tickets-per-order histogram: TicketsPerOrder (OrderSizeCountDTO.cs:7) and how many Orders have exactly that many Live tickets (:10).
  • Depends on: nothing first-party.
  • Walkthrough: built by grouping the per-email order tallies on their ticket count, smallest first (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:241-244). Single-ticket orders are included.
  • Where it's used: GroupOrdersDTO.OrderSizes (GroupOrdersDTO, GroupOrdersDTO.cs:22).
  • Caveats / not-in-source: the counts are raw integers, not InsightCount cells; an order-size bucket with one or two orders is reported exactly.

RosterHealthDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/RosterHealthDTO.cs:7 · Level 0 · record

  • What it is: report A5, roster health: voided, erased and nameless tickets, duplicate-name counts, and the roster's freshness timestamps (RosterHealthDTO.cs:3-6).
  • Depends on: nothing first-party in the type; the handler reads Ticket and TicketStatus.
  • Walkthrough:
    • Voided (RosterHealthDTO.cs:10): tickets no longer in the latest upload (BR-268), status Voided.
    • Erased (:13): any-status tickets whose holder fields were erased with the linked account (ADR-005); the handler detects these by the barcode starting with Ticket.AnonymizedBarcodePrefix (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:307,338).
    • BlankName (:19): Live, non-erased tickets with both attendee name parts empty (GetRosterInsightsHandler.cs:308,339-341).
    • DuplicateNameTickets (:22) and DuplicateNames (:25): tickets and distinct names that appear on more than one Live ticket (GetRosterInsightsHandler.cs:320-324,342-343).
    • SameOrderDuplicateNameTickets (:32): Live tickets sharing a name within the same order email, most often the buyer's name filled in for blank attendee names (GetRosterInsightsHandler.cs:344).
    • LastTicketAddedOn (:35) and LastTicketChangedOn (:38): UTC, null on an empty roster, read by two single-row specification queries (GetRosterInsightsHandler.cs:326-333).
  • Why it's built this way: names compare under the database collation, case-insensitive on SQL Server (RosterHealthDTO.cs:4-5), so the check runs as a GROUP BY on the server instead of loading names into memory (GetRosterInsightsHandler.cs:313-318).
  • Where it's used: RosterInsightsDTO.Health (RosterInsightsDTO.cs:38); exported as A5 by TicketInsightsCsv.
  • Caveats / not-in-source: these are raw integers, not InsightCount cells, so a count of 1 or 2 is shown exactly. Whether that is intended under BR-278 (these counts name no person) is not stated in the type.

TicketInsightsReport

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/TicketInsightsReport.cs:9 · Level 0 · enum

  • What it is: the name of one table on the ticket insights page (UC-56), as the CSV export takes it (report=a1 .. report=b4) (TicketInsightsReport.cs:3-7).
  • Depends on: nothing first-party.
  • Concept: two report families in one enum, numbered apart: A1 to A6 = 1..6 read the roster only (BR-279) (TicketInsightsReport.cs:12-27), B1 to B4 = 11..14 join the roster with the app activity of linked holders (BR-280) (:30-39). 0 is reserved as unset so a missing report name never resolves to a real table (CA1008 suppression, :8).
  • Walkthrough: TicketInsightsCsv maps each value to a renderer through two FrozenDictionary tables, one per family (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/TicketInsightsCsv.cs:36-54), and IsRosterReport decides which query handler the export runs (TicketInsightsCsv.cs:60).
  • Why it's built this way: the export endpoint binds the enum from the query string and rejects an undefined value with a validation error (Ticket.Insights.UnknownReport) before running any query (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:254-264). [Rubric §9, API & Contract Design] assesses explicit, validated contracts; a closed enum keeps the set of exportable tables fixed in one place.
  • Where it's used: TicketsController ExportInsightsAsync (TicketsController.cs:247-268), TicketInsightsCsv, and the UI's InsightReportSection.

TicketTypeFunnelDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/TicketTypeFunnelDTO.cs:7 · Level 0 · record

  • What it is: one row of report A1, the invite-to-link funnel per TicketLeap ticket type; the same type also carries the all-types total row, with an empty TicketTypeName (TicketTypeFunnelDTO.cs:10).
  • Depends on: nothing first-party in the type; the handler reads TicketLinkMethod.
  • Walkthrough: Tickets (:13), Invited (:16), Linked (:19), PercentLinked (:22, 0-100 to one decimal), LinkedByVerifiedEmail (:25, BR-272/BR-277) and LinkedByBarcode (:28, BR-273). The handler runs one GROUP BY (ticket type, invited, link method) over Live tickets through IEntityQuerier<TEntity, TIdentifierType> CountByAsync, then folds the cells per type, ordered ordinally, and once more for the total (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:82-118); the fold's input row is the private FunnelCell.
  • Why it's built this way: one server-side grouping returns a handful of rows however large the roster, and both the rows and the total come from it (GetRosterInsightsHandler.cs:81). The total's Tickets is reused as the denominator of A2's cumulative percentage (GetRosterInsightsHandler.cs:61).
  • Where it's used: RosterInsightsDTO.Funnel and FunnelTotal (RosterInsightsDTO.cs:23,26).
  • Caveats / not-in-source: raw integers, not InsightCount cells.

AdoptionTrendDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/AdoptionTrendDTO.cs:7 · Level 1 · record

  • What it is: report A2, adoption over time: the day series plus the median gap between a ticket's invite and its link.
  • Depends on: AdoptionDayDTO.
  • Walkthrough: Days (AdoptionTrendDTO.cs:10), oldest first, empty when nothing was invited or linked; InvitedThenLinked (:13), the sample size; MedianDaysInviteToLink (:19), decimal?, null when the sample is empty. The handler groups Live tickets by (invite day, link day) on the event clock (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:121-138), returns an empty trend when there are no cells (:143-144), and computes a weighted median over the per-cell day gaps, averaging the two middle values for an even total (GetRosterInsightsHandler.cs:167-176,358-381). The grouping cell is the private AdoptionCell.
  • Why it's built this way: the day series, the cumulative share and the median all fold from the same few grouped rows rather than from per-ticket data (GetRosterInsightsHandler.cs:121-122).
  • Where it's used: RosterInsightsDTO.Adoption (RosterInsightsDTO.cs:29); exported as A2.

EmailDomainCountDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/EmailDomainCountDTO.cs:4 · Level 1 · record

  • What it is: one company email domain of A6 with its Live ticket count.
  • Depends on: InsightCount.
  • Walkthrough: Domain (EmailDomainCountDTO.cs:7), lowercase, the part after the @; Tickets (:10), an InsightCount defaulting to InsightCount.Of(0). The handler builds it with InsightCount.Of(d.Tickets, withEmail), so the rate is the domain's share of tickets that carry an email (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:276).
  • Where it's used: EmailDomainMixDTO.TopCompanyDomains (EmailDomainMixDTO).

GroupOrdersDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/GroupOrdersDTO.cs:7 · Level 1 · record

  • What it is: report A4, group orders: orders of two or more tickets, their tickets, how many of those are still unlinked, the tickets with no order email, and the order-size histogram.
  • Depends on: OrderSizeCountDTO.
  • Walkthrough: GroupOrders (GroupOrdersDTO.cs:10), GroupOrderTickets (:13), UnlinkedGroupOrderTickets (:16), TicketsWithoutEmail (:19), OrderSizes (:22). An "order" is a per-email tally, so a group order is a tally with Tickets > 1 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:230-247).
  • Where it's used: RosterInsightsDTO.GroupOrders (RosterInsightsDTO.cs:35); exported as A4.
  • Caveats / not-in-source: raw integers, not InsightCount cells.

TicketTypeCountDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/TicketTypeCountDTO.cs:4 · Level 1 · record

EmailDomainMixDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/EmailDomainMixDTO.cs:9 · Level 2 · record

  • What it is: report A6, the email domain mix of the Live tickets that carry an order email, counted in tickets. Domains only, never an address (EmailDomainMixDTO.cs:3-8).
  • Depends on: InsightCount, EmailDomainCountDTO.
  • Concept: the strongest application of the small-number rule introduced on InsightCount. [Rubric §30, Compliance/Privacy/Data Governance]: a company domain with fewer than 3 tickets is folded into "Other" so a single person's employer is never singled out (EmailDomainMixDTO.cs:5-7).
  • Walkthrough: TicketsWithEmail (:12) is the denominator of every rate; PersonalWebmail (:15) and CompanyDomains (:18) split the tickets by a personal-webmail domain list; TopCompanyDomains (:21) holds at most 10 domains with 3 or more tickets, most tickets first; OtherCompanyDomains (:24) is the company remainder. The handler enforces the threshold, the TopDomainCount = 10 cap and an ordinal tie-break (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:40,253-294).
  • Where it's used: RosterInsightsDTO.DomainMix (RosterInsightsDTO.cs:41); exported as A6.
  • Caveats / not-in-source: the content of the personal-webmail domain list (PersonalWebmailDomains, used at GetRosterInsightsHandler.cs:261) was not read for this section.

RosterInsightsDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Roster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Insights/Roster/RosterInsightsDTO.cs:8 · Level 3 · record

  • What it is: the roster-only half of one event's ticket insights (UC-56, BR-279): reports A1 to A6 in one response (RosterInsightsDTO.cs:3-7). The activity half (B1 to B4) is EngagementInsightsDTO.
  • Depends on: TicketTypeFunnelDTO, AdoptionTrendDTO, FollowUpQueueDTO, GroupOrdersDTO, RosterHealthDTO, EmailDomainMixDTO, InsightTimeBasis; the EventIdentifierType alias.
  • Concept: an aggregate-only read model. [Rubric §30, Compliance/Privacy/Data Governance]: no report names a ticket holder or carries an email address or account id; A6 carries domains under the small-number rule (RosterInsightsDTO.cs:4-6). [Rubric §6, CQRS & Event-Driven] assesses read/write separation; this is a pure query result computed by grouped counts, with no entity crossing the boundary.
  • Walkthrough: EventId (required, :11), GeneratedOn (:14), TimeBasis (:17, default Utc) and UtcOffsetMinutes (:20) describe the run; Funnel (:23) and FunnelTotal (:26) are A1; Adoption (:29) A2; FollowUp (:32) A3; GroupOrders (:35) A4; Health (:38) A5; DomainMix (:41) A6. Every sub-report defaults to an empty instance, so a roster-less event still serializes complete. GetRosterInsightsHandler builds it in one pass: resolve the event clock, then run the funnel, adoption, order and health reads and assemble (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetRosterInsightsHandler.cs:49-79).
  • Why it's built this way: one response feeds the whole roster tab and every A-table CSV: the export re-runs the same handler and renders the chosen table from this DTO (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:268-275), so screen and file cannot drift.
  • Where it's used: TicketsController GET tickets/insights/roster, gated on EngagementPermissions.TicketsManage and answering 200 with empty reports for an event with no roster (TicketsController.cs:191-212); TicketInsightsCsv Render (TicketInsightsCsv.cs:88); on the client, ITicketUIService / TicketService, the TicketInsights page and RosterInsightsReports.

BookmarkWriteOutcome

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/BookmarkWriteOutcome.cs:15 · Level 0 · record

  • What it is: the success value of a bookmark toggle: whether the write was confirmed by the server or kept on the device for later, and the new bookmark id when there is one.
  • Depends on: no first-party types; only the UserSessionBookmarkIdentifierType alias (the alias convention is taught in the primer).
  • Concept, "queued" is a success, not a failure. [Rubric §29, Resilience & Business Continuity] assesses whether the app keeps working through a degraded dependency; here the degraded dependency is the attendee's own network. A star tapped with no signal is not an error the page must show: it is a write the device will deliver later, so it comes back as Result.Success with Queued: true rather than as a failure. [Rubric §19, State Management]: the page needs exactly two facts to settle its optimistic star, and this record carries exactly those two.
  • Walkthrough: a positional record with two members (BookmarkWriteOutcome.cs:15). Queued is true when the write was kept on the device to be sent when it is back online, or when it cancelled out an earlier queued write of the same session, and false when the server confirmed it (doc comment :6-10). BookmarkId is the server id after a confirmed add and null after a remove and after a queued add, "whose id the server has not assigned yet" (:11-14). The producer shows every combination: a confirmed add returns new BookmarkWriteOutcome(Queued: false, bookmark.Id) (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:110), an add that meets "already bookmarked" and a confirmed remove both return Queued: false, BookmarkId: null (:118, :129), and a successful enqueue returns Queued: true, BookmarkId: null (:211).
  • Why it's built this way: a null id after a duplicate add or a queued add is honest rather than lossy: the page keeps the star lit and resolves the id later, either on the next read or by session when the user un-stars it (the comment at SessionBookmarkUIService.cs:113-114). Keeping the record in .Shared lets Conference's pages read it without referencing Engagement's UI assembly, the same split ISessionBookmarkUIService relies on.
  • Where it's used: the return value of ISessionBookmarkUIService.SetBookmarkedAsync (ISessionBookmarkUIService.cs:62), produced by SessionBookmarkUIService and read by Conference's PublicSessionListView (PublicSessionListView.razor.cs:170, :186) and SessionBookmarkButton (SessionBookmarkButton.razor.cs:122).

CreateBookmarkRequest

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/CreateBookmarkRequest.cs:6 · Level 0 · record

  • What it is: the two-field request body for "bookmark this session for this user". It is simultaneously the JSON contract of the POST /bookmarks endpoint and the CQRS command object the handler consumes; Engagement declares no separate internal command type for the create use case.
  • Depends on: no first-party types. It uses the two module-scoped identifier aliases UserIdentifierType and SessionIdentifierType (the alias convention is taught in the primer), which is why the type sits at Level 0.
  • Concept introduced, request-as-command. [Rubric §9, API & Contract Design] assesses whether the wire contract is explicit and stable; [Rubric §6, CQRS & Event-Driven] assesses whether writes flow through a command object and a single handler. Here the two collapse into one type on purpose: BookmarksController injects ICommandHandler<CreateBookmarkRequest, Result<UserSessionBookmarkDTO>> (MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:38) and passes the deserialized body straight into createHandler.HandleAsync(request, cancellationToken) (BookmarksController.cs:72), so there is no request-to-command mapping step to keep in sync. The trade-off is that the public contract and the command shape can no longer diverge, which is exactly what the module wants for a request this small.
  • Walkthrough: two members, both required and init-only. UserId (CreateBookmarkRequest.cs:9) names the owner of the bookmark; SessionId (CreateBookmarkRequest.cs:12) names the session being saved. required means neither construction nor JSON deserialization can leave a member unset, and init freezes the instance after construction, so no decorator in the CQRS pipeline can mutate a command mid-flight.
  • Why it's built this way: keeping the payload to two identifiers pushes every other concern to a dedicated place: shape validation to CreateBookmarkRequestValidator (MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/Create/CreateBookmarkRequestValidator.cs:9), business rules (session validity, duplicate detection) to CreateBookmarkHandler (.../Create/CreateBookmarkHandler.cs:23), and authorization to the controller. Because UserId travels in the body rather than being inferred server-side, the controller binds it to the caller: a non-Organizer whose user-identifier claim does not equal request.UserId gets a Forbidden failure (BookmarksController.cs:58-70), the create-side counterpart of the OwnerOrAdminFilter on the list endpoints (ADR-033). [Rubric §11, Security]: without that check any authenticated user could create bookmarks owned by someone else. Note also the [Idempotent] attribute on the action (BookmarksController.cs:50), justified in the action's own doc comment (:45-47): because the body names the (user, session) pair explicitly and a duplicate already answers 409, replaying a retried star is what the attendee meant.
  • Where it's used: the API entry point CreateAsync (BookmarksController.cs:54-55); the UI HTTP wrapper BookmarkApiClient, whose CreateAsync takes one (MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:53-54); and SessionBookmarkUIService, which constructs one inline when a star is toggled online (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:140) and enqueues one as the offline-write payload when the device is offline (SessionBookmarkUIService.cs:201).

IBookmarkCountService

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/IBookmarkCountService.cs:11 · Level 0 · interface

  • What it is: the cross-module read contract that lets Conference ask "how many people bookmarked this session?" without referencing an Engagement domain entity, an Engagement DbContext, or an Engagement package beyond .Shared.
  • Depends on: nothing first-party beyond the SessionIdentifierType alias and the ServiceContractAttribute marker it carries (IBookmarkCountService.cs:1, :10); BCL Task, IReadOnlyDictionary, IReadOnlyCollection, CancellationToken.
  • Concept introduced, the extraction-ready cross-module interface. [Rubric §7, Microservices Readiness] assesses whether modules talk through contracts that survive a process split; [Rubric §1, SOLID] (Dependency Inversion) assesses whether the consumer depends on an abstraction rather than a concrete collaborator. This interface is the canonical example in ADC: it has two production implementations that a host picks between with no consumer change at all. Inside the Engagement host it is BookmarkCountService (registered with TryAddScoped at MMCA.ADC.Engagement.Application/DependencyInjection.cs:39), the implementation BookmarkCountsGrpcService serves from; in the Conference host, which never loads the Engagement module, it is BookmarkCountServiceGrpcAdapter, registered with Replace by AddEngagementBookmarkCountClient() (MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:46, called from MMCA.ADC.Conference.Service/Program.cs:361) as that host's only registration (DependencyInjection.cs:35-36). The Conference integration tier swaps in a third, FakeBookmarkCountService (MMCA.ADC.Conference.IntegrationTests/Infrastructure/FakeBookmarkCountService.cs:13, wired at ConferenceTestWebApplicationFactory.cs:40). That is ADR-007 and ADR-008 made concrete: the C# call site never learns which one it got. The [ServiceContract] marker is what declares this intent in code rather than in a comment.
  • Walkthrough: one method, GetBookmarkCountsForSessionsAsync(sessionIds, cancellationToken) (IBookmarkCountService.cs:20-22), taking an explicit (non-defaulted) CancellationToken so every implementation, including the gRPC one, threads cancellation. It is batched only: there is no single-session overload, so a caller with one session passes a one-element collection. Its contract is spelled out in the doc comment (IBookmarkCountService.cs:14-15): every requested session id is present in the result, and a session with no bookmarks maps to 0. That sentence is a real contract, not decoration: a caller can index the map by any id it asked for without a missing-key branch, whichever implementation answered. [Rubric §12, Performance & Scalability]: the batch shape lets the speaker dashboard resolve N sessions in one round trip instead of N, which matters most when the call is a network hop rather than a local query.
  • Why it's built this way: returning a plain IReadOnlyDictionary rather than Result<T> keeps the contract trivially projectable onto a proto message; a fault surfaces as an exception (over gRPC, a status the caller's resilience pipeline can react to) instead of a failure payload each caller must unwrap. Living in .Shared is what keeps the reference direction legal: Conference references Engagement's contract assembly only, which the Conference service project spells out in a comment on its own ProjectReference (MMCA.ADC.Conference.Service/MMCA.ADC.Conference.Service.csproj:41-44).
  • Where it's used: Conference's GetSessionBookmarkCountsHandler; on the producing side it is what BookmarkCountsGrpcService publishes over the wire.

PendingTicketInvitationDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Invitations · MMCA.ADC.Engagement.Shared/Tickets/Invitations/PendingTicketInvitationDTO.cs:12 · Level 0 · record

  • What it is: the four facts Identity needs to re-issue a ticket invitation whose link expired: the invitee's first and last name and the event's name and first day (BR-271).
  • Depends on: no first-party types; BCL string and DateOnly.
  • Concept, the minimal cross-module answer. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether data crossing a boundary is limited to what the receiver needs. The doc comment states the limit outright (PendingTicketInvitationDTO.cs:3-7): "the same name and event details the original invitation carried, and nothing else of the ticket". No ticket id, order email or ticket type leaves Engagement.
  • Walkthrough: a positional record (PendingTicketInvitationDTO.cs:12). FirstName and LastName are the names the invitation's account is created with (:8-9); EventName is the conference event's display name (:10); EventStart is the event's first day as a DateOnly (:11), a calendar date with no time zone to misread.
  • Why it's built this way: a positional record maps one-to-one onto the gRPC message the extracted service sends, so the in-process answer and the remote answer are the same shape (ADR-007).
  • Where it's used: returned by IPendingTicketInvitationService and its implementations (PendingTicketInvitationService, TicketInvitationServiceGrpcAdapter); Identity's SendSignInLinkHandler copies its four members into the invite command (MMCA.ADC.Identity.Application/Users/UseCases/SendSignInLink/SendSignInLinkHandler.cs:73-80).

SessionScopeSource

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/SessionScopeSource.cs:5 · Level 0 · enum

  • What it is: where the engagement report took the event's session ids from (BR-280), and therefore whether its bookmark and session-feedback counts are exact.
  • Depends on: nothing.
  • Concept, a degraded answer that says it is degraded. [Rubric §29, Resilience & Business Continuity] assesses graceful degradation. When the Conference lookup fails, GetEngagementInsightsHandler does not fail the report: it falls back to the sessions Engagement itself has seen activity for and stamps the result with this enum, Conference on the happy path and LocalActivity on the fallback (MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:234, :184). [Rubric §34, Architecture Governance & Documentation]: the member comments state the consequence precisely, a session "nobody checked into, asked in or polled in is missed, so bookmarks and session feedback can be undercounted" (SessionScopeSource.cs:10-14).
  • Walkthrough: two members, Conference = 1 (SessionScopeSource.cs:8) and LocalActivity = 2 (:15). There is no zero member on purpose: the CA1008 suppression (:4) records that 0 is reserved as the unset value "so a defaulted field never resolves to a real source", following the TicketLinkMethod precedent.
  • Why it's built this way: a flag on the payload, rather than a failed request, lets the organizer still read B1 to B4 while the page warns that two columns may be low; EngagementInsightsReports renders that warning when Report.SessionScope == SessionScopeSource.LocalActivity (MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/EngagementInsightsReports.razor:11).
  • Where it's used: the SessionScope property of EngagementInsightsDTO (EngagementInsightsDTO.cs:35).

UserSessionBookmarkErrorCodes

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/UserSessionBookmarkErrorCodes.cs:7 · Level 0 · class (static)

  • What it is: the bookmark error codes a client branches on, today the single Duplicate code.
  • Depends on: nothing.
  • Concept, a shared error code as a compile-time contract. [Rubric §9, API & Contract Design] assesses whether clients can rely on stable, machine-readable error identities. The doc comment names the reason the constant lives in .Shared (UserSessionBookmarkErrorCodes.cs:3-6): it is "shared by the handler that emits them and the UI service that reads them, so a rename on one side fails the build on the other". A string literal duplicated on both sides would drift silently.
  • Walkthrough: one constant, Duplicate = "UserSessionBookmark.Duplicate" (UserSessionBookmarkErrorCodes.cs:13). Its doc comment (:9-12) carries the behavioral rule as well: the caller already has an active bookmark on the session, and a replayed offline create treats that as success "because the star the user asked for exists".
  • Why it's built this way: offline replay makes a duplicate create a normal outcome rather than an edge case (a queued POST that reached the server before the connection dropped is replayed later), so the client must recognize it precisely. The server emits it from both duplicate paths of CreateBookmarkHandler, the pre-check and the unique-index catch for a concurrent request, as an Error.Conflict (MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/Create/CreateBookmarkHandler.cs:50, :85).
  • Where it's used: emitted by CreateBookmarkHandler; read by SessionBookmarkUIService to count an online add that meets "already bookmarked" as done (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:220-221) and by BookmarkCreateReplayHandler to treat a replayed duplicate as success (MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkCreateReplayHandler.cs:46).

IPendingTicketInvitationService

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Invitations · MMCA.ADC.Engagement.Shared/Tickets/Invitations/IPendingTicketInvitationService.cs:14 · Level 1 · interface

  • What it is: the cross-module contract Identity calls to ask "does this address still hold a ticket invitation?", so it can re-issue an invitation whose link expired before the invitee created an account (BR-271).
  • Depends on: PendingTicketInvitationDTO and the ServiceContractAttribute marker (IPendingTicketInvitationService.cs:13); BCL Task, CancellationToken.
  • Concept, ownership decides who answers. [Rubric §4, Domain-Driven Design] assesses whether each fact has one owning context. The doc comment gives the reason this lives in Engagement and not Identity (IPendingTicketInvitationService.cs:5-12): Engagement owns the ticket's state, so it is the only module that knows whether an invitation still stands, and "a voided ticket, or one already linked to an account, holds none". [Rubric §7, Microservices Readiness]: this is the same extraction-ready shape IBookmarkCountService introduced, two implementations chosen by the host: in-process PendingTicketInvitationService (TryAddScoped at MMCA.ADC.Engagement.Application/DependencyInjection.cs:47), and TicketInvitationServiceGrpcAdapter when Engagement runs as its own process, swapped in with Replace by AddEngagementTicketInvitationClient() (MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:100, :105). There is no disabled stub: a host that does not load Engagement registers the gRPC adapter. See ADR-007 and ADR-059.
  • Walkthrough: one member, GetPendingInvitationAsync(email, cancellationToken) (IPendingTicketInvitationService.cs:25), which returns the invitation's details or null when no invitation stands. Its doc comment (:16-24) fixes the selection rule so a re-issue announces the same ticket the original run did: a live, unlinked, invited ticket whose order email is the address, compared in the roster's normalized form, preferring the most recently invited event and, within it, the earliest ticket that names an attendee.
  • Why it's built this way: returning a nullable DTO rather than Result<T> keeps the contract projectable onto a proto message, as on IBookmarkCountService; a fault surfaces as an exception. The caller is built for that: Identity's handler documents that a lookup that throws propagates to the framework base, which logs it without the address and still answers success (MMCA.ADC.Identity.Application/Users/UseCases/SendSignInLink/SendSignInLinkHandler.cs:60-64), so a sign-in request never reveals whether an address holds an invitation.
  • Where it's used: Identity's SendSignInLinkHandler, whose OnNoAccountAsync calls it for an address with no account and returns early on null (SendSignInLinkHandler.cs:68, :72-74); exposed over the wire by TicketInvitationGrpcService (MMCA.ADC.Engagement.Service/Grpc/TicketInvitationGrpcService.cs:26).

TicketTypeEngagementDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/TicketTypeEngagementDTO.cs:8 · Level 1 · record

  • What it is: one row of report B1: how the linked holders of one ticket type used the app at the event (BR-280).
  • Depends on: InsightCount, the count cell every member uses.
  • Concept, the small-number rule on every cell. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether aggregate reporting can re-identify a person. Every cell is an InsightCount rather than an int, and the type comment states the rule it follows (BR-278, TicketTypeEngagementDTO.cs:3-7); the endpoint's comment says what that means on the wire: "every count of 1 or 2 is withheld on the server" (MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:216-217).
  • Walkthrough: nine init properties, each defaulted so an empty row is valid. TicketTypeName is the TicketLeap ticket type, empty on the total row (TicketTypeEngagementDTO.cs:11). LinkedHolders is the distinct accounts linked to a Live ticket of the type, "the denominator of every rate" (:14). Then the activity cells: CheckedInToEvent (:17), SessionCheckIns (:20, a total whose rate is the average per holder rather than a share, as the type comment notes at :5-6), Bookmarked (:23), GaveSessionFeedback (:26), GaveEventFeedback (:29), VotedInPoll (:32) and AskedQuestion (:35).
  • Why it's built this way: one shape serves both the per-type rows and the total row, which EngagementInsightsDTO carries as AllTicketTypes with an empty name (EngagementInsightsDTO.cs:43-44), so the UI and the CSV render them with one code path.
  • Where it's used: the ByTicketType and AllTicketTypes members of EngagementInsightsDTO; built by GetEngagementInsightsHandler.

UserSessionBookmarkDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/UserSessionBookmarkDTO.cs:8 · Level 1 · record

  • What it is: the read contract for one personal-schedule entry: which user saved which session, when, and under what bookmark id.
  • Depends on: IBaseDTO<TIdentifierType> from MMCA.Common.Shared.DTOs (UserSessionBookmarkDTO.cs:1, :8), and the UserSessionBookmarkIdentifierType, UserIdentifierType, SessionIdentifierType aliases.
  • Concept, the DTO as the module's outward-facing projection. [Rubric §3, Clean Architecture] assesses whether the domain entity leaks past the application boundary: it does not, UserSessionBookmark never crosses the wire and UserSessionBookmarkDTOMapper does the projection. [Rubric §9, API & Contract Design]: implementing IBaseDTO<T> is what lets this record flow through the framework's generic read plumbing, for example the IEntityQueryService<UserSessionBookmark, UserSessionBookmarkDTO, UserSessionBookmarkIdentifierType> the controller injects (MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:42), with no bookmark-specific query code.
  • Walkthrough: Id satisfies the IBaseDTO<T> contract (UserSessionBookmarkDTO.cs:11); UserId and SessionId are the two scalar cross-module references (:14, :17), scalar rather than navigation properties because the referenced rows live in other services' databases; CreatedOn (:20) is the audit timestamp. The first three are required, CreatedOn is not, which is the readable signal that it is server-stamped rather than caller-supplied. There is no IsDeleted here: soft-deleted bookmarks are filtered out by the global query filter long before projection.
  • Why it's built this way: a flat, four-member record keeps the payload cheap for a list endpoint that a phone pages through on a conference floor, and keeps the shape identical whether it is produced in-process or deserialized from HTTP in the UI.
  • Where it's used: returned by CreateBookmarkHandler and GetUserBookmarksHandler inside a Result<T>; declared on both controller actions (BookmarksController.cs:34, :35, :51); deserialized client-side by BookmarkApiClient (MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:75), whose create result SessionBookmarkUIService passes through (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:137, :142).

ArrivalBucketDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/ArrivalBucketDTO.cs:7 · Level 2 · record

  • What it is: one half hour of report B4, the arrival curve: the event check-ins that fell in it, split by the ticket types the arriving accounts hold (BR-280).
  • Depends on: InsightCount and TicketTypeCountDTO.
  • Concept: the small-number rule taught on TicketTypeEngagementDTO applies to every count here as well (BR-278, ArrivalBucketDTO.cs:3-6).
  • Walkthrough: StartsAt is the start of the half hour at the report's UTC offset (ArrivalBucketDTO.cs:10), so the bucket reads in the event's clock when it is known (see TimeBasis and UtcOffsetMinutes on EngagementInsightsDTO). CheckIns counts every event check-in in the slot (:13); ByTicketType splits them per ticket type held, ordered by type, with empty types omitted (:16); WithoutLinkedTicket counts the check-ins of accounts that hold no linked Live ticket of the event (:19).
  • Why it's built this way: the WithoutLinkedTicket cell keeps the split honest: people without a linked ticket arrive too, and leaving them out would make the per-type rows look like the whole crowd.
  • Where it's used: the Arrivals list of EngagementInsightsDTO, one row per half hour with a check-in, oldest first (EngagementInsightsDTO.cs:52-53); built by GetEngagementInsightsHandler, rendered by EngagementInsightsReports and exported by TicketInsightsCsv.

SponsorReachDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/SponsorReachDTO.cs:7 · Level 2 · record

  • What it is: one row of report B3: one sponsor's reach, the distinct accounts with a booth visit (a sponsor-scope check-in), split by the ticket types they hold (BR-280).
  • Depends on: InsightCount, TicketTypeCountDTO, and the SponsorIdentifierType alias.
  • Concept: the small-number rule from TicketTypeEngagementDTO (BR-278, SponsorReachDTO.cs:3-6), plus the same "say when degraded" idea as SessionScopeSource, here per row.
  • Walkthrough: SponsorId (SponsorReachDTO.cs:10) identifies the sponsor; SponsorName (:13) is its display name, or "Sponsor {id}" when NameResolved (:16) is false, meaning Conference did not supply the name. UniqueVisitors (:19) is the distinct visitor count; ByTicketType (:22) splits it per ticket type held, ordered by type with empty types omitted; WithoutLinkedTicket (:25) counts visitors holding no linked Live ticket of the event.
  • Why it's built this way: sponsor names live in Conference, so a failed lookup would otherwise blank the sponsor column; falling back to the id keeps every row usable, and the report-level SponsorNamesResolved flag on EngagementInsightsDTO (EngagementInsightsDTO.cs:38) tells the page to say so.
  • Where it's used: the SponsorReach list of EngagementInsightsDTO, most unique visitors first (EngagementInsightsDTO.cs:49-50); built by GetEngagementInsightsHandler and exported by TicketInsightsCsv.

TicketedVsPresentDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/TicketedVsPresentDTO.cs:8 · Level 2 · record

  • What it is: report B2, ticketed versus present: the linked holders who never checked in to the event, and the people who checked in with no linked ticket (BR-280).
  • Depends on: InsightCount and TicketTypeCountDTO.
  • Concept: counts only, under the small-number rule taught on TicketTypeEngagementDTO (BR-278, TicketedVsPresentDTO.cs:3-7).
  • Walkthrough: three members. NotCheckedInByTicketType lists the no-shows per ticket type, ordered by type (TicketedVsPresentDTO.cs:11); NotCheckedIn is the distinct no-show count (:14); CheckedInWithoutLinkedTicket counts accounts checked in to the event that hold no linked Live ticket of it (:17), which the type comment spells out as "speakers, sponsors, comps, walk-ins and attendees who never linked" (:5-6).
  • Why it's built this way: the two directions answer different organizer questions (who held a ticket and stayed home, who came without a ticket linked in the app), so they are separate cells rather than one net figure that would hide both.
  • Where it's used: the TicketedVsPresent member of EngagementInsightsDTO (EngagementInsightsDTO.cs:47); built by GetEngagementInsightsHandler and exported by TicketInsightsCsv.

EngagementInsightsDTO

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.Tickets.Insights.Usage · MMCA.ADC.Engagement.Shared/Tickets/Insights/Usage/EngagementInsightsDTO.cs:14 · Level 3 · record

  • What it is: the whole roster-plus-activity report for one event (UC-56, BR-280): reports B1 to B4 over the linked holders (Live tickets linked to an account), by ticket type.
  • Depends on: TicketTypeEngagementDTO, TicketedVsPresentDTO, SponsorReachDTO, ArrivalBucketDTO, SessionScopeSource, InsightTimeBasis, and the EventIdentifierType alias.
  • Concept, aggregate-only reporting that degrades in the open. [Rubric §30, Compliance, Privacy & Data Governance]: the type comment fixes the privacy boundary (EngagementInsightsDTO.cs:3-7): aggregate only (BR-278), "no name, email address or account id", every count cell under the small-number rule, and a holder whose tickets span two types counts once in each type and once in the totals. [Rubric §29, Resilience & Business Continuity]: a failed cross-service lookup "degrades the report instead of failing it, and says so here" (:9-12), through four flags: SessionScope for the sessions, SponsorNamesResolved for sponsor names, and TimeBasis plus EventWindowKnown for the event's clock.
  • Walkthrough: header fields first. EventId is required (EngagementInsightsDTO.cs:17); GeneratedOn is the UTC compute time (:20). The clock: TimeBasis defaults to InsightTimeBasis.Utc (:23) and UtcOffsetMinutes is the offset the B4 buckets are stamped at, 0 under UTC (:26); EventWindowKnown (:32) says whether B4 covers the event's own days only or, when false, every event check-in of the event (:28-31). The degradation flags: SessionScope defaults to SessionScopeSource.Conference (:35) and SponsorNamesResolved to true (:38). Then the four reports: ByTicketType (B1, :41) and its total row AllTicketTypes with an empty type name (:44), TicketedVsPresent (B2, :47), SponsorReach (B3, :50) and Arrivals (B4, :53). Every collection defaults to [] and every nested row to new(), so an event with no roster serializes as empty reports.
  • Why it's built this way: the endpoint documents that an event with no roster answers 200 with empty reports and that a failed Conference lookup "degrades the report and is flagged in it rather than failing the request" (MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:216-220); the defaults and flags on this record are what make both statements true.
  • Where it's used: returned by GetEngagementInsightsHandler (MMCA.ADC.Engagement.Application/Tickets/UseCases/GetTicketInsights/GetEngagementInsightsHandler.cs:88) through GET /tickets/insights/engagement on TicketsController, behind EngagementPermissions.TicketsManage (TicketsController.cs:216-217); fetched by the UI's TicketService (MMCA.ADC.Engagement.UI/Services/Tickets/TicketService.cs:134-137), rendered by EngagementInsightsReports and exported by TicketInsightsCsv (TicketInsightsCsv.cs:193).

ISessionBookmarkUIService

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.UserSessionBookmarks · MMCA.ADC.Engagement.Shared/UserSessionBookmarks/ISessionBookmarkUIService.cs:15 · Level 3 · interface

  • What it is: the narrow UI-side contract that lets the Conference session pages render a bookmark star and toggle it inline, without navigating to an Engagement page and without referencing the Engagement UI assembly.
  • Depends on: BookmarkWriteOutcome, Result and ErrorType from MMCA.Common.Shared.Abstractions (ISessionBookmarkUIService.cs:1), and the identifier aliases.
  • Concept introduced, the cross-module UI service contract. [Rubric §18, UI Architecture] assesses how one module's page composes another module's capability. The pattern here is optional resolution: Conference's pages hold the dependency as a nullable property and ask the container for it rather than injecting it, BookmarkService = ServiceProvider.GetService<ISessionBookmarkUIService>() (MMCA.ADC.Conference.UI/Pages/Public/Sessions/PublicSessionList.razor.cs:156, and, for the detail page, the same line inside the extracted SessionBookmarkButton toggle it renders, SessionBookmarkButton.razor.cs:56), so a host that never called AddEngagementUI() simply renders no stars instead of failing to construct the page. PublicSessionListView then takes it as a nullable [Parameter] (PublicSessionListView.razor.cs:77). [Rubric §7, Microservices Readiness]: this is the presentation-layer twin of what IBookmarkCountService does for the application layer.
  • Concept, Result all the way to the page. Every member reports its outcome as a Result carrying the API's own errors with their ErrorType intact, and the interface doc comment states the rule (ISessionBookmarkUIService.cs:9-13): the calling page branches instead of catching, and only the caller's own OperationCanceledException still propagates. [Rubric §9, API & Contract Design] and [Rubric §24, Forms, Validation & UX Safety]: a "not there" answer and a "the remove failed" answer are different facts, and a boolean cannot tell them apart. That is spelled out for the delete member (:28-29): a missing bookmark answers 404, which arrives as an ErrorType.NotFound failure.
  • Concept, one offline-aware write entry point. [Rubric §29, Resilience & Business Continuity] and [Rubric §19, State Management]: every bookmark write goes through SetBookmarkedAsync, which sends online when it can and otherwise puts the write on the device's offline write queue to be replayed on reconnect (ADR-144). The doc comment (ISessionBookmarkUIService.cs:37-55) fixes the rules a page can rely on: the newest intent wins and is always issued in full (any write still queued for the same user and session is dropped first); online, an add is sent with an Idempotency-Key and an add that meets "already bookmarked" counts as done; a device known to be offline queues at once without trying the network; an online call that fails with a transport fault is queued too, reusing the add's idempotency key so a request that reached the server is deduplicated on replay; any other failure is returned as it is; and a write the queue refuses (OfflineWrites.QueueFull, OfflineWrites.Unavailable) is returned as a failure, never as queued.
  • Walkthrough: three members, each shaped by a real UI need.
    • GetBookmarkedSessionIdsAsync(userId, cancellationToken) (ISessionBookmarkUIService.cs:20-21) returns Result<IReadOnlyDictionary<SessionIdentifierType, UserSessionBookmarkIdentifierType>>, a map rather than a set. A list page needs both facts at once: which sessions are starred, and the bookmark id it must send to un-star each one, so the dictionary saves a second round trip per row.
    • DeleteBookmarkAsync(bookmarkId, sessionId, cancellationToken) (:32-35) takes the session id even though the API key alone identifies the row. The doc comment says why (:24-26): the session-reminder layer (ADR-042 Wave 2) needs to know which session's scheduled local notification to cancel, and the bookmark id cannot answer that after the row is gone.
    • SetBookmarkedAsync(userId, sessionId, bookmarked, knownBookmarkId, cancellationToken) (:62-67) is the toggle. bookmarked is the state the user asked for; knownBookmarkId is the id the caller holds, when it holds one. It may be null for a star set by a queued add, in which case a remove resolves the id through the session-ids read, and a bookmark that is already gone counts as removed (:40-42). It returns a BookmarkWriteOutcome saying whether the write was confirmed or queued, with the new id after a confirmed add (:61).
  • Why it's built this way: the interface lives in .Shared, the assembly Conference already references, while its implementation lives in Engagement's UI project. That split is what makes the star a genuinely optional feature of the Conference page rather than a hard dependency. Routing every write through one toggle keeps the offline rules (coalescing, idempotency key reuse, duplicate-as-success) in one implementation, SessionBookmarkUIService (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:79-129), instead of in every page that draws a star. All three CancellationToken parameters are defaulted here, unlike on IBookmarkCountService, because the callers are Blazor event handlers rather than a generated gRPC client.
  • Where it's used: implemented by SessionBookmarkUIService (MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:36-41), registered scoped in DependencyInjection (MMCA.ADC.Engagement.UI/DependencyInjection.cs:35), consumed by Conference's PublicSessionList, PublicSessionDetail (through SessionBookmarkButton, whose toggle calls SetBookmarkedAsync at SessionBookmarkButton.razor.cs:122), PublicSessionListView (PublicSessionListView.razor.cs:170, :186) and PublicSessionBookmarkState (PublicSessionBookmarkState.cs:15). Its nullable-injection convention is cited as precedent by ISessionLiveUIService (MMCA.ADC.Engagement.Shared/SessionQuestions/ISessionLiveUIService.cs:4-5).

EngagementRoutePaths

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:8 · Level 0 · class (static)

  • What it is: the single source of truth for every Engagement URL: the four live-layer routes, the two feedback routes, the three badge check-in routes, the two points routes, the organizer ticket roster and ticket insights routes, and the two deep-link-only self-service QR routes.
  • Depends on: nothing first-party. It uses the SessionIdentifierType, EventIdentifierType, SponsorIdentifierType and RoomIdentifierType aliases, plus System.Globalization (EngagementRoutePaths.cs:1).
  • Concept, centralized route paths. [Rubric §25, Navigation & Information Architecture] assesses whether URL strings are declared once or scattered across NavigateTo call sites and @page directives. Every route here is either a const (parameterless) or a static method (id-carrying), so renaming a route touches one file and the compiler finds the call sites. [Rubric §27, Internationalization] shows up in an easy-to-miss detail: each interpolated route is built with string.Create(CultureInfo.InvariantCulture, $"...") (EngagementRoutePaths.cs:12-14, :17-18, :35, :39-40) rather than plain interpolation, so a culture with non-ASCII digits or a different number format can never produce a URL the router will not match.
  • Walkthrough
    • Live layer (EngagementRoutePaths.cs:10-14): const string HappeningNow = "/happening-now", plus SessionDetails, SessionLive and SessionPresent, which build /conference/sessions/{id}, .../live and .../present.
    • Feedback (EngagementRoutePaths.cs:16-18): EventFeedback(eventId) and SessionFeedback(sessionId), whose outputs match the @page templates on the two feedback pages.
    • Badge check-in (EngagementRoutePaths.cs:20-23): MyBadge = "/my-badge", CheckInScan = "/check-in", OrganizerAttendance = "/organizer/attendance", the three routes carried by the pages later in this part.
    • Points (EngagementRoutePaths.cs:25-27): MyPoints = "/points" and OrganizerPointsOverview = "/organizer/points".
    • Tickets (EngagementRoutePaths.cs:29-35): OrganizerTickets = "/organizer/tickets" for the roster, and OrganizerTicketInsights = "/organizer/tickets/insights" with its builder OrganizerTicketInsightsFor(eventId), which appends ?eventId={id} because the insights page is reached from the roster carrying its selected event. The comment at :29-30 records why the attendee side adds no route: "Link my ticket" lives on the MyBadge page.
    • Self-service QR (EngagementRoutePaths.cs:39-40): SponsorVisit(sponsorId) and RoomCheckIn(roomId) build /engage/sponsors/{id} and /engage/rooms/{id}. The comment above them (EngagementRoutePaths.cs:37-38) records the design decision that matters to a reader: these are deep-link-only landings reached by scanning a printed code, so neither contributes a nav item.
  • Why it's built this way: methods are used wherever an id is embedded so the interpolation (and its invariant culture) lives in one place; plain consts are used for the parameterless routes because they must be usable in attribute and collection-initializer positions, which is exactly how EngagementUIModule consumes them.
  • Where it's used: seven of the constants seed the nav items in EngagementUIModule (MMCA.ADC.Engagement.UI/EngagementUIModule.cs:33-42); the feedback and live builders are called from pages and services that link an attendee onward (SessionLive.razor.cs, SessionFeedback.razor.cs, SessionReminderPlanner.cs, LiveEventListener.razor.cs), TicketInsights uses the insights route, the host's AppActionRouteMap maps app actions onto these routes, and the QR builders are what a printed sponsor or room code encodes.

ScanOutcomeKind

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/ScanOutcomeKind.cs:4 · Level 0 · enum (internal)

  • What it is: the four things one check-in attempt can mean to the organizer holding the phone, quoting the type's own summary (ScanOutcomeKind.cs:3). It lives in its own file beside CheckInScan, the page that produces and renders it.
  • Depends on: nothing.
  • Concept, the closed outcome vocabulary behind a UI feed. [Rubric §21, Accessibility] is the reason this is an enum and not a pre-formatted string: each member fans out through three separate switch expressions, the sentence on the page (OutcomeText, CheckInScan.razor.cs:352-359), and the alert severity and the icon on ScanOutcome itself (Severity, ScanOutcome.cs:9-16; Icon, ScanOutcome.cs:19-26), so colour never carries the status alone. The markup pairs the severity with the icon on every row (CheckInScan.razor:114-117), which is what WCAG 2.1 AA asks for. [Rubric §27, i18n]: because the enum stays a symbol until render time, the wording lives entirely in the page's resource file.
  • Walkthrough: CheckedIn, AlreadyCheckedIn, NotABadge, Failed (ScanOutcomeKind.cs:6-9). AlreadyCheckedIn is not an error state: a repeat scan is a normal thing to happen at a door, so it maps to Severity.Warning with a replay icon (ScanOutcome.cs:12, :22) rather than to a failure. NotABadge covers a scanner reading a poster or sponsor QR and maps to Severity.Info (:13). Only Failed maps to Severity.Error (:14).
  • Why it's built this way: four named cases keep the render-time mapping exhaustive and reviewable in two short files, the page and the record. All three switch expressions still carry a _ => default arm (CheckInScan.razor.cs:358, ScanOutcome.cs:15, ScanOutcome.cs:25) so adding a member cannot throw at runtime, only produce the generic failure presentation until the arms are extended.
  • Where it's used: carried by ScanOutcome and consumed only inside CheckInScan; it is internal, so it never leaves the Engagement UI assembly.

SessionAttendanceRow

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC.Engagement.UI/Pages/CheckIns/OrganizerAttendance.razor.cs:245 · Level 0 · record (private sealed, nested in OrganizerAttendance)

  • What it is: one rendered attendance row, a session title paired with its check-in count. It is the view model the organizer attendance table iterates, distinct from the server DTO it is built from.
  • Depends on: nothing first-party (a string and an int).
  • Concept, the page-local view model. [Rubric §18, UI Architecture] assesses whether a page renders raw server contracts or a shape it owns. The stats endpoint returns SessionAttendanceDTO, which carries a SessionId and a Count (MMCA.ADC.Engagement.Shared/CheckIns/Attendance/SessionAttendanceDTO.cs:9-12) and no title, because the Engagement service does not own the session catalog. Rather than resolve a title inside the markup (which would put I/O in the render path), the page projects each DTO into this record once, already labelled and already sorted.
  • Walkthrough: a positional record with Title and Count (OrganizerAttendance.razor.cs:245), constructed inside the projection in BuildSessionRowsAsync (OrganizerAttendance.razor.cs:113-123) and rendered as the table body rows (OrganizerAttendance.razor:58-63), where Title becomes the row header cell and Count is formatted with ToString("N0", CultureInfo.CurrentCulture).
  • Why it's built this way: it is private sealed because nothing outside the page has a use for it, and a record because it is pure data, compared and never mutated after projection.
  • Where it's used: only by OrganizerAttendance, which holds them in the _rows list (OrganizerAttendance.razor.cs:38).

CheckInState

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns.Rooms · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Rooms/RoomCheckIn.razor.cs:204 · Level 0 · enum (protected, nested)

  • What it is: the nine states one scan of a printed room QR can put the page in, as seen by the attendee (RoomCheckIn.razor.cs:203). It is nested inside RoomCheckIn and is the single field its markup switches on.
  • Depends on: nothing (a bare enum). Its refusal values are produced by the page's static FailureState switch (RoomCheckIn.razor.cs:152-160) from the IsTransient flag and the error code carried on SelfCheckInOutcome<TResult>: a CheckInErrorCodes value, or ParticipantErrorCodes.VerifiedParticipantRequired (:157).
  • Concept introduced, the page-owned outcome enum. [Rubric §19, State Management] assesses whether a component's visible states are enumerated or reconstructed ad hoc from a scatter of booleans. This page has exactly one state field, so "confirm", "loading", "recorded", "nothing scheduled here", "code rejected", "event not published", "account not verified", "no answer yet, retry" and "unavailable" are mutually exclusive by construction, and the markup is a flat chain of comparisons (RoomCheckIn.razor:12, :16, :31, :67, :73, :81, :85, :93, with the final else at :108) with no combination to reason about. [Rubric §9, API & Contract Design] is the other half of the story: the refusals cannot all be told apart by HTTP status, so the state is picked from the server's stable error code carried back on SelfCheckInOutcome<TResult>, and its IsTransient flag (MMCA.ADC.Engagement.UI/Services/CheckIns/SelfCheckInOutcome.cs:20-25) separates "the server said no" from "no definitive answer arrived".
  • Walkthrough: nine members in the order the attendee meets them. Confirm (RoomCheckIn.razor.cs:207) is what an interactive arrival shows: the scanned room with a Check in button, and nothing posted yet (set at :92, rendered at RoomCheckIn.razor:16-30). Loading (RoomCheckIn.razor.cs:210) is the initial value of State (:57), so it covers the prerender, and it covers the in-flight post (:104). Recorded (:213) covers both a fresh check-in and a re-confirmed earlier one; the distinction is RoomCheckInResultDTO.AlreadyCheckedIn, not a separate state. NoCurrentSession (:216) means nothing is scheduled in that room right now, and, per the member comment, an unknown room reads the same way. NotPublished (:219) means the owning event is not published yet. CodeRejected (:222) means the scanned code is not the room's current one because the room's QR was re-issued; the markup points the attendee at the code on the door (RoomCheckIn.razor:73-80). NotVerified (RoomCheckIn.razor.cs:225) means the account has neither a linked ticket nor a confirmed email; nothing was recorded, and the markup tells the attendee the two ways to qualify (RoomCheckIn.razor:85-92, comment :87-88). Unavailable (RoomCheckIn.razor.cs:228) is the feature-off answer: per its member comment, the server answered and the answer is no. Transient (:231) is the absence of a definitive answer (rate limited, timed out, offline), the state the attendee can act on through the Retry button the markup renders beside it (RoomCheckIn.razor:100-106).
  • Why it's built this way: collapsing "unknown room" into NoCurrentSession and the feature gate into Unavailable is a deliberate disclosure choice: a printed code that produces a distinguishable answer for a room that does not exist would confirm which room ids do exist. Splitting NotVerified off Unavailable goes the other way because the attendee can act on it (link a ticket or confirm the email), so it gets its own sentence rather than the generic refusal. Splitting Transient off Unavailable follows the same reasoning: a timeout is not a refusal, so it must not read as "this code is not available", and the markup comment (RoomCheckIn.razor:95-96) records that the retry reuses the same attempt key, so a check-in whose first try did land reads as recorded rather than repeated. Confirm exists so that opening the link records nothing until its holder taps. See ADR-072 for the surrounding scan-surface decision.
  • Where it's used: only inside RoomCheckIn (RoomCheckIn.razor.cs:57, :92, :104, :124, :145, :152-160) and its markup. protected rather than private so the bUnit component tests can assert the rendered outcome (see RoomCheckInTests).
  • Caveats / not-in-source: the doc comments on the State property (RoomCheckIn.razor.cs:56) and on the enum (:203) both say nine, matching the members. The S-ADC-identity-02 tag in the NotVerified member comment (:224) names a review finding whose text is not in source.

OptionState

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Components · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Components/CreateLivePollForm.razor.cs:137 · Level 0 · class (private sealed, nested)

  • What it is: a tiny private, mutable holder for one poll option's text (doc comment CreateLivePollForm.razor.cs:136), used purely as a two-way binding target while an organizer types the options of a new poll in CreateLivePollForm.
  • Depends on: BCL only (a nullable string); no first-party types.
  • Concept, the mutable view-model row for two-way binding. [Rubric §19, State Management] (assesses how transient form state is held in a component) and [Rubric §24, Forms, Validation & UX Safety] (assesses editable-collection form modelling). Blazor's @bind needs a stable reference-typed target it can write back into. A List<string> cannot be bound element by element the same way, because a list slot is not an object the binder can hold onto across re-renders. OptionState gives each option row its own object, so growing, shrinking and editing _newOptions (CreateLivePollForm.razor.cs:46) stays stable: the markup binds @bind-Value="_newOptions[index].Text" (CreateLivePollForm.razor:14) to that per-row object. It is not a domain concept, only a UI scratch buffer.
  • Walkthrough: a single member, public string? Text { get; set; } (CreateLivePollForm.razor.cs:139), a mutable auto-property. The class is private sealed and nested (:137), so nothing outside the form can see or reuse it. Fresh rows come from NewOptions() (:124-125), which seeds LivePollDTO.MinOptions empty holders.
  • Why it's built this way: modelling the option rows as objects (not raw strings) is what lets AddOption / RemoveOption (CreateLivePollForm.razor.cs:53-59, :61-67) add and remove rows between LivePollDTO.MinOptions and LivePollDTO.MaxOptions while each MudTextField keeps binding to its own row. On submit the form projects _newOptions back to a trimmed, non-empty List<string> (:77-81) for the CreateLivePollRequest.
  • Where it's used: only inside CreateLivePollForm, as the element type of the _newOptions list backing the create-poll form.

ScanOutcome

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/ScanOutcome.cs:6 · Level 1 · record (internal sealed)

  • What it is: one line in the organizer's on-screen scan feed: what happened to a badge, and to whom, in the order the organizer saw it (ScanOutcome.cs:5). It also owns its own row presentation: the alert severity and the icon that go with its kind.
  • Depends on: ScanOutcomeKind; MudBlazor's Severity and Icons (using MudBlazor;, ScanOutcome.cs:1).
  • Concept, the immutable UI event record. [Rubric §19, State Management] assesses where transient UI state lives and how it changes. The feed is a plain List<ScanOutcome> field on CheckInScan (CheckInScan.razor.cs:74) whose entries are never edited after creation: a new scan is inserted at index 0 and the list is trimmed from the tail (AddOutcome, CheckInScan.razor.cs:341-350, bounded by the const int MaxOutcomes = 10 at :24). Immutable entries plus a bounded list mean the feed cannot grow without limit during a long scanning session and cannot be retroactively rewritten by a later scan. [Rubric §21, Accessibility]: the two computed properties keep colour from carrying the status alone; the Severity doc comment says so in as many words (ScanOutcome.cs:8), and the icon differs per kind as well.
  • Walkthrough
    • A positional record with AttendeeName and Kind (ScanOutcome.cs:6).
    • Severity (ScanOutcome.cs:9-16) is a switch over Kind: CheckedIn is Severity.Success, AlreadyCheckedIn is Severity.Warning, NotABadge is Severity.Info, Failed is Severity.Error, and the _ default arm is also Severity.Error (:11-15).
    • Icon (ScanOutcome.cs:19-26) is the matching switch: CheckCircle, Replay, QrCodeScanner and ErrorOutline, with ErrorOutline again as the default arm (:21-25). A default arm on both means a new kind renders as a failure until the arms are extended, never as a runtime throw.
    • It is constructed in four places on the page, and the differences are the interesting part: new ScanOutcome(string.Empty, ScanOutcomeKind.NotABadge) when the scanned text is not a badge payload (CheckInScan.razor.cs:257), a named Failed when a manual write comes back a failure (:303), a Failed carrying whatever name the caller had when the response itself is a failure (:330), and the success path in RecordResultAsync, which resolves a name and picks AlreadyCheckedIn or CheckedIn from the response (:339-341). Where no name is available the page substitutes the localized Outcome.UnknownAttendee string (:340) rather than rendering an empty row.
  • Why it's built this way: keeping the name on the record (instead of re-resolving it at render time) means the feed is pure data by the time the markup runs, so re-rendering never triggers another lookup. Putting Severity and Icon on the record keeps the kind-to-presentation mapping next to the kind, so the markup reads two properties instead of calling page helpers. The sentence stays on the page (OutcomeText, CheckInScan.razor.cs:352) because it needs the page's localizer.
  • Where it's used: only inside CheckInScan; rendered as one MudAlert per entry, binding Severity="@outcome.Severity" and Icon="@outcome.Icon" (CheckInScan.razor:114-117) inside a role="status" aria-live="polite" region (CheckInScan.razor:109). OnScannedAsync also returns its text to the scanner as the over-camera outcome line (CheckInScan.razor.cs:262).

OrganizerEventPicker

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/OrganizerEventPicker.razor.cs:14 · Level 3 · class (partial)

  • What it is: the code-behind for a small event-chooser component shared by the organizer pages. It takes the published events and the currently selected one, tells its host when the organizer picks a different event, and offers the hosts one static loader that resolves the current event and the events to list.
  • Depends on: LiveEventContext (the event row it lists: a name and a live-window start), ILiveEventUIService and LiveEventLookup (the three-state current-event read, MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventLookup.cs:10). Externals: Blazor [Parameter] / EventCallback<T> and the EventIdentifierType alias. The markup (the select control) is not in this file.
  • Walkthrough
    • Three parameters (OrganizerEventPicker.razor.cs:17-23): Events (IReadOnlyList<LiveEventContext>, default empty), SelectedEventId (EventIdentifierType?) and OnEventSelected (EventCallback<EventIdentifierType>). The host owns the selection; the picker only reports changes.
    • OffersAChoice(events) (:32-36) is a public static predicate returning events.Count > 1, after an ArgumentNullException.ThrowIfNull. It is static so the host pages can call it too, to drop their plain event-name heading while the picker (which already shows the chosen name) is on screen (doc comment :25-31).
    • LoadEventsAsync(liveEventService, cancellationToken) (:47-61) is the public static loader every host runs before it loads anything. It awaits GetCurrentEventAsync (:53) and returns that LiveEventLookup with an empty list when there is no current event (:54-57), so a host can tell a failed read (IsFailed, LiveEventLookup.cs:19) from no published event (LiveEventLookup.cs:22). Otherwise it reads GetPublishedEventsAsync and returns the published list, or the current event alone when that list is empty (OrganizerEventPicker.razor.cs:59-60). The doc comment (:38-46) states the rule: the current event stays the default, and a failed read of the published list degrades to the current event alone (no picker), never an error.
    • OrderedEvents (:63-65) sorts by LiveWindowStartUtc then by Name under StringComparer.CurrentCulture, so the list reads chronologically.
    • OnSelectedEventChangedAsync (:67-70) invokes OnEventSelected only when the chosen id is non-null and differs from SelectedEventId; re-selecting the current event returns Task.CompletedTask, which is why the callback is documented as never raised for the event already selected (:22).
  • Why it's built this way: a single event needs no chooser, so OffersAChoice keeps the single-event case unchanged for hosts. Keeping selection state in the host lets each page decide what a change reloads, and putting the load in one static method keeps the "failed read versus no event" distinction identical on every host.
  • Where it's used: hosted by CheckInScan (CheckInScan.razor:15, heading guard at :36, loader call at CheckInScan.razor.cs:90) and OrganizerAttendance (OrganizerAttendance.razor:15, guard at :36, loader call at OrganizerAttendance.razor.cs:74), and used by the ticket pages (TicketInsights and the Pages/Tickets/TicketRoster.razor.cs roster page); component-tested through CheckInScanTests and OrganizerAttendanceTests.
  • Caveats / not-in-source: the select markup and its resource strings live outside this file.

MyBadge

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/MyBadge.razor.cs:17 · Level 6 · class (partial)

  • What it is: the code-behind for the attendee's own badge page (@page "/my-badge", MyBadge.razor:1). It fetches the caller's opaque badge credential, encodes it as a QR code, renders the attendee's name beside it as plain text, and lets the attendee reissue the badge, after a confirmation, when a copy of it has leaked (class summary MyBadge.razor.cs:11-16).
  • Depends on: ICheckInUIService (MyBadge.razor.cs:19) for both the fetch and the reissue, IToastService (:20), BadgePayload (:71, :103), and MyBadgeDTO as the value inside both results. Externals: Blazor's [CascadingParameter] Task<AuthenticationState> (:22-23), MudBlazor's BreadcrumbItem/Icons, the shared QrCodeImage, PageLoadingState and DetailLoadStateContent components from MMCA.Common.UI.Components (the latter driven by DetailLoadState), ResultUiExtensions.ActionErrorMessage for the reissue failure toast (:110), and an injected IStringLocalizer<MyBadge> named L declared in the markup (MyBadge.razor:7).
  • Concept introduced, the opaque-credential badge. [Rubric §11, Security] and [Rubric §30, Compliance, Privacy & Data Governance] both apply, and the class summary states the rule (MyBadge.razor.cs:11-16): the QR carries only the credential, nothing about the person. Anyone photographing a badge across the room learns a GUID, not a name or an email, and the server remains the sole authority on which attendee that credential belongs to (MMCA.ADC.Engagement.Shared/CheckIns/Badges/BadgePayload.cs:6-11). The human-readable name is rendered beside the code as ordinary text (MyBadge.razor:43) so an organizer can confirm the badge belongs to the person holding it; it is never inside the code. [Rubric §21, Accessibility]: the QR image carries an AltText from the resource file, and its PixelsPerModule="14" plus Medium error correction are documented in the markup comment (MyBadge.razor:35-36) as making the code readable at arm's length and tolerant of glare or a fingerprint.
  • Concept, the attendee-side badge reissue. [Rubric §11, Security]: an opaque credential is still a bearer token for check-in, so a photographed or printed copy has to be revocable. ReissueAsync (MyBadge.razor.cs:95) calls CheckInService.RegenerateMyBadgeAsync(LifetimeToken) (:100) and, on success, re-encodes _payload from the new credential in place (:103), so the page shows the new code and earlier copies stop scanning (doc comment :94). [Rubric §24, Forms, Validation & UX Safety]: the action is two-step. The Reissue button only sets _confirmingReissue through StartReissue (:90, markup MyBadge.razor:66-73), which swaps the button for a warning alert with Yes and Cancel (:50-65); the markup comment (:48-49) gives the reason, since every copy the attendee still relies on stops working too. _reissuing (MyBadge.razor.cs:41) disables both buttons while the call runs (MyBadge.razor:56, :60). A failure toasts result.ActionErrorMessage(L, L["Reissue.Failed"].Value) (MyBadge.razor.cs:110): a refusal the API stated is shown verbatim, an unexpected fault keeps the page's own wording (comment :109).
  • Concept, distinguishing "no badge" from "the fetch failed". [Rubric §24, Forms, Validation & UX Safety]: the page reads the result twice, once for the happy path and once for the shape of the failure. badgeResult.TryGetValue(out var badge) unwraps a success (:69); else if (!badgeResult.IsNotFound()) sets the error message only when the failure was something other than a 404 (:73-78), and the inline comment (:75-76) records that a not-found is simply an attendee who has no badge yet. The markup then has three distinct terminal states, not two: the failed-load body, a DetailLoadStateContent in its Failed state whose OnRetry is LoadAsync (MyBadge.razor:18-23), the empty-state alert when _payload is still null (:24-29), and the badge card (:30-77).
  • Walkthrough (teaching order)
    • State: a CancellationTokenSource field (MyBadge.razor.cs:25), the LifetimeToken property (:30, see below), the breadcrumb list (:32), a protected bool IsLoading that starts true (:35), three privates for the error message, the encoded payload and the display name (:37-39), and the two reissue flags _confirmingReissue and _reissuing (:40-41).
    • LifetimeToken => _cts.LifetimeToken() (:30) is the token every await uses. The comment above it (:27-29) gives the reason: reading Token off a disposed source throws ObjectDisposedException, whereas Dispose cancels before it disposes, so a load or handler that resumes after the attendee navigated away gets an already-cancelled token and exits through its OperationCanceledException path.
    • OnInitializedAsync (:43) is not async: it builds the two-item breadcrumb trail (:45-49) and returns LoadAsync() (:51).
    • LoadAsync (:55) is the load and, per its summary, also the Retry action (:54), which is why it begins by setting IsLoading = true and clearing _loadError (:57-58): a retry starts from the spinner, not from the previous error. Inside a try it awaits the cascaded AuthenticationState for state.User.Identity?.Name (:62-66) and calls CheckInService.GetMyBadgeAsync(LifetimeToken) (:68). Only on a successful unwrap does it compute _payload = BadgePayload.Format(badge.Credential) (:71).
    • Failure handling is the house pattern: OperationCanceledException is swallowed as expected during disposal (:80-83), and IsLoading is cleared in finally (:84-87) so the page can never be stuck on the spinner. Because the service returns a Result, an ordinary server refusal never reaches a catch at all.
    • StartReissue / CancelReissue (:90, :92) only flip _confirmingReissue. ReissueAsync (:95-120) sets _reissuing (:97), and on success replaces _payload, closes the confirmation and toasts Reissue.Done (:101-106); otherwise it toasts the error (:110). The same disposal-time OperationCanceledException catch applies (:112-115), and finally clears _reissuing (:116-119).
    • Dispose(bool) / Dispose() (:124-144) are the standard disposable pattern with a _disposed guard, cancelling and disposing the token source so an in-flight fetch or reissue stops when the attendee navigates away.
  • Why it's built this way: encoding the payload on the client from a credential the server issued keeps the QR format in exactly one place, BadgePayload.Format (BadgePayload, MMCA.ADC.Engagement.Shared/CheckIns/Badges/BadgePayload.cs:20), which is the same class the scanner side parses with (:30). Display and check-in cannot drift apart because they share the type and its mmca-adc:badge: prefix (:15). The reissue reuses that path: the regenerated credential is formatted by the same call, so a reissued code is scannable the moment it renders. Reissue exists on two sides (ADR-072): here for the attendee, and at the desk through AttendeeSearchPanel for an organizer.
  • Where it's used: routed at /my-badge behind a plain [Authorize] attribute (MyBadge.razor:2), so any signed-in attendee can open it, and the nav item EngagementUIModule registers for it sits in the User section with no role requirement (EngagementUIModule.cs:37). Its QR is what CheckInScan reads at a session door. Component-tested by MyBadgeTests.
  • Caveats / not-in-source: the resource strings and the QrCodeImage rendering behaviour live outside this file; this section covers the code-behind and the small amount of markup cited. The markup also renders a MyTicketsPanel below the badge states (MyBadge.razor:79-82), which is not part of this code-behind.

RoomCheckIn

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns.Rooms · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Rooms/RoomCheckIn.razor.cs:25 · Level 6 · class (partial)

  • What it is: the code-behind for the room QR landing page (@page "/engage/rooms/{RoomId:int}", RoomCheckIn.razor:1). An attendee scans the code printed beside a room door, signs in if needed, lands here, sees the room, and taps Check in; the page then records the check-in. The scan never names a session: the server decides which session that room is hosting at this instant. The printed QR also carries the room's check-in code as ?code=, the proof of presence the server checks.
  • Depends on: ICheckInUIService (the post), SelfCheckInOutcome<TResult> (the return shape), RoomCheckInResultDTO (the payload), CheckInErrorCodes and ParticipantErrorCodes (the refusal vocabulary), IToastService (the snackbar), ViewerTimeZone (the viewer's clock, RoomCheckIn.razor.cs:38), and its own nested CheckInState. Externals: Blazor ComponentBase (RendererInfo, [Parameter], [SupplyParameterFromQuery]), MudBlazor BreadcrumbItem / MudAlert / MudButton / MudCard / Icons, and an injected IStringLocalizer<RoomCheckIn> named L supplied by the markup (RoomCheckIn.razor:5).
  • Concept introduced, the confirm-to-write landing page. [Rubric §18, UI Architecture] assesses component/behavior separation and render-mode discipline. Arriving from a scan is half the interaction; one tap is the other half. The page prepares the write in OnParametersSetAsync and posts it only from ConfirmAsync, the Check in button's handler (RoomCheckIn.razor:24-25). That makes the Blazor render-mode question load-bearing in a narrower way: a prerendered pass and the interactive pass both run the lifecycle, so the guard at RoomCheckIn.razor.cs:76-77 (!RendererInfo.IsInteractive || RoomId == _postedRoomId && CheckInCode == _postedCheckInCode, compared ordinally) keeps one scan to one prepared attempt, while a scan of a different room, or of the same room with a different code, reusing the routed instance prepares a new one. The class comment (just above :25) gives the reason for the tap: a link opened from anywhere (a forwarded message, an app link the phone resolved on its own) records nothing until its holder confirms. [Rubric §19, State Management] covers the single-field state model taught on CheckInState.
  • Concept introduced, the retryable write under one attempt key. A phone at a crowded door loses packets, so a post that got no answer must be retryable without risking a double record. Each scan gets one Idempotency-Key, minted as Guid.NewGuid().ToString("N") when the scan changes (RoomCheckIn.razor.cs:88) and kept in _attemptKey (:54) for every retry of that scan, the Retry button included. The comment (:85-87) gives the reason: a retry whose first try did land replays that first answer instead of reading as a repeat check-in. The server half is the IdempotentAttribute on the room-visits endpoint (CheckInsController.cs:243). [Rubric §11, Security] applies through @attribute [Authorize] (RoomCheckIn.razor:2): the page identifies the attendee from the authenticated session, so a scanned code carries no identity of its own, and the ?code= value proves presence at the door rather than who is scanning.
  • Walkthrough (teaching order)
    • [Parameter] RoomIdentifierType RoomId (RoomCheckIn.razor.cs:28) is bound from the {RoomId:int} route constraint, so an unparseable code never reaches the component. [SupplyParameterFromQuery(Name = "code")] string? CheckInCode (:33) reads the room's check-in code from the query string; per its doc comment (:29-32) it is absent on a QR printed before the room had a code, which the server accepts until an organizer issues one. The injected ICheckInUIService, IToastService and ViewerTimeZone follow (:35-37), then a CancellationTokenSource (:39), the LifetimeToken property (:44), the breadcrumb list (:46), the _postedRoomId and _postedCheckInCode pair holding the scan this instance last showed, posted or is posting (:48-50), and the _attemptKey string (:53) holding the current scan's idempotency key.
    • LifetimeToken => _cts.LifetimeToken() (:44) is the token every await on the page uses. The comment above it (:41-43) records why: reading Token off a disposed source throws ObjectDisposedException, while Dispose cancels before it disposes, so a post that resumes after the attendee navigated away sees an already-cancelled token and exits through its OperationCanceledException path.
    • State (:56) starts at CheckInState.Loading and is protected with a private setter; Result (:59) holds the RoomCheckInResultDTO and is documented as present only in the Recorded state.
    • OnInitialized (:61-66) is a synchronous expression-bodied method that builds the two-item breadcrumb trail, so even the non-interactive prerender has a complete chrome. OnParametersSetAsync (:68) is not async: it returns Task.CompletedTask if the render is not interactive or the room and code match the last scan (:75-79). Otherwise it records the scan (:81-82), mints a fresh _attemptKey (:87), clears Result and moves to CheckInState.Confirm (:89-91), posting nothing. The comment (:70-74) gives the reason the code is part of the guard: rescanning the room's current door code while an out-of-date one is refused on screen changes only ?code, and must be a new attempt (M247, the SessionLive per-id pattern).
    • ConfirmAsync (:96) is the Check in button's handler and RetryAsync (:99) is the Retry button's (RoomCheckIn.razor:95); both send RecordCheckInAsync for _postedRoomId under the current key and do nothing when no scan has been shown.
    • RecordCheckInAsync (RoomCheckIn.razor.cs:102) resets State to Loading and clears Result (:103-104), copies _attemptKey into a local attemptKey that identifies the scan this post belongs to (:106-108), then awaits CheckInService.RecordRoomCheckInAsync(roomId, _postedCheckInCode, attemptKey, LifetimeToken) (:112).
    • Right after the await, a stale-scan check (:115-118) returns when attemptKey no longer equals _attemptKey: a newer scan took over the page while this one was in flight, and its own post owns the state.
    • The success branch (:120-131) assigns Result, moves to CheckInState.Recorded, and raises a success toast only when Result?.AlreadyCheckedIn == false (:125-128): a rescan is a normal thing to do, so it renders as information (RoomCheckIn.razor:33-47) rather than as a second celebration.
    • The refusal branch (RoomCheckIn.razor.cs:133-140) is a property-pattern switch over the outcome: IsTransient: true becomes Transient (checked first, so a timeout never reads as a refusal), ErrorCode: CheckInErrorCodes.NoCurrentSession becomes NoCurrentSession, ErrorCode: CheckInErrorCodes.EventNotPublished becomes NotPublished, ErrorCode: CheckInErrorCodes.RoomCodeRejected becomes CodeRejected (:138), and everything else (including a null code) falls through the discard arm to Unavailable. This is the client-side consumer of the contract that SelfCheckInOutcome<TResult> exists to carry.
    • catch (OperationCanceledException) when (LifetimeToken.IsCancellationRequested) (:142-145) is silent only when the page's own token was cancelled, that is when the attendee navigated away; any other exception, including a cancellation the page did not ask for such as a client timeout, lands on Transient only when the attempt key is still current (:147-152), so a stale scan's failure cannot overwrite a newer scan's state. The CA1031 suppression around that catch (:146, :148) carries the reason inline: a fault with no definitive answer is the retryable state, never "not available".
    • OnAfterRenderAsync (:160-166) runs on the first render only: it awaits ViewerTime.EnsureResolvedAsync(LifetimeToken) and calls StateHasChanged() when the zone changed, so the recorded time moves from the UTC fallback to the viewer's clock once JS interop is available (doc comment :155-159).
    • FormatCheckedInOn (:176-177) is an instance method that renders the recorded instant through ViewerTime.Format(checkedInOn.UtcDateTime). The XML comment (:168-175) gives the reason: the attendee is comparing the timestamp against the clock on the wall beside them, and DateTimeOffset.ToLocalTime would read the server's clock on Blazor Server and during prerender. [Rubric §27, Internationalization] covers both halves of that, the viewer-zone formatting and the fact that every visible string is an L["..."] resource lookup (ADR-027).
    • PointsLine (:186-194) picks the line under a first check-in from the RoomCheckInResultDTO: PointsPaused gives the PointsPaused string (session points are switched off, nothing is awarded), otherwise EarnsPoints selects Success.PointsHint ("added to your total") or NoPointsThisTimeSlot for a second check-in in the same time slot (doc comment :179-185).
    • Dispose(bool) / Dispose() (:224-246) implement the standard disposable pattern with a _disposed latch, cancelling and disposing _cts so an in-flight post stops when the attendee navigates away.
  • Why it's built this way: the class comment (just above RoomCheckIn.razor.cs:25) states the constraints. The write runs on the interactive render only, once per scan rather than once per page instance, and only after the attendee confirms: a prerender must not spend a round trip, a back button must not read as a second arrival, and a link that reached a phone some other way must not record anything on its own. The server is idempotent per session regardless (a repeat returns AlreadyCheckedIn), so the per-scan guard is about not making a pointless call rather than about correctness; the attempt key adds the same guarantee for a retry, which the endpoint replays rather than re-executes. Resolving the session server-side from the room, instead of encoding it in the QR, means the printed code does not change when the schedule moves (ADR-072); only re-issuing the room's check-in code retires an old print, which is what CodeRejected reports. The page complements organizer badge scanning at the door rather than replacing it: one session yields one check-in by either path, which is exactly what the "already checked in" branch says (RoomCheckIn.razor:35-36).
  • Where it's used: the target of the room QR rendered on the Conference room detail page (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Rooms/RoomDetail.razor:64, a QrCodeButton over ConferenceRoutePaths.RoomCheckInLink(id, checkInCode), ConferenceRoutePaths.cs:68) per ADR-071. The post lands on CheckInsController's room-visits endpoint (CheckInsController.cs:242, [Idempotent] at :194, feature-gated on EngagementFeatures.RoomCheckIn at :195) and is handled by RecordRoomCheckInHandler. [Rubric §28, Front-End Testing]: covered by RoomCheckInTests (bUnit), and the architecture suite carries a RoomCheckInModeTests contract test. Render-mode background: ADR-056.
  • Caveats / not-in-source: the confirm card, the outcome copy, the success card, the points hint and the Retry button live in RoomCheckIn.razor (:16-30, :31-66, :85-99) and the resource files, not in this code-behind. Whether a given deployment has EngagementFeatures.RoomCheckIn on is configuration, not source.

AttendeeSearchPanel

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/AttendeeSearchPanel.razor.cs:18 · Level 7 · class (partial, DataGridListPageBase<AttendeeSummary>)

  • What it is: the manual check-in fallback, a paged, sortable, mobile-aware search over the Identity users endpoint with a per-row check-in action. It is a component, not a page: it has no @page directive and is embedded by CheckInScan.
  • Depends on: DataGridListPageBase<TDto> as its base (AttendeeSearchPanel.razor.cs:18), IAttendeeLookupService plus AttendeeSummary and AttendeeSearchField (MMCA.ADC.Engagement.UI/Services/Lookups/IAttendeeLookupService.cs:15, :39), MobileInfiniteScrollList<TItem>, and Result for the mobile fetch signature (:3, :79). Externals: MudBlazor MudDataGrid/GridState/GridData, and an injected IStringLocalizer<AttendeeSearchPanel> (AttendeeSearchPanel.razor:5).
  • Concept introduced, extracting a list surface out of a page. [Rubric §15, Best Practices & Code Quality] and [Rubric §18, UI Architecture]: the class summary records the reason for the split (AttendeeSearchPanel.razor.cs:12-17), namely that the page owns the scan loop and its own cancellation while the grid keeps the shared base's behaviour (server paging, mobile card layout, state restore) unchanged. Inheriting the framework base rather than hand-rolling a grid is what buys the mobile path: [Rubric §22, Responsive & Cross-Browser] shows in ReloadActiveLayoutAsync (:59-60), which delegates to the base's protected ReloadActiveLayoutAsync(_infiniteList) (MMCA.Common/Source/Presentation/MMCA.Common.UI/Pages/Common/DataGridListPageBase.cs:1879-1888): on a phone with a card list it saves the filter state and resets the list from page 1, otherwise it reloads the grid, so the same filter change reloads whichever layout is live.
  • Walkthrough
    • Contract with the base: Title from the localizer (:19) and GridRef => _dataGrid (:32), which is how the base drives ReloadServerData(); OnMobileDataRequestedAsync (:55) routes the base's mobile hook back through the same reload, and RetryLoadAsync (:57) is what the empty-state retry button calls.
    • Parameters from the host page: CanCheckIn (:24) gates the per-row action, and OnCheckIn (:27) is the EventCallback<AttendeeSummary> raised by CheckInAsync (:127). The component performs no write of its own; it reports which row was actioned and lets the page decide.
    • Filter persistence: SaveFilters / RestoreFilters (:39-52) round-trip the search term and the chosen field through the base's state store, with Enum.TryParse falling back to LastName if the stored value is unreadable (:49-51).
    • Search handling: OnSearchChangedAsync and OnSearchFieldChangedAsync (:62-72) each set a field and return ReloadActiveLayoutAsync() directly (they are plain Task-returning methods, not async). The markup wires the text field with Immediate="true" DebounceInterval="300" (AttendeeSearchPanel.razor:12), so typing does not fire a request per keystroke, a [Rubric §23, Front-End Performance] detail.
    • Data loading: LoadServerData (:74-77) is LoadServerDataAsync(state, SearchAsync, ApplySearchTerm), handing the base the private SearchAsync (:96-103) as its fetch delegate. SearchAsync passes the filter bag to AttendeeLookup.SearchAsync(filters, page, pageSize, sortColumn, sortDirection, cancellationToken) verbatim (doc comment :90-95): the grid's column operators on LastName, FirstName and Email, and the search box's entry under the field's own key or under the ~search alias the base class moves it to when that column is also filtered, so both apply. FetchMobilePageAsync (:79-88) builds a filter bag, applies the search term, calls SearchAsync with "LastName" / "asc" (:87) and returns Task<Result<(IReadOnlyList<AttendeeSummary> Items, int TotalItems)>>, pinning the sort since the card layout has no sort UI. The markup binds it through FetchPageResult (AttendeeSearchPanel.razor:30), the Result-aware overload, which is what lets a failed page render ListNoRecordsContent with LoadFailed and a retry rather than an empty list (:86).
    • ApplySearchTerm (:109-125) is the load-bearing piece and its doc comment explains it (:105-108, echoed in the markup at :15): the Identity users endpoint ANDs its filters, so one search box broadcast across email, first name and last name would match nobody. The single term is therefore applied to exactly the field the organizer picked, as a "contains" filter (:116-124).
  • Why it's built this way: an organizer at a door needs the fallback to be fast and forgiving, and the shared base already solved paging, mobile layout and state restore for every other list in the app. Raising an EventCallback instead of calling the check-in service directly keeps the write path (and its scope, target and error reporting) in one place, the page. [Rubric §21, Accessibility]: both action buttons carry a per-row aria-label built from the attendee's display name (AttendeeSearchPanel.razor:43, :79), so a screen-reader user hears which person a "Check in" button belongs to.
  • Where it's used: rendered unconditionally near the bottom of the scan page, <AttendeeSearchPanel CanCheckIn="CanCheckIn" OnCheckIn="ManualCheckInAsync" /> (CheckInScan.razor:127). The comment above it (CheckInScan.razor:122-123) states the intent: on web and Windows heads there is no camera, so this search is the check-in surface.

CreateLivePollForm

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Components · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Components/CreateLivePollForm.razor.cs:17 · Level 8 · class (partial, IAsyncDisposable)

  • What it is: the one create-poll form of the live layer (class summary CreateLivePollForm.razor.cs:9-16), shared by the Happening Now Manage tab (an event-wide poll) and the session Live moderation panel (a session poll, when SessionId is set). It owns the draft question and options and performs the create call; the host owns the poll lists and reloads them when told.
  • Depends on: ILivePollUIService (CreateLivePollForm.razor.cs:19) for the create, IToastService (:20), CreateLivePollRequest (:91-97), LivePollDTO for the MinOptions / MaxOptions bounds and QuestionMaxLength (CreateLivePollForm.razor:9), ResultUiExtensions.ActionErrorMessage (CreateLivePollForm.razor.cs:103), and its nested OptionState. Externals: MudBlazor MudCard / MudTextField / MudIconButton / MudButton, and an injected IStringLocalizer<CreateLivePollForm> named L (CreateLivePollForm.razor:2).
  • Concept introduced, one form component, two hosts, parent-owned busy flag. [Rubric §18, UI Architecture]: rather than each host carrying its own copy of the question-and-options form, both render this component (PollManagementPanel.razor:5, SessionLiveModerationPanel.razor:58), and the only difference between them is whether SessionId (CreateLivePollForm.razor.cs:27-29) is passed. The heading follows that one parameter (CreateLivePollForm.razor:6). The saving state stays with the host: IsSaving (CreateLivePollForm.razor.cs:31-33) comes in, IsSavingChanged (:35-37) goes out, so one flag disables every action of the host while any of them runs, and OnPollCreated (:39-41) tells the host to reload its rows. [Rubric §24, Forms, Validation & UX Safety]: the option count is held between LivePollDTO.MinOptions and LivePollDTO.MaxOptions, the same numbers the server validates (class summary :14-15), both in the handlers and in the markup's disabled states (CreateLivePollForm.razor:19, :25).
  • Walkthrough (teaching order)
    • Parameters: EventId is [EditorRequired] (CreateLivePollForm.razor.cs:22-25); SessionId, IsSaving, IsSavingChanged and OnPollCreated follow (:27-41).
    • State: a CancellationTokenSource (:43), the draft _newQuestion (:45) and _newOptions (:46), seeded by NewOptions() with MinOptions empty rows (:124-125), and LifetimeToken => _cts.LifetimeToken() (:51) with the usual disposed-source comment (:48-50).
    • AddOption (:53-59) appends a row only below MaxOptions; RemoveOption (:61-67) removes one only above MinOptions and only for an in-range index.
    • CreatePollAsync (:69-122) warns with Snackbar.RequiredFields and stops when the question is blank (:71-75) or fewer than MinOptions non-blank trimmed options remain (:77-86). It then raises IsSavingChanged(true) (:88), builds the request (:91-97) and awaits PollService.CreateAsync(request, LifetimeToken) (:98). A failure toasts created.ActionErrorMessage(L, L["Snackbar.ActionFailed"].Value) (:103): a refusal the API stated is shown verbatim, an unexpected fault keeps the form's own wording (comment :101-102). A success clears the draft back to fresh rows (:107-109), toasts Snackbar.Created (:111) and raises OnPollCreated (:112). A disposal-time OperationCanceledException is swallowed (:114-117), and finally always raises IsSavingChanged(false) (:118-121).
    • DisposeAsync (:128-134) cancels and disposes the token source so a create in flight stops when the host goes away.
  • Why it's built this way: keeping the draft inside the form and the poll lists inside the host splits ownership along the data each side actually needs, so adding a third host would be one tag. Raising the busy flag through a callback rather than holding a private one is what lets the host re-render every section on the change (doc comment CreateLivePollForm.razor.cs:34), and the create button reads the host's flag back (CreateLivePollForm.razor:32-33), so it is disabled while any of the host's actions runs (doc comment CreateLivePollForm.razor.cs:30).
  • Where it's used: PollManagementPanel (PollManagementPanel.razor:5, event-wide) and SessionLiveModerationPanel (SessionLiveModerationPanel.razor:58, per session). Covered through those hosts' bUnit tests, PollManagementPanelTests and SessionLiveModerationPanelTests.
  • Caveats / not-in-source: what the server does with the request is in the live-layer chapter; the resource strings live in the .resx files.

CheckInScan

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/CheckInScan.razor.cs:21 · Level 10 · class (partial)

  • What it is: the organizer check-in surface (@page "/check-in", [Authorize(Roles = RoleNames.Organizer)], CheckInScan.razor:1-2). On a head with a camera it runs one continuous session of the shared barcode scanner and posts each badge payload; everywhere else the manual search below the scan area is the whole page. Both paths write through the same endpoints and report the attendee by name.
  • Depends on: ICheckInUIService, IAttendeeLookupService, ISessionLookupService, ILiveEventUIService, IBarcodeScannerService and IToastService (CheckInScan.razor.cs:26-31); the shared contracts BadgePayload, CheckInScope, CheckInAttendeeRequest, ManualCheckInRequest, CheckInResultDTO; LiveEventContext and SessionInfo; Result and ErrorType (:4); ScanOutcome / ScanOutcomeKind for the feed; and the AttendeeSearchPanel and OrganizerEventPicker components.
  • Concept introduced, the capability-gated scan session. [Rubric §18, UI Architecture] and the device-capability abstraction of ADR-042 meet here. ScannerAvailable => Scanner.IsSupported (:46, with the ADR named in the comment at :45) is the whole capability switch: the markup renders the scan card only when it is true (CheckInScan.razor:78), and every head that cannot open a camera falls through to the manual panel with no conditional compilation and no per-platform page. The page does not drive the camera itself: it hands one callback to IBarcodeScannerService.ScanContinuouslyAsync (:221; the member is at MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/IBarcodeScannerService.cs:57), which keeps one scan session open, hands over each decoded payload and does not hand over again a payload held in view (IBarcodeScannerService.cs:36-39). Camera permission is asked once, before the camera opens: Scanner.EnsureCameraAccessAsync (CheckInScan.razor.cs:215) returning false toasts a Snackbar.CameraDenied warning and returns (:215-219), so a denial leaves the organizer on the page with the reason and the manual search rather than on a camera surface that stays black (comment :213-214). [Rubric §11, Security]: scanned text is untrusted input, so BadgePayload.TryExtractCredential screens it before any request goes out (:251), and a poster or sponsor QR is reported as a skipped scan rather than an error (comment :248-249). [Rubric §24, Forms, Validation & UX Safety]: CanCheckIn (:49-50) refuses to start a scan or a manual write until a target exists, and the markup renders an inline "pick a target" alert when it is false (CheckInScan.razor:69-73).
  • Walkthrough (teaching order)
    • Constants and state: MaxOutcomes = 10 bounds the on-screen feed (CheckInScan.razor.cs:24); the CancellationTokenSource (:33), LifetimeToken (:38), IsLoading (:43), _loadError, _liveEvent, the _events list of published events that feeds the OrganizerEventPicker (:54), _sessions and _selectedSessionId (:52-56), the _loadGeneration counter (:63, explained below), the scope field (:68), the _isScanning flag (:70), the _scanSession token source of the running scan session (:72-73) and the _outcomes list (:74).
    • LifetimeToken => _cts.LifetimeToken() (:38) is the page's lifetime token: the catalog load, the manual write and the name lookup await on it, and every scan session's token is linked to it (:209). The comment above it (:35-37) explains that reading Token off a disposed source throws ObjectDisposedException; because Dispose cancels before it disposes, a handler resuming after navigation gets a cancelled token and stops through its OperationCanceledException path.
    • Default scope: _scope = CheckInScope.Session with a comment that is real operational knowledge (:65-68, repeated for the reader in the markup at CheckInScan.razor:43-45), namely that the conference runs door and arrival check-in through TicketLeap, so session check-in is the working path and Event scope is kept for future info-desk use.
    • OnInitializedAsync (CheckInScan.razor.cs:76) is not async: it builds the breadcrumbs and returns RunLoadAsync(LoadEventAsync) (:84).
    • LoadEventAsync (:88-104) calls OrganizerEventPicker.LoadEventsAsync(LiveEventService, LifetimeToken) (:90). A failed read sets the localized load error and returns (:91-96), so an outage shows the failed-load body with Retry rather than reading as "no published event". Otherwise it stores the current event and the picker's events (:98-99) and, when there is a current event, awaits LoadSessionsAsync(_liveEvent.EventId) (:100-103).
    • Event switching: OnEventSelectedAsync (:110) is the handler the picker's OnEventSelected callback targets (CheckInScan.razor:15). It ignores an id not in _events (CheckInScan.razor.cs:112-116), calls StopScanning() and sets _liveEvent to the chosen event (:118-119), and returns ReloadSessionsAsync(eventId) (:120).
    • RetryLoadAsync (:127-128) is the OnRetry target of the failed-load body (CheckInScan.razor:25): it reloads the selected event's sessions, or runs LoadEventAsync again when no event was resolved because the event read failed (doc comment CheckInScan.razor.cs:123-126). ReloadSessionsAsync (:131-136) clears the session choice and session list (sessions belong to one event) and returns RunLoadAsync(() => LoadSessionsAsync(eventId)).
    • RunLoadAsync(Func<Task> load) (:139-162) is the one loading wrapper. It bumps _loadGeneration first, so anything in flight now belongs to an older generation (:141-143), clears _loadError and sets IsLoading (:144-145), awaits the load (:149), swallows a disposal-time OperationCanceledException (:151-154), and in finally clears IsLoading only when the generation is unchanged (:155-161), so a superseded load cannot hide the spinner of a newer selection.
    • LoadSessionsAsync (:165-185) is the shared session loader. It snapshots the generation, awaits the Result-returning catalog lookup (:169), and drops the result if the generation moved while it was in flight (:170-173), so a slow earlier load never overwrites a newer selection's list. A failed result sets the load error (:175-179); otherwise it filters sessions to the given event id, ordering by start time with ?? DateTime.MaxValue so unscheduled sessions sort last, then by title under StringComparer.CurrentCulture (:181-184).
    • Target selection: OnScopeChangedAsync stops any running scan when the scope changes (:187-192), which prevents a scan started against one target from continuing under another; OnSessionChanged just records the selection (:194).
    • StartScanningAsync (:201-233) runs one continuous scan session (doc comment :196-200). It refuses to start twice or without a target (:203-206), sets _isScanning, and creates the session's own token source linked to LifetimeToken, kept in _scanSession (:208-210). It runs the camera-access check described above on the session token (:215-219), then awaits Scanner.ScanContinuouslyAsync(OnScannedAsync, session.Token) (:221) until the organizer stops, the scanner closes or the page goes away. An OperationCanceledException is the expected way a stopped or disposed session ends (:223-226), and finally clears _scanSession, disposes the session source and clears _isScanning (:227-232).
    • StopScanning (:235-239) clears _isScanning and cancels _scanSession, so the camera closes at once rather than after its next read (the doc comment's "so the camera closes at once", :198-199).
    • OnScannedAsync (:246-263) is the per-payload callback. A badge payload goes to SubmitScanAsync with the session's token (:251-254); anything else becomes a NotABadge outcome added to the feed (:255-259). Either way it re-renders through InvokeAsync(StateHasChanged) (:261) so the list is current when the camera closes, and it returns OutcomeText(outcome) (:262), the line the scanner shows over the camera so the operator reads the result without leaving it (doc comment :241-245).
    • SubmitScanAsync (:265-279) builds a CheckInAttendeeRequest carrying the credential, the scope, the event id and, only in session scope, the selected session (:267-273). It does not catch anything: the write (CheckInByCredentialAsync(request, cancellationToken), :277) returns a Result that RecordResultAsync turns into a Failed row while the session keeps scanning, and it returns that outcome to OnScannedAsync (:278); a genuine cancellation propagates to the session's own handler (comment :275-276).
    • ManualCheckInAsync (:282-320) is the fallback the panel raises. It toasts a warning when no target is selected (:284-288), builds a ManualCheckInRequest by user id (:292-298), and on a failed result adds a named Failed outcome (:303) plus a toast whose wording depends on why it failed: a refusal the API stated is shown verbatim through result.LocalizedErrorMessage(L), while an ErrorType.Unexpected fault keeps the page's own wording instead of raw diagnostic text (:305-310). [Rubric §11, Security] and [Rubric §13, Observability & Operability]: that branch is the boundary between what an organizer may read and what belongs in the logs.
    • RecordResultAsync (:326-342) turns one response into an outcome and returns it. A failed Result becomes a Failed row (:328-331). The scan path has no name to start from because a badge carries only a credential, so it resolves one via AttendeeLookup.GetDisplayNameAsync(checkIn.UserId, LifetimeToken) (:334-337); the manual path already has one and skips the lookup. Finally the response's AlreadyCheckedIn flag selects the outcome kind (:341), which is how a repeat scan reads as a recognisable warning instead of an error.
    • The bounded AddOutcome (:344-353) inserts at the head, trims the tail and returns the outcome it added; OutcomeText (:355-362) is the localized sentence per kind. The row's severity and icon are properties of ScanOutcome itself.
    • Dispose(bool) (:366-382) clears _isScanning before cancelling the page token source, then disposes any running _scanSession and the page source (:375-378).
  • Why it's built this way: one page serving both a camera head and a keyboard head is a deliberate choice, and it is only affordable because the scan capability is behind an injected interface. Handing the scanner a callback instead of looping ScanAsync on the page lets a head with a continuous camera surface keep it open for the whole session and show each outcome over it, while a head without one still runs through the interface's default loop (IBarcodeScannerService.cs:51-56). Treating a duplicate as a first-class outcome rather than an error is the other design decision that matters at a real door: the organizer needs to see who the badge belongs to either way, which is why CheckInResultDTO carries AlreadyCheckedIn instead of returning a conflict (MMCA.ADC.Engagement.Shared/CheckIns/CheckInResultDTO.cs:3-7, :14).
  • Where it's used: routed at /check-in, Organizer-only, and surfaced in the nav by EngagementUIModule with the same role requirement (EngagementUIModule.cs:39). It writes through CheckInService to the CheckInsController endpoints. Component-tested by CheckInScanTests, CheckInScanOutcomeTests and CheckInScanSessionTests.
  • Caveats / not-in-source: what the camera actually does on each platform is behind IBarcodeScannerService (EnsureCameraAccessAsync at MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Capabilities/Media/IBarcodeScannerService.cs:26, ScanContinuouslyAsync at :57) and is covered in the device-capability chapter, not here.

OrganizerAttendance

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/OrganizerAttendance.razor.cs:17 · Level 10 · class (partial)

  • What it is: the organizer attendance rollup for the current event, or another published event chosen through the picker (@page "/organizer/attendance", [Authorize(Roles = RoleNames.Organizer)], OrganizerAttendance.razor:1-2): one headline arrival figure plus one row per session that has at least one check-in.
  • Depends on: ICheckInUIService, ILiveEventUIService, ISessionLookupService (OrganizerAttendance.razor.cs:19-21), OrganizerEventPicker (its event loader and the picker component), AttendanceStatsDTO and SessionAttendanceDTO, and its own nested SessionAttendanceRow. Externals: MudBlazor MudSimpleTable/BreadcrumbItem, System.Globalization in the markup (OrganizerAttendance.razor:3), the shared DetailLoadStateContent failed-load body, and an injected IStringLocalizer<OrganizerAttendance> (:7).
  • Concept, client-side enrichment across a service boundary. [Rubric §7, Microservices Readiness] and [Rubric §12, Performance & Scalability] both apply. The class summary states the situation (OrganizerAttendance.razor.cs:11-15): the stats endpoint reports session identifiers only, because Engagement owns check-ins and Conference owns the session catalog, so titles are resolved through ISessionLookupService. This page does it in the client, and BuildSessionRowsAsync documents the choice (:189-193): the whole catalog is fetched once rather than one request per row, because a busy conference day reports dozens of sessions at a time. That is the N+1 avoidance rule applied to a UI join.
  • Walkthrough
    • State: the token source (:23), the LifetimeToken property (:28, the disposed-source guard explained in the comment above it), breadcrumbs (:30), IsLoading (:33), the error string, event name, the raw _stats and the projected _rows (:35-38), then the picker state: _events (:39, the published events) and _selectedEventId (:40), plus _loadGeneration (:47), a counter bumped to supersede every stats load already in flight (doc comment :42-46).
    • OnInitializedAsync (:49) is not async: it builds the breadcrumbs and returns LoadEventAsync() (:57).
    • LoadEventAsync (:64-103) is both the initial load and the Retry action while no event has been resolved (doc comment :60-63). It bumps _loadGeneration (:66-68), clears the error and sets IsLoading (:69-70), then calls OrganizerEventPicker.LoadEventsAsync(LiveEventService, LifetimeToken) (:74). A failed read sets the localized load error and returns (:75-80), so an outage is not shown as "no published event"; no current event returns quietly (:82-85); otherwise it stores the selected id, name and picker events (:87-89) and awaits LoadStatsAsync(liveEvent.EventId) (:90). It swallows a disposal-time cancellation (:92-95), and the finally clears IsLoading only when the generation is unchanged (:96-102).
    • OnEventSelectedAsync (:106) is the picker callback target (OrganizerAttendance.razor:15). It ignores an id not in _events (OrganizerAttendance.razor.cs:108-112), swaps in the selected id and name (:114-115), and returns ReloadStatsAsync(eventId) (:116).
    • RetryLoadAsync (:123-124) is the OnRetry target of the failed-load body (OrganizerAttendance.razor:25): it reloads the selected event's figures, or runs LoadEventAsync again when the event read itself failed (doc comment OrganizerAttendance.razor.cs:119-122).
    • ReloadStatsAsync (:127-153) bumps _loadGeneration first, so anything in flight now belongs to an older generation (:129-131), clears _stats, _rows and the error and sets IsLoading (:133-136), then awaits LoadStatsAsync under the same swallow-cancel and generation-gated finally as the initial load (:138-152).
    • LoadStatsAsync (:156-187) is the shared loader: it fetches the rollup with GetAttendanceStatsAsync(eventId, LifetimeToken) (:160), drops the result if a newer selection superseded it (:161-164), sets the localized load error and returns on a failed Result (:166-170), builds the rows (:172), re-checks the generation (:173-176), stores _stats (:178), and if the row build returned null clears the rows and raises the load error (:179-184), otherwise assigns _rows (:186).
    • BuildSessionRowsAsync (:194) returns Task<List<SessionAttendanceRow>?> instead of assigning state itself: it short-circuits to an empty list when the rollup has no session rows, avoiding a pointless catalog fetch (:196-199). The catalog fetch itself uses SessionLookup.GetAllAsync(LifetimeToken) (:201). A failed catalog fetch returns null (:202-205), which LoadStatsAsync turns into cleared rows plus the same load error rather than silently rendering untitled rows. Otherwise it projects each DTO into a SessionAttendanceRow, substituting the localized Sessions.DeletedTitle when the catalog does not know the session (:210-215). The comment (:207-209) gives the reasoning: the catalog holds every live session of every edition, so a checked-in session missing from it was deleted after the check-ins were recorded, and its row is kept because the attendance happened. Sorting is OrderByDescending(Count) then ThenBy(Title, StringComparer.CurrentCulture) (:216-217), a culture-aware tie-break, so the busiest sessions lead.
    • Dispose (:220-242) is the same disposable pattern as the other check-in pages.
  • Why it's built this way: sorting and labelling once, on load, keeps the markup a pure loop over _rows (OrganizerAttendance.razor:68) with no I/O in the render path. [Rubric §21, Accessibility]: that markup is a real MudSimpleTable with a <caption>, <th scope="col"> headers and a <th scope="row"> per session (OrganizerAttendance.razor:59-76), not a styled div grid, so a screen reader announces the counts with their session names. [Rubric §27, i18n]: both the headline figure and each row count are formatted ToString("N0", CultureInfo.CurrentCulture) (:44, :72).
  • Where it's used: routed at /organizer/attendance and surfaced as an Organizer-only nav item by EngagementUIModule (EngagementUIModule.cs:40). Its numbers come from the same check-in rows that CheckInScan writes. Component-tested by OrganizerAttendanceTests.

LiveEventListener

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Components · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Components/LiveEventListener.razor.cs:26 · Level 10 · class (public partial component)

  • What it is: the module's invisible layout component. It renders no markup; on the first render, and again on every authentication-state change, it decides the circuit's membership in the event-wide live channel: a signed-in user joins while the current event is inside its live window (so a poll opening reaches the attendee on whatever page they happen to be on), a signed-out user releases what was held. When the shell opens before the window, it arms a timer and joins when the window opens. The .razor half is only a comment wrapped in CascadingAuthenticationState / AuthorizeView / Authorized (LiveEventListener.razor:4-10); all the behavior lives in the code-behind, which does its own authentication check rather than relying on that wrapper.
  • Depends on: ILiveEventUIService, the LiveEventLookup its GetCurrentEventAsync returns (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/ILiveEventUIService.cs:14) and the LiveEventContext inside it, NotificationHubService (injected as the concrete sealed class, there is no interface in front of it), IToastService and ToastSeverity, LivePollChannel and LivePollOpenedPayload from MMCA.ADC.Engagement.Shared, IBatteryStatusService and IAccessibilityAnnouncer from MMCA.Common.UI.Services.Capabilities, and EngagementRoutePaths. Externals: Blazor's NavigationManager, AuthenticationStateProvider (injected at :42 for the auth-change subscription) and the cascading Task<AuthenticationState>, IStringLocalizer<LiveEventListener> (injected in the markup, LiveEventListener.razor:2), System.Text.Json, TimeProvider (injected at :41 for the live-window clock and the window timer), and the [LoggerMessage] source generator (:358-359).
  • Concept, the ambient listener that must never throw. [Rubric §29, Resilience & Business Continuity] assesses whether a non-essential capability degrades instead of taking the user's session down with it. This component is contributed as a layout component and so is live on every page, and the shell's ErrorBoundary wraps only the page body, which the class remarks state directly (:19-25): an exception escaping its render lifecycle tears down the Blazor circuit and forces a full page reload wherever the user happens to be. Every evaluation (the first render and each auth change) therefore runs through EvaluateGuardedAsync, guarded end to end: OperationCanceledException is swallowed as the expected disposal signal (:126-129), and everything else is logged and absorbed behind an inline CA1031 suppression whose justification is written into the pragma itself (:130). Every join that runs outside an evaluation (the energy-saver toast action and the live-window timer tick) goes through JoinChannelGuardedAsync, which repeats the same two catches. The remarks add that the guard stays even though the live-event read already turns transport, timeout and resilience-pipeline faults into a failed lookup (:22-24).
  • Concept, a join that follows the auth state inside one shell. [Rubric §19, State Management]. The shell persists across an in-circuit sign-in on MAUI and WebAssembly (comment :59-60), so evaluating only on the first render would leave a user who signs in later without the channel. The component subscribes to AuthenticationStateChanged on the first render (:75-76) and re-evaluates on each change. A monotonically bumped _evaluation counter (:63-66, :108) makes an older evaluation stand down when a newer one started while it was awaiting (:111-116, :154), so a stale signed-out pass cannot release the join a newer sign-in made.
  • Concept, two concurrent holders of one channel. [Rubric §19, State Management] assesses how a shared per-circuit resource is owned when more than one component holds it at once. This listener joins LivePollChannel.ForEvent(liveEvent.EventId) (:163, :173, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/LivePolls/LivePollChannel.cs:24-25), and the Happening Now page joins the identical key for the same event. Membership therefore cannot be a set: it is reference-counted per key inside NotificationHubService (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Notifications/NotificationHubService.cs:25-28, :186-189, :217-219), so navigating away from Happening Now releases one join and leaves this listener still receiving events on event:{id}. The flip side is that this listener must never leave a channel it did not join, or it would drop the other holder's reference: _joinedChannelKey (:50-52) records the join actually taken, kept distinct from _channelKey, which is also set while only the window timer is armed or the energy-saver opt-in is pending.
  • Concept, capability-aware live UX. [Rubric §21, Accessibility] and [Rubric §27, Internationalization]. Every user-visible string is a resource key resolved through the injected localizer (LiveEventListener.razor:2, ADR-027), and each poll-opened toast is mirrored to the platform's assistive channel through IAccessibilityAnnouncer (:328) so a screen-reader user gets the same event a sighted user sees.
  • Walkthrough
    • PayloadJsonOptions (:28): a static JsonSerializerOptions.Web, so payloads are read with the same web (camelCase) conventions the publisher serialized them with.
    • MaxWindowTimerStep (:32): a static one-day TimeSpan. The comment (:30-31) gives the reason: a timer delay above about 49.7 days (uint.MaxValue - 1 ms) throws, and the next published event can be months away, so the wait runs in steps of at most one day.
    • Nine [Inject] properties (:34-42): the live-event service, the hub service, the toast service, NavigationManager, the battery-status and accessibility-announcer capabilities, the typed logger, TimeProvider, and AuthenticationStateProvider. The [CascadingParameter] Task<AuthenticationState>? AuthState (:44-45) is nullable because the component can be rendered outside a CascadingAuthenticationState.
    • The mutable state: _subscription and _channelKey (:47-48), _joinedChannelKey (:52), _windowTimer and _disposed (:56-57), _authSubscribed (:61) and _evaluation (:66). The timer is armed when the shell opens before the live window, a tab or MAUI shell left open from the evening before (comment :54-55), so the join happens when the window opens instead of never.
    • OnAfterRenderAsync(firstRender) (:68-79): a non-async method. Past the first render it returns Task.CompletedTask (:70-73); on the first it subscribes to AuthStateProvider.AuthenticationStateChanged and sets _authSubscribed (:75-76), then returns EvaluateGuardedAsync(AuthState) when a cascading auth state exists (:78).
    • OnAuthenticationStateChanged(authStateTask) (:84-85) and ReevaluateAsync(authStateTask) (:87-97): the event-handler signature discards the task explicitly rather than using async void (comment :81-83, VSTHRD100); ReevaluateAsync marshals onto the renderer with InvokeAsync(() => EvaluateGuardedAsync(authStateTask)) (:91) and swallows only ObjectDisposedException, the renderer torn down between the event and the dispatch (:93-96).
    • EvaluateGuardedAsync(authStateTask) (:104-138): bumps _evaluation and awaits the state (:108-109), stands down if a newer evaluation started meanwhile (:113-116), calls ReleaseAsync for an unauthenticated principal (:118-122), and otherwise awaits EvaluateSignedInAsync(evaluation) (:124). The two catches follow (:126-137); the catch-all logs through LogLiveChannelSetupFailed and stays silent in the UI, since this component renders nothing and has no place to show a message (:134-136).
    • EvaluateSignedInAsync(evaluation) (:146-175): a no-op once disposed or once a _channelKey is held (:148-151), because a token refresh also raises the auth event (doc :141-142). It reads (await LiveEventService.GetCurrentEventAsync()).LiveEvent (:153) and stands down on no event, on disposal, or on a newer evaluation (:154-157). It then reads "now" once from the injected TimeProvider (:159) and branches three ways. Before liveEvent.LiveWindowStartUtc it sets _channelKey and calls ArmLiveWindowTimer instead of joining (:160-166); after the window (per IsLiveAt, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventContext.cs:22-23 for the half-open window it tests) it returns (:168-171); inside it, it sets _channelKey (:173) and awaits TryJoinAsync(JoinChannelAsync) (:174), the unguarded join, since it already runs inside the evaluation guard. Reading the clock through the injected TimeProvider rather than DateTime.UtcNow lets a test pin "now": the resilience tests register TimeProvider.System (LiveEventListenerResilienceTests.cs:49), and LiveEventListenerTests drives the window from a controlled clock (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Components/LiveEventListenerTests.cs:68, :100).
    • TryJoinAsync(join) (:182-200): the energy-saver check shared by the evaluation and the window timer. When Battery.IsEnergySaverOn (:187), the auto-join is skipped and an Info toast offers a "join anyway" action whose callback is JoinChannelGuardedAsync (:191-195), returning Task.CompletedTask (:196). The inline comment (:184-186) is explicit that only the lossy live channel is deferred and the core notification connection is untouched (ADR-042 Wave 3). Otherwise it returns the supplied join() (:199): unguarded from the evaluation path, guarded from the timer (:181).
    • ArmLiveWindowTimer(liveEvent, utcNow) (:206-215): computes the time until the window starts (:208), disposes any previous timer (:209), and creates a one-shot TimeProvider.CreateTimer whose due time is the smaller of that gap and MaxWindowTimerStep, with an infinite period (:210-214). The callback marshals onto the renderer with InvokeAsync(() => OnLiveWindowTimerAsync(liveEvent)) (:211).
    • OnLiveWindowTimerAsync(liveEvent) (:221-236): does nothing once _disposed is set or _channelKey has been cleared, which covers a tick queued before a sign-out released the channel (:223-226, comment :217-220); re-reads the clock and re-arms when the tick was a capped step that still lands before the window (:228-233); otherwise joins through TryJoinAsync(JoinChannelGuardedAsync) when the window is live, and joins nothing when it has already closed (:235).
    • JoinChannelGuardedAsync() (:242-258): the same two catches again, because the toast action and the timer tick fire outside the evaluation and inherit none of its guarding (doc :238-241, :189-190). IToastService.ShowAction documents the same rule from the other side: exceptions are the caller's to handle (MMCA.Common/Source/Presentation/MMCA.Common.UI/Common/Interfaces/IToastService.cs:96-101).
    • JoinChannelAsync() (:260-276): a non-async method returning Task. A guard first (_disposed || _channelKey is null || _subscription is not null, returning Task.CompletedTask, :265-268), so a toast-triggered join after an auto-join cannot double-subscribe and a join that resumes after disposal takes nothing nobody would release (:262-264). Then HubService.OnChannelEvent(_channelKey, HandleChannelEventAsync) (:270), _joinedChannelKey recorded before the hub call because the hub counts the reference synchronously (:272-274), and HubService.JoinChannelAsync(_channelKey) returned directly, un-awaited (:275), so the caller's await observes the hub join and no extra state machine is allocated. Subscribing does not join the server-side group, and joining does not register a handler, so both calls are required.
    • ReleaseAsync() (:284-302): shared by disposal and a sign-out (doc :278-283). It disposes the window timer (:286-290), disposes the subscription and clears _channelKey (:292-294), and calls HubService.LeaveChannelAsync only when _joinedChannelKey is set, clearing it first (:296-301).
    • HandleChannelEventAsync(eventName, payloadJson) (:304-342): filters to LivePollChannel.PollOpened (the literal poll.opened, LivePollChannel.cs:14) with an ordinal comparison (:306-309), deserializes a LivePollOpenedPayload and returns silently on a JsonException or a null result (:311-324), announces the poll with the question text (:328), then marshals back to the renderer with InvokeAsync to raise the toast (:332-341). That call passes ToastSeverity.Info and requireInteraction: true (:340-341), so the toast is pinned open rather than expiring on the host timer, and it carries an action that navigates to EngagementRoutePaths.HappeningNow, that is /happening-now (:337, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:11).
    • DisposeAsync() (:345-356): sets _disposed first (:347), so a tick already queued on the renderer finds the flag and joins nothing; unsubscribes from AuthenticationStateChanged when subscribed (:348-352); awaits ReleaseAsync() (:354); and calls GC.SuppressFinalize(this) (:355).
    • LogLiveChannelSetupFailed (:358-359): a source-generated Error-level log whose message states the degraded outcome ("the live channel stays dormant for this session"). [Rubric §13, Observability].
  • Why it's built this way: the live layer is best-effort by design, so every failure on this path degrades to "no live channel" rather than surfacing to the user, and the authoritative data is always one page load away. The energy-saver deferral and the screen-reader announcement are the two device-capability touch points, both reached through interfaces whose web fallbacks are no-ops, so the same component runs unchanged on Blazor Server, WebAssembly, and the MAUI hybrid head.
  • Where it's used: contributed by EngagementUIModule as its single LayoutComponentTypes entry (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementUIModule.cs:45) and rendered by the shared MainLayout on every page; regression-tested by LiveEventListenerResilienceTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Components/LiveEventListenerResilienceTests.cs, for example the energy-saver and failing-join cases at :128, :154), with the live window and the auth-state behavior pinned by LiveEventListenerTests: a render sixty days before the window that must arm without throwing (LiveEventListenerTests.cs:100), a later in-shell sign-in that joins (:135), a sign-out that releases (:151), a stale signed-out evaluation that must not release a newer join (:167), and disposal cases that must leave another holder's channel joined or never join afterwards (:191, :207).
  • Caveats / not-in-source: the battery state is read only at the moment of a join attempt (:187, on an evaluation or on the window-timer tick), and the component never subscribes to an energy-saver-changed notification, so turning energy saver off later does not auto-join; the toast action is the only way in for that session. Once a _channelKey is held, a later signed-in evaluation is a no-op (:148-151), so an event rescheduled after the timer was armed is not picked up until the next sign-in cycle or page load. The leave call in ReleaseAsync carries no try/catch of its own: on disposal it relies on the hub service handling its own failures, and on a sign-out a throw lands in the evaluation guard. The localizer L is declared only in the markup (LiveEventListener.razor:2), so it is invisible in the code-behind despite being used throughout it.

EngagementUIModule

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementUIModule.cs:22 · Level 11 · class (sealed)

  • What it is: the Engagement module's UI descriptor. It implements IUIModule to contribute seven navigation items, one invisible layout component, and its own assembly for Blazor component discovery.
  • Depends on: IUIModule, NavItem and NavSection from MMCA.Common.UI.Common, RoleNames, EngagementRoutePaths, LiveEventListener, MudBlazor Icons, and System.Reflection.
  • Concept, the pluggable UI module descriptor. [Rubric §18, UI Architecture] assesses how a modular monolith composes its front end without the host hard-coding each module's menu: every module ships an IUIModule, and the shared shell merges their nav items, layout components and assemblies (ADR-067). [Rubric §25, Navigation & IA]: the menu is declarative data here, not imperative wiring, including where each item sits: a Section, an optional Group key and an Order. [Rubric §11, Security]: four of the seven items pass RoleNames.Organizer as their required role (:39-42) so the shared NavMenu hides them from attendees; this is menu trimming, and the real enforcement remains the [Authorize(Roles = ...)] attribute on each page. [Rubric §27, i18n]: per the ADR-027 comment (:27-28), each Title and Group is a resource key, resolved by NavMenu against the co-located EngagementUIModule.resx pair at render time through the typeof(EngagementUIModule) title-resource pointer passed to every item, so the labels localize instead of being hard-coded English.
  • Walkthrough
    • Two group keys (:24-25): GroupConferenceDay = "Nav.Group.ConferenceDay" and GroupAttendeesAccess = "Nav.Group.AttendeesAccess". Per the class remarks (just above :22), the Administration groups are described once in ConferenceUIModule, which owns the organizer layout; this module only names their keys.
    • NavItems (:29-43) is a collection expression of seven entries, each pairing a resource key, a centralized route and an icon. Three sit in NavSection.User, the signed-in user section beside the profile entry: Nav.HappeningNow to HappeningNow (:33, Order = -90), Nav.MyPoints to MyPoints (:34, Order = -70) and Nav.MyBadge to MyBadge (:37, Order = -60). The negative orders sort them ahead of the framework's Notification Inbox (order 0), per the class remarks. The comment above HappeningNow (:31-32) gives the reason for the user section: the page is [Authorize], and the General section also renders for anonymous visitors, which offered them a link that only ends at the sign-in page; the comment above MyBadge (:36) says it is for every signed-in user because the badge page is also where an attendee links a ticket. Four sit in NavSection.Admin with the Organizer role: Nav.CheckIn to CheckInScan (:39, Conference day group, Order = 1), Nav.Attendance to OrganizerAttendance (:40, Conference day, Order = 2), Nav.PointsOverview to OrganizerPointsOverview (:41, Conference day, Order = 3), and Nav.TicketRoster to OrganizerTickets (:42, Attendees and access group, Order = 1).
    • LayoutComponentTypes (:45): [typeof(LiveEventListener)], an invisible component the shell renders on every page; the class summary says it joins the event live channel while the event is live.
    • Assembly (:47): typeof(EngagementUIModule).Assembly, so Blazor's router and component discovery can find this module's routable pages.
  • Why it's built this way: exposing nav, layout components and the assembly as read-only properties lets the host treat every module identically, and keeping the descriptor beside the routes it points at means adding a page is a two-line change in one project. Note what is deliberately absent: the two self-service QR routes (EngagementRoutePaths.cs:39-40) and the ticket insights route contribute no nav item, the first because they are reachable only by scanning a printed code, the second because it is reached from the roster page.
  • Where it's used: registered as a singleton IUIModule by DependencyInjection's AddEngagementUI (MMCA.ADC.Engagement.UI/DependencyInjection.cs:90); consumed by the shared shell's NavMenu and router. The architecture suite's PermissionCoverageTests also reads it.

DependencyInjection

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/DependencyInjection.cs:24 · Level 12 · class (static)

  • What it is: the Engagement UI composition root. One static class exposing an AddEngagementUI() extension on IServiceCollection that registers every Engagement UI service (bookmarks and their offline replay, reminders, feedback, check-in, points, tickets, lookups, the live layer, notification scoping) plus the EngagementUIModule descriptor.
  • Depends on: IServiceCollection and Microsoft.Extensions.DependencyInjection.Extensions (for TryAddSingleton), the Engagement UI service interfaces and implementations, ISessionBookmarkUIService and ISessionLiveUIService from .Shared, the Common offline write queue (OfflineWriteQueue, IOfflineWriteHandler), and IUIModule plus INotificationScopeProvider from the Common UI framework.
  • Concept, extension(IServiceCollection) registration. [Rubric §5, Vertical Slice] and [Rubric §1, SOLID] assess whether a slice owns its own wiring: this is the single place the Engagement UI declares its services, so a host calls AddEngagementUI() and stays ignorant of the internals. The C# preview extension(IServiceCollection services) block (DependencyInjection.cs:26) is the DI-registration idiom used across the codebase (see the primer on extension(T) members), which is what lets AddEngagementUI read as an instance method on the collection.
  • Walkthrough: AddEngagementUI() (:32) registers in labelled groups, all scoped (per circuit) unless noted.
  • Why it's built this way: one extension method per module UI keeps registration cohesive and lets a host compose modules by convention. The TryAdd versus Add choices are the part worth reading closely: TryAdd where this module is a fallback provider (TimeProvider), plain Add where it must win over a framework default (the notification scope provider). [Rubric §29, Resilience, Reliability & Business Continuity]: getting that pair wrong is exactly how the notification bell would silently stop scoping to the current event.
  • Where it's used: called by the Blazor UI host's startup when the Engagement module is enabled, alongside the other modules' AddXUI() calls.

VisitState

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns.Sponsors · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Sponsors/SponsorVisit.razor.cs:166 · Level 0 · enum (protected, nested)

  • What it is: the seven states one scan of a printed sponsor-booth QR can put the page in (the enum summary at SponsorVisit.razor.cs:165 and the State comment at :51 both count seven). The sibling of CheckInState, nested inside SponsorVisit, without the room page's schedule and room-code members, because a sponsor booth has no "what is running here right now" question and its code carries no re-issuable room code.
  • Depends on: nothing (a bare enum); its refusal values are chosen from the IsTransient flag and the error code on SelfCheckInOutcome<TResult>, matched against CheckInErrorCodes and ParticipantErrorCodes.
  • Concept: the page-owned outcome enum is taught on CheckInState; the same reasoning applies unchanged here.
  • Walkthrough: Confirm (SponsorVisit.razor.cs:169), the booth shown with a Record visit button and nothing posted yet (set at :82, rendered at SponsorVisit.razor:17-31); Loading (SponsorVisit.razor.cs:172), the initial value of State (:52) and the in-flight state (:94); Recorded (:175), which covers both a first visit and a repeat, split in the markup by SponsorVisitResultDTO.AlreadyVisited (SponsorVisit.razor:34); NotPublished (SponsorVisit.razor.cs:178, rendered at SponsorVisit.razor:65-68); NotVerified (SponsorVisit.razor.cs:181), the account has neither a linked ticket nor a confirmed email (S-ADC-identity-02, member comment at :180), rendered as a warning alert (SponsorVisit.razor:69-76); Unavailable (SponsorVisit.razor.cs:184); and Transient (:187), the no-definitive-answer state that renders a Retry button (SponsorVisit.razor:77-91). The mapping is a property-pattern switch over the outcome (SponsorVisit.razor.cs:120-126): IsTransient: true selects Transient, CheckInErrorCodes.EventNotPublished selects NotPublished, ParticipantErrorCodes.VerifiedParticipantRequired ("Engagement.VerifiedParticipantRequired", ParticipantErrorCodes.cs:13) selects NotVerified (SponsorVisit.razor.cs:124), and everything else, including a null code, falls to Unavailable.
  • Why it's built this way: the member comment on Unavailable (SponsorVisit.razor.cs:183) folds "feature off" and "unknown sponsor" into one member, an answer the server gave, and the markup comment (SponsorVisit.razor:94-95) states the reason: the two are the same sentence to an attendee holding a phone, and naming them apart would only confirm which sponsor codes exist. That makes the collapse a [Rubric §26, Front-End Security] decision (no existence disclosure through error differentiation) as much as a copy decision. NotVerified is kept apart from that collapse because the attendee can act on it: the markup comment (SponsorVisit.razor:71-72) says nothing was recorded and the attendee is told the two ways to qualify. An unreachable service is deliberately not part of the collapse either: it is Transient (SponsorVisit.razor.cs:186-187), because a timeout is no answer at all and the attendee can retry it.
  • Where it's used: only inside SponsorVisit (SponsorVisit.razor.cs:52, :82, :94, :110, :120-125, :137) and its markup; protected so SponsorVisitTests can drive it.
  • Caveats / not-in-source: the NotVerified wording lives in the page's resources under Error.NotVerified (SponsorVisit.razor:74), not in the code-behind.

BookmarkDeletePayload

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkDeletePayload.cs:11 · Level 0 · sealed record (internal)

  • What it is: the payload of a queued bookmark removal: the user, the session, and the bookmark id when the device knew it.
  • Depends on: the UserIdentifierType, SessionIdentifierType and UserSessionBookmarkIdentifierType aliases only.
  • Concept introduced: none; the offline toggle is taught at SessionBookmarkUIService. The point of the shape is the nullable BookmarkId (BookmarkDeletePayload.cs:14): a star set by a queued add has no id yet, so the delete carries the session and lets the replay resolve the id.
  • Walkthrough: three positional members, UserId, SessionId, BookmarkId (BookmarkDeletePayload.cs:11-14).
  • Where it's used: enqueued by SessionBookmarkUIService (SessionBookmarkUIService.cs:206) under BookmarkOfflineWrites.DeleteKind, read back by BookmarkDeleteReplayHandler (BookmarkDeleteReplayHandler.cs:34).

BookmarkOfflineWrites

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkOfflineWrites.cs:10 · Level 0 · static class (internal)

  • What it is: the names the bookmark feature uses on the Common offline write queue: the two write kinds and the coalesce key.
  • Depends on: the UserIdentifierType and SessionIdentifierType aliases. Externals: System.Globalization.
  • Concept introduced: the queue itself is taught at IOfflineWriteQueue. What these constants carry: a kind routes a queued write to its IOfflineWriteHandler, and is versioned (.v1) because a queued write can outlive an app update; a coalesce key names the writes that supersede one another, so one user's toggles of one session collapse to the newest intent.
  • Walkthrough: CreateKind = "Engagement.Bookmark.Create.v1" (BookmarkOfflineWrites.cs:13, payload a CreateBookmarkRequest), DeleteKind = "Engagement.Bookmark.Delete.v1" (:16, payload a BookmarkDeletePayload), and CoalesceKey(userId, sessionId) (:22-23), which formats bookmark:{userId}:{sessionId} with the invariant culture. The user is part of the key, so another user's toggle of the same session on a shared device never cancels this user's queued write.
  • Why it's built this way: the toggle service and both replay handlers must agree on these strings exactly, so they live once (ADR-144).
  • Where it's used: SessionBookmarkUIService (SessionBookmarkUIService.cs:91, :197-208), BookmarkCreateReplayHandler (BookmarkCreateReplayHandler.cs:32), BookmarkDeleteReplayHandler (BookmarkDeleteReplayHandler.cs:27). The per-user scoping is tested by Offline_AnotherUsersToggleOfTheSameSession_DoesNotCancelThisUsersQueuedWrite (SessionBookmarkSetBookmarkedTests.cs:261).

InsightLoadState<T>

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightLoadState.cs:8 · Level 0 · sealed class (internal, generic)

  • What it is: the load state of one report group on the ticket insights page (UC-56). The roster group (A) and the engagement group (B) each own one, so a slow or failed group never holds back the other (type doc at InsightLoadState.cs:3-6).
  • Depends on: nothing first-party; T is the group's report DTO, constrained where T : class (:9).
  • Concept introduced, a per-region load state with a generation guard. [Rubric §19, State Management] assesses how UI state is modelled and kept consistent. Instead of one page-wide isLoading flag, each independent region owns a small state machine (loading, loaded, unavailable with a reason, failed and retryable), and Generation (:27, doc at :23-26) lets a load that started under an older selection drop its result, so a slow earlier load never overwrites a newer one.
  • Walkthrough (InsightLoadState.cs:8-66): read-only state IsLoading (:12, starts true), Failed (:15), Message (:18), Value (:21) and Generation (:27). Begin() (:31-39) bumps the generation, resets every field to loading and returns the new generation. Succeed(value) (:43-47), Unavailable(message) (:51-55, a reason such as the feature being off or the permission revoked) and Fail() (:58-62, a failure a retry may fix) each end loading with one outcome; Stop() (:65) ends it with none, for a cancelled load.
  • Where it's used: TicketInsights holds _roster and _engagement instances (TicketInsights.razor.cs:54-55) and maps each group's Result onto one in Apply<T> (:206): success, a 404 as feature-off (ADR-031), a 403 as forbidden, anything else as a failure.

InsightRateDisplay

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightRateDisplay.cs:7 · Level 0 · enum

  • What it is: how a report cell's rate is shown next to its count.
  • Depends on: nothing.
  • Concept introduced: none; see InsightCountValue, which renders it.
  • Walkthrough: None = 0 (InsightRateDisplay.cs:10, the count alone), Share = 1 (:13, the rate as a percentage of the cell's denominator) and Average = 2 (:16, the rate as an average per linked holder).
  • Where it's used: the Rate parameter of InsightCountValue (InsightCountValue.razor.cs:23), set from the report components' markup.

InsightChartData

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightChartData.cs:11 · Level 1 · static class (internal)

  • What it is: two small helpers the ticket insights report components share to turn report cells into MudBlazor chart series.
  • Depends on: InsightCount. Externals: MudBlazor (ChartSeries<double>, InsightChartData.cs:2).
  • Concept introduced: none new; it is the chart half of the "a chart cannot draw a withheld value" rule that InsightReportSection explains. [Rubric §1, SOLID] applies lightly: the one place that decides how a suppressed cell is plotted keeps the two report components from each inventing their own answer.
  • Walkthrough: Plot(InsightCount count) (InsightChartData.cs:16) returns the cell's count, or 0 when the server withheld it (count.Count ?? 0, BR-278 per the doc at :13). Series(name, values) (:22-23) materializes one named series, the name being the localized legend label, with Data = values.ToArray().
  • Why it's built this way: both report components plot the same kind of cell, so the suppressed-as-zero rule lives once; the figure caption that admits the substitution is driven separately through InsightReportSection.ChartPlotsSuppressedAsZero (InsightReportSection.razor.cs:65).
  • Where it's used: EngagementInsightsReports (EngagementInsightsReports.razor.cs:51-75) and RosterInsightsReports (RosterInsightsReports.razor.cs:62-89).

InsightCountValue

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightCountValue.razor.cs:14 · Level 1 · partial class (Razor component)

  • What it is: the Razor component that renders one report cell as text: the count, optionally followed by its rate as a share or an average.
  • Depends on: InsightCount, InsightRateDisplay, the component's string localizer (L). Externals: Microsoft.AspNetCore.Components ([Parameter], [EditorRequired]), System.Globalization.
  • Concept introduced: none new; it is the cell-level formatter for the insights tables. [Rubric §27, Internationalization] applies: every number is formatted with CultureInfo.CurrentCulture and the count-plus-rate phrasing comes from resource keys, so word order is the translator's choice, not the code's.
  • Walkthrough (InsightCountValue.razor.cs:14-44): Count (:18, [EditorRequired], defaulting to InsightCount.Of(0)) and Rate (:22, defaulting to InsightRateDisplay.None). The private Text (:24-42) formats the count as N0 (:28, a null count reads as 0), returns it alone when the cell carries no rate (:29-32), and otherwise switches on Rate: Share uses the Value.WithShare key with the rate as P1 (:36), Average uses Value.WithAverage with the rate as N1 (:37), and None (or anything else) is the count alone (:38-39).
  • Why it's built this way: the same rate number means a fraction in one report and a per-holder average in another, so the caller states which reading applies rather than the component guessing from the value.
  • Where it's used: from the markup of the report components (EngagementInsightsReports, RosterInsightsReports).
  • Caveats / not-in-source: what the markup shows for a withheld ("fewer than 3") cell, as opposed to the 0 Text substitutes for a null count, is decided in InsightCountValue.razor, which this section did not read: not determinable from the code-behind.

InsightReportSection

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/InsightReportSection.razor.cs:22 · Level 1 · partial class (Razor component)

  • What it is: the frame every ticket insights report shares (UC-56): heading, CSV download of the report's table, optional notes and summary, and a body that is either a chart with a "Show as table" toggle or the captioned table itself (type doc at InsightReportSection.razor.cs:7-14).
  • Depends on: TicketInsightsReport, the EventIdentifierType alias. Externals: Microsoft.AspNetCore.Components (RenderFragment, [Parameter]), the framework's ApiFileDownloadButton (named in the remarks at :15-20), System.Globalization.
  • Concept introduced, the table as the chart's text alternative. [Rubric §21, Accessibility] assesses whether non-text content has an equivalent. Here every chart sits in a labelled figure (ChartAriaLabel, :61) and the toggle swaps in the captioned table carrying the same numbers, which is the text alternative (:10-11). A chart also cannot draw "fewer than 3" (BR-278), so a withheld value is plotted as 0 and the figure says so when ChartPlotsSuppressedAsZero is set (:65, doc at :12-13); the table shows the text. [Rubric §26, Front-End Security]: the CSV is fetched with RequiresAuthentication because the export needs the organizer's bearer token, and the aggregate CSV names nobody (:16-20).
  • Walkthrough (InsightReportSection.razor.cs:22-101):
    • Parameters: Report (:27) names the export and keys the test ids; EventId (:32); GeneratedOn (:36) stamps the file name; Title (:41) and optional Description (:45); Notes (:49) and Summary (:53) render whatever the toggle says; ChartContent (:57, null for a table-only report); ChartAriaLabel (:61); ChartPlotsSuppressedAsZero (:65); TableContent (:70, [EditorRequired]); IsEmpty and EmptyText (:74, :78).
    • State and derived values: _showTable (:80) flipped by ToggleTable (:100); HasChart (:82) is true only with chart content and a non-empty report; Key (:85) is Report.ToString() (A1 .. B4), reused by HeadingId (:87).
    • ExportPath (:90) builds tickets/insights/export?eventId=..&report=.. with invariant formatting, and FileName (:96-98) reproduces the server attachment's name format (ticket-insights-a1-event-10-20261103T120000Z.csv, doc at :94-95) stamped with the report on screen.
  • Why it's built this way: one frame keeps every report consistent in heading, export, empty state and accessibility behavior; the reports only supply fragments.
  • Where it's used: by EngagementInsightsReports and RosterInsightsReports, whose markup wraps each report in it.

EngagementInsightsReports

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/EngagementInsightsReports.razor.cs:16 · Level 4 · partial class (Razor component)

  • What it is: the Razor component that renders the engagement group (B) of the ticket insights page from one EngagementInsightsDTO; the code-behind builds the chart data for B3 (sponsor reach by ticket type) and B4 (half-hourly check-in arrivals).
  • Depends on: EngagementInsightsDTO, SponsorReachDTO, TicketTypeCountDTO, InsightCount, InsightChartData, InsightReportSection, InsightCountValue, the EventIdentifierType alias. Externals: MudBlazor (StackedBarChartOptions, LineChartOptions, ChartSeries<double>), System.Globalization.
  • Concept introduced: none new beyond InsightReportSection; what this component adds is honest per-type splits. [Rubric §9, API & Contract Design] applies to how it reads the server's shape: the server omits a ticket type with no count, so a missing type is an exact zero, not a withheld value (CountFor, doc at EngagementInsightsReports.razor.cs:83-86), and only a cell the server actually withheld sets the _b3HasSuppressed / _b4HasSuppressed flags (:58, :77) that make the figure admit "plotted as 0".
  • Walkthrough (EngagementInsightsReports.razor.cs:16-109):
    • MaxAxisLabels = 12 (:19) caps B4's drawn axis labels; the table still lists every bucket. Parameters Report (:24) and EventId (:29, which names each CSV export) are both [EditorRequired]. Chart options (:31-32) and the per-chart label, series and suppressed fields (:34-41).
    • OnParametersSet (:44-81) rebuilds everything. B3 (:46-59): one series per distinct ticket type over the sponsors plus a "no linked ticket" series (:54-56). B4 (:61-80): a label every step buckets (:63-64), an all-check-ins series, one per ticket type, and the "no linked ticket" series (:65-76).
    • CountFor (:87-89) and TicketTypes (:92-93, distinct ordinal, sorted by current culture) read the per-type splits; TicketTypeLabel (:95) shows the localized "all ticket types" row for an empty name.
    • HalfHour (:102-105) formats a bucket on the report's own clock (the bucket carries the event's UTC offset, doc at :98-101), long form whenever SpansSeveralDays (:107-108) is true.
  • Why it's built this way: the page loads group A and group B independently (see InsightLoadState<T>), so each group is its own component taking only its own DTO.
  • Where it's used: rendered by TicketInsights (TicketInsights.razor:141).

RosterInsightsReports

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets.Insights · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/Insights/RosterInsightsReports.razor.cs:22 · Level 4 · partial class (Razor component)

  • What it is: the Razor component that renders the roster group (A) of the ticket insights page from one RosterInsightsDTO; the code-behind builds the A1 funnel, A2 adoption, A4 order-size and A6 email-domain charts.
  • Depends on: RosterInsightsDTO, InsightCount, InsightChartData, InsightReportSection, ViewerTimeZone (injected, RosterInsightsReports.razor.cs:27), the EventIdentifierType alias. Externals: MudBlazor (BarChartOptions, LineChartOptions, ChartSeries<double>), System.Globalization.
  • Concept introduced: none new; it is the sibling of EngagementInsightsReports. [Rubric §27, Internationalization] applies: days use the short date pattern (Day, :103), counts N0 (N, :105), and a server-scaled 0..100 percentage is divided by 100 and shown as P1 (Percent, :108), all in the current culture.
  • Walkthrough (RosterInsightsReports.razor.cs:22-109):
    • MaxAxisLabels = 12 (:25) caps A2's day labels. Parameters Report (:32) and EventId (:37) are [EditorRequired]. Four chart option sets (:39-42) and the per-chart fields (:44-53).
    • OnParametersSet (:56-91): A1 (:58-65) plots tickets, invited and linked per ticket type; A2 (:67-75) plots invites sent, accounts linked and cumulative linked per day with a label every step days; A4 (:77-79) plots orders per tickets-per-order; A6 (:81-90) builds rows of personal webmail, the top company domains and "other company domains", plots them through InsightChartData.Plot and records whether any row was withheld (:90).
    • Text helpers: TicketTypeLabel (:93), MedianText (:96-99, the median invite-to-link days or an "unavailable" string), and When (:101), which formats a UTC time in the viewer's zone through ViewerTimeZone or says "never".
  • Why it's built this way: only A6 can carry withheld cells, so only A6 tracks the suppressed flag; A1, A2 and A4 plot plain integers.
  • Where it's used: rendered by TicketInsights (TicketInsights.razor:113).

BookmarkApiClient

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21 · Level 5 · sealed class (internal)

  • What it is: the three bookmark HTTP calls (read the session-id map, create, delete), shared by SessionBookmarkUIService and the two offline replay handlers.
  • Depends on: AuthenticatedServiceBase (its SendRequestAsync overloads do the dispatch), ITokenStorageService, CreateBookmarkRequest, UserSessionBookmarkDTO, Result; HttpResultExecutor, ProblemDetailsResultReader and IdempotencyHeaders are reached through that base class, not called here. Externals: IHttpClientFactory, System.Net.Http.Json (PostAsJsonAsync), System.Globalization.
  • Concept introduced, constructed rather than resolved to break a DI cycle. [Rubric §1, SOLID] assesses, among other things, whether dependencies point the right way and stay intentional. The type doc (BookmarkApiClient.cs:11-14) states the constraint: the offline write queue takes the replay handlers in its constructor and the toggle service takes the queue, so a shared registered client would close that circle. Each consumer therefore news its own instance from the factory and token storage it already holds (SessionBookmarkUIService.cs:43, BookmarkCreateReplayHandler.cs:29, BookmarkDeleteReplayHandler.cs:24). The class is internal, so the choice stays invisible outside the assembly.
  • Walkthrough (BookmarkApiClient.cs:21-73):
    • Endpoint = "bookmarks" (:24); NewCreateKey() (:28) exposes the base class's NewIdempotencyKey() so the caller can pick a create's key before the first attempt.
    • Each call is one lambda handed to the base class's SendRequestAsync: the generic overload (AuthenticatedServiceBase.cs:171) for a call that returns a body, the body-less one (:201) for the delete. That dispatch creates one client per logical operation, runs the action under the shared RetryPolicy (:185), and reads the response through ProblemDetailsResultReader (:186), all inside HttpResultExecutor.ExecuteAsync (:179).
    • GetSessionIdsAsync(userId, ct) (BookmarkApiClient.cs:34-42) GETs bookmarks/session-ids?userId= (invariant formatting, :37) and reads a Dictionary<SessionIdentifierType, UserSessionBookmarkIdentifierType>, so a caller learns both "is it starred" and "which id deletes it".
    • CreateAsync(request, idempotencyKey, ct) (:53-59) POSTs the request and passes the given key as idempotencyKey: (:59); the base class stamps it as the Idempotency-Key header on the per-operation client once (AuthenticatedServiceBase.cs:242), so every retry attempt carries the same key. The doc (BookmarkApiClient.cs:44-47) records the two effects: a retried or replayed create is answered from the server's replay cache (ADR-017), and the key lets the shared retry policy treat the POST as replay-safe.
    • DeleteAsync(bookmarkId, ct) (:65-72) DELETEs bookmarks/{id}; a bookmark that is not there is a NotFound failure (:61).
  • Why it's built this way: nothing here throws for a server answer (:16-18): responses come through ProblemDetailsResultReader with the API's ErrorType intact, and transport faults become Http.TransportFailure failures through HttpResultExecutor, which is the code SessionBookmarkUIService keys its queue fallback on (ADR-144). Both guarantees come from the shared SendRequestAsync dispatch rather than from code in this class, so the bookmark calls behave like every other AuthenticatedServiceBase client.
  • Where it's used: SessionBookmarkUIService, BookmarkCreateReplayHandler, BookmarkDeleteReplayHandler.

SponsorVisit

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.CheckIns.Sponsors · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/CheckIns/Sponsors/SponsorVisit.razor.cs:27 · Level 6 · class (partial)

  • What it is: the code-behind for the sponsor-booth QR landing page (@page "/engage/sponsors/{SponsorId:int}", SponsorVisit.razor:1). The attendee scans the booth's printed code with the phone camera, signs in if needed, lands here, and taps Record visit; the page then records the visit.
  • Depends on: ICheckInUIService, SelfCheckInOutcome<TResult>, SponsorVisitResultDTO, CheckInErrorCodes, ParticipantErrorCodes, IToastService, ViewerTimeZone (SponsorVisit.razor.cs:34), its nested VisitState, and (from the markup) ConferenceRoutePaths for the follow-on "all sponsors" link. Externals as on RoomCheckIn: Blazor RendererInfo / [Parameter], MudBlazor components, and an injected IStringLocalizer<SponsorVisit> (SponsorVisit.razor:6).
  • Concept: the confirm-to-write landing page is taught on RoomCheckIn; this page is the same shape with no room code and a simpler refusal map. The one difference worth naming is what happens after success: [Rubric §25, Navigation & Information Architecture] assesses whether a dead-end page gives the reader somewhere to go, and this one ends with a filled "all sponsors" button back into the public sponsor list (SponsorVisit.razor:57-63), which the room page has no equivalent of because a room scan is followed by sitting down.
  • Walkthrough of what differs from RoomCheckIn
    • [Parameter] SponsorIdentifierType SponsorId (SponsorVisit.razor.cs:30) instead of a room id, and no query-string code; LifetimeToken (:41, the same disposed-source guard as on RoomCheckIn, explained in the comment above it) backs every await; _postedSponsorId (:46) is a nullable SponsorIdentifierType holding the sponsor this instance last posted (or is posting); _attemptKey (:49) is the current booth's idempotency key; State defaults to VisitState.Loading (:52) and Visit holds a SponsorVisitResultDTO (:55).
    • OnInitialized (:57-62) only builds the breadcrumbs; OnParametersSetAsync (:64) carries an inline comment naming the pattern it follows (:66-67): the visit is a write, so it stays off the prerender pass, and the interactive instance is the one that owns the round trip (the ADCHome pattern). The guard is !RendererInfo.IsInteractive || SponsorId == _postedSponsorId (:68), so a deep link to another booth reusing the routed instance (M247, the SessionLive per-id pattern) prepares a new attempt. Past the guard it records the sponsor (:73), mints one attempt key per scanned booth (:78, comment :75-77 citing A-27), clears Visit and moves to VisitState.Confirm (:80-82), posting nothing.
    • ConfirmAsync (:87) backs the Record visit button (SponsorVisit.razor:25-26) and RetryAsync (SponsorVisit.razor.cs:90) backs the Retry button (SponsorVisit.razor:87); both send RecordVisitAsync for _postedSponsorId under the same key, exactly as on the room page.
    • RecordVisitAsync (SponsorVisit.razor.cs:92) resets State to Loading and clears Visit (:94-95) before calling CheckInService.RecordSponsorVisitAsync(sponsorId, _attemptKey, LifetimeToken) (:99).
    • A stale-scan check (:102-105) returns when sponsorId != _postedSponsorId, because a newer scan took over the page while this one was in flight. Unlike the room page, the check compares sponsor ids rather than attempt keys, since a booth scan has no code that can change on its own.
    • Success (:107-118) sets Visit, moves to VisitState.Recorded, and toasts only on a first visit (Visit?.AlreadyVisited == false, :112-115).
    • The refusal map (:120-126) is a property-pattern switch without the room page's schedule and code arms: IsTransient: true selects Transient, CheckInErrorCodes.EventNotPublished selects NotPublished, ParticipantErrorCodes.VerifiedParticipantRequired selects NotVerified (:124, the server's answer when the account has neither a linked ticket nor a confirmed email), and everything else is Unavailable. There is no room-style "nothing scheduled here" or "code rejected" case, because a booth is not on a schedule and its QR carries no code.
    • catch (OperationCanceledException) when (LifetimeToken.IsCancellationRequested) (:128-131) stays silent only when the attendee navigated away; catch (Exception) when (sponsorId == _postedSponsorId) (:132-138, inside the same inline CA1031 suppression as the room page) maps any other fault to Transient, only for the current scan.
    • OnAfterRenderAsync (:146-152) resolves the viewer's time zone on first render and calls StateHasChanged() if it changed, exactly as on the room page.
    • FormatVisitedOn (:162-163) is an instance method over ViewerTime.Format(visitedOn.UtcDateTime), identical in mechanism to the room page's, with the reason in its XML comment (:154-161): the attendee is at the booth, and ToLocalTime would be the server's clock on Blazor Server and during prerender.
    • Dispose(bool) / Dispose() (:192-212) are the same disposable pattern over _cts.
  • Why it's built this way: the class comment (just above SponsorVisit.razor.cs:27) says the write runs on the interactive render only and once per scanned sponsor, and that the server is idempotent per sponsor regardless of the guard, so the per-sponsor guard is about not making a pointless round trip rather than about correctness; a retry under the same attempt key is replayed by the endpoint's [Idempotent] attribute (CheckInsController.cs:208) rather than re-executed. The single confirm tap (SponsorVisit.razor:19) keeps a link opened outside a booth from recording a visit on its own while costing an attendee at the booth one tap; ADR-072 records the attendee-self-recorded scan surfaces this page belongs to.
  • Where it's used: the target of the sponsor QR rendered on the Conference sponsor detail page (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Sponsors/SponsorDetail.razor:73, a QrCodeButton over ConferenceRoutePaths.SponsorVisitLink, ConferenceRoutePaths.cs:65). The post lands on CheckInsController's sponsor-visits endpoint (CheckInsController.cs:207, feature-gated on EngagementFeatures.SponsorVisits at CheckInsController.cs:209, see EngagementFeatures and ADR-031) and is handled by RecordSponsorVisitHandler, which takes an IVerifiedParticipantGate (RecordSponsorVisitHandler.cs:40) for the verified-participant rule the NotVerified state reports. Component-tested by SponsorVisitTests.
  • Caveats / not-in-source: the confirm card, the success card, the points hint, the "already visited" copy, the not-verified alert and the Retry button live in SponsorVisit.razor (:17-31, :32-64, :69-76, :77-91) and its resources. How many points a visit earns is decided server-side by the points earn rules, not here.

BookmarkCreateReplayHandler

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkCreateReplayHandler.cs:24 · Level 9 · sealed class

  • What it is: the offline write handler that replays a queued bookmark create (kind BookmarkOfflineWrites.CreateKind) when the device reconnects or the queue retries.
  • Depends on: IOfflineWriteHandler, PendingWrite, BookmarkApiClient, BookmarkOfflineWrites, CreateBookmarkRequest, UserSessionBookmarkErrorCodes, SessionReminderCoordinator, Result, Error. Externals: IHttpClientFactory.
  • Concept introduced: the queue and handler contract is taught at IOfflineWriteQueue and IOfflineWriteHandler; the toggle-side half is at SessionBookmarkUIService. [Rubric §29, Resilience] applies: a replay must be safe to run after the original may already have reached the server, and this one is, because it reuses the queued key and treats "already bookmarked" as done.
  • Walkthrough (BookmarkCreateReplayHandler.cs:24-54): it builds its own BookmarkApiClient (:29) and claims Kind => BookmarkOfflineWrites.CreateKind (:32). ReplayAsync (:35-53) reads the payload as a CreateBookmarkRequest (:39), answering a validation failure Bookmarks.Replay.InvalidPayload when it cannot (:41-42); posts it with write.IdempotencyKey (:45), the same key the online attempt used; returns any failure other than UserSessionBookmarkErrorCodes.Duplicate (:46-49); and then notifies the reminder layer of the add (:51) before succeeding (:52).
  • Why it's built this way: the toggle service picks the create's key before its online attempt and queues the write under that same key, so a POST that reached the server before the connection dropped is answered from the replay cache instead of running twice (ADR-144).
  • Where it's used: registered through services.AddOfflineWriteHandler<BookmarkCreateReplayHandler>() (MMCA.ADC.Engagement.UI/DependencyInjection.cs:43); registration is asserted by SessionBookmarkSetBookmarkedTests.AddEngagementUI_RegistersTheOfflineQueue_AndBothBookmarkReplayHandlers (SessionBookmarkSetBookmarkedTests.cs:30).

BookmarkDeleteReplayHandler

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkDeleteReplayHandler.cs:19 · Level 9 · sealed class

  • What it is: the offline write handler that replays a queued bookmark removal (kind BookmarkOfflineWrites.DeleteKind), resolving the bookmark id by session when the queued write did not know it.
  • Depends on: IOfflineWriteHandler, PendingWrite, BookmarkApiClient, BookmarkOfflineWrites, BookmarkDeletePayload, SessionReminderCoordinator, Result, Error. Externals: IHttpClientFactory.
  • Concept introduced: none new beyond BookmarkCreateReplayHandler; the difference is that a delete is idempotent by outcome rather than by key, so it carries no idempotency key and instead treats "not there" as removed.
  • Walkthrough (BookmarkDeleteReplayHandler.cs:19-67): own BookmarkApiClient (:24), Kind => BookmarkOfflineWrites.DeleteKind (:27). ReplayAsync (:30-66) reads a BookmarkDeletePayload (:34, invalid payload at :36-37). With no BookmarkId (:40-53) it reads the session-id map, returns a failed read as a failure (:44-47), and takes the id for the session if present (:49-52). With an id (:55-62) it deletes, returning any failure except NotFound (:58). Either way it then notifies the reminder layer of the removal (:64) and succeeds (:65): a session that is not in the map, or a 404, means the bookmark is already gone.
  • Why it's built this way: a star set by a queued add has no id on the device, and an add then remove while offline coalesces to a single delete; resolving by session on replay is what lets that delete be a clean no-op when the add never reached the server (ADR-144; tested by Offline_AddThenRemove_LeavesExactlyOneQueuedDelete_ThatReplaysAsANoOpWithoutTheBookmark, SessionBookmarkSetBookmarkedTests.cs:232).
  • Where it's used: registered through services.AddOfflineWriteHandler<BookmarkDeleteReplayHandler>() (MMCA.ADC.Engagement.UI/DependencyInjection.cs:44).

SessionBookmarkUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Bookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/SessionBookmarkUIService.cs:36 · Level 9 · sealed class

  • What it is: a cross-module service implementing ISessionBookmarkUIService, used by the Conference UI to read bookmark state and toggle bookmarks inline. Every successful read or mutation also feeds the session-reminder layer, and a toggle that cannot reach the server is kept on the device's offline write queue and replayed later.
  • Depends on: ISessionBookmarkUIService, BookmarkApiClient (constructed, :43), ITokenStorageService, SessionReminderCoordinator (injected as a concrete class, :39), IOfflineWriteQueue and OfflineWriteOptions, IConnectivityStatusService, BookmarkOfflineWrites, BookmarkDeletePayload, BookmarkWriteOutcome, CreateBookmarkRequest, UserSessionBookmarkDTO, UserSessionBookmarkErrorCodes, HttpResultExecutor (for TransportErrorCode). Externals: IHttpClientFactory.
  • Concept introduced, the side effect on the write path, and the offline fallback. [Rubric §19, State Management] assesses where derived client state is kept in step with the server. Local session reminders are exactly that kind of derived state: they are only correct if they track the bookmark set, and the bookmark set can change from any page or any device. Putting the reminder calls inside this one service, rather than in each component that toggles a bookmark, is what makes that hold regardless of entry point. The ordering is the load-bearing part: HTTP first, reminder only after a confirmed success. The class doc adds the guarantee that makes this safe to read (:19-24): nothing here throws for a server answer, the response is read through ProblemDetailsResultReader with the API's own ErrorType intact and transport faults become failures through HttpResultExecutor, so the reminder layer is driven only by outcomes the server actually confirmed. [Rubric §29, Resilience]: reminder failures are swallowed inside the coordinator, so they never surface to the bookmark caller; and a toggle that never got an answer is not lost, it goes on the Common offline write queue and is replayed by BookmarkCreateReplayHandler and BookmarkDeleteReplayHandler (:25-29). The rule that picks the queue is narrow on purpose: only a request that never got an answer falls back to the queue, a refusal is an answer (IsTransportFailure, :215-217).
  • Walkthrough
    • GetBookmarkedSessionIdsAsync (:46-60) reads the map through BookmarkApiClient.GetSessionIdsAsync (:49), a Dictionary<SessionIdentifierType, UserSessionBookmarkIdentifierType>, which is why a page can render a bookmark toggle and know the id needed to delete it from one call. A failure is re-wrapped with its original errors and returns early (:51-54), so the reminder call is unreachable on that path. On success it calls reminderCoordinator.ResyncAsync([.. bookmarks.Keys], cancellationToken) (:57) with the comment naming the intent: this response is the authoritative set, so it is the right moment to heal drift caused by another device.
    • DeleteBookmarkAsync (:63-76) DELETEs by bookmark id and calls NotifyBookmarkRemovedAsync(sessionId, ...) only on a confirmed delete (:70-73). A 404 is a NotFound failure and therefore does not notify here.
    • SetBookmarkedAsync(userId, sessionId, bookmarked, knownBookmarkId, ct) (:79-135) is the toggle, answering a BookmarkWriteOutcome. First it cancels any write still queued for the same user and session (:91, the newest intent wins and is always issued in full, comment at :86-90: a create queued after a transport failure may already have reached the server, so the opposite toggle must still reach it as a remove). It picks the create's idempotency key before any attempt (:96, comment at :93-95) so a queued retry carries the same key. A device that already knows it is offline queues at once (:100-103). Online, an add that succeeds returns Queued: false with the new id (:108-111); an add that meets UserSessionBookmarkErrorCodes.Duplicate notifies the reminder layer and counts as done with no id (:113-119); a transport failure queues, any other failure is returned (:121-123). A remove that succeeds returns Queued: false (:126-130); its transport failure queues likewise (:132-134).
    • CreateOnlineAsync (:137-150) posts the CreateBookmarkRequest with the chosen key and notifies the add only on success (:144-147).
    • RemoveOnlineAsync (:157-182) resolves a missing id through the session-id read (:166); a session not in the map is already removed and succeeds (:172-175), and a 404 from the delete also counts as success (:180-181).
    • EnqueueAsync (:189-213) queues one complete write under BookmarkOfflineWrites.CoalesceKey(userId, sessionId) (:197): a create of kind CreateKind carrying the chosen key (:199-203), or a delete of kind DeleteKind carrying a BookmarkDeletePayload (:204-208). A write the queue refuses comes back as a failure, never as queued (:210-212).
    • IsTransportFailure (:215-217) matches HttpResultExecutor.TransportErrorCode; IsDuplicate (:219-221) matches UserSessionBookmarkErrorCodes.Duplicate.
    • The coordinator members these calls use are ResyncAsync (SessionReminderCoordinator.cs:68), NotifyBookmarkAddedAsync (:60) and NotifyBookmarkRemovedAsync (:64).
  • Why it's built this way: the class doc (:13-18) records both reminder halves: the wiring lives here so reminders track bookmarks no matter which page toggled them (ADR-042 Wave 2), and reminder failures never reach the bookmark caller. The offline half follows ADR-144; the registration comment (MMCA.ADC.Engagement.UI/DependencyInjection.cs:37-41) notes that on a Blazor Server circuit the queued writes live in the browser's storage through JS interop, so the queue works only while the circuit is up. The coordinator is registered scoped alongside this service (DependencyInjection.cs:48) and is a no-op on hosts whose local-notification capability is unsupported, which is why a web-only host pays nothing for the reminder coupling.
  • Where it's used: registered scoped as ISessionBookmarkUIService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:35); resolved optionally by the Conference public pages, which call ServiceProvider.GetService<ISessionBookmarkUIService>() and null-check the result (PublicSessionList at PublicSessionList.razor.cs:37, :141; SessionBookmarkButton, the toggle the detail page renders, at SessionBookmarkButton.razor.cs:33, :56, calling SetBookmarkedAsync at :122), passed down as a nullable parameter to PublicSessionListView (PublicSessionListView.razor.cs:77, toggling at :164, :186), and taken by PublicSessionBookmarkState (PublicSessionBookmarkState.cs:15). That optional resolution is the extraction story in practice: Conference renders correctly in a host where the Engagement UI module is not registered at all. Covered by SessionBookmarkUIServiceTests (the HTTP contract) and SessionBookmarkSetBookmarkedTests (the online and offline toggle paths, SessionBookmarkSetBookmarkedTests.cs:47-313).
  • Caveats / not-in-source: the dependency is on the concrete SessionReminderCoordinator, not an interface, so a test of this service has to construct a real coordinator; the test suite does exactly that, assembling an inert one from mocks (SessionBookmarkUIServiceTests.cs:180-193). Whether a reminder is actually scheduled is decided inside the coordinator and SessionReminderPlanner, not here.

SelfCheckInOutcome<TResult>

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/CheckIns/SelfCheckInOutcome.cs:25 · Level 0 · sealed record (generic)

  • What it is: the return shape of one self-service check-in post, a sponsor booth visit or a room check-in. It carries the recorded payload, the server's stable error code, or a flag saying the attempt got no definitive answer at all, so the calling page can pick its state without catching an exception.
  • Depends on: nothing first-party; it is closed over SponsorVisitResultDTO and RoomCheckInResultDTO at the two call sites, and its ErrorCode values come from CheckInErrorCodes. Externals: BCL only, with a where TResult : class constraint (SelfCheckInOutcome.cs:26) so the nullable Value means exactly "absent".
  • Concept introduced, the result envelope for a refusal that is not a fault. [Rubric §1, SOLID] and [Rubric §9, API & Contract Design] both apply: the type doc (SelfCheckInOutcome.cs:3-13) explains that the landing pages must tell three server answers apart (no session running in this room, event not published, and the flat "unavailable" a disabled feature or unknown target produces), that all three arrive as ordinary non-success responses, and that two of them share the same 404 status. A result carrying only a message would force the page to parse localized prose; an exception would force a try/catch around a normal outcome. Carrying the code as data is what makes the page's mapping a switch expression over constants. The envelope also keeps a refusal apart from a non-answer: a rate limit, a timeout, a 5xx, a dropped network or a sign-in that could not be refreshed is not the server saying no, so it travels as IsTransient (param doc at SelfCheckInOutcome.cs:20-24) and the page offers a Retry instead of telling the attendee the code is not available. Note this is deliberately not the framework's Result, which the other four members of the same interface do return: this is a UI-layer transport envelope for one narrow HTTP pattern, so it stays small and local rather than reusing an abstraction whose error vocabulary it does not need.
  • Walkthrough (SelfCheckInOutcome.cs:25-29): three positional members, Value (the recorded outcome, null when the server refused), ErrorCode (null when the response carried none: a bare feature-gate 404 or an unparseable body, per the param doc at :16-19) and IsTransient, which defaults to false (:25) so every refusal construction stays a two-argument call and only the no-answer branches name the flag. One computed member, IsSuccess => Value is not null (:29), so success is derived from the payload rather than tracked as a further field that could disagree with it. Construction is centralized in CheckInService.PostSelfCheckInAsync (CheckInService.cs:164-200): the success branch deserializes TResult and pairs it with a null code (:178-182); a 401 still standing after the refresh attempt, or a retryable status still standing after the in-place retries, returns IsTransient: true (:184-187), as do a transport failure (:191-194) and an HttpClient timeout, which surfaces as a cancellation the caller never requested (:195-200); any other non-success passes null with whatever ReadErrorCodeAsync extracted from the RFC 9457 problem body (:189, defined at :393-428).
  • Why it's built this way: the four other members on the same service run through HttpResultExecutor.ExecuteAsync and answer with a framework Result (CheckInService.cs:55-79, :108-124, :131-146), because an organizer facing a broken scan wants a typed failure to surface. The two attendee-facing self-service writes must not, because every refusal is a sentence the landing page renders calmly to someone holding a phone in a hallway, and an unanswered attempt is a Retry button rather than a refusal. The method doc records both rules (CheckInService.cs:147-163). Keeping the generic on the payload lets one private helper serve both endpoints with no duplication (ADR-072).
  • Where it's used: returned by ICheckInUIService.RecordSponsorVisitAsync and .RecordRoomCheckInAsync (ICheckInUIService.cs:75, :70), implemented at CheckInService.cs:94 and :97, consumed by SponsorVisit (SponsorVisit.razor.cs:99, mapping IsTransient to VisitState.Transient at :112) and RoomCheckIn (RoomCheckIn.razor.cs:88, mapping it to CheckInState.Transient at :110). Page-tested through SponsorVisitTests and RoomCheckInTests.

NowNextSessionInfo

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/INowNextService.cs:26 · Level 0 · sealed record

  • What it is: one row of the now-and-next snapshot, a session's identifier, title, room name, and its wall-clock start and end in the event's own time zone.
  • Depends on: the SessionIdentifierType alias (solution-wide global using, see primer §2). Externals: BCL DateTime, plus System.Text.Json name-based binding at the call site.
  • Concept, the locally mirrored wire shape. [Rubric §7, Microservices Readiness] assesses whether a module can be lifted out without dragging a neighbor's assembly along, and [Rubric §9, API & Contract Design] how a payload contract is expressed to its consumers. The bytes on the wire are produced by Conference's NowNextSessionDTO; Engagement redeclares only the fields it renders instead of referencing MMCA.ADC.Conference.Shared for one payload, and JSON binds them by property name. The type doc on the enclosing snapshot records that this is a deliberate mirror and that the Android home-screen widget makes the same call with a mirror of its own (INowNextService.cs:6-9; the widget's private copy is at MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/Platforms/Android/NowNextWidgetProvider.cs:128-132). The same tolerant-reader trade-off taught on AttendeeRow applies: nothing at compile time keeps the mirror aligned with the DTO, only the round-trip tests do.
  • Walkthrough (INowNextService.cs:26-31): five positional members, SessionId (line 28, the deep-link target), Title (29), RoomName (30, nullable), StartsAtLocal (31), and EndsAtLocal (32). Two details are load-bearing. RoomName is null whenever the session carries no room id, or carries one the event's room map does not contain, a decision the server makes in a single expression (GetNowNextHandler.cs:78). And the two times are plain DateTime wall clock in the event's zone, not UTC and not DateTimeOffset: the server passes the stored wall-clock values straight through (GetNowNextHandler.cs:87-88) while keeping the UTC instants it computed for its own filtering on its side of the row (:81-82), so no client ever converts a zone.
  • Why it's built this way: glanceable surfaces (a page card, a home-screen widget) should print exactly what the printed schedule says, so the wall-clock value travels as data. The UTC instants stay on the server's side of the contract for callers that do their own math; this mirror deliberately drops them, along with EventId. The slice arrives with ADR-042 Wave 8 (GetNowNextHandler.cs:13).
  • Where it's used: only inside NowNextSnapshot's Now and Next lists; the HappeningNow page holds them in _sessionsNow / _sessionsNext (HappeningNow.razor.cs:56-57) and renders one card per row.
  • Caveats / not-in-source: the mirror is checked by NowNextServiceTests round-tripping a JSON body, not by the compiler, so a renamed server property would deserialize to a default value rather than break the build.

SessionReminder

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/SessionReminderPlanner.cs:15 · Level 0 · sealed record

  • What it is: an immutable value describing one planned on-device reminder for a bookmarked session, a stable notification id, when it should fire, and where a tap takes the user.
  • Depends on: the SessionIdentifierType alias (solution-wide global using, see primer §2). Externals: BCL DateTimeOffset. No first-party types beyond the alias.
  • Concept, the immutable planning DTO. [Rubric §19, State Management] assesses whether client-side state is modeled as explicit, predictable values rather than mutable ad-hoc fields. A sealed record gives value equality and init-only positional members for free (see primer §4), so a planned reminder is a snapshot that cannot drift after SessionReminderPlanner computes it. The type carries no behavior: it is pure data handed from the pure planner to the stateful coordinator.
  • Walkthrough (SessionReminderPlanner.cs:15-29): six positional members, NotificationId (int, line 16), SessionId (17), SessionTitle (18), StartsAtUtc (19), DeliverAt (20), and DeepLinkRoute (21), plus one init-only body property, IsImmediate (:28). The doc comment (:5-14) is load-bearing intent: NotificationId is derived deterministically from the session id so rescheduling replaces an existing OS notification instead of stacking a duplicate, DeliverAt is the fire instant (start minus lead, clamped to now), and DeepLinkRoute is the app-relative route published on tap. IsImmediate (doc at :23-27) marks a reminder whose session was already inside the lead window at planning time, so its DeliverAt was clamped to fire almost at once; the doc states the contract the coordinator enforces, such a reminder fires once, when the session becomes tracked, not again on every replan. It is a body property rather than a seventh positional member, so existing positional construction stays valid and the planner sets it with an object initializer.
  • Why it's built this way: keeping the planned reminder as a value lets the planner stay a pure function and the coordinator diff plans by id (ADR-042 Wave 2, the local-notification dispatcher). Carrying IsImmediate on the value, rather than having the coordinator recompute "was this clamped", keeps the window decision in the one place that did the date math.
  • Where it's used: produced by SessionReminderPlanner.Plan (SessionReminderPlanner.cs:90-99); consumed by SessionReminderCoordinator, which calls Plan at SessionReminderCoordinator.cs:172, reads IsImmediate to skip an already-issued immediate reminder (:215), and turns each remaining value into a LocalNotificationRequest (:223).

NowNextSnapshot

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/INowNextService.cs:14 · Level 1 · sealed record

  • What it is: the whole "happening now / up next" payload for one event as the Engagement UI consumes it, the event's display name, whether the event is live at the query instant, and two lists of NowNextSessionInfo rows.
  • Depends on: NowNextSessionInfo. Externals: BCL IReadOnlyList<T>.
  • Concept, the two-bucket time projection, computed once on the server. [Rubric §12, Performance & Scalability] assesses whether work sits where it is cheapest, and [Rubric §18, UI Architecture] whether a page renders a prepared view model rather than deriving one. Both buckets are decided by GetNowNextHandler against a single instant taken from an injected TimeProvider (GetNowNextHandler.cs:29), never from the browser clock. Now is every eligible session whose window is half-open around that instant, StartsAtUtc <= utcNow && utcNow < EndsAtUtc (GetNowNextHandler.cs:61), so a session that ends exactly now is already out and the one starting exactly now is already in. Next is not "the next session": it is the batch that shares the earliest future start (:58-66), which is what makes parallel tracks appear together instead of one arbitrary room winning. The empty cases are ordinary, not error states: between sessions Now is empty, after the last session Next is empty (nextStart is null and the list is [], :60-62), and before the first session Now is empty while Next carries the opening batch.
  • Walkthrough (INowNextService.cs:14-18): four positional members, EventName (line 16), IsLive (17), Now (18), and Next (19). IsLive is independent of the two lists: the server compares the same instant against the event's live window from CurrentEventSelector.GetLiveWindowUtc(StartDate, EndDate, TimeZone) (GetNowNextHandler.cs:76-77), so a live event during a coffee break reports IsLive: true with an empty Now. Ordering is fixed server-side too: Now sorts by start then by room name ordinal-ignore-case (:54-55), Next by room name alone (:65) since every row in it shares one start.
  • Why it's built this way: no client can compute either bucket correctly on its own, because eligibility depends on data a public catalog read does not expose (see INowNextService), so the snapshot is shipped precomputed and every surface (page and widget) shows the same answer. The one snapshot type also keeps IsLive next to the lists, which is what lets a caller distinguish "the conference is not running" from "nothing is on right now".
  • Where it's used: carried by the Result that INowNextService.GetAsync returns; the HappeningNow page projects it with result.Value?.Now ?? [] and result.Value?.Next ?? [] (HappeningNow.razor.cs:200-202), so a failed read renders the same empty state as an empty list. Conference's own wire type is NowNextDTO (GetNowNextHandler.cs:79), and the Android widget deserializes a third copy of the shape (NowNextWidgetProvider.cs:127, :132).
  • Caveats / not-in-source: nothing on the record marks how fresh it is. Staleness is bounded by one cache only, the endpoint's 60-second NowNextCache output-cache policy (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:272, applied at MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Events/EventsController.cs:163 and :193); GetNowNextQuery deliberately has no query-level cache under it (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Sessions/UseCases/NowNext/GetNowNextQuery.cs:10-12). The page fetches the snapshot from its own load path (HappeningNow.razor.cs:200) and has no timer of its own for it, so a long-open tab keeps its first now-and-next lists until something refreshes it.

SessionReminderPlanner

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/SessionReminderPlanner.cs:39 · Level 1 · static class

  • What it is: a pure, side-effect-free planner that turns a set of bookmarked sessions plus an event time zone and a lead time into a list of SessionReminder values. All the date math (wall-clock to UTC, DST edge cases, lead-window clamping) lives here.
  • Depends on: SessionReminder, SessionInfo (the input session shape), EngagementRoutePaths (the tap route), and the SessionIdentifierType alias. Externals: BCL TimeZoneInfo, DateTimeOffset.
  • Concept, the deterministic pure function. [Rubric §14, Testability] assesses whether logic can be exercised without infrastructure. Every input the planner needs is a parameter, including now (SessionReminderPlanner.cs:61), the current instant, which the caller supplies rather than the planner reading DateTimeOffset.UtcNow itself. That single choice makes DST behavior, lead-window clamping and skip rules unit-testable with fixed clocks and no OS notification stack. [Rubric §27, Internationalization] also applies: session times are wall-clock local to the event's IANA time zone, never UTC in the DTOs (SessionInfo.StartsAt is a bare DateTime?, ISessionLookupService.cs:13), so correct conversion is a first-class concern here rather than an afterthought.
  • Walkthrough:
    • NotificationIdSeed (:44) is a private constant offset that keeps reminder ids clear of any other local-notification ids the app might use. The comment above it (:41-43) states the assumption the whole replace-by-id contract rests on: SessionIdentifierType hash codes are stable for value types.
    • GetNotificationId(sessionId) (:47-48) shifts the seed 16 bits and XORs the session id's hash unchecked, producing that stable id.
    • Plan(bookmarkedSessions, timeZoneId, leadTime, now) (:57-103) guards its arguments (:63-64), resolves the TimeZoneInfo (:66), then per session skips those with no start time (:71-74) or already started (:77-80), computes deliverAt = startsAtUtc - leadTime (:82) and captures isImmediate = deliverAt <= now (:83); when that holds it fires the reminder 30 seconds out rather than dropping it (:84-88). Finally it emits a SessionReminder whose tap route comes from EngagementRoutePaths.SessionDetails (:90-96, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:12), with IsImmediate = isImmediate set by object initializer (:97-99). The planner only records the clamp; deciding whether a clamped reminder should actually be scheduled again is the coordinator's job.
    • ToUtc(localWallClock, timeZone) (:105-118) is the DST-correct converter: it marks the wall time Unspecified (:107), shifts a spring-forward invalid time forward one hour (:110-113), and lets GetUtcOffset resolve ambiguous fall-back times to the standard offset (:115-117).
  • Why it's built this way: separating planning (pure, here) from scheduling (I/O, in the coordinator) means the tricky calendar logic is provable in isolation and the coordinator stays a thin best-effort orchestrator (ADR-042 Wave 2, named in the type doc at :32).
  • Where it's used: called by SessionReminderCoordinator.ReplanAsync (SessionReminderCoordinator.cs:172); GetNotificationId is also called there to cancel reminders for sessions that left the tracked set (:109), to cancel everything when reminders are switched off (:138), and to sweep the ids that dropped out of the plan (:190). Covered by SessionReminderPlannerTests.

ICheckInUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/CheckIns/ICheckInUIService.cs:20 · Level 3 · interface

  • What it is: the single UI contract for every QR badge check-in surface: the attendee's own badge and its self-service reissue, the organizer scan, manual fallback and badge-reissue writes, the two attendee self-service scans, and the organizer attendance rollup.
  • Depends on: MyBadgeDTO, CheckInAttendeeRequest, ManualCheckInRequest, CheckInResultDTO, SelfCheckInOutcome<TResult>, SponsorVisitResultDTO, RoomCheckInResultDTO, AttendanceStatsDTO, Result, and the UserIdentifierType / SponsorIdentifierType / RoomIdentifierType / EventIdentifierType aliases. The UI service abstraction itself is taught on ISessionBookmarkUIService.
  • Concept introduced, two error contracts in one interface. [Rubric §9, API & Contract Design] assesses whether a contract's failure semantics are legible from its signatures, and this interface is the clearest example in the module because it deliberately carries two. Six methods return a Result, the ordinary shape for this module: a refusal is a typed failure the page renders. Five of them carry a value; the organizer badge reissue returns the non-generic Result because its endpoint answers with no body (ICheckInUIService.cs:42). Two methods return SelfCheckInOutcome<TResult> instead, because those two are the endpoints an attendee reaches by scanning a printed code, and every refusal there has to be told apart by a stable error CODE and rendered as a calm sentence. The type doc states that split (ICheckInUIService.cs:13-18), though its count still reads "the four Result-returning members" (:14) while the interface now declares six. The same two self-service methods are also the only ones whose idempotency key is the caller's to supply, because the page reuses it across its own Retry; the two organizer check-in writes carry a key too, but CheckInService mints it internally per check-in (CheckInService.cs:138-145), and the two reissues carry none because their server endpoints are deliberately [NonIdempotent] (CheckInsController.cs:101, :123). The class doc on CheckInService (CheckInService.cs:16-19) states the other axis: every call is authenticated, the badge read is caller-scoped ("my badge"), and the organizer calls are role-gated server-side (the doc still says "three"; the attendee reissue makes it four, each carrying [HasPermission] at CheckInsController.cs:122, :154, :178, :262), so [Rubric §11, Security] lives on the server, not in this contract.
  • Walkthrough (ICheckInUIService.cs:20-102):
    • GetMyBadgeAsync(ct) (:27) fetches the signed-in attendee's own badge credential; an attendee with no badge answers ErrorType.NotFound, which the badge page renders as its empty state (:22-26).
    • RegenerateMyBadgeAsync(ct) (:34) reissues the caller's own badge and returns the new credential; every earlier copy of the badge stops scanning, and an attendee with no badge answers ErrorType.NotFound (:29-33). The server endpoint names this the ADR-072 revocation of a leaked badge and takes the identity from the token (CheckInsController.cs:96-97).
    • RegenerateAttendeeBadgeAsync(userId, ct) (:42-44) reissues an attendee's badge on an organizer's request; organizer only, and the new credential is never returned: the attendee sees it the next time they open their badge (:37-38). The server answers 204 (CheckInsController.cs:121-127).
    • CheckInByCredentialAsync(request, ct) (:51-53) checks an attendee in from a scanned or typed badge payload; organizer only (:47).
    • ManualCheckInAsync(request, ct) (:61-63) is the fallback used when a badge cannot be scanned; organizer only (:57). Both post through the shared PostCheckInAsync (CheckInService.cs:133), whose doc (:128-132) records that a repeat check-in is reported through AlreadyCheckedIn rather than as a failure, so there is no conflict branch to interpret.
    • RecordSponsorVisitAsync(sponsorId, idempotencyKey, ct) (:75-78) records the caller's visit to one sponsor booth; the doc states a repeat visit is a success carrying AlreadyVisited, not a failure (:67).
    • RecordRoomCheckInAsync(roomId, checkInCode, idempotencyKey, ct) (:88-92) checks the caller into whatever session the scanned room is hosting right now. The doc sentence at :81-82 is the whole design of that surface: the session is never sent, the server resolves it from the room and the configured grace window, which is why a printed room code never expires when the schedule moves. The nullable checkInCode (:85) is the room's check-in code the scanned QR carried, if any, and travels in the request body.
    • The idempotencyKey on both self-service writes (param docs at :70-73 and :86) is one key per attendee attempt, reused by every retry of it, the page's Retry included, so the server's idempotency filter replays the first answer instead of reporting a second visit. The pages mint it with Guid.NewGuid().ToString("N") (SponsorVisit.razor.cs:78, RoomCheckIn.razor.cs:88), and both server endpoints carry [Idempotent] (CheckInsController.cs:208, :243).
    • GetAttendanceStatsAsync(eventId, ct) (:99-101) fetches the attendance rollup for one event; organizer only (:95, enforced by [HasPermission] at CheckInsController.cs:262).
  • Why it's built this way: one interface rather than one per surface keeps the whole check-in vocabulary, and the single checkins resource it maps to (CheckInService.cs:31), in one reviewable place; the eight methods correspond one-for-one to the eight endpoints on CheckInsController (ADR-071 for the scan surfaces, ADR-072 for the check-in, points and badge-revocation model).
  • Where it's used: implemented by CheckInService (CheckInService.cs:26), registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:57), and injected into six components: CheckInScan (CheckInScan.razor.cs:26), AttendeeSearchPanel (AttendeeSearchPanel.razor.cs:38, reissuing a badge at :144), MyBadge (MyBadge.razor.cs:19, reissuing at :100), OrganizerAttendance (OrganizerAttendance.razor.cs:19), RoomCheckIn (RoomCheckIn.razor.cs:36, passing the code it was opened with at :113) and SponsorVisit (SponsorVisit.razor.cs:32). Server-side the whole controller sits behind [FeatureGate(EngagementFeatures.CheckIn)] (CheckInsController.cs:41) with the two self-service writes gated again individually (:209, :244), see EngagementFeatures and ADR-031.

INowNextService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/INowNextService.cs:39 · Level 3 · interface

  • What it is: the UI-side contract for reading one event's now-and-next snapshot, a single method returning a Result over a NowNextSnapshot.
  • Depends on: NowNextSnapshot, Result, and the EventIdentifierType alias. Externals: BCL Task, CancellationToken.
  • Concept, a port over a server-owned computation. [Rubric §18, UI Architecture] assesses whether components depend on typed contracts rather than transport, and [Rubric §7, Microservices Readiness] whether cross-module reads travel through an explicit boundary. The interface doc (INowNextService.cs:33-38) is the contract worth memorizing, because it enumerates what the server owns and the client therefore must not re-derive: session eligibility (scheduled, non-service, not declined or cancelled), the event-local wall-clock conversion, and the "next = the batch sharing the earliest future start" rule. Concretely, eligibility is CalendarExportMapper.IsExportable (GetNowNextHandler.cs:48). None of that is visible in a public catalog listing, which is precisely why the page cannot compute now-and-next itself; the implementation's doc records that this endpoint replaces the old whole-catalog fetch on Happening Now (NowNextService.cs:8-12).
  • Walkthrough (INowNextService.cs:48-50): one method, GetAsync(eventId, cancellationToken = default), returning Task<Result<NowNextSnapshot>>. The failure contract is the doc at :42-46: an event that is not found or not published answers an ErrorType.NotFound failure, which the page renders as "nothing scheduled". The server produces it as Result.Failure carrying Error.NotFound when the event is missing or IsPublished is false (GetNowNextHandler.cs:32-36), the API surfaces it as a 404, and ProblemDetailsResultReader turns it back into a typed failure in the client (NowNextService.cs:31-33). Answering with a failure rather than throwing is what lets a caller degrade to an empty schedule with no try/catch of its own.
  • Why it's built this way: the one-method port is the DI swap point (services.AddScoped<INowNextService, NowNextService>(), MMCA.ADC.Engagement.UI/DependencyInjection.cs:74) and the test extension point, so the page can be exercised against a fake snapshot with no HTTP stack; it also keeps Engagement free of any compile-time reference to Conference for this read (ADR-007 and ADR-008 put the module in its own process, so this crosses a real service boundary over public HTTP; the implementation uses the plain "APIClient" factory client with no token, NowNextService.cs:23, because the endpoint is anonymous).
  • Where it's used: injected into the HappeningNow page (HappeningNow.razor.cs:29) and called from its load path (:156). Implemented by NowNextService (NowNextService.cs:14); covered by NowNextServiceTests.
  • Caveats / not-in-source: the contract exposes only the per-event form. The endpoint also serves an id-less form where the server auto-selects the current-or-next published event, but no first-party C# client for it exists in this UI; the Android widget calls Events/now-next with a bare HttpClient instead (NowNextWidgetProvider.cs:119-120). Note also a wording gap: the doc comment says "not declined or cancelled" while the code's actual gate is the calendar-export allow-list above.

CheckInService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/CheckIns/CheckInService.cs:26 · Level 5 · sealed class

  • What it is: the single HTTP client for every badge and scan surface in the module, implementing ICheckInUIService against the checkins resource (CheckInService.cs:31). It carries eight calls with three different audiences: the attendee reading or reissuing their own badge, the organizer scanning, manually checking someone in or reissuing their badge, and the attendee self-recording a sponsor booth or room visit. The two self-service writes also carry their own bounded retry, token-refresh replay and caller-supplied idempotency key, because the attendee is standing at the booth or the door when they fire; the two organizer check-in writes carry an internally minted key so a retried scan is replayed rather than counted twice.
  • Depends on: ICheckInUIService, AuthenticatedServiceBase (its SendRequestAsync pair, AuthenticatedServiceBase.cs:171, :201, and the token-replay helpers), ITokenStorageService, ITokenRefresher (optional, CheckInService.cs:29), HttpResultExecutor and ProblemDetailsResultReader (both reached through the base's SendRequestAsync, AuthenticatedServiceBase.cs:179-186, not called here directly), IdempotencyHeaders, MyBadgeDTO, CheckInAttendeeRequest, ManualCheckInRequest, CheckInResultDTO, SponsorVisitRequest, SponsorVisitResultDTO, RoomCheckInRequest, RoomCheckInResultDTO, AttendanceStatsDTO, SelfCheckInOutcome<TResult>, and the UserIdentifierType alias. Externals: IHttpClientFactory, System.Net (HttpStatusCode), System.Text.Json (JsonDocument), System.Net.Http.Json (JsonContent, ReadFromJsonAsync), System.Globalization, and the System.Threading.Lock behind the single-flight refresh.
  • Concept introduced, two failure dialects in one client. The authenticated-HTTP shape is taught at BookmarkApiClient; what is new here is that this class deliberately reports failure two different ways depending on who is looking at the screen. [Rubric §9, API & Contract Design] assesses whether a client contract preserves the distinctions the server actually makes. The six organizer and badge calls answer with a Result, carrying the server's own error code and type, and all six go through the base class's SendRequestAsync. The two attendee self-service calls do not: they return a SelfCheckInOutcome<TResult> carrying only a raw error-code string, because the QR landing pages have to tell "no session is running in this room" from "the owning event is not published" and both arrive as HTTP 404 (CheckInService.cs:147-153, and the outcome record's own doc at SelfCheckInOutcome.cs:3-13). A status code alone cannot pick the state, so the code is read out of the problem body and handed to the page. The same doc adds a third answer (:154-162): an attempt that got no definitive answer is not a refusal. A 408, 409 (the same key still in flight), 429 or 5xx is retried in place, a 401 is renewed and replayed once, and whatever is still unanswered comes back as IsTransient, which the page offers a Retry for; only the caller's own cancellation propagates. [Rubric §26, Front-End Security] is the reason the pages then collapse several of the refusal codes into one message: see CheckInState and VisitState.
  • Walkthrough (public calls first, then the self-service send pipeline)
    • The primary constructor (:26-29) takes the factory, the token storage and an optional ITokenRefresher defaulting to null; the param doc (:22-25) records that a host registering no refresher reports a 401 on a self check-in as transient instead of replaying it (which now holds only for a storage that does not renew refused tokens itself, see ReplayTokenAsync below). SelfCheckInMaxAttempts = 3 (:37, the first send plus two retries, kept small because the page's Retry covers anything longer) and MaxRetryAfter of 5 seconds (:43) bound the in-place retries. _refreshSync and _refreshInFlight (:45-46) hold the shared refresh, and the internal settable Delay delegate (:52) lets a test run the retries without waiting out the real delays.
    • GetMyBadgeAsync (:55-61) GETs checkins/my-badge through SendRequestAsync<MyBadgeDTO>. The comment (:57-59) records the contract precisely: a 404 arrives as a NotFound failure rather than the old null, so "this attendee has no badge" stays a distinguishable state while the badge page renders exactly the empty surface it rendered for null. The server action is CheckInsController.GetMyBadgeAsync (CheckInsController.cs:68).
    • RegenerateMyBadgeAsync (:64-67) POSTs an empty body to checkins/my-badge/regenerate and reads the new MyBadgeDTO back. RegenerateAttendeeBadgeAsync (:70-79) POSTs to checkins/badges/{userId}/regenerate, formatted invariantly (:76), through the non-generic SendRequestAsync, so the server's 204 is a plain success. Neither passes an idempotency key: both server endpoints are [NonIdempotent] with the stated reason that a retried reissue only rotates the credential once more (CheckInsController.cs:101, :123), and the organizer one is permission-gated (:122).
    • CheckInByCredentialAsync (:82-85) and ManualCheckInAsync (:88-91) are one-line delegations to PostCheckInAsync, differing only in the relative URL: the root checkins and checkins/manual. Both server endpoints are marked [Idempotent] and permission-gated on EngagementPermissions.CheckInManage (CheckInsController.cs:153-154, :177-178), so the client does no role check of its own.
    • RecordSponsorVisitAsync (:94-102) and RecordRoomCheckInAsync (:105-114) build their requests inline (SponsorVisitRequest with the sponsor id; RoomCheckInRequest with the room id and the scanned CheckInCode, :112) and delegate to PostSelfCheckInAsync together with the caller's idempotencyKey. Neither call passes an attendee identity: the server takes it from the token, so a scanned code can only ever check in the person holding the phone. Each also has its own feature gate on the server (CheckInsController.cs:209, :244).
    • GetAttendanceStatsAsync (:117-126) GETs checkins/stats?eventId= with invariant formatting (:123) and returns the AttendanceStatsDTO rollup; the endpoint is permission-gated the same way as the writes (CheckInsController.cs:262).
    • PostCheckInAsync<TRequest> (:133-145) is the Result-returning poster shared by the two organizer check-in writes. Its doc comment (:128-132) records why there is no conflict branch: a repeat check-in comes back with AlreadyCheckedIn set rather than as a 409, so the caller has one success shape to interpret. It hands SendRequestAsync<CheckInResultDTO> a freshly minted key as its idempotencyKey argument (:145); the comment (:138-142) gives the reason: a scan whose response is lost on the venue network is retried and the server replays the first answer instead of "already checked in", and without a key the retry policy would resend a POST only when it failed before being sent. The key is minted once per scan because the argument is evaluated before the retry pipeline runs, and the base stamps it on the one per-operation client every attempt uses (AuthenticatedServiceBase.cs:232-236).
    • PostSelfCheckInAsync<TRequest, TResult> (:164-200) is the outcome-returning poster, and notably the one path in the class that does not go through SendRequestAsync, HttpResultExecutor or the reader. It rejects a blank key up front (:171), sends through SendSelfCheckInAsync (:175), and on success reads the payload with ReadFromJsonAsync and wraps it (:177-181). A 401 or a retryable status that is still standing becomes IsTransient: true (:183-186); any other non-success becomes new SelfCheckInOutcome<TResult>(null, await ReadErrorCodeAsync(...)) (:188), so a refusal is data, not an exception. An HttpRequestException (:190-193) and an OperationCanceledException the caller did not ask for, which is how HttpClient.Timeout surfaces (:194-199), are both transient too.
    • SendSelfCheckInAsync (:208-237) runs the retrying send on an authenticated client, first recording the bearer that client sent (:215-219), and returns that response unless it is a 401 (:222-225). Then it asks ReplayTokenAsync for a token to replay with (:227); a null leaves the 401 standing (:228-231), otherwise it disposes the rejected response and replays the write once on a client built with the new token through CreateClientWithToken (:233-236). The doc (:202-207) explains why the replay never just re-reads storage for the token it sent: the stored token can still look fresh by the client clock after the server rejected it.
    • ReplayTokenAsync (:358-366, doc :348-357) settles where that token comes from, at the cost of exactly one renewal per 401. When the storage renews refused tokens itself (StorageRenewsRejectedTokens, true for an ISessionAwareTokenStorage such as the MAUI head's, AuthenticatedServiceBase.cs:106), the API client's auth handler has already made that renewal before the 401 reached here, so it reads the renewed token through ReadRenewedAccessTokenAsync (:362; the base answers null when no bearer was sent, the storage is empty, or it still holds the refused token, AuthenticatedServiceBase.cs:117-128). Refreshing again would be a second rotation for the same 401, which the server reads as refresh-token reuse (BR-206). Only a storage without that capability falls back to the forced refresh through the optional ITokenRefresher, or to null when none is registered (:365).
    • SendWithRetriesAsync (:244-272) loops until it gets a definitive answer or runs out of attempts, with the backoff starting at one second (:252) and doubling after each wait (:270). Only the last attempt lets a transport failure propagate (throwOnTransportFailure: retriesLeft == 0, :257); earlier ones come back as a null response and wait the current backoff (:261, :269).
    • TrySendOnceAsync (:277-302) builds a fresh HttpRequestMessage per attempt, since a sent message cannot be sent again (:285-291), and stamps every one with the same IdempotencyHeaders.IdempotencyKey header (:292).
    • RetryWait (:309-318) answers null, meaning final, on the last attempt or a non-retryable status, and otherwise prefers the server's Retry-After over the backoff; a requested wait past MaxRetryAfter also ends the attempt (:317) rather than holding the page on its loading state. IsRetryableStatus (:325-328) is 408, 409, 429, or any 5xx except 501 and 505, and RetryAfter (:331-346) reads either header form, clamped at zero.
    • TryAcquireRefreshedTokenAsync (:374-388) is single-flight under _refreshSync: two check-ins landing on one rejected token share one rotation, because on MAUI a second rotation presenting the same refresh token is read as reuse and revokes the session (BR-206, per the doc at :368-373). Each caller waits on the shared task with its own token (:387), while AcquireRefreshedTokenAsync (:390-407) runs under CancellationToken.None (:394), so one caller giving up never cancels the refresh for another. A blank token, an InvalidOperationException (no JS interop during SSR prerender) or an HttpRequestException yields null (:395-405), which leaves the 401 standing and the outcome transient.
    • ReadErrorCodeAsync (:414-449) walks the problem body's errors array and returns the first element's code string (:431-439). Everything else yields null: an empty body (:421-422), a body with no errors array (:425-429), a non-string code, or a JsonException from an HTML error page or a bare challenge (:443-448, with the comment naming that case). null is a meaningful value here, it is what the pages render as the generic "unavailable" state.
  • Why it's built this way: the class doc (:16-19) sets the rule that every call is authenticated, including the badge read, because the badge is caller-scoped rather than public (CheckInsController.cs:68); it still speaks of "three organizer calls", where the badge reissue now makes four. The split between the two posters is the client-side consequence of a server design decision recorded in ADR-072: organizer scanning and attendee self-service produce the same domain writes but face very different humans, so the refusal vocabulary is stable (CheckInErrorCodes) and the client passes it through untranslated. Retrying any of the four check-in writes is only safe because every attempt of one operation carries the same key and all four server endpoints are [Idempotent] (CheckInsController.cs:153, :177, :208, :243): a replayed first answer can never be counted as a second check-in or visit. The two reissues take the opposite stance on purpose: a replayed reissue response would hand back a code a later reissue already revoked, so they are [NonIdempotent] (CheckInsController.cs:101, :123).
  • Where it's used: registered scoped as ICheckInUIService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:57) and injected by six surfaces: MyBadge (MyBadge.razor.cs:19, called at :68, :100), CheckInScan (CheckInScan.razor.cs:26, called at :277, :300), AttendeeSearchPanel (AttendeeSearchPanel.razor.cs:38, called at :144), OrganizerAttendance (OrganizerAttendance.razor.cs:19, called at :160), RoomCheckIn (RoomCheckIn.razor.cs:36, called at :113) and SponsorVisit (SponsorVisit.razor.cs:32, called at :99). The whole controller sits behind the EngagementFeatures.CheckIn gate (CheckInsController.cs:41), so a deployment with the feature off answers 404 to every one of these calls.
  • Caveats / not-in-source: CheckInServiceTests covers both reissue routes (:40, :55) and mostly the self-service path: response disposal on success and failure (:69, :97), the idempotency key on both writes (:118, :130), a 429 honoring Retry-After under the same key (:149), the bounded retry ending transient (:169), a Retry-After past the cap (:184), the 401 refresh-and-replay, its renewing-storage variant that replays the renewed token and never refreshes again, and its unrefreshable case (:197, :220, :239), repeated transport failure and an HttpClient timeout (:254, :266), and caller cancellation propagating (:277). Two tests cover the organizer key: a retried organizer check-in resends the same non-empty key (:295) and each manual check-in mints a fresh one (:319). The badge read and the stats read are exercised indirectly through the bUnit page tests (MyBadgeTests, CheckInScanTests, AttendeeSearchPanelTests, OrganizerAttendanceTests, RoomCheckInTests, SponsorVisitTests), which mock the interface rather than the transport. Which error codes a given server build emits is the API's contract, not this file's.

NowNextService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/NowNextService.cs:14 · Level 4 · sealed class

  • What it is: the HTTP implementation of INowNextService, one GET against the Conference API's anonymous Events/{id}/now-next endpoint, read into a NowNextSnapshot and handed back untouched.
  • Depends on: INowNextService, NowNextSnapshot, HttpResultExecutor, IdempotentReadRetry, ProblemDetailsResultReader. Externals: IHttpClientFactory, HttpClient, CultureInfo.
  • Concept introduced, the thin lookup service (the contrast with the authenticated services above). [Rubric §18, UI Architecture] and [Rubric §12, Performance & Scalability]. Unlike BookmarkApiClient (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21-22), the module's bookmark HTTP client, this class does not derive from AuthenticatedServiceBase: it takes the named "APIClient" from the factory directly (NowNextService.cs:23), the same shape as the module's other read-only lookups (SessionLookupService). That named client is registered once in the framework (MMCA.Common/Source/Presentation/MMCA.Common.UI/DependencyInjection.cs:152) with the gateway base address plus the auth and culture delegating handlers, so a bearer token still rides along when the user has one, but the endpoint is [AllowAnonymous] (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Events/EventsController.cs:125) and an anonymous visitor gets the same payload. The consequence to notice: no token fetch wraps this call, because there is nothing user-specific to authorize. Retry still applies, without the base class: the GET goes through IdempotentReadRetry.GetAsync (:26-29), whose policy is the same object AuthenticatedServiceBase uses (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/IdempotentReadRetry.cs:24), so a transient failure (an HttpRequestException, a 5xx other than 501/505, 408 or 429) is re-sent up to three times with exponential backoff plus jitter (IdempotentReadRetry.cs:10-12). The inline comment names why that is safe here (NowNextService.cs:25): the read is idempotent and anonymous, like the other lookups.
  • Walkthrough (NowNextService.cs:17-35), which is mostly guards
    • The whole body runs inside HttpResultExecutor.ExecuteAsync (:20), so a refused connection or a broken socket becomes a Http.TransportFailure failure rather than an exception the page has to catch.
    • Both disposables are scoped with using, the client (:23) and the final response (:26), so a per-call fetch leaks neither; any response a retry discards is disposed by the policy itself (IdempotentReadRetry.cs:27-28).
    • The relative URI is built with string.Create(CultureInfo.InvariantCulture, $"Events/{eventId}/now-next") (:28). Invariant formatting is not decoration: the id is interpolated into a path, and a culture-sensitive numeric format would produce a path the API cannot route.
    • The response goes through ProblemDetailsResultReader.ReadAsync<NowNextSnapshot> (:33), so 404 becomes a NotFound failure, with the comment naming the case it covers (an unpublished or deleted event) and the consequence: the page shows nothing scheduled, exactly as it did for the old null (:31-32). A 5xx becomes a failure carrying the server's status code instead, so the page can tell "no such event" from "the service is broken" by reading the error rather than by catching an exception.
    • The CancellationToken is threaded through the retried GET (:29, honoured between attempts as well as by each send), the read (:33) and the executor (:35), so page disposal cancels an in-flight fetch or a pending backoff and the cancellation propagates rather than being reported as an error.
    • There is no client-side filtering, sorting or time math anywhere in the method: the lists arrive ordered and filtered and are passed straight to the page.
  • Why it's built this way: the class doc (:8-13) states the rationale directly, the endpoint already excludes service, declined and cancelled sessions and does the event-local time math, so nothing is recomputed here. A whole-catalog fetch plus client-side time comparison could not tell an ineligible session apart, since eligibility is not part of a public catalog listing. The call is also cheap to repeat: the server output-caches it under the NowNextCache policy (EventsController.cs:163) and the payload is identical for every role, so no per-user cache key is needed.
  • Where it's used: registered scoped as INowNextService in the module's UI wiring (MMCA.ADC.Engagement.UI/DependencyInjection.cs:74); consumed only by the HappeningNow page today (HappeningNow.razor.cs:29, called at :156). [Rubric §14, Testability]: covered by three facts in NowNextServiceTests, the exact request path (:20), the unchanged projection of the server snapshot (:33), and the 404-to-NotFound-failure degradation (:50).
  • Caveats / not-in-source: the retry lives in the call, not on the named client: no timeout or circuit breaker is configured on this path in the framework registration of "APIClient". A failure that survives the three retries is one transport failure and one localized error message, with a page reload as the next attempt. Note also that the Conference API exposes a second, id-less form of the same snapshot for the home-screen widget (EventsController.cs:139); this service does not call it.

SessionReminderCoordinator

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.HappeningNow · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/HappeningNow/SessionReminderCoordinator.cs:30 · Level 8 · sealed partial class

  • What it is: the piece that keeps on-device session reminders in step with the user's bookmarks (ADR-042 Wave 2). It owns a tracked session set and two settings in device preferences, and on every change it replans the whole schedule and cancel-then-reschedules the difference (class doc, :11-18). The class doc's second paragraph (:19-25) adds the one exception to "replan everything": a session already inside the lead window gets its immediate reminder once, when it becomes tracked on this device, and never again on a later replan, unless the replan that should have issued it could not run, in which case the reminder stays owed until one can. The third paragraph (:26-29) states the concurrency rule: every read-mutate-write of the tracked set runs one at a time.
  • Depends on: ILocalNotificationService, IDevicePreferences, ISessionLookupService, ILiveEventUIService, SessionReminderPlanner, LocalNotificationRequest, LiveEventContext, SessionInfo, SessionReminder, LiveEventLookup. Externals: BCL TimeProvider (the clock, :36), SemaphoreSlim (the tracked-set gate, :54), IStringLocalizer<T>, ILogger<T> with a source-generated [LoggerMessage]. The class also implements IDisposable (:37, :317) solely to release that gate.
  • Concept introduced, best-effort derived state behind a capability gate. Two ideas meet here. First, [Rubric §19, State Management]: a scheduled local notification is derived state that only stays correct if it tracks the bookmark set, and the bookmark set changes from any page and any device. This class is the one place that derivation lives, and because a resync from a page load can overlap a bookmark toggle, the read-mutate-write cycle is serialized by _trackedGate (:54): MutateTrackedAsync (:114) and ApplySettingsAsync (:79) both WaitAsync on it and release in finally (:91-94, :135-138), so neither can overwrite the other's change. Second, [Rubric §29, Resilience & Business Continuity]: reminders are a convenience and must never fail a bookmark operation, so every entry point is best-effort. Both wrap their work in catch (Exception ex) when (ex is not OperationCanceledException) and log a warning through LogReminderSyncFailed (:87-90, :131-134, defined :319-320), rather than propagating. Note the exception filter: a genuine cancellation is not swallowed. Third, and this is what makes the coupling cheap, every entry point begins with if (!notifications.IsSupported) return; (:74-77, :109-112), before touching the gate, so on a web head the whole class is a no-op that touches no storage and issues no calls. The [LoggerMessage] source generator is the framework's structured-logging default, [Rubric §13, Observability & Operability]: a failure here is invisible to the user by design, so a log entry is the only signal that reminders may be stale.
  • Walkthrough (constants, then the four entry points, then the private engines)
    • The preference keys and defaults are consts: EnabledKey (:40) and LeadMinutesKey (:43) and DefaultLeadMinutes = 15 (:51) are public, while the tracked-set key (:45) and the owed-immediate key OwedImmediateKey (:48) are private. The class exposes no capability flag of its own: the notifications.IsSupported check stays internal to the entry points.
    • NotifyBookmarkAddedAsync (:57-58) and NotifyBookmarkRemovedAsync (:61-62) are one-liners over MutateTrackedAsync, appending with Distinct() and filtering with the default equality comparer for the identifier alias respectively.
    • ResyncAsync (:68-69) replaces the tracked set outright with an authoritative bookmark map. Its doc (:64-67) names the reason it exists: a page that loads the user's bookmarks has the truth in hand, so this is the moment to heal drift caused by changes made on another device.
    • ApplySettingsAsync (:72-95) persists both settings then replans with an empty newly-tracked set (:85), which is also how disabling works: the replan cancels everything when enabled is false. The empty set means a settings change never newly issues an immediate reminder (it can still issue one that was already owed).
    • GetSettingsAsync (:98-103) reads the pair back for the device-settings UI, defaulting to enabled and 15 minutes. It takes no gate, since it only reads.
    • MutateTrackedAsync (:105-139) is the shared write path: take the gate, read the tracked array, apply the caller's mutation, compute newlyTracked = updated.Except(tracked) (:119), persist the new array (:120), cancel reminders for sessions that left the set (:122-127), then replan the rest passing newlyTracked along (:129). Cancelling before replanning is deliberate and the comment says so (:122). Because ResyncAsync runs through here too, a resync on every schedule load only counts the ids that were not already tracked as new.
    • ReplanAsync(tracked, newlyTracked, ...) (:152-164, doc :141-151) is a thin wrapper that owns the owed immediate bookkeeping. It reads the persisted owed ids, keeps only those still tracked, unions in newlyTracked (:157-160), runs TryReplanAsync, and persists the owed set back: emptied when the replan ran, kept as-is when it could not (:162-163). That is what stops an immediate reminder from being lost when its one chance to fire hit a denied permission, a missing live event or a failed catalog read.
    • TryReplanAsync(tracked, owed, ...) (:174-235, doc :166-173) is the heart of the class, returns bool, and reads as a sequence of early returns, each protecting the existing schedule: reminders switched off, or nothing tracked, cancels everything when off and returns true, a completed replan (:179-189); a denied OS permission returns false without scheduling, and the comment records that the prompt appears at most once and a denial leaves reminders silently off until the user grants them in system settings (:191-196); no live event returns false (:198-202); a catalog read the API refuses returns false, with the comment giving the reason, replanning against an empty catalog would cancel reminders that are still valid (:206-212). The live-event guard reads the LiveEvent member of the LiveEventLookup that ILiveEventUIService.GetCurrentEventAsync returns (:198; the interface doc at ILiveEventUIService.cs:9-14 names three states: the event, no published event, a failed read). The coordinator collapses the last two into one null and answers false for both, so a failed read and a genuinely absent event leave the schedule, and the owed set, exactly as they were. Note the shape of the catalog guard too: sessionLookup.GetAllAsync returns a Result and the code branches on TryGetValue (:209), so "the API said no" and "there are no sessions" are different outcomes.
    • Past the guards it calls PlanTrackedSessionsAsync (:214-215), then does the stale sweep (:224-231): the tracked ids minus the planned ids, cancelled. The comment there (:217-223) names the four ways a session can stay tracked yet drop out of the plan (deleted, its event ended, times cleared per BR-16, start moved into the past), notes that nothing upstream cancels those, and explains why the sweep sits after a plan was computed rather than beside the early returns: cancelling on a transient null live event would wipe reminders that are still valid. It then hands off to ScheduleAsync with the owed set and returns true (:233-234).
    • PlanTrackedSessionsAsync (:247-282, doc :237-246) does not narrow the plan to the live event. It builds a map of event id to LiveEventContext seeded with the live event and extended from liveEventService.GetPublishedEventsAsync (:260-264), drops sessions whose event's live window has closed (:274), groups the rest by their own event's IANA zone, falling back to the live event's zone when the event is not in the list (:275), and calls SessionReminderPlanner.Plan once per zone with the lead time and timeProvider.GetUtcNow() (:276-280, clock read at :254). The effect (A-21 in the doc): a bookmarked session of a later event keeps its reminder while another event is live, and a wrong fallback zone only shifts a reminder until the next replan replaces it by id (:256-259).
    • ScheduleAsync(plan, owed, ...) (:287-314) schedules each planned reminder as a LocalNotificationRequest, with one skip: a reminder whose IsImmediate is set and whose session is not in owed is passed over (:298-301). The comment (:294-297) gives the reasoning: re-issuing it would fire an already-delivered reminder again, and because its id is still in the plan the stale sweep above leaves any still-pending copy alone. The body text does not quote the configured lead: minutesUntilStart is the real gap between StartsAtUtc and DeliverAt, rounded up with a floor of 1 (:305), so a clamped reminder does not claim the full lead (:303-304). Title and body are localized, the body taking the session title and minutesUntilStart as format arguments (:308-309), so the wording is resource-driven rather than concatenated. [Rubric §27, i18n].
    • Dispose (:317) disposes the gate.
  • Why it's built this way: ADR-042 puts device capabilities behind interfaces the web head can answer "unsupported" to, which is what lets this class be registered unconditionally (MMCA.ADC.Engagement.UI/DependencyInjection.cs:48, AddScoped<SessionReminderCoordinator>()) and injected into a service every head uses. Notification ids are derived deterministically from the session id (SessionReminderPlanner.GetNotificationId, SessionReminderPlanner.cs:47-48), which is what makes rescheduling replace instead of duplicate, and is why a replan-everything strategy is affordable. The two things a blind replan would get wrong are both handled by the owed set: re-firing a clamped immediate reminder on every resync (prevented because only owed ids pass the ScheduleAsync skip), and silently losing one whose replan could not run (prevented because ReplanAsync keeps the owed ids when TryReplanAsync answers false). Reading the clock through an injected TimeProvider (:36, used at :254) instead of DateTimeOffset.UtcNow puts the coordinator under the same fixed-clock testability as the planner; the Engagement UI wiring adds TimeProvider.System with TryAddSingleton, so the system clock that AddOfflineWriteQueue (and AddUIShared on the heads that call it) already registers is kept rather than duplicated (MMCA.ADC.Engagement.UI/DependencyInjection.cs:84-86).
  • Where it's used: injected as a concrete class by SessionBookmarkUIService (SessionBookmarkUIService.cs:39), which drives all three notify or resync members; by the offline replay handlers BookmarkCreateReplayHandler (BookmarkCreateReplayHandler.cs:27, calling NotifyBookmarkAddedAsync at :51) and BookmarkDeleteReplayHandler (BookmarkDeleteReplayHandler.cs:22, calling NotifyBookmarkRemovedAsync at :64), so a bookmark write queued offline updates reminders when it replays; and by the host's device-settings page (MMCA.ADC/Source/Hosts/UI/MMCA.ADC.UI/Pages/DeviceSettings.razor:7), which reads the settings (:62), writes them on change (:68, :74) and seeds its lead-time control from DefaultLeadMinutes (:58). [Rubric §14, Testability]: SessionReminderCoordinatorTests holds seventeen [Fact]/[Theory] methods covering the branches above (stale-sweep cases, no live event, an unsupported host, lookup failures never throwing out of the coordinator, a failed catalog read leaving the schedule alone, a resync not re-issuing an immediate reminder, and an immediate reminder naming the real remaining time).
  • Caveats / not-in-source: the class is registered scoped while the state it manages is device-global, so the _trackedGate serializes only calls made through one instance: correctness across instances rests on preferences being the single source of truth and on every mutation replanning from scratch. Whether a scheduled notification actually fires is the platform's business, outside this file.

AttendeeRow

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/AttendeeLookupService.cs:213 · Level 0 · record (private sealed, nested)

  • What it is: the wire shape of one row returned by the generic paged Identity users endpoint (users/paged, AttendeeLookupService.cs:24), declared privately inside AttendeeLookupService purely so System.Text.Json has something to bind to. It never leaves the service: every row is projected into the public AttendeeSummary before it reaches a caller.
  • Depends on: the UserIdentifierType alias (solution-wide global using, see primer §2). Externals: System.Text.Json binding at the call site, wrapped in PagedCollectionResult<T>.
  • Concept introduced, the private deserialization shape. [Rubric §9, API & Contract Design] assesses how a consumer expresses the contract it reads. Two types for one payload looks redundant until you read what the private one is allowed to be: the doc comment (AttendeeLookupService.cs:208-212) records that this is the Identity roster row, whose identifier is id, that only the fields the check-in surfaces render are read, and that the lock state and live session count the row also carries are ignored, which is exactly the tolerant-reader posture. [Rubric §7, Microservices Readiness] is the other half: Engagement redeclares five fields instead of referencing the Identity assembly for its list DTO (IAttendeeLookupService.cs:6-9 states that constraint for the public twin), so Identity can move, be versioned, or add columns without a compile-time edit here.
  • Walkthrough (AttendeeLookupService.cs:213-218): five positional members, Id, Email, FirstName, LastName, Role, structurally identical to AttendeeSummary minus its computed DisplayName (the identifier is Id here, matching the generic paged row, where the public twin calls it UserId). It is bound as PagedCollectionResult<AttendeeRow> (AttendeeLookupService.cs:71-72) so one read picks up both the page items and the pagination metadata, and converted one row at a time by the private ToSummary (:213-214), which maps row.Id onto UserId.
  • Why it's built this way: private sealed keeps the wire shape from becoming an accidental public contract. The projection point is the single place where a server rename would have to be absorbed, and the computed display fallback lives on the public record rather than on the row, so the transport type stays inert data.
  • Where it's used: only inside AttendeeLookupService, by SearchAsync (:54, :72-79) and, through it, by the roster snapshot LoadRosterAsync builds (:132-165).
  • Caveats / not-in-source: nothing at compile time keeps this shape aligned with what Identity actually serializes. A renamed server property binds to the member default rather than failing the build; only AttendeeLookupServiceTests round-tripping a JSON body catches it.

AttendeeSearchField

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/IAttendeeLookupService.cs:41 · Level 0 · enum

  • What it is: which one of last name, first name or email the organizer's single search box applies to when looking an attendee up at the door.
  • Depends on: nothing (a bare enum).
  • Concept introduced, the enum that exists because of a server semantic. [Rubric §9, API & Contract Design] assesses whether a client contract makes the server's actual behavior usable. The type doc states the reason outright (IAttendeeLookupService.cs:36-40): the Identity users endpoint ANDs its filters, so broadcasting one typed term across all three fields would match nobody. A UI that offered one box and no field picker would therefore be a UI that silently never finds anyone. [Rubric §24, Forms, Validation & UX Safety] covers the resulting shape: one box plus one explicit selector, so the organizer always knows which field the term is being matched against.
  • Walkthrough (IAttendeeLookupService.cs:41-51): three members with explicit values, LastName = 0 (:44), FirstName = 1 (:47), Email = 2 (:50). The explicit ordinals matter because the value is round-tripped as a string through the grid's filter state and parsed back with Enum.TryParse (AttendeeSearchPanel.razor.cs:49-51), which falls back to LastName when the stored value does not parse. LastName is also the field's initial value (AttendeeSearchPanel.razor.cs:47), which is the field an organizer reads off a badge first.
  • Why it's built this way: an enum rather than a raw string keeps the three-way mapping exhaustive and reviewable in one switch (AttendeeSearchPanel.razor.cs:127-133), which projects the selected member onto the matching AttendeeSummary property name and writes a single ("contains", term) filter (:120).
  • Where it's used: only by AttendeeSearchPanel, as the bound value of a MudSelect (AttendeeSearchPanel.razor:15-22) and as the discriminator in its filter builder; the resulting filter is what IAttendeeLookupService.SearchAsync receives as its email / firstName / lastName arguments (IAttendeeLookupService.cs:73-79).

RosterSnapshot

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/AttendeeLookupService.cs:161 · Level 0 · record (private sealed, nested)

  • What it is: the outcome of one roster load inside AttendeeLookupService: the identifier-to-name map the load read, plus whether every page it asked for answered (doc, AttendeeLookupService.cs:160). Declared privately and never seen by a caller.
  • Depends on: the UserIdentifierType alias (solution-wide global using, see primer §2). Externals: BCL Dictionary<TKey, TValue>.
  • Concept introduced, a partial read that does not count as fresh. [Rubric §19, State Management] assesses whether cached state records how trustworthy it is, not just what it holds. The roster snapshot behind GetDisplayNameAsync has a freshness stamp that turns a miss into a cached "unknown" for RosterRecheckInterval (:40). A load cut short by a refused page has still read some names worth keeping, but stamping it fresh would answer every miss for the next 60 seconds with null, including attendees on the pages that failed. Carrying Complete beside the names lets the caller keep the names and withhold the stamp.
  • Walkthrough (:161): two positional members, Names (a Dictionary<UserIdentifierType, string>) and Complete (bool). LoadRosterAsync returns Complete: false the moment a page's Result fails (:139-142) and Complete: true once the page loop finishes (:157), whether it stopped on an empty page, on reaching the reported total (:151-154) or on the page cap. GetDisplayNameAsync always adopts snapshot.Names (:98-99) but stamps _rosterLoadedAtTicks with the current time only when Complete is true, and with 0 otherwise (:104, comment :101-103), so the freshness check (:86-87) fails and the next miss refetches. A caller that joins a load already in flight reads only its Names (:83).
  • Why it's built this way: a record pairing the two values keeps the decision in the one place that stamps freshness, rather than making LoadRosterAsync write instance fields as a side effect; the loader stays a function of its pages, and the in-flight Task<RosterSnapshot> (_rosterLoad, :47) hands every concurrent waiter the same answer.
  • Where it's used: only inside AttendeeLookupService: the return type of LoadRosterAsync (:125), the type of the shared in-flight load (:47), and the value GetDisplayNameAsync unpacks (:83, :98-104). AttendeeLookupServiceTests pins the incomplete path: a refused roster page leads to a refetch on the next miss inside the recheck window (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Services/Lookups/AttendeeLookupServiceTests.cs:76).
  • Caveats / not-in-source: Complete means "no page was refused", not "every account was read": a roster larger than MaxRosterPages * RosterPageSize (2500) exits the loop at the cap and is still returned Complete: true (:129-157), so ids past page five stay unnamed for the whole window. In the other direction there is no backoff on the incomplete path: while the API keeps refusing (a non-organizer caller is refused by users/search), every miss starts a new roster load.

SearchFilter

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/AttendeeLookupService.cs:203 · Level 0 · record (private sealed, nested)

  • What it is: the wire shape of one filter inside the users/search request body, an operator plus an optional value (doc, AttendeeLookupService.cs:202). Declared privately inside AttendeeLookupService and never seen by a caller.
  • Depends on: nothing first-party; two strings, serialized by System.Text.Json as part of SearchBody.
  • Concept: the request-side twin of the private deserialization shape AttendeeRow introduces: the client declares the exact JSON it sends rather than referencing Identity's request type, so the Engagement UI still depends on the Identity HTTP contract only.
  • Walkthrough (:206): SearchFilter(string Operator, string? Value). BuildSearchBody creates one per filter whose operator is non-blank and passes a blank value through as null (:181-186), which is how a value-less operator (is empty, is not empty) travels without a value.
  • Where it's used: only as the value type of SearchBody.Filters (:199), built in BuildSearchBody (:178, :186).

SessionInfo

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/ISessionLookupService.cs:10 · Level 0 · record

  • What it is: the lightweight projection of a Conference session carrying just what Engagement pages and the session reminders need to label a session: id, title, optional start and end times, the owning event id, and the Sessionize status the live layer gates on (ISessionLookupService.cs:5-9). It sits at the top of ISessionLookupService.cs because it is the shape that lookup contract returns.
  • Depends on: the SessionIdentifierType and EventIdentifierType aliases (Conference identifier aliases, solution-wide global using, see primer §2). No first-party service dependencies.
  • Concept introduced, the cross-module display projection. Engagement owns no session table (database-per-service, ADR-006), so it cannot join to a session title: it fetches the fields it needs over HTTP and holds them in this small record, a deliberately thinner shape than Conference's own SessionDTO. [Rubric §9, API & Contract Design] assesses how a consumer models another service's data at its boundary; declaring six fields here means a change to unrelated SessionDTO members never ripples into Engagement. [Rubric §7, Microservices Readiness] is the same decision seen from the extraction side, and it is the identical posture the neighbouring AttendeeSummary takes against Identity: the consumer redeclares the view it renders rather than depending on the producer's assembly.
  • Walkthrough (ISessionLookupService.cs:10-16): six positional members, (SessionIdentifierType Id, string Title, DateTime? StartsAt, DateTime? EndsAt, EventIdentifierType EventId, string? Status = null). StartsAt and EndsAt are nullable because a session imported from the schedule source may not yet have times assigned, so every consumer has to tolerate an unscheduled session. Status (:16) is the last member and the only one with a default, so a caller that only labels a session (a test fixture, for one) can omit it; the type doc ties it to BR-49 and Conference's SessionStatuses.IsEligible (:7-8), which is the check the live pages run on it. It is a plain public record, not sealed.
  • Why it's built this way: a compact record lets SessionLookupService build a whole-catalog dictionary cheaply, and value equality plus init-only members mean a page can hold, compare and sort the rows client-side without a second fetch per row.
  • Where it's used: returned by ISessionLookupService (a catalog keyed by id, or one row), constructed by SessionLookupService from SessionDTO payloads, Status included (SessionLookupService.cs:73-74, :63-64); consumed by CheckInScan as its session list (CheckInScan.razor.cs:55), by SessionReminderPlanner as the bookmarked-session input it schedules against (SessionReminderPlanner.cs:58), by SessionReminderCoordinator as the catalog it hands on (SessionReminderCoordinator.cs:249), and by the live-session pages, which hold one row (Pages/SessionLive/SessionLive.razor.cs:66, Pages/SessionLive/PresenterView.razor.cs:50) and refuse a session whose status is not eligible (SessionLive.razor.cs:155, PresenterView.razor.cs:127).
  • Caveats / not-in-source: nothing here constrains Title to non-empty or the times to a sane order; both come straight off the Conference payload, and the nullable times are the only shape signal that an unscheduled session exists. Status is a free string, not an enum: which values count as eligible, and how a null status is treated, is decided by Conference's SessionStatuses.IsEligible, not in this file.

SearchBody

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/AttendeeLookupService.cs:195 · Level 1 · record (private sealed, nested)

  • What it is: the wire shape of the POST users/search request body that AttendeeLookupService sends, the client's private copy of Identity's UserSearchRequest (doc, AttendeeLookupService.cs:194; server side MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Controllers/UsersController.cs:41).
  • Depends on: SearchFilter. Externals: System.Text.Json through PostAsJsonAsync (:68).
  • Concept introduced, the search term in the body, not the URL. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether personal data is kept out of places that retain it by default. An organizer's search term is often an attendee's email address, and a query string is exactly what request telemetry and ingress logs keep; carrying the generic paged contract (filters with their operators, sort, paging) in a body is what keeps the term out of them (class doc, :9-12; the server endpoint's own doc, UsersController.cs:37-38, :255-256). [Rubric §9, API & Contract Design]: the shape is the same filter, sort and paging contract GET users/paged takes, moved from the query string into JSON, so nothing about the caller's filters changes but their transport.
  • Walkthrough (:198-203): five positional members, Filters (a Dictionary<string, SearchFilter>), SortColumn and SortDirection (both string?), PageNumber and PageSize. BuildSearchBody (:171-195) fills Filters with an ordinal-comparer dictionary keyed by property name (:178), drops an entry with no operator (:181-184), and turns a blank sort column or direction into null (:189-194) so an unsorted request carries no sort.
  • Where it's used: built once per SearchAsync call (:63) and posted to users/search (:67-69), which also serves every page of the roster snapshot LoadRosterAsync builds (:137-143). The endpoint is [HttpPost("search")] gated on IdentityPermissions.UsersRead (UsersController.cs:261-262). AttendeeLookupServiceTests pin the body shape: filters posted verbatim (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Services/Lookups/AttendeeLookupServiceTests.cs:123), an email term kept out of the URL (:133), and a value-less operator sent without a value (:172).
  • Caveats / not-in-source: as with AttendeeRow, nothing at compile time keeps this record aligned with UserSearchRequest; a renamed server property would silently drop a field, and only the tests above catch it.

ISessionLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/ISessionLookupService.cs:21 · Level 3 · interface

  • What it is: the contract for fetching Conference session data for display enrichment inside Engagement pages, returning SessionInfo projections. Two members: a whole-catalog read and a single-session read, both Result-typed.
  • Depends on: SessionInfo, Result (MMCA.Common.Shared.Abstractions, imported at ISessionLookupService.cs:1), the SessionIdentifierType alias. Externals: BCL IReadOnlyDictionary and Task.
  • Concept introduced, two reads with an explicit efficiency contract, and absence expressed as a typed failure. The doc on GetAllAsync (ISessionLookupService.cs:23-28) is unusually prescriptive: use it "only when a page genuinely needs the whole set (e.g. the bookmark reminder planner, which schedules against every bookmarked session)", while single-session pages "must use GetByIdAsync instead of transferring the catalog to label one row". That is the interface teaching its own performance discipline. [Rubric §12, Performance & Scalability] assesses whether whole-collection transfers are avoided on paths that render one item; the split-method contract encodes the fast path in the type rather than in a review comment. The second idea is the Result posture: GetByIdAsync's doc states that a missing session answers an ErrorType.NotFound failure rather than the old null (:31-32), so callers branch on an ErrorType instead of on a null check that could not distinguish "no such session" from "the fetch broke".
  • Walkthrough
    • GetAllAsync(CancellationToken) (:27-28) returns Result<IReadOnlyDictionary<SessionIdentifierType, SessionInfo>>, the catalog keyed by id, so a page can label many rows with O(1) lookups.
    • GetByIdAsync(SessionIdentifierType, CancellationToken) (:34-36) returns Result<SessionInfo> and fails with NotFound rather than answering an empty value.
  • Why it's built this way: keeping both shapes on one interface lets a page pick the cost that matches its need while the implementation shares one HTTP client and one mapping; typing both on Result means a Conference outage is a renderable state, not an unhandled exception on a bookmark list. Note the contrast with the sibling IAttendeeLookupService, which drops Result on its naming member on purpose: here both reads feed content a page actually renders, so both failures matter.
  • Where it's used: implemented by SessionLookupService, registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:68). Injected by CheckInScan (CheckInScan.razor.cs:28), OrganizerAttendance, the live-session pages, and SessionReminderCoordinator, which is the whole-catalog case the GetAllAsync doc names.
  • Caveats / not-in-source: the "must use GetByIdAsync" rule is a doc comment, not a compiler or test constraint; nothing fails the build if a single-session page calls GetAllAsync.

AttendeeSummary

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/IAttendeeLookupService.cs:15 · Level 5 · record

  • What it is: the subset of an attendee's account the check-in surfaces need, five positional members plus one computed display name. Enough to recognise a person standing at a door, and nothing more (IAttendeeLookupService.cs:15-34).
  • Depends on: the UserIdentifierType alias and four strings. Nothing first-party; notably not Identity's UserListDTO.
  • Concept introduced, the consumer-owned view contract. [Rubric §7, Microservices Readiness] assesses whether a module's cross-boundary dependencies are on contracts it can keep working when the other side becomes a separate service. The doc comment (:5-8) states the decision outright: this record is declared here rather than reusing the Identity list DTO, so the Engagement UI depends on the Identity HTTP contract only, not on the Identity assembly. [Rubric §30, Compliance, Privacy & Data Governance] is the second reason to declare it narrowly: the Identity users endpoint can return more about a person than a door scanner needs, and a hand-declared five-field record is a data-minimisation decision expressed in the type system. The same instinct appears one level down in the private AttendeeRow (AttendeeLookupService.cs:213-218), whose comment says only the fields the check-in surfaces render are read.
  • Walkthrough: the positional members are UserId, Email, FirstName, LastName and Role (:16-20). DisplayName (:26-33) is the only behavior: it trims "{FirstName} {LastName}" and falls back to Email when the result is blank, with the comment giving the reason, a row must never render blank. That single fallback is why a caller can bind a grid column straight to DisplayName without a null guard. The sibling enum in the same file, AttendeeSearchField (:41-51), names which of the three fields a single search term applies to, and its own doc explains why that is necessary: the Identity users endpoint ANDs its filters, so broadcasting one term across all three would match nothing (:36-40).
  • Why it's built this way: a record (not a class) gives value equality for free, which matters because the search panel re-fetches pages and compares rows. It stays mutation-free through positional init members, in line with the workspace's required/init default.
  • Where it's used: the grid item type of AttendeeSearchPanel (AttendeeSearchPanel.razor.cs:18, with the filter columns named through nameof(AttendeeSummary.Email) and friends at :80-82, :95-97, :114-117), the payload of its OnCheckIn callback (:27, :130), and the argument of CheckInScan's manual check-in path (CheckInScan.razor.cs:282). Produced only by AttendeeLookupService.ToSummary (AttendeeLookupService.cs:173-174).
  • Caveats / not-in-source: Role is a plain string mirroring whatever the Identity endpoint sends; no enum or constant in this file constrains it.

QuestionLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/QuestionLookupService.cs:17 · Level 5 · sealed class

  • What it is: the HTTP implementation of IQuestionLookupService. It fetches the user-authored feedback questions for one entity type ("Event" or "Session") from the Conference-owned questions resource.
  • Depends on: IQuestionLookupService, AuthenticatedServiceBase (and its protected SendRequestAsync<T>), ITokenStorageService, PagedReadAll, QuestionDTO, PagedCollectionResult<T>. Externals: IHttpClientFactory.
  • Concept: the same authenticated-HTTP shape as BookmarkApiClient (which also derives from AuthenticatedServiceBase, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21-22), used here to reach a Conference-owned read endpoint from the Engagement UI. [Rubric §7, Microservices Readiness] assesses whether a module reaches across a boundary through a contract that survives extraction: this one already does, because the call is plain HTTP through the Gateway rather than a project reference into Conference. The Engagement UI references only QuestionDTO from MMCA.ADC.Conference.Shared (QuestionLookupService.cs:2), which is the wire contract, not the implementation.
  • Walkthrough (:25-43): GetQuestionsAsync(questionEntity, ct) escapes the caller-supplied value once (:29), then hands a per-page fetch to PagedReadAll.ReadAllAsync (:31-40). Each page is one call to the base class's SendRequestAsync<PagedCollectionResult<QuestionDTO>> (:32), whose lambda only builds the URL and returns the GetAsync task (:33-38). Each page URL (:35-36) constrains QuestionEntity to the escaped argument and QuestionSource to User, carries pageNumber, pageSize=100 (the PageSize constant, :22, documented as sitting below the questions API's page-size clamp, MaxPageSize, 500 by default, :21) and sortColumn=Sort&sortDirection=asc (built from nameof(QuestionDTO.Sort)). The Uri.EscapeDataString on the caller-supplied value is the one input-handling detail worth naming: the argument is a string, not an enum, so escaping it is what keeps a stray character from reshaping the query. Everything else a page needs is the base class's: SendRequestAsync<T> wraps the call in HttpResultExecutor.ExecuteAsync, creates the authenticated client, sends through the base RetryPolicy and reads the envelope with ProblemDetailsResultReader.ReadAsync<T> (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171-189), so this class holds no client, retry or response-reading code of its own. ReadAllAsync keeps requesting pages until the reported total is reached, and the accumulated list is Mapped to an IReadOnlyList (:42), so a failure travels on untouched while a success arrives already unwrapped.
  • Why it's built this way: the class doc's remarks (:13-16) state the paging contract: the read continues until the reported total, in Sort order, so a form with more questions than one page still loads them all, and a result that fits one page is still exactly one request. Sorting by Sort also keeps the form in its authored order. Filtering QuestionSource to User server-side rather than fetching everything and filtering in the page keeps system-authored questions off the wire entirely, and pushing QuestionEntity into the query lets the same service serve both feedback pages with no branching.
  • Where it's used: registered scoped as IQuestionLookupService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:51); injected by both feedback pages, EventFeedback (EventFeedback.razor.cs:19) and SessionFeedback (SessionFeedback.razor.cs:18). Covered by QuestionLookupServiceTests.
  • Caveats / not-in-source: questionEntity is an unconstrained string in both the interface (IFeedbackUIService.cs:15) and this implementation, so the valid values ("Event", "Session") are a convention the callers hold, not a type the compiler checks. The pageSize=100 is the per-request size, not a ceiling on the result: paging continues until the reported total, bounded only by PagedReadAll's own page cap (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/PagedReadAll.cs:33, 40 pages).

SessionLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/SessionLookupService.cs:14 · Level 4 · sealed class

  • What it is: the HTTP implementation of ISessionLookupService. It fetches sessions from the Conference-owned sessions resource and builds either a session-keyed lookup of SessionInfo projections or one row.
  • Depends on: ISessionLookupService, SessionInfo, SessionDTO (Conference shared), PagedCollectionResult<T>, PagedReadAll, HttpResultExecutor, ProblemDetailsResultReader, IdempotentReadRetry. Externals: IHttpClientFactory (SessionLookupService.cs:14), System.Globalization. Note what is absent: unlike its two neighbours in this folder, it does not derive from AuthenticatedServiceBase and takes no token storage, because it reads the plain "APIClient" (:30, :52) against a public, output-cached listing. It still gets the base class's retry, through the static IdempotentReadRetry rather than through inheritance.
  • Concept introduced, the paged catalog transfer that stops at the reported total. GetAllAsync hands a one-page fetch to PagedReadAll.ReadAllAsync (:26-40), which requests pages 1, 2, ... until a page is empty or the accumulated count reaches the total the server reports, giving up after 40 pages (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/PagedReadAll.cs:33, :57-89). The inline comment (:21-25) records why a single read was replaced: the base /sessions endpoint serves one page capped at MaxPageSize (500) of the catalog of every edition, sorted by StartsAt, so once the catalog passed 500 the current event's sessions silently fell off the end (the check-in picker, the attendance titles and the session reminders all lost them). Each page URL comes from PagedReadAll.LookupPageUrl("sessions", pageNumber) (:33), which sorts by Id so consecutive pages neither skip nor repeat a row and sets includeFKs=false&includeChildren=false (PagedReadAll.cs:48-51). [Rubric §12, Performance & Scalability] assesses transfer sizing: the trimmed query shrinks each page on the wire and the six-field SessionInfo projection shrinks it on the heap, so the whole-catalog read the interface sanctions stays cheap while no longer truncating. [Rubric §9, API & Contract Design]: the class consumes Conference through the wire contract only, referencing SessionDTO and nothing else from the other module.
  • Walkthrough
    • GetAllAsync (:18-43) passes PagedReadAll.ReadAllAsync a per-page delegate (:27-39) that runs inside HttpResultExecutor.ExecuteAsync (:27-28), sends the GET through IdempotentReadRetry.GetAsync(httpClient, ...) (:31-34) and reads the response as a PagedCollectionResult<SessionDTO> through ProblemDetailsResultReader.ReadAsync (:36-37). The accumulated Result<List<SessionDTO>> then goes through sessions.Map(BuildLookup) (:42). BuildLookup (:68-78) fills a Dictionary<SessionIdentifierType, SessionInfo> by looping the list, copying each session's Status along with its title, times and event id (:73-74), and returns it as IReadOnlyDictionary. Because Map runs on success only, no null guard is needed: a failed page short-circuits ReadAllAsync, which returns that first failure unchanged.
    • GetByIdAsync (:46-66) is an expression-bodied method that returns the Task from HttpResultExecutor.ExecuteAsync directly (:49, no async/await of its own, since the only awaits live inside the delegate). It GETs sessions/{sessionId} through the same IdempotentReadRetry.GetAsync (:54-57) with an invariant-culture interpolated URI (:56), reads one SessionDTO (:61) and maps it, status included, into a SessionInfo (:63-64); that status is what the live and presenter pages check before rendering. The comment there (:59-60) records the contract from the page's side: a missing session answers 404, which arrives as a NotFound failure rather than the old null, and the pages render exactly the same "session unavailable" state for it.
  • Why it's built this way: building the dictionary once lets a page label many bookmark or attendance rows with O(1) lookups, while the per-id method serves single-session pages without paying the catalog transfer: exactly the fast and slow split ISessionLookupService prescribes. Both reads retry exactly as the token-bearing services in this folder do: IdempotentReadRetry hands out the same policy object AuthenticatedServiceBase uses (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/IdempotentReadRetry.cs:24), re-sending on an HttpRequestException, a 5xx other than 501/505, 408 or 429, up to three times with 2s, 4s, 8s backoff plus jitter (IdempotentReadRetry.cs:10-12). Re-sending is safe here only because both calls are GETs, which is why a GET is the helper's sole entry point (IdempotentReadRetry.cs:35-44).
  • Where it's used: registered scoped as ISessionLookupService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:68). Its class doc (SessionLookupService.cs:9-13) names the callers: the check-in, attendance, live and presenter pages and the session reminders, and LiveEventService uses it too. Covered by SessionLookupServiceTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.UI.Tests/Services/Lookups/SessionLookupServiceTests.cs), and named as one of the anonymous lookup callers in the class doc of IdempotentReadRetryTests (MMCA.Common/Tests/Presentation/MMCA.Common.UI.Tests/Services/Api/IdempotentReadRetryTests.cs:12).
  • Caveats / not-in-source: the 500-row page size and the 40-page ceiling (20,000 rows) live in PagedReadAll, not in this file. If a server kept reporting a larger total than it returns, the loop would stop at the ceiling and GetAllAsync would hand back what it had gathered so far without saying so.

IAttendeeLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/IAttendeeLookupService.cs:58 · Level 6 · interface

  • What it is: the cross-module lookup contract over the Identity users endpoint (the generic paged entity contract, GET users/paged), used by the organizer check-in fallback to find an attendee by name or email and to put a name on the person a scan just resolved (:53-57). Two members, deliberately asymmetric.
  • Depends on: AttendeeSummary (the row shape), Result, the UserIdentifierType alias.
  • Concept introduced, a contract shaped by what the server can actually answer. [Rubric §9, API & Contract Design] assesses whether an abstraction reflects the capability underneath it rather than an idealised one. The obvious contract here would be GetByIdAsync, and it is precisely the one the Identity endpoint cannot serve: it filters by property (name, email) but the by-identifier question is answered from a roster snapshot instead (see the implementation's class doc, AttendeeLookupService.cs:13-16). So the interface exposes what the transport supports, a filtered paged SearchAsync, plus a narrower GetDisplayNameAsync whose implementation is free to solve the identifier problem however it can. [Rubric §1, SOLID]: the two members are the two questions the check-in surfaces ask, and the second returns a string? rather than a full record because a scan only needs a name to render.
  • Walkthrough
    • SearchAsync (:73-79) takes one filters bag, a Dictionary<string, (string Operator, string Value)> keyed by property name (LastName, FirstName, Email, and aliases such as LastName~search when the search box and a column filter target the same field, :62-65), paging (pageNumber = 1, pageSize = 10), optional sortColumn / sortDirection, and a token. It returns Result<(IReadOnlyList<AttendeeSummary> Items, int TotalItems)>: the tuple exists because a data grid needs the total to draw a pager, not just the page, and the Result exists because a non-organizer caller gets a refusal the panel must render rather than an empty grid. The doc comment (:60-66) names the semantics: the bag is the standard paged-entity shape and reaches the endpoint verbatim with its operators, and the server ANDs the entries, so the operator now travels with each filter instead of being a fixed "contains". That ANDing is the fact the sibling enum AttendeeSearchField exists to work around.
    • GetDisplayNameAsync (:88-90) breaks the pattern on purpose: it returns a bare string?, not a Result. The doc says why (:81-85): null covers both "the account is unknown" and "the roster snapshot behind this lookup could not be read", because naming is a convenience beside a completed check-in and must never fail the caller. A Result here would push a decision onto a page that has nothing useful to do with it.
  • Where it's used: implemented by AttendeeLookupService, registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:69). Injected by AttendeeSearchPanel (AttendeeSearchPanel.razor.cs:23) for the search half and by CheckInScan (CheckInScan.razor.cs:27, used at :223) for the name-resolution half.
  • Caveats / not-in-source: the interface says nothing about caching or freshness; the roster snapshot and its recheck window are entirely an implementation decision, described at AttendeeLookupService.

AttendeeLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Lookups · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Lookups/AttendeeLookupService.cs:18 · Level 7 · sealed class

  • What it is: the HTTP implementation of IAttendeeLookupService over the Identity users roster, served by POST users/search (:24, Organizer only, BR-51): the generic paged entity contract (filters with their operators, sort, paging) carried in the request body. Search reads straight through to the API with the caller's filters verbatim; the by-identifier lookup is answered from an in-memory roster snapshot this class builds and refreshes itself, up to five pages of 500 sorted by Email (class doc, :7-17).

  • Depends on: IAttendeeLookupService, AttendeeSummary, the private shapes SearchBody, SearchFilter, AttendeeRow and RosterSnapshot, AuthenticatedServiceBase (and its protected SendRequestAsync<T>), ITokenStorageService, PagedCollectionResult<T>. Externals: IHttpClientFactory, TimeProvider, PostAsJsonAsync (System.Net.Http.Json).

  • Concept introduced, the scoped roster snapshot with single-flight and a negative-cache window. This is the most stateful class in the group, and each piece of that state answers a specific failure of the naive version. [Rubric §12, Performance & Scalability] assesses whether repeated work is avoided on a hot path, and the hot path here is real: an organizer scanning badges at a door produces a stream of identifier lookups, many of them for codes the roster does not know. The naive implementation refetched the entire roster on every unrecognised code, which the comment at :89-90 records as the defect this design fixes. Three mechanisms combine:

    1. The snapshot (_rosterNames, :44), an identifier-to-name map built once per scanning session.
    2. Single flight (_rosterLoad, a Task<RosterSnapshot>, :47, documented at :46 as "published so concurrent misses share it instead of stampeding"), so several misses arriving together await one load.
    3. A negative-cache window (RosterRecheckInterval, 60 seconds, :40), so a miss against a fresh snapshot is reported as a genuine unknown instead of triggering a refetch, while a miss against a stale one refetches and lets an attendee who registered mid-conference resolve on a later scan (:35-39). Only a complete load opens that window: a load cut short by a refused page reports itself incomplete through RosterSnapshot and is never stamped fresh.

    [Rubric §14, Testability] shows in the constructor: TimeProvider? timeProvider = null (:21) defaulting to TimeProvider.System (:42) is what makes the 60-second window testable without a real 60-second wait, and AttendeeLookupServiceTests uses exactly that with a hand-rolled advanceable clock (AttendeeLookupServiceTests.cs:54, :300). [Rubric §19, State Management] covers the lifetime question: the service is registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:69), so the snapshot lives and dies with the Blazor circuit rather than being a process-wide cache of attendee names. [Rubric §30, Compliance, Privacy & Data Governance] is the reason search is a POST: a search term is often an attendee's email address, and a body keeps it out of the URL that request telemetry and ingress logs retain (class doc, :8-11; see SearchBody).

  • Walkthrough (constants, then the two public members, then the loader)

    • The constants encode the sizing decisions: Endpoint = "users/search" (:24), RosterPageSize = 500 (:27, matching the server's page cap noted as BR-11) and MaxRosterPages = 5 (:33), whose comment (:29-32) gives both reasons for the bound, five pages cover 2500 accounts (far above the real attendee count) and a paging bug therefore cannot loop forever.
    • SearchAsync (:52-68) takes the caller's filters bag (a Dictionary<string, (string Operator, string Value)>) and delegates the request body to the private static BuildSearchBody (:62, :168-192). That builder copies paging always, the sort column and direction only when non-blank (null otherwise), and every filter as a SearchFilter carrying its own operator; a value-less operator (is empty, is not empty) travels with a null value, and an entry with no operator is dropped (doc, :163-167; loop :176-184). The operator is part of each filter, so the service does not decide "contains" for the caller. The whole request is one call to the base class's SendRequestAsync<PagedCollectionResult<AttendeeRow>> (:59-63), whose lambda posts the SearchBody with PostAsJsonAsync (:60); the base method supplies the authenticated client, the RetryPolicy re-send, the ProblemDetailsResultReader read and the HttpResultExecutor exception boundary (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171-189). The result is Mapped, on success only, into the page of AttendeeSummary rows plus PaginationMetadata.TotalItemCount (:64-68).
    • GetDisplayNameAsync (:71-113) is the interesting one, and it reads as four ordered guards. A snapshot hit returns immediately (:75-78). Otherwise, if a load is already in flight, the caller awaits that task and reads its Names rather than starting a second one (:80-84). Otherwise, if the snapshot exists and is younger than RosterRecheckInterval measured against the injected clock, the miss is answered null (:86-92), with the comment naming the behavior this replaced. Only past that does it start a load, publish it to _rosterLoad (:94-95) and await it. It adopts the loaded names whatever happened (:98-99), but stamps _rosterLoadedAtTicks with the current time only when the RosterSnapshot reports itself complete, and with 0 otherwise (:104): the comment (:101-103) gives the reason, the names an interrupted load did read still answer hits, while the next miss refetches instead of being told "recently loaded" for the whole recheck interval. The finally (:106-110) clears _rosterLoad even when the load throws (the comment names cancellation, :108), so the next miss starts a new load.
    • LoadRosterAsync (:125-158) pages the roster with SearchAsync itself, an empty filter bag ([]), 500 rows per page, sorted by Email ascending (:131-137). The sort is not cosmetic: it is what makes page boundaries stable across the several requests that make up one snapshot, so a row cannot be skipped by shifting between calls. A page the API refuses ends the load at once with what it has read, marked Complete: false (:139-142), and the doc above says why that is acceptable (:119-122): the roster is a naming convenience behind GetDisplayNameAsync, whose contract is already "null when the account cannot be named", so a partial snapshot degrades to that answer instead of failing a check-in, and reporting itself incomplete keeps the caller from treating it as fresh. The loop also stops early when a page comes back empty or the accumulated count reaches the server's reported total (:151-154); leaving the loop returns Complete: true (:157).
    • RosterSnapshot (:161), ToSummary (:205-206) and the private wire shapes close the file: SearchBody (:195-200), SearchFilter (:203) and AttendeeRow (:213-218), the last deliberately narrower than what the endpoint returns (:208-212); its identifier member is Id, the name the generic paged row uses.
  • Why it's built this way: the class doc (:13-16) states the split: search straight through with the caller's filters verbatim, by-identifier from a snapshot, and a miss against a snapshot older than RosterRecheckInterval refreshes it. That is the same catalog-versus-one-row thinking as SessionLookupService, here forced by the transport: the by-identifier question is not one the paged search contract asks, so the snapshot exists for that reason rather than because of a performance target. The constants are sized for one conference (about 2500 accounts, at a real observed attendance far below that), not for a general-purpose directory.

  • Where it's used: AttendeeSearchPanel drives SearchAsync from both its data-grid loader (AttendeeSearchPanel.razor.cs:88, through its private SearchAsync at :96-103) and its mobile infinite-scroll loader (:87); CheckInScan calls GetDisplayNameAsync after a scan resolves to an identifier (CheckInScan.razor.cs:333). [Rubric §14, Testability]: AttendeeLookupServiceTests cover the snapshot behaviors, one roster fetch for repeated unknown ids (AttendeeLookupServiceTests.cs:23), a known id answered from the snapshot (:39), a refetch past the recheck interval that resolves a new attendee (:54), a refetch on the next miss inside the window after a refused roster page (:76), concurrent misses sharing one load (:98) and the five-page, 500-row, Email-sorted roster read (:232), plus the wire contract: filters posted verbatim in the body (:123), an email term kept out of the URL (:155), the search alias sent beside the column filter (:177), a value-less operator sent without a value (:194), and rows and total mapped (:210).

  • Caveats / not-in-source: four things are worth knowing before relying on this class.

    • The Users/search endpoint is [HttpPost("search")] gated on IdentityPermissions.UsersRead (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Controllers/UsersController.cs:261-262, BR-51), so a non-organizer caller gets a Forbidden failure out of SearchAsync, not an empty list, and null out of GetDisplayNameAsync. Because a refused first page yields an incomplete snapshot that is never stamped fresh, such a caller re-requests the roster on every miss: the recheck window does not throttle it.
    • The search is a POST that RetryPolicy may re-send. That is harmless only because the search writes nothing, which the server records on the endpoint with a [NonIdempotent(...)] attribute whose reason also keeps the page of attendee data out of the replay cache (UsersController.cs:263).
    • MaxRosterPages * RosterPageSize is a hard 2500-account ceiling on the snapshot. Past it, ids on later pages would never resolve by name, the capped load still reports Complete: true, and nothing logs or surfaces that.
    • The single-flight guarantee rests on _rosterLoad being assigned (:95) before any yield point, with no lock taken and the field neither volatile nor interlocked. On the single-threaded Blazor circuit context that holds, and the concurrency test exercises it, but the class is not written to be shared across threads and its scoped registration is what keeps it from being.

LiveEventContext

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventContext.cs:13 · Level 0 · sealed record

  • What it is: the UI's read-only view of the currently published event's live window: the event id and name, its IANA time zone, and the UTC start/end of the window during which the live layer (polls and session Q&A) is active. It is a sealed record with two small behaviors attached, not a bare DTO.
  • Depends on: EventIdentifierType (the Conference module's identifier alias), BCL DateTime and TimeZoneInfo. No NuGet or first-party service dependencies; this is a pure value.
  • Concept introduced, client-side re-derivation of a server-enforced window. The doc comment (LiveEventContext.cs:4) is explicit that the window uses "the same math the backend enforces": StartDate 00:00 local through EndDate + 1 day 00:00 local, converted to UTC via the event's zone. The UI does not invent its own liveness rule, it mirrors the authoritative one so the ambient LiveEventListener and the HappeningNow page light up at exactly the moment the API would accept a vote. [Rubric §19, State Management] assesses how derived UI state is kept consistent with its source of truth; the record centralizes the "am I live" decision in one value both surfaces call, rather than scattering time-zone arithmetic across components. [Rubric §12, Performance & Scalability] applies mildly: IsLiveAt is a pure comparison, so an ambient listener can re-evaluate it without a round trip.
  • Walkthrough: the primary constructor (LiveEventContext.cs:13-18) captures EventId, Name, TimeZoneId, LiveWindowStartUtc, and LiveWindowEndUtc. IsLiveAt(DateTime utcNow) (:22-23) returns true when utcNow is inside the half-open window: note the inclusive lower bound and the exclusive < LiveWindowEndUtc upper bound matching the parameter doc that calls the end "exclusive" (:12). ToEventLocal(DateTime utcNow) (:30-31) converts a UTC instant into the event's local time via TimeZoneInfo.ConvertTimeFromUtc over TimeZoneInfo.FindSystemTimeZoneById(TimeZoneId), with no fallback: the doc comment states the id always resolves because EventInvariants.EnsureTimeZoneIsValid guards every write path (:25-28).
  • Why it's built this way: making the record own both the window and the "is it live / what is local time" helpers keeps the liveness contract in a single testable value. The conversion trusts the domain invariant instead of defensively catching TimeZoneNotFoundException, so an invalid zone is prevented where it is written rather than papered over where it is read.
  • Where it's used: produced by LiveEventService from Conference event data; consumed by the HappeningNow page and the ambient LiveEventListener to decide whether to show live surfaces.

LiveWindowStartTimer

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveWindowStartTimer.cs:12 · Level 0 · sealed class

  • What it is: a one-shot wait, on the injected TimeProvider, for an event's live window to open, so a conference-day page opened before the window starts its live behavior at the moment the window opens instead of waiting for an unrelated re-render (class doc, LiveWindowStartTimer.cs:3-11, M267, the M254 pattern of LiveEventListener).
  • Depends on: BCL only: TimeProvider, ITimer, Lock, IAsyncDisposable. The window start it waits for comes from a LiveEventContext.
  • Concept introduced, a long wait run as capped steps on an injectable clock. [Rubric §19, State Management] assesses whether time-driven UI state changes when the time arrives rather than when something happens to re-render. The class doc names the constraint that shapes the design (:8-9): a timer delay above about 49.7 days throws, and the next event can be months away, so the wait runs in steps of at most MaxStep, one day (:15), and each tick re-reads the clock and re-arms until the window has actually opened. [Rubric §14, Testability] applies because every clock read and every timer comes from the TimeProvider passed in, so a fake clock can advance across the window start without a real wait.
  • Walkthrough
    • State (:17-22): a Lock, the clock, the window start, the callback, the current ITimer, and a disposed flag.
    • ArmUntil(timeProvider, windowStartUtc, onOpened) (:36-56) null-checks both references (:38-39) and, under the lock, takes ONE clock read (:45) that decides both whether to arm and how long to wait, so the window cannot open between the check and the arm and leave a negative delay (:43-44). It is a no-op after disposal, once already armed (_onOpened is set), or when the window has already started (:46-49). The remarks (:31-35) give the caller its ordering rule: call it BEFORE the caller's own "is the window open yet" check, so if the window opens between the two reads either this arms or the later check sees it open.
    • ArmStep(utcNow) (:77-87), called under the lock, clamps a negative remaining wait to zero (:80), disposes any previous timer, and creates a one-shot timer (Timeout.InfiniteTimeSpan period) for the smaller of the remaining wait and MaxStep (:82-86). The comment (:75-76) records why the clamp exists: a negative delay never fires, or throws on a timer thread.
    • OnTick (:89-110) returns at once after disposal (:94-97), re-arms when the clock is still short of the window start (:99-104), and otherwise captures the callback under the lock and invokes it outside it (:106, :109), fire-and-forget from the timer thread.
    • DisposeAsync (:59-73) sets the disposed flag and detaches the timer under the lock (:62-67), then awaits the timer's disposal outside it (:69-72).
  • Why it's built this way: the page already has a render loop; what it lacks is a trigger at a known future instant. A self-contained handle with a single arm and a dispose keeps the stepping, the clamp and the race reasoning out of the page, and the page only states which instant and what to run.
  • Where it's used: HappeningNow holds one as a field (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/HappeningNow/HappeningNow.razor.cs:68), arms it with the live event's LiveWindowStartUtc and a callback routed through InvokeAsync once its sessions load (HappeningNow.razor.cs:116), and disposes it in its own DisposeAsync (HappeningNow.razor.cs:382). Covered by LiveWindowStartTimerTests in MMCA.ADC.Engagement.UI.Tests.
  • Caveats / not-in-source: the callback runs on a timer thread, not the renderer's dispatcher, which is why the page passes () => InvokeAsync(...). The returned task is discarded (:109), so a fault in the callback is not observed by this class.

LiveEventLookup

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventLookup.cs:10 · Level 1 · sealed record

  • What it is: the three-state outcome of resolving the current published event: the read failed, it succeeded with no published event, or it found one (LiveEventLookup.cs:3-9). It is what ILiveEventUIService.GetCurrentEventAsync returns.
  • Depends on: LiveEventContext only.
  • Concept introduced, separating "nothing there" from "could not ask". [Rubric §24, Forms/Validation/UX Safety] assesses whether a failure state is shown as a failure. The type doc states the split (:6-8): a page tells the first two states apart, so an outage shows its load error with Retry instead of the "no published event" state, while the ambient live layer reads only LiveEvent and stays dormant on both. [Rubric §29, Resilience, Reliability & Business Continuity] applies because the outage still degrades quietly for the ambient listener; only a page that can offer Retry surfaces it.
  • Walkthrough: a private constructor (:12-16) so the only instances are the three named ones: the static Failed (:19, IsFailed true) and None (:22) singletons, and Found(liveEvent) (:42-46), which null-checks its argument (:44). LiveEvent (:25) is the event or null; IsFailed (:28) is the flag. A hand-written Deconstruct (:33-37) lets a caller unpack both in one statement.
  • Why it's built this way: a nullable return could not carry the third state, and a full Result would force every ambient consumer to unwrap a failure it handles identically to absence. A record with two properties keeps the common path (LiveEvent is null) unchanged while giving a page the one extra bit it needs.
  • Where it's used: produced by LiveEventService (LiveEventService.cs:27, :37). HappeningNow deconstructs it and sets its load error only when eventsFailed (HappeningNow.razor.cs:106-111); it also reaches LiveEventListener, CheckInScan, OrganizerAttendance, MyTicketsPanel, TicketInsights and TicketRoster through the same call, and the UI test suites build it through Found, None and Failed.

RoomCheckInRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RecordRoomCheckIn · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RoomCheckInRequestValidator.cs:10 · Level 1 · class (sealed)

  • What it is: the two-rule validator for the room-QR self check-in request. The room id must be a positive number, and the optional room check-in code, when present, must fit the code length Conference stores.
  • Depends on: RoomCheckInRequest, the RoomIdentifierType alias, RoomCheckInCodeDTO.CodeMaxLength from the Conference Shared project; externals: FluentValidation.
  • Concept reinforced: the pipeline wiring taught under CreateBookmarkRequestValidator. [Rubric §11, Security] is the interesting tag here: the request stays thin on purpose. The attendee names a room and, for a room that has one, the code printed on its door QR; the server resolves which session that room is hosting and checks the code, so there is no session field a caller could tamper with to check in somewhere they are not standing (see RecordRoomCheckInHandler). The validator only bounds the code's length; whether it is the current code is Conference's answer, not a structural rule.
  • Walkthrough: a block-bodied constructor (RoomCheckInRequestValidator.cs:12-23) with two RuleFors. RoomId GreaterThan(0), message "Room ID is required.", error code "CheckIn.RoomId.Required" (:14-17). GreaterThan(0) works because RoomIdentifierType is int (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/MMCA.ADC.Conference.GlobalUsings.IdentifierType.cs:16). CheckInCode MaximumLength(RoomCheckInCodeDTO.CodeMaxLength) with error code "CheckIn.CheckInCode.TooLong" (:19-22); the limit is 64 (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInCodeDTO.cs:18), and the property itself is a nullable string (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/Rooms/RoomCheckInRequest.cs:18), so an absent code passes this rule.
  • Where it's used: runs ahead of RecordRoomCheckInHandler, whose command arrives from CheckInsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:242,252).

SessionLiveUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/SessionLiveUIService.cs:10 · Level 1 · sealed class

  • What it is: the Engagement-side implementation of the ISessionLiveUIService extension point: it maps a session id to the route of that session's Live page, so the Conference session-detail page can light up a Live button only when the Engagement module is enabled.
  • Depends on: ISessionLiveUIService (the contract, declared in MMCA.ADC.Engagement.Shared.SessionQuestions, imported at SessionLiveUIService.cs:1), EngagementRoutePaths (the route builder), and the SessionIdentifierType alias.
  • Concept introduced, cross-module UI extension point resolved by module presence. Conference must not hard-reference an Engagement route, that would couple the two modules. Instead Conference depends on the abstract ISessionLiveUIService, and Engagement registers this implementation when its module loads. When Engagement is absent, no implementation is registered and the Live button stays off. [Rubric §7, Microservices Readiness] assesses whether modules collaborate through boundaries that survive extraction into separate services; this is the UI-layer version of that discipline, a capability advertised only when its owner is running. [Rubric §1, SOLID] applies through Dependency Inversion: Conference depends on the interface, not on the concrete route builder.
  • Walkthrough: GetSessionLivePath(SessionIdentifierType sessionId) (SessionLiveUIService.cs:13) delegates straight to EngagementRoutePaths.SessionLive(sessionId) (:14). The class is a sealed expression-bodied one-liner carrying /// <inheritdoc />; all it does is put an Engagement route behind a Conference-visible contract.
  • Why it's built this way: routing knowledge for the Live page belongs to Engagement, so Engagement owns the string; Conference only needs the abstraction to conditionally render a link.
  • Where it's used: registered in the Engagement UI module's DI; consumed by the Conference session-detail page to render its Live button, which lands on SessionLive.

SponsorVisitRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RecordSponsorVisit · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordSponsorVisit/SponsorVisitRequestValidator.cs:9 · Level 1 · class (sealed)

  • What it is: the sponsor-booth twin of RoomCheckInRequestValidator. One rule, one identifier.
  • Depends on: SponsorVisitRequest, the SponsorIdentifierType alias; externals: FluentValidation.
  • Concept reinforced: same pipeline placement as the two validators above. The shared shape of these two files is not an accident: both flows are attendee-self-recorded scans where the only client input is the id printed on the QR, so both validators have exactly one thing to check.
  • Walkthrough: expression-bodied constructor, one RuleFor (SponsorVisitRequestValidator.cs:11-15): SponsorId GreaterThan(0), message "Sponsor ID is required.", error code "CheckIn.SponsorId.Required". The error code prefix is CheckIn. rather than Sponsor. because a booth visit is stored as a CheckIn row with Scope = Sponsor, and the code namespace follows the aggregate, not the endpoint.
  • Where it's used: runs ahead of RecordSponsorVisitHandler, reached from CheckInsController (CheckInsController.cs:207,217).

ILiveEventUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/ILiveEventUIService.cs:7 · Level 2 · interface

  • What it is: the UI-facing contract for resolving the current published event and its live window. Two methods: GetCurrentEventAsync, returning a three-state LiveEventLookup, and GetPublishedEventsAsync, returning a nullable list of LiveEventContext.
  • Depends on: LiveEventLookup, LiveEventContext and BCL Task/CancellationToken.
  • Concept introduced, absence and failure kept apart at a UI boundary, without a Result. The doc comment (ILiveEventUIService.cs:10-11) says the current-event read resolves "in three states: the event, no published event, or a failed read (the API is unavailable or unreadable)". Neither state throws: "no live event" is a first-class, expected return that the ambient listener handles by staying dormant, and a failed read is a flag a page can turn into a load error with Retry. Note the contrast with its sibling contracts: ILivePollUIService and ISessionQuestionUIService answer with Result and its error list; this interface carries only the one bit a page needs (IsFailed), because no caller acts on why the read failed. The cross-event read, GetPublishedEventsAsync, still collapses failure into null. [Rubric §1, SOLID] applies through Dependency Inversion: components depend on this abstraction, not on the HTTP-bound implementation, so tests can substitute a fake. [Rubric §18, UI Architecture] assesses how the UI layer separates data-resolution contracts from rendering; this interface is that boundary for the live layer.
  • Walkthrough: Task<LiveEventLookup> GetCurrentEventAsync(CancellationToken cancellationToken = default) (ILiveEventUIService.cs:14). The type-level doc names both consumers explicitly, the Happening Now page and the ambient LiveEventListener (:4-5). Task<IReadOnlyList<LiveEventContext>?> GetPublishedEventsAsync(CancellationToken cancellationToken = default) (:22) returns every published event's context (its own time zone and live window) for a caller that spans events, the bookmark reminder planner, so each session is read against its own event rather than the current one; it too answers null when the API is unavailable (:18-20).
  • Why it's built this way: a two-method interface is the minimum surface the HappeningNow page, the ambient listener and the cross-event reminder planner need, keeping the contract easy to fake and hard to misuse.
  • Where it's used: implemented by LiveEventService; consumed by HappeningNow, LiveEventListener, CurrentEventNotificationScopeProvider, SessionReminderCoordinator, OrganizerEventPicker, CheckInScan, OrganizerAttendance, MyTicketsPanel, TicketInsights, and TicketRoster.

LiveBroadcastPatch

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveBroadcastPatch.cs:22 · Level 2 · internal static class

  • What it is: two small helpers that apply a live broadcast payload directly onto a page's in-memory list, patching a poll's tallies or a question's upvote count in place, so the page does not have to refetch from the API to show a fresh count.
  • Depends on: LivePollResultsDTO and SessionQuestionDTO (the two list element types it rewrites) and SessionQuestionUpvoteChangedPayload (the upvote broadcast body). Externals: System.Text.Json with JsonSerializerOptions.Web.
  • Concept introduced, patch-on-broadcast instead of reload-on-broadcast. [Rubric §12, Performance & Scalability] and [Rubric §23, Front-End Performance] assess whether a real-time surface scales with the number of connected clients. The naive pattern is to treat a broadcast as a "something changed" ping and refetch; the comment at HappeningNow.razor.cs:135-137 records what that costs in practice, V votes times C viewers becoming V*C authenticated refetches under burst voting. The broadcasts here already carry the fresh counts (BR-229/BR-238, LiveBroadcastPatch.cs:10-11), so the payload is the update, not a notification of one. [Rubric §19, State Management] is the discipline that makes it safe: these two helpers are the only events treated this way. Every structural event (a poll opened or closed, a question posted or answered) still reloads, so the optimization is confined to counters where a lost update self-corrects on the next broadcast.
  • Concept, the boolean fallback contract. Both methods return false for anything they cannot apply (:48, :52, :80, :84), and the caller reloads. That is what keeps the fast path from becoming a correctness risk: an unknown poll id, an unknown question id or an unparsable body all degrade to the behavior the page would have had without the patch at all.
  • Walkthrough:
    • TryApplyPollResults(polls, payloadJson, preserveMyVote) (:42-68) deserializes the payload as a LivePollResultsDTO (:46), finds the matching entry by PollId (:50), drops the payload as stale when its TalliedAtTicks is older than the entry's (:54-57), and otherwise replaces the entry in place (:59-61). The preserveMyVote flag is the subtle parameter and its doc (:34-40) is the reason it exists: the broadcast strips per-user data, so an attendee circuit passes true and carries the current entry's MyVoteOptionId across the patch, or the marker rendering the viewer's own vote would vanish; the projector view passes false because it shows no personal vote and a stale marker must not survive into its list.
    • TryApplyUpvoteCount(questions, payloadJson) (:74-100) is the twin: deserialize SessionQuestionUpvoteChangedPayload (:78), find by Id (:82), apply the same staleness check against a per-list marker (:86-90), record the new marker (:92), and rewrite only the UpvoteCount with a with expression (:93), leaving every other field of the question untouched.
    • Out-of-order guard (L206). Broadcasts are computed at dispatch and enqueued unordered, so a stale count can arrive after a fresher one. Each payload carries TalliedAtTicks, the moment its count was read, and one older than the last applied for that poll or question is ignored yet still reported as handled (return true), so the caller does not reload (class doc, :11-17). A poll keeps its marker on the list entry itself; a question's marker lives in a ConditionalWeakTable keyed weakly by the page's question list (:29), because SessionQuestionDTO carries no marker of its own. A reload replaces the list and so starts clean.
    • Both wrap the work in try/catch (JsonException) (:64-67, :96-99), catching the parse failure specifically rather than swallowing everything.
  • Why it's built this way: internal static with no injected state (bar the weak-keyed marker table) is the honest shape. There is nothing to configure and nothing to mock: the input is a list and a string, the output is a bool, and the three pages that use it call it identically. Using with expressions on the record DTOs rather than mutating them keeps the list elements immutable values, which is what lets a page compare or re-render without worrying that a background patch aliased an object it already handed to a component.
  • Where it's used: by the three conference-day pages, each guarding the call with the channel's event name so an unrelated broadcast never reaches it. SessionLive routes both events through one switch and reloads on null (SessionLive.razor.cs:193-200, patching at :190 and :192 with preserveMyVote: true); PresenterView handles them as two early-return branches with preserveMyVote: false (PresenterView.razor.cs:140, :127); HappeningNow patches only poll results and falls back to ReloadPollsAsync (HappeningNow.razor.cs:175, :145).
  • Caveats / not-in-source: the class is internal, so nothing outside MMCA.ADC.Engagement.UI can call it, and no dedicated test class for it exists in the repository. Its behavior is exercised only through the pages that call it.

ILivePollUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/ILivePollUIService.cs:15 · Level 3 · interface

  • What it is: the full UI contract for the live-poll layer: read open polls (event-wide or per session) with tallies and the caller's own vote, cast or change a vote, and drive the organizer lifecycle (create, open, close, delete), plus a session-scoped manage list.
  • Depends on: LivePollResultsDTO, LivePollDTO, CreateLivePollRequest (all MMCA.ADC.Engagement.Shared.LivePolls, imported at ILivePollUIService.cs:1), Result (MMCA.Common.Shared.Abstractions, :2), and the LivePollIdentifierType/LivePollOptionIdentifierType/EventIdentifierType/SessionIdentifierType aliases.
  • Concept introduced, a Result-typed UI contract: a server refusal is data, not an exception. The type doc states it outright (ILivePollUIService.cs:11-12): "Every member answers with a Result: a server refusal is data the page renders, never an exception. Only the caller's own cancellation still propagates." Every one of the ten members returns Task<Result> or Task<Result<T>>, so a 403 from a poll the caller may not manage, or a 412 from a stale open, arrives as a value a Blazor page can bind to an alert. [Rubric §24, Forms/Validation/UX Safety] assesses whether failure states are renderable rather than fatal; typing the contract on Result removes the try/catch from every consuming page. A second idea also appears here, two result shapes for two audiences: read-and-vote methods return LivePollResultsDTO (tallies plus the caller's own vote) while the manage views return the richer LivePollDTO. [Rubric §9, API & Contract Design] covers that fit-the-shape-to-the-consumer split. [Rubric §11, Security] applies through the explicit note that manage operations require engagement:live:manage and that "the API enforces this regardless of what the UI renders" (:8-9): the UI contract never pretends to be the security boundary.
  • Walkthrough: attendee and reader path: GetOpenPollsAsync (ILivePollUIService.cs:18), GetOpenSessionPollsAsync (:21), GetResultsAsync (:24), CastVoteAsync (:27, which returns the fresh tallies so a vote needs no follow-up read). Manage path: GetEventPollsAsync (:30, ALL polls of an event) and GetSessionManagePollsAsync (:36), whose doc records that the session list is "open to the session's assigned speakers as well as organizers (BR-236), unlike the event-wide manage list" (:33-34). Lifecycle: CreateAsync (:39, creates as Draft), OpenAsync (:42) and CloseAsync (:45), each taking a byte[] rowVersion alongside the id, and DeleteAsync (:48, "must not be Open"). The rowVersion parameter on the two transitions is the optimistic-concurrency token of ADR-035: the caller must state which version of the poll it saw. Every method takes a trailing CancellationToken.
  • Why it's built this way: grouping the whole poll lifecycle behind one interface lets the various poll surfaces (HappeningNow, SessionLive, SessionLiveModerationPanel, PresenterView) inject a single dependency and lets tests fake it wholesale, while the Result return type keeps every one of those pages free of HTTP error handling.
  • Where it's used: implemented by LivePollUIService; consumed by the live-poll Blazor pages and panels.

ISessionQuestionUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/ISessionQuestionUIService.cs:15 · Level 3 · interface

  • What it is: the UI contract for the session Q&A layer: attendees read approved questions and submit their own, moderators work a queue (approve / dismiss / mark-answered), and anyone can upvote or remove an upvote.
  • Depends on: SessionQuestionDTO and SubmitQuestionRequest (MMCA.ADC.Engagement.Shared.SessionQuestions, imported at ISessionQuestionUIService.cs:1), Result, and the SessionIdentifierType/SessionQuestionIdentifierType aliases.
  • Concept introduced, two views of the same queue. GetQuestionsAsync (ISessionQuestionUIService.cs:18) returns the attendee view (every approved question plus the caller's own pending/dismissed ones), while GetModerationQueueAsync (:21) returns all statuses with Pending first. The same two disciplines as its poll sibling appear verbatim: every member answers with a Result and only caller cancellation propagates (:11-12), and moderation needs organizer/admin or an assigned-speaker claim with "the API enforces this regardless of what the UI renders (BR-236)" (:8-9). [Rubric §24, Forms/Validation/UX Safety] assesses how submission and moderation flows are shaped; the split read methods keep an attendee from seeing another attendee's un-approved question while giving moderators the full picture. [Rubric §11, Security] applies through the server-authoritative moderation note.
  • Walkthrough: reads: GetQuestionsAsync (:18), GetModerationQueueAsync (:21). Submit: SubmitAsync (:24), whose doc notes the question "starts at the event's moderation default (BR-233)". Moderation: ApproveAsync (:27), DismissAsync (:30), MarkAnsweredAsync (:33), each taking (SessionQuestionIdentifierType id, byte[] rowVersion, CancellationToken) so the write is conditional on the version the moderator saw (ADR-035) and two moderators racing cannot silently overwrite each other. Upvoting: UpvoteAsync (:36) and RemoveUpvoteAsync (:39), each returning Result<int>, the fresh upvote count, so the button can re-render from the response.
  • Why it's built this way: one interface spans attendee, moderator, and voter roles so a session Live page injects a single service; the API remains the enforcer, so the contract can expose the moderation methods without granting rights. Returning the count from the upvote verbs saves a follow-up read on the hottest interaction in the room.
  • Where it's used: implemented by SessionQuestionUIService; consumed by SessionLive, SessionLiveModerationPanel, SessionLiveQuestionPanel, and PresenterView.

LivePollUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LivePollUIService.cs:14 · Level 5 · sealed class

  • What it is: the HTTP implementation of ILivePollUIService, calling the Gateway's /LivePolls routes through the authenticated base's central dispatch, which supplies the client, the retry pipeline, and the Problem-Details-to-Result translation.
  • Depends on: AuthenticatedServiceBase (base class supplying SendRequestAsync and NewIdempotencyKey; the dispatch composes HttpResultExecutor, RetryPolicy, and ProblemDetailsResultReader, and sets IdempotencyHeaders, so this file names none of them), ConcurrencyETag (MMCA.Common.Shared.Http), ILivePollUIService and the poll DTO/request records, plus IHttpClientFactory and ITokenStorageService (LivePollUIService.cs:14-16).
  • Concept introduced, the two-halves translation of an HTTP call into a Result, held once in the base. Every method here is one call to the base's SendRequestAsync (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171-189, with a body-less overload at :201-217 for calls that answer with no payload). That dispatch wraps the work in HttpResultExecutor.ExecuteAsync(..., cancellationToken), creates one client per logical operation, runs the passed lambda through RetryPolicy.ExecuteAsync, and ends in ProblemDetailsResultReader.ReadAsync (AuthenticatedServiceBase.cs:179-188). The reader and the executor do complementary jobs: the reader converts a response (an RFC 9457 Problem Details body from the API back into the original Error list, preserving ErrorType), and the executor converts the absence of a response (a refused connection, DNS failure, dropped socket, or HttpClient timeout) into a transport failure, while rethrowing an OperationCanceledException that the caller's own token caused. Together they are what makes the Result-typed contract in ILivePollUIService honest. The two optional arguments, idempotencyKey and ifMatch, become default headers on that per-operation client (AuthenticatedServiceBase.cs:232-257), so every retry attempt carries the same values. [Rubric §29, Resilience, Reliability & Business Continuity] assesses whether resilience and error translation are applied uniformly; every method here gets all three by construction. [Rubric §26, Front-End Security] applies because the dispatch's client carries the bearer token read from token storage (AuthenticatedServiceBase.cs:73-97).
  • Walkthrough: Endpoint = "livepolls" (LivePollUIService.cs:18). Reads: GetOpenPollsAsync (:21) GETs livepolls/open?eventId= built with string.Create(CultureInfo.InvariantCulture, ...) (:27) and, being async for this one step, applies .Map(...) to the awaited result to widen List<LivePollResultsDTO> to IReadOnlyList<...> (:30); GetOpenSessionPollsAsync (:33) is the same call keyed by sessionId (:39); GetResultsAsync (:45) GETs livepolls/{pollId}/results (:51); GetEventPollsAsync (:74) GETs livepolls?eventId= (:80) and GetSessionManagePollsAsync (:86) GETs livepolls/manage?sessionId= (:92), both returning LivePollDTO lists widened the same way (:83, :95). The two creating writes pass idempotencyKey: NewIdempotencyKey(): CastVoteAsync (:57) POSTs a CastVoteRequest (:68) to livepolls/{pollId}/votes (:66-67) with the key at :71, and CreateAsync (:98) POSTs the CreateLivePollRequest to livepolls (:105-106) with the key at :108. The comments at :62-65 and :102-104 explain why that placement is the safe one: the argument is evaluated once per call, before the retry pipeline runs, so every attempt shares one key, whereas a fresh key per attempt would leave the server nothing to deduplicate on and turn a retried vote into a second write. Lifecycle: OpenAsync (:111) and CloseAsync (:115) both delegate to PostLifecycleAsync(pollId, action, rowVersion, ...) (:129), which POSTs livepolls/{pollId}/{action} with no body (:131-134) through the body-less overload, passing a fresh idempotency key (:136) and ifMatch: ConcurrencyETag.Format(rowVersion) (:137). The comment above it (:124-128) gives both reasons: a stale-view open or close answers 412 Precondition Failed, and because the open and close endpoints are [Idempotent], a retry after a lost response replays the stored answer rather than failing its own precondition. DeleteAsync (:119) DELETEs livepolls/{pollId} (:121) with neither a precondition nor a key.
  • Why it's built this way: with the client / retry / read ceremony held once in the base, each method shrinks to its URL, its payload, and the two optional header arguments, so the class reads as a faithful map of the interface onto REST routes. The non-list methods are expression-bodied and return the SendRequestAsync task directly rather than awaiting it; only the list reads are async, to apply the widening Map. The idempotency-key and If-Match arguments are the two spots where that ceremony genuinely matters, and both carry an in-code explanation so a later edit does not quietly move the key minting inside the retried lambda (ADR-035, ADR-021).
  • Where it's used: registered as the ILivePollUIService in the Engagement UI module; injected into HappeningNow, SessionLivePollPanel, SessionLiveModerationPanel, and PresenterView.

SessionQuestionUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/SessionQuestionUIService.cs:14 · Level 5 · sealed class

  • What it is: the HTTP implementation of ISessionQuestionUIService, calling the Gateway's /SessionQuestions routes through the same base SendRequestAsync dispatch as LivePollUIService.
  • Depends on: AuthenticatedServiceBase (SendRequestAsync, NewIdempotencyKey; the dispatch composes HttpResultExecutor, ProblemDetailsResultReader, and IdempotencyHeaders), ConcurrencyETag, ISessionQuestionUIService, SessionQuestionDTO/SubmitQuestionRequest, IHttpClientFactory, and ITokenStorageService (SessionQuestionUIService.cs:14-16).
  • Concept reinforced: this is the structural sibling of LivePollUIService and reuses the base dispatch introduced there (executor wrapper, RetryPolicy.ExecuteAsync, and ProblemDetailsResultReader.ReadAsync, all inside SendRequestAsync), so the concept is not re-taught. What differs is the count-returning upvote pair and the moderation helper. [Rubric §29, Resilience, Reliability & Business Continuity] and [Rubric §26, Front-End Security] apply for the same inherited-resilience and token-flow reasons as its poll sibling.
  • Walkthrough: Endpoint = "sessionquestions" (SessionQuestionUIService.cs:18). Reads: GetQuestionsAsync (:21) GETs sessionquestions?sessionId= (:27) and GetModerationQueueAsync (:33) GETs sessionquestions/moderation?sessionId= (:39), each awaiting the dispatch and widening the deserialized List<SessionQuestionDTO> with .Map (:30, :42). SubmitAsync (:45) POSTs the SubmitQuestionRequest to sessionquestions (:53-54) with idempotencyKey: NewIdempotencyKey() (:56); the comment (:49-52) states that the argument is evaluated once per call, before the retry pipeline runs, and names the concrete failure a per-attempt key would cause, an attendee whose submit times out over conference wifi posting the same question twice. Moderation: ApproveAsync (:59), DismissAsync (:63), and MarkAnsweredAsync (:67) each delegate to PostModerationAsync(id, action, rowVersion, ...) (:90) with the action strings "approve", "dismiss", and "answered"; that helper POSTs sessionquestions/{id}/{action} with no body (:92-95) through the body-less overload, passing a fresh idempotency key (:97) and ifMatch: ConcurrencyETag.Format(rowVersion) (:98). Its comment (:85-89) gives both reasons: "two moderators racing surface as 412 Precondition Failed", and because the endpoints are [Idempotent], a retry after a lost response replays the stored answer rather than failing its own precondition. Upvotes: UpvoteAsync (:71) POSTs sessionquestions/{id}/upvotes with a null body (:75) and a per-click key (:77), since the upvote endpoint is [Idempotent] and a retry after a lost response then replays the count instead of being skipped (:73-74); RemoveUpvoteAsync (:80) DELETEs the same route (:82) with no key. Both read the fresh count through SendRequestAsync<int> (:72, :81), and neither carries a precondition.
  • Why it's built this way: like its poll sibling, the non-list methods return the SendRequestAsync task directly instead of awaiting it, and only the list reads are async, to apply the widening Map. One private helper (PostModerationAsync) collapses the repeated conditional-POST call for the three moderation verbs, leaving each public method to state only its action string. Every POST carries an idempotency key minted once per logical operation (submit, upvote, the three moderation verbs), the moderation verbs add If-Match on top, and the remove-upvote DELETE carries neither; in each case the key is an argument evaluated before the retry pipeline runs, so every attempt shares it.
  • Where it's used: registered as ISessionQuestionUIService; consumed by SessionLive, SessionLiveModerationPanel, SessionLiveQuestionPanel, and PresenterView.

LiveChannelSubscription

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveChannelSubscription.cs:16 · Level 5 · sealed class

  • What it is: a join-once / leave-once handle for one live notification channel, held as a field by the conference-day pages that listen for real-time events. It owns the two pieces of state and the join and leave sequences those pages used to repeat inline, so a page states only which channel it wants and what to do with an event (class doc, :5-9).
  • Depends on: NotificationHubService (:1, passed in per join rather than injected). Externals: IAsyncDisposable, IDisposable, GC.SuppressFinalize.
  • Concept introduced, the component-owned resource handle. [Rubric §19, State Management] assesses where transient client state lives and who is responsible for tearing it down. The remarks block (:11-14) is the whole design in three sentences: this is not a DI service. A page news one up as a field, so the handle's lifetime is the component's, nothing has to be registered or scoped, and disposal is a no-op for a handle that never joined. Compare that with the alternative of a scoped service tracking channel membership: it would outlive the component and would have to be told when the component went away. Here the component's own DisposeAsync is the only teardown signal needed, and LeaveAsync covers the one case where a component outlives its channel. [Rubric §15, Best Practices & Code Quality]: two pages held the identical field pair and repeated the same three-step join and two-step leave; folding that into one type means a change to the join protocol happens once.
  • Walkthrough
    • The four fields (:18-21) are the hub service, the handler subscription token, the optional connection-restored subscription token, and the channel key. All are nullable and all are set and cleared together.
    • IsJoined (:27) reports simply whether _channelKey is non-null. Its doc (:23-26) names the exact job it does: the pages call it as the already-joined guard inside OnAfterRenderAsync, which is deliberately not firstRender-gated (BR-229 / BR-238). See HappeningNow at HappeningNow.razor.cs:147, SessionLive at SessionLive.razor.cs:201 and PresenterView at PresenterView.razor.cs:159 for the guard in place.
    • JoinAsync(hubService, channelKey, handler, resync = null) (:43-61, not async) null-checks the hub service (:49), returns Task.CompletedTask early when a key is already recorded so a second call is a no-op (:51-54), then assigns the fields and subscribes the handler through OnChannelEvent (:56-58) before returning the JoinChannelAsync task (:60). The ordering is the load-bearing part and the doc says why (:30-32): the key is recorded before the join is awaited, so IsJoined already answers true for any render that interleaves with the in-flight join. Without that, a render landing mid-join would see false and start a second join.
    • The optional resync callback (:37-42) is subscribed through the hub's OnConnectionRestored only when one is passed (:59). Its doc gives the reason it exists: SignalR delivers nothing that was sent while the connection was down, so a page passes a re-read of what it shows live, run once for each restored connection. It runs off the renderer's dispatcher, so a page routes its reload through InvokeAsync, and the hub isolates and logs one that throws. [Rubric §29, Resilience, Reliability & Business Continuity] applies: a dropped conference-wifi connection self-heals the page's live state instead of leaving it silently stale.
    • LeaveAsync (:70-88) captures the service and key locally, then disposes both subscriptions and nulls all four fields before awaiting (:77-82), so IsJoined already answers false for any render that interleaves with the leave and a restored connection no longer runs the old channel's re-read. It calls LeaveChannelAsync only when both service and key were present (:84-87). That returns the handle to its never-joined state so JoinAsync can attach it to another channel: a routed page Blazor reuses across a route-parameter change (one session's Live page to another's) leaves the old channel here before joining the new one. A no-op for a handle that is not joined.
    • DisposeAsync (:91-96) is just await LeaveAsync() followed by GC.SuppressFinalize (:95). A handle that never joined therefore disposes cleanly with no hub traffic.
  • Why it's built this way: real-time listening on a Blazor page is a resource with a strict pairing (subscribe and join on the way in, unsubscribe and leave on the way out) that the render loop can interleave with. Making the handle a plain field with an idempotent join and an idempotent dispose puts both halves in one place a reader can check at a glance.
  • Where it's used: HappeningNow holds one for the event channel (HappeningNow.razor.cs:59, joined at :156-158 via LivePollChannel.ForEvent, disposed at :371), and SessionLive (SessionLive.razor.cs:74, joined at :207-209, disposed at :395) and PresenterView (PresenterView.razor.cs:59, joined at :166-168, disposed at :261) each hold one for the session channel via LivePollChannel.ForSession. All three guard the join with RendererInfo.IsInteractive as well, which keeps the prerender pass and the bUnit suite off the hub (HappeningNow.razor.cs:147). The resync path is covered by LiveChannelResyncTests in MMCA.ADC.Engagement.UI.Tests.
  • Caveats / not-in-source: the class is not thread-safe. JoinAsync reads and writes _channelKey around an await with no lock, which holds on the single-threaded Blazor circuit context the pages run on and is not written to be shared beyond it. Unlike earlier shapes, leaving is no longer only disposal: LeaveAsync is public, so one handle can move from channel to channel.

LiveEventService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.SessionLive · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventService.cs:17 · Level 9 · sealed class

  • What it is: the implementation of ILiveEventUIService: it fetches the live, else next, else most recently ended published event from the Conference API and computes its live window into a LiveEventContext, answering a LiveEventLookup that keeps "no published event" apart from "the API is down" (type doc, LiveEventService.cs:8-16).
  • Depends on: ILiveEventUIService, LiveEventLookup, CurrentEventSelector (the shared selection plus window math), EventDTO and PagedCollectionResult<T>, LiveEventContext, and the two primary-constructor dependencies IHttpClientFactory and TimeProvider (LiveEventService.cs:17). For the read it composes HttpResultExecutor, IdempotentReadRetry and ProblemDetailsResultReader, the same read composition as its sibling SessionLookupService (:51-53). It uses the plain "APIClient" (:57), not the authenticated base: the published-events read is public.
  • Concept introduced, fail-soft resolution that still names the failure. The read is internally Result-shaped (the executor turns every fault into a failed Result), and the public contract reduces that to one flag rather than an error list: the type doc states that any "transport, payload or timeout failure (a captive portal answering 200 with HTML, a dropped body, the client timeout) degrades to LiveEventLookup.Failed, never an exception, so the live layer simply stays dormant while a page can still tell the outage apart from "no published event"; only the caller's own cancellation propagates" (LiveEventService.cs:12-15). [Rubric §29, Resilience & Business Continuity] assesses graceful degradation under a dependency outage; here an unavailable Conference API turns the ambient live layer off instead of erroring a page, and a page that can retry shows its load error with Retry (:25-26). [Rubric §12, Performance & Scalability] applies because the same public, output-cached events read backs this call. The cross-event GetPublishedEventsAsync keeps the older shape: failure is null, indistinguishable at the call site from nothing to plan.
  • Walkthrough: both public methods share one private read, ReadPublishedEventsAsync (:49), which returns the published EventDTO list or null when the read failed. It wraps the call in HttpResultExecutor.ExecuteAsync(..., cancellationToken) (:54-66); inside the delegate it creates the "APIClient" (:57), issues IdempotentReadRetry.GetAsync against the relative URI events?includeFKs=false&includeChildren=false (:58-61), and reads the response with ProblemDetailsResultReader.ReadAsync<PagedCollectionResult<EventDTO>> (:63-64). When read.TryGetValue(out var wrapper) succeeds it returns the published subset as a list via a null-safe wrapper?.Items?.Where(e => e.IsPublished) ?? [] (:68-70), otherwise null. GetCurrentEventAsync (:20-38) returns LiveEventLookup.Failed when the read is null (:23-28), else hands CurrentEventSelector.SelectCurrentOrNext that list with accessor lambdas for start date, end date, and time zone (:30-34) and the injected clock's timeProvider.GetUtcNow().UtcDateTime (:35), so a test can pin "now" with a fake TimeProvider; a null selection returns LiveEventLookup.None, a hit returns LiveEventLookup.Found(ToContext(...)) (:37). GetPublishedEventsAsync (:41-45) maps every published event through ToContext into a list, or null when the read failed, which is what lets the bookmark reminder planner read each session against its own event. The static ToContext (:73-84) computes (startUtc, endUtc) from CurrentEventSelector.GetLiveWindowUtc(StartDate, EndDate, TimeZone) (:75-76) and constructs the LiveEventContext from the event id, name, time zone, and window (:78-83). There is no try/catch in the class: the executor, not this file, names the fault set.
  • Why it's built this way: delegating both "which event" and "what window" to CurrentEventSelector means the UI and the API share one implementation of the conference-day math, which is what lets LiveEventContext claim to mirror the backend window exactly. Returning Failed and None as distinct values keeps the ambient listener silent in both cases while letting a page offer Retry only when retrying could help.
  • Caveats / not-in-source: the call comment names the executor's fault set as "transport, JSON, IO, client timeout" (:51-53), but the executor's own internals are not in this file; see HttpResultExecutor. Only the caller's cancellation propagates, so a page's lifecycle method never sees a read failure from this service.
  • Where it's used: registered as ILiveEventUIService; consumed by HappeningNow, the ambient LiveEventListener, CheckInScan, OrganizerAttendance, MyTicketsPanel, TicketInsights, and TicketRoster; the Conference UI's EventLookupService also references it (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Services/Events/EventLookupService.cs).

RecordRoomCheckInHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RecordRoomCheckIn · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:48 · Level 12 · class (sealed partial)

  • What it is: the attendee-facing self check-in from a room's printed QR. The request names a room; the SERVER decides which session that room is hosting right now and records a session check-in for the caller.
  • Depends on: IUnitOfWork, IVerifiedParticipantGate, IEventLiveValidationService and its RoomSessionInfo result, CheckInSettings via IOptions<T>, PointsSwitch, SessionTimeSlotPoints (called statically), ErasedUserGuard, CheckInProcessor, CheckIn, RoomCheckInResultDTO, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept introduced, server-side resolution as the anti-abuse property. [Rubric §11, Security] (assesses whether authority for a decision sits with the party that can be trusted with it) and [Rubric §12, Performance & Scalability] in passing. The class doc states the property (RecordRoomCheckInHandler.cs:20-47): the request names the room (plus the scanned room code, when the QR carried one) and never a session (:21-25), so a shared room link records nothing outside the session's window, and nobody can name a session they are not standing in. Worth contrasting with the organizer paths, where the client does send a session id: there the caller is a trusted organizer, here the caller is the beneficiary of the write. The second teachable point is the answer-shape rule in MapRoomLookupFailure (:146-166): an unknown room and a room with nothing scheduled deliberately produce the SAME attendee-facing error, because distinguishing them would leak which room ids exist. Transport-level failures still propagate unchanged, so a Conference outage is not misreported as an empty schedule (:154-157). The third is proof of presence: a room that has a check-in code requires the scan to carry the current one, so a QR printed before the organizer rotated the code, or a room id typed in by hand, records nothing and sends the attendee back to the door code (:149-151).
  • Walkthrough: seven constructor dependencies (:48-55, including IVerifiedParticipantGate and PointsSwitch), one HandleAsync (:58-144).
    • Caller identity from the token, never the request (:64-68): verifiedParticipantGate.RequireCaller("CheckIns.Forbidden") returns the calling account from the request principal, or a Forbidden error with that code when the request carries none (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/IVerifiedParticipantGate.cs:13-19).
    • Erased-account guard (:70-73, L207): ErasedUserGuard.EnsureNotErasedAsync refuses an erased account's still-valid token, so no check-in is left under its id.
    • Verified-participant gate (:75-79, S-ADC-identity-02): a self-recorded check-in awards points, so EnsureVerifiedAsync accepts only an account with a confirmed email or a live linked ticket, and succeeds unconditionally when Engagement:RequireVerifiedParticipant is off (IVerifiedParticipantGate.cs:21-31).
    • Cross-module resolution (:84-86): GetCurrentRoomSessionInfoAsync(command.RoomId, command.CheckInCode, settings.Value.RoomCheckInGraceMinutes, ...). The scanned code travels to Conference, which owns the room's current code and answers the comparison. The grace window travels in the call rather than living in Conference because it is this module's policy (:81-83); its default is 15 minutes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInSettings.cs:21), and the setting's own doc (CheckInSettings.cs:16-20) explains that a zero-grace window would reject the entire pre-session queue.
    • Failure triage (:87-88): the result is unwrapped with if (!sessionInfo.TryGetValue(out var current)), so the success path holds the resolved current without a Value! dereference, and every failure goes through MapRoomLookupFailure (:160-166). An error whose code is Conference's RoomCheckInCodeDTO.RejectedErrorCode ("Room.CheckInCodeRejected", MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Rooms/RoomCheckInCodeDTO.cs:24) becomes this module's RoomCodeRejected() validation error (:162-163, defined at :168-172 with code CheckInErrorCodes.RoomCodeRejected, target CheckInCode); otherwise a NotFound collapses to the shared NoCurrentSession() error (:165, defined at :174-178 with code CheckInErrorCodes.NoCurrentSession); anything else is passed through verbatim. Both codes are constants on CheckInErrorCodes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/CheckInErrorCodes.cs:16, :22).
    • Published gate (:90-91): an unpublished event fails even when a session resolves, and the failure is the processor's shared EventNotPublished(...) with this handler named as the source (CheckInProcessor.cs:29-33), so the error still points at the entry point the caller used.
    • Points eligibility (:95-114), asked before the write. await pointsSwitch.GetAwardAsync(PointsActivityType.SessionCheckIn, ...) <= 0 sets pointsPaused (:98): the same tests the awarder applies, a configured value of 0 or below or the whole points game switched off (:95-97; the class doc at :40-45 names the EngagementFeatures.Points flag), so a paused rule never promises an award. Only when points are live does it call SessionTimeSlotPoints.HasEarlierOverlappingCheckInAsync (:102-109); a failure there fails closed and nothing is written (:110-111), and earnsPoints = !earlierInSlot.Value (:113) reflects the once-per-time-slot rule. This also lets an attendee already checked in to another, overlapping session switch rooms without staff: the check-in is still recorded here (:33-37).
    • The write goes through CheckInProcessor.RecordAsync (:118-127) with CheckInScope.Session, the event id Conference reported, sponsorId: null, and checkedInByUserId: userId. That last argument is the only field that distinguishes a self check-in from a door scan (:27-30), which is what keeps the two operationally separable while everything downstream (points award, attendance rollup, export posture) treats them identically. Idempotency lives inside RecordAsync: it looks for an existing row on the same scope-specific predicate the organizer paths use (CheckInProcessor.cs:221-240) and, when it finds one, returns AlreadyRecorded: true with the ORIGINAL CheckedInOn rather than writing again (CheckInProcessor.cs:73-77).
    • The response (:135-143) carries the session title Conference returned plus AlreadyCheckedIn and CheckedInOn from the outcome, and EarnsPoints and PointsPaused (:141-142); the Information log fires only on a genuinely new row (:132-133). timeProvider.GetUtcNow() supplies the timestamp inside the processor (CheckInProcessor.cs:85), so the flow is testable without wall-clock dependence ([Rubric §14, Testability]).
  • Why it's built this way: writing an ordinary session check-in rather than a new row type means AttendeeCheckedInPointsHandler, the rollups, and the privacy export need no change at all to cover the self-service surface.
  • Where it's used: CheckInsController resolves it as ICommandHandler<RoomCheckInRequest, Result<RoomCheckInResultDTO>> (CheckInsController.cs:53,252).

RecordSponsorVisitHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.RecordSponsorVisit · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:38 · Level 12 · class (sealed partial)

  • What it is: records the caller's visit to one sponsor booth, scanned from the sponsor's printed deep-link QR. The row is a CheckIn with Scope = Sponsor whose CheckedInByUserId equals its UserId, which is what marks it self-recorded.
  • Depends on: IUnitOfWork, IVerifiedParticipantGate, IEventLiveValidationService and its SponsorLiveInfo result, ICurrentUserService, ErasedUserGuard, CheckInProcessor, SponsorVisitResultDTO, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept introduced, where to draw the reuse line, and a written-down accepted trade-off. [Rubric §15, Best Practices & Code Quality] and [Rubric §11, Security]. The doc comment (RecordSponsorVisitHandler.cs:16-37) is the most instructive part of the file and rewards reading in full. It argues first that this flow is deliberately not a third branch inside CheckInProcessor.ExecuteAsync (:21-28): that entry point resolves its own target through Conference, and this flow asks a different question (the sponsor lookup) and answers in a different shape (the sponsor name), so folding it in would make the organizer path carry conditionals for a question it never asks. The reuse line is drawn one level lower instead: the not-published failure and the idempotent record still run through CheckInProcessor, just through RecordAsync and EventNotPublished rather than ExecuteAsync, and the caller check is the same ICurrentUserService.RequireUserId every entry point calls (:25-27). Splitting a helper by which half is genuinely shared, rather than sharing the whole entry point, is the transferable lesson. Then the doc states the trade-off honestly (:29-36): the deep-link URL is shareable, exactly like the badge QR, and the live window is deliberately not enforced. What makes sharing worthless is the combination of gates: the owning event must be published, the filtered unique index caps the award at one per sponsor per attendee, the configured value is low with 0 turning it off entirely (PointsSettings), and the feature flag answers 404 when the surface is retired. Rotating tokens and date windows were considered and rejected as inconsistent with the badge QR. Documenting a rejected alternative next to the accepted risk is what makes this an architecture decision rather than an oversight.
  • Walkthrough: six constructor dependencies (:38-44), one HandleAsync (:47-109).
    • ArgumentNullException.ThrowIfNull(command) (:51) and the caller from the token (:53-57) through currentUserService.RequireUserId("CheckIns.Forbidden"), the same CheckIns.Forbidden code as the room flow.
    • Erased-account guard (:59-62, L207): ErasedUserGuard.EnsureNotErasedAsync refuses an erased account's still-valid token, so no booth visit is left under its id.
    • Verified-participant gate (:64-68, S-ADC-identity-02): a booth visit awards points, so IVerifiedParticipantGate.EnsureVerifiedAsync accepts only an account with a linked ticket or a confirmed email, the same rule the room flow applies.
    • Sponsor lookup (:72-74): GetSponsorLiveInfoAsync proves the sponsor exists and returns its owning event plus display name, so a QR printed for a sponsor that was later pulled records nothing (:70-71). The result is unwrapped with if (!sponsorInfo.TryGetValue(out var sponsor)) (:75-76), so the success path holds sponsor without a Value! dereference. Unlike the room flow, failures pass through unchanged, since a nonexistent sponsor id is not the same kind of enumeration risk as a room schedule.
    • Published gate (:78-79), the same shared EventNotPublished error as the other check-in paths, sourced to this handler.
    • The write through CheckInProcessor.RecordAsync (:85-94) with CheckInScope.Sponsor, sessionId: null, the sponsor id, and checkedInByUserId: userId. Idempotency again lives in the processor: a (UserId, SponsorId, Scope == Sponsor) predicate (CheckInProcessor.cs:242-243) means a second scan of the same booth reports the ORIGINAL visit instead of writing a second row. The comment names the filtered unique index on (UserId, SponsorId) WHERE [Scope] = 2 as the race backstop (:81-83).
    • The response carries the sponsor name (:102-108) so the attendee's confirmation screen needs no second cross-module call, and the Information log fires only on a genuinely new visit (:99-100).
  • Why it's built this way: returning the same DTO shape on both the fresh and repeat paths means the client renders one screen, and the AlreadyVisited flag is presentation, not an error the user has to interpret.
  • Where it's used: CheckInsController (CheckInsController.cs:52,217).

CreateBookmarkRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.Create · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/Create/CreateBookmarkRequestValidator.cs:9 · Level 1 · class (sealed)

  • What it is: the shape gate in front of CreateBookmarkHandler. Two rules, both saying the same thing about a different identifier: a bookmark needs a real user and a real session.
  • Depends on: CreateBookmarkRequest, the UserIdentifierType / SessionIdentifierType aliases; externals: FluentValidation (AbstractValidator<T>, RuleFor, NotEqual, WithMessage, WithErrorCode).
  • Concept introduced, the request validator and where it sits in the command pipeline. [Rubric §9, API & Contract Design] (assesses whether a contract states its own preconditions and reports violations in a machine-readable form) and [Rubric §5, Vertical Slice] (assesses whether everything one use case needs lives in the use case's own folder). The wiring is worth learning once because every validator in this unit rides it. Validators are never resolved by name: ScanModuleApplicationServices<ClassReference>() in the module's composition root (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) scans the assembly and registers each AbstractValidator<T> as IValidator<T>. At request time ValidatingCommandDecorator<TCommand, TResult> receives IEnumerable<IValidator<TCommand>> and runs ALL of them, not just the first registration (MMCA.Common/Source/Core/MMCA.Common.Application/UseCases/Decorators/ValidatingCommandDecorator.cs:18-21,31-36), so a module-authored validator and a framework one both get their say and the caller sees every broken rule in one response. Either way the validation runs before the handler sees the command, and a handler is free to assume the structural rules already held. The other thing to notice is WithErrorCode: the string "UserSessionBookmark.UserId.Required" (CreateBookmarkRequestValidator.cs:16) is a stable code a client can branch on, which a localized message never is.
  • Walkthrough: a block-bodied constructor with two rules (CreateBookmarkRequestValidator.cs:11-22).
    • UserId must not equal default(UserIdentifierType) (CreateBookmarkRequestValidator.cs:13-16). The alias is int (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Shared/MMCA.ADC.Identity.GlobalUsings.IdentifierType.cs:2), so this rejects an unset zero. Writing it as NotEqual(default(...)) rather than GreaterThan(0) keeps the rule correct if the alias ever changes width or becomes a struct id.
    • SessionId gets the identical treatment against default(SessionIdentifierType) (CreateBookmarkRequestValidator.cs:18-21), also an int alias (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/MMCA.ADC.Conference.GlobalUsings.IdentifierType.cs:20).
  • Why it's built this way: the validator deliberately checks only what it can decide without touching a database or another module. Ownership (may this caller bookmark for this user) is enforced in BookmarksController against the caller's user-identifier claim (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:71-77, ADR-033), and session eligibility (BR-49, BR-91) is a cross-module call inside the handler. Three checks, three layers, none duplicated.
  • Where it's used: applied automatically to every CreateBookmarkRequest command entering the pipeline; the request itself arrives from BookmarksController.CreateAsync (BookmarksController.cs:61-84).

DeleteTicketRosterCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.DeleteRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/DeleteRoster/DeleteTicketRosterCommand.cs:10 · Level 1 · record (sealed)

  • What it is: the organizer's post-event request to remove one event's whole ticket roster (BR-274, UC-53). It carries a single value, the event.
  • Depends on: ITransactional, the EventIdentifierType alias; nothing external.
  • Concept: the transactional marker on a command record is taught with ITransactional and its decorator TransactionalCommandDecorator<TCommand, TResult> (ADR-107). Here the doc comment states what the marker buys: the roster is removed whole or not at all (DeleteTicketRosterCommand.cs:5-8).
  • Walkthrough: one positional parameter, EventId (:10). There is no request body: the controller builds the record from the eventId query string.
  • Where it's used: built by TicketsController.DeleteRosterAsync for DELETE /tickets/roster?eventId= (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:298,307-309), which requires EngagementPermissions.TicketsManage (:294) and sits behind the class-level EngagementFeatures.Tickets gate (:39). Validated by DeleteTicketRosterCommandValidator and handled by DeleteTicketRosterHandler; the controller resolves that handler as ICommandHandler<DeleteTicketRosterCommand, Result> (TicketsController.cs:49).

EngagementFeatures

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/EngagementFeatures.cs:11 · Level 1 · class (static)

  • What it is: the module's eight feature-flag names as const strings. Each constant is simultaneously the key read from the "FeatureManagement" configuration section and the argument to a [FeatureGate(...)] attribute on a controller, so a flag flip turns a whole surface off without a code change. One constant, Points, is also read below the HTTP boundary, by the points write path (EngagementFeatures.cs:8).
  • Depends on: nothing first-party beyond the [FeatureFlag] attribute (MMCA.Common/Source/Core/MMCA.Common.Shared/FeatureFlags/FeatureFlagAttribute.cs:32) and FeatureFlagLifetime each constant is decorated with; nothing external. The file's only using is the namespace that attribute lives in (EngagementFeatures.cs:1). That is what lets Shared-layer callers, API controllers, and configuration authors all name the same string without any of them referencing each other.
  • Concept, module-scoped feature flags as compile-time constants. The sibling explanation for the pattern lives with ConferenceFeatures; this section covers what is specific to Engagement. Three mechanisms meet here. First, const string (not static readonly) means the value is inlined at the use site, which is why it can be used in an attribute argument and in an [InlineData] in a test. Second, every constant carries [FeatureFlag(FeatureFlagLifetime.Permanent, Owner = "ADC Engagement")] (EngagementFeatures.cs:22,34,46,59,71,84,96,109), so FeatureFlagRegistry records ownership and lifetime for all eight flags rather than treating them as untracked strings. Third, the runtime behavior of a disabled flag is not the default from Microsoft.FeatureManagement.Mvc: MMCA.Common registers DisabledFeatureHandler (MMCA.Common/Source/Presentation/MMCA.Common.API/FeatureManagement/DisabledFeatureHandler.cs:14), which sets an RFC 9457 ProblemDetails body with Status = 404 and the title "Feature not available" (:18-26). So a gated route answers 404 in the same envelope as every other failure from ApiControllerBase, and the endpoint reads to an outside caller as simply not existing rather than as forbidden. [Rubric §9, API & Contract Design] assesses whether concerns like this are applied uniformly at one point rather than re-implemented per endpoint: the gate is a single attribute on a controller class, and the disabled response shape is one handler in the framework. [Rubric §11, Security] shows in the choice of 404 over 403: a disabled surface leaks nothing about whether the capability exists. [Rubric §29, Resilience and Business Continuity] applies to the conference-day intent recorded in the doc comments: these are kill switches an organizer can throw mid-event, and each is explicitly Permanent, never subject to FeatureFlagRegistry's RemoveBy check for Temporary flags.
  • Walkthrough: eight constants, all prefixed Engagement. so keys stay unambiguous in a shared configuration file, and all decorated [FeatureFlag(FeatureFlagLifetime.Permanent, Owner = "ADC Engagement")].
    • SessionBookmarks = "Engagement.SessionBookmarks" (EngagementFeatures.cs:23) gates create, list, and delete for the personal schedule; applied at BookmarksController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:34). Its <para> (EngagementFeatures.cs:17-20) states why the lifetime is Permanent: a shipped capability switch a conference chooses to run with or without, not a rollout toggle, so it carries no removal date.
    • LivePolls = "Engagement.LivePolls" (:35) gates the conference-day live layer (author, open, close, vote, results). Its summary names two controllers (:27), and both carry the gate: LivePollsController (LivePollsController.cs:39) and LivePollVotingController (LivePollVotingController.cs:34). Its <para> (:29-32) names it the conference-day kill switch for the live layer, kept so an organizer can shed it mid-event.
    • CheckIn = "Engagement.CheckIn" (:47) gates QR badge check-in (my badge, scan, manual, attendance stats); applied at CheckInsController (CheckInsController.cs:41).
    • SponsorVisits = "Engagement.SponsorVisits" (:60) gates the attendee-facing sponsor booth-visit endpoint (CheckInsController.cs:209). The doc comment (:49-58) names the operational contrast worth remembering: this flag makes every printed sponsor QR inert, while setting the Points:SponsorVisit award (20 points at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/appsettings.json:33) to zero is the softer switch that keeps the visit recorded but stops the award; its <para> (:54-57) reiterates that the flag itself is Permanent, not a rollout toggle.
    • RoomCheckIn = "Engagement.RoomCheckIn" (:72) gates the attendee-facing room self check-in endpoint (CheckInsController.cs:244). The comment (:62-70) states why it is not folded into SponsorVisits: the two surfaces are printed and retired independently, so each needs its own switch.
    • Points = "Engagement.Points" (:85) gates the whole points game, and it is the one constant enforced in two places. At the HTTP boundary it is applied at PointsController (PointsController.cs:34), so every points route (my points, leaderboard, opt-in, organizer overview) answers 404. Below it, the summary (:74-83) records two more effects: the points awarder writes nothing for any activity, as if every rule were configured to 0, and the room self check-in response reports points paused, so turning the game back on never reveals points earned while it was off (:78). Both effects come from one read: PointsSwitch.GetAwardAsync returns the configured award only when the rule is above 0 and IsEnabledAsync(EngagementFeatures.Points) is true, otherwise 0 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsSwitch.cs:22-32). PointsAwarder honors that 0 at the one write path every adapter shares (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:26-29), and RecordRoomCheckInHandler still records the check-in but reports PointsPaused instead of promising an award (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:40-45).
    • SessionQA = "Engagement.SessionQA" (:97) gates session Q&A (submit, list, moderate, upvote); applied at SessionQuestionsController (SessionQuestionsController.cs:36). Its <para> (:91-94) again names it a conference-day kill switch an organizer can shed mid-event.
    • Tickets = "Engagement.Tickets" (:110) gates the whole ticket roster surface (roster upload and delete, invites, summary, barcode claim, my tickets); applied at TicketsController (TicketsController.cs:41) and TicketRosterImportController (TicketRosterImportController.cs:34). Its summary (:99-103) frames it for a conference that does not invite its TicketLeap ticket holders, and its <para> (:104-107) gives the same Permanent reasoning as SessionBookmarks.
    • Note the nesting on CheckInsController: the class carries [FeatureGate(EngagementFeatures.CheckIn)] (:41) and two of its actions carry a second gate (:209, :244), so those two routes need both flags on. Turning CheckIn off retires the badge surface and the two attendee self-serve routes together; turning SponsorVisits off retires only the booth game.
  • Why it's built this way: ADR-031 is the decision record. Flag granularity here follows a printed-artifact and capability rule rather than a code-structure rule: each constant corresponds to something an organizer might need to retire on its own, which is why sponsor visits and room check-in are separate constants even though they share a controller, and why one Tickets constant covers two controllers that together make up one capability. Keeping the constants in the Shared assembly (not the API assembly) is what lets tests, the service host, and other layers name a flag without taking a controller dependency. Declaring every one of the eight [FeatureFlag(FeatureFlagLifetime.Permanent, ...)] with an explicit Owner records, in the attribute itself, that these are durable operational switches an organizer relies on, not rollout debt due for cleanup; each doc comment's <para> restates that same intent per flag (ADR-031).
  • Where it's used: as [FeatureGate(...)] arguments on the eight Engagement controllers listed above, as the IFeatureManager key PointsSwitch reads for Points (PointsSwitch.cs:32), and as configuration keys. All eight appear in the standalone service host's "FeatureManagement" section, all set to true: MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/appsettings.json:17-25. The same host passes the class's assembly to services.AddReloadableFeatureFlags(b.Configuration, typeof(EngagementFeatures).Assembly) (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:137), which per its comment (:131-136) layers stored overrides from the service's own database over the "FeatureManagement" configuration so an organizer can flip a kill switch without a new revision; AdminFeatureFlagsController serves those overrides at Admin/Engagement/FeatureFlags (AdminFeatureFlagsController.cs:21). The constants are also asserted directly in the API tests, for example EngagementFeatures.Points at MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Controllers/PointsControllerTests.cs:186, EngagementFeatures.Tickets at TicketsControllerTests.cs:292 and TicketRosterImportControllerTests.cs:123, and the per-action gate theory at MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Controllers/CheckInsControllerTests.cs:394-395, which pins that RecordSponsorVisitAsync carries SponsorVisits and RecordRoomCheckInAsync carries RoomCheckIn. The application tests stub the Points flag on the fake feature manager to drive the game-off path (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Points/Services/PointsAwarderTests.cs:376, MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/CheckIns/UseCases/RecordRoomCheckInHandlerTests.cs:650).
  • Caveats / not-in-source: the class doc comment (EngagementFeatures.cs:5-10) states the scope itself: the constants are used with [FeatureGate] attributes on the controllers, Points is also read by the points write path (:8), and no Engagement command implements the IFeatureGated marker (:9). So no Engagement flag is enforced by the IFeatureGated step of the CQRS pipeline (the ADC implementors are both in Conference: RefreshFromSessionizeCommand, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Events/UseCases/RefreshFromSessionize/RefreshFromSessionizeCommand.cs:14, and ScoreEventSessionsInternalCommand, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Sessions/UseCases/DecisionSupport/ScoreEventSessions/ScoreEventSessionsInternalCommand.cs:37; Engagement's roster-import internal command states it is deliberately not gated, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportInternalCommand.cs:13). Seven flags are enforced at the HTTP boundary only; Points is enforced there and, separately, by the explicit IFeatureManager read in PointsSwitch. The effective value of a flag at run time is the configuration value with any stored override applied; which overrides exist in a given environment lives in that service's database and is not determinable from source.

LinkExistingAccountsCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.LinkExistingAccounts · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/LinkExistingAccounts/LinkExistingAccountsCommand.cs:11 · Level 1 · record (sealed)

  • What it is: the organizer's explicit "link existing accounts" run for one event's roster (BR-277, UC-55): link roster tickets to accounts that already exist with a confirmed address.
  • Depends on: ITransactional, the EventIdentifierType alias; nothing external.
  • Concept: same transactional-marker shape as DeleteTicketRosterCommand. The doc comment (LinkExistingAccountsCommand.cs:5-9) adds the property that matters to an operator: the run is re-runnable, and a second run links nothing new, so retrying after a failure is safe.
  • Walkthrough: one positional parameter, EventId (:11), taken by the controller from the eventId query string.
  • Where it's used: built by TicketsController.LinkExistingAccountsAsync for POST /tickets/link-existing (TicketsController.cs:94,105-107), which carries [Idempotent] (:93) so a retried request replays the stored response, and requires EngagementPermissions.TicketsManage (:94). Validated by LinkExistingAccountsCommandValidator and handled by LinkExistingAccountsHandler (TicketsController.cs:50).

SendTicketInvitesRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.SendTicketInvites · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/SendTicketInvites/SendTicketInvitesRequestValidator.cs:9 · Level 1 · class (sealed)

  • What it is: the shape gate in front of SendTicketInvitesHandler: an invite run must name a real event.
  • Depends on: SendTicketInvitesRequest, the EventIdentifierType alias; externals: FluentValidation.
  • Concept: the request validator and its pipeline wiring are taught at CreateBookmarkRequestValidator.
  • Walkthrough: one expression-bodied constructor with one rule (SendTicketInvitesRequestValidator.cs:11-15): EventId must not equal default(EventIdentifierType), message "Event ID is required." and code "Ticket.Invites.EventIdRequired" (:15). The request's dry-run flag is a bool and needs no rule.
  • Where it's used: runs ahead of SendTicketInvitesHandler for POST /tickets/invites (TicketsController.cs:65,73); exercised in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/Validation/TicketValidatorTests.cs.

StartTicketRosterImportCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.StartRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportCommand.cs:16 · Level 1 · record (sealed)

  • What it is: the commit step of a roster upload (UC-48 step 3): a reviewed TicketLeap roster export, turned into a durable, batched import run.
  • Depends on: ITransactional, the EventIdentifierType alias, TicketRosterLimits (by reference in its doc comment); externals: ReadOnlyMemory<byte>.
  • Concept: the transactional marker is what makes "a run exists exactly when its work is queued" true. The doc comment (StartTicketRosterImportCommand.cs:5-9) states it: the request validates the file, records the run with its staged roster, and schedules the processing in the same transaction (ADR-114), so a rolled-back start leaves neither.
  • Walkthrough: two positional parameters (:16-18). EventId names the ADC event. Content is the uploaded CSV as ReadOnlyMemory<byte>, a read-only view over the bytes, capped at TicketRosterLimits.MaxFileBytes by both the controller and the validator (:10-13); that constant is 2 MB (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketRosterLimits.cs:11). The remark also records that only the parsed, whitelisted fields are staged on the run (:12).
  • Where it's used: built by TicketRosterImportController on the non-dry-run path of POST /tickets/roster (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:57,111-115), which answers 202 Accepted with the run DTO; a dry run goes to ImportTicketRosterCommand instead (:104-108). The action carries [Idempotent] and [RequestSizeLimit(TicketRosterLimits.MaxRequestBytes)] (:58-59), the request cap being the file cap plus 65536 bytes (TicketRosterLimits.cs:14). Validated by StartTicketRosterImportCommandValidator and handled by StartTicketRosterImportHandler (TicketRosterImportController.cs:38).

CheckInAttendeeRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.CheckInAttendee · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/CheckInAttendee/CheckInAttendeeRequestValidator.cs:9 · Level 2 · class (sealed)

  • What it is: the validator for the organizer scanning path. Four rules covering the badge credential, the scope, the event, and the conditionally required session.
  • Depends on: CheckInAttendeeRequest, CheckInScope, the EventIdentifierType alias; externals: FluentValidation (NotEmpty, IsInEnum, NotEqual, NotNull, When).
  • Concept introduced, the conditional rule. [Rubric §9, API & Contract Design] (assesses whether a request that means different things in different modes states which fields each mode requires). The request is one payload serving two scopes, so a flat "all fields required" rule set would be wrong for an event-scope check-in and a flat "nothing required" set would let a session check-in arrive with no session. FluentValidation's .When(...) states the mode-specific half declaratively (CheckInAttendeeRequestValidator.cs:33) instead of pushing an if into the handler. IsInEnum() is the second thing worth naming: a C# enum backed by int will happily deserialize an out-of-range number, so an enum field is not self-validating and the rule at :18-21 is the check that makes it so.
  • Walkthrough: four rules in the constructor (CheckInAttendeeRequestValidator.cs:11-34).
    • Credential NotEmpty() with message "Badge credential is required." and code "CheckIn.Credential.Required" (:13-16). Presence only: whether the credential decodes and whether it names a real badge are decided in the handler, and both failures are answered identically there for anti-oracle reasons.
    • Scope IsInEnum() with code "CheckIn.Scope.Invalid" (:18-21).
    • EventId not default(EventIdentifierType) with code "CheckIn.EventId.Required" (:23-26).
    • SessionId NotNull() with code "CheckIn.SessionId.Required", guarded by .When(x => x.Scope == CheckInScope.Session) (:29-33). The comment above it (:28) states the asymmetry outright: the event is required for both scopes, only the session is scope-conditional.
  • Why it's built this way: the event stays mandatory even for a session scan although the shared core will later overwrite it with the event Conference reports for that session (CheckInProcessor, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:145-149,195-198). Requiring it keeps the request self-describing for logs and clients; letting the server value win keeps a stale organizer screen from filing attendance under the wrong event.
  • Where it's used: runs ahead of CheckInAttendeeHandler (CheckInsController.cs:152,163).

DeleteTicketRosterCommandValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.DeleteRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/DeleteRoster/DeleteTicketRosterCommandValidator.cs:8 · Level 2 · class (sealed)

  • What it is: the shape gate in front of DeleteTicketRosterHandler: a roster delete must name a real event.
  • Depends on: DeleteTicketRosterCommand, the EventIdentifierType alias; externals: FluentValidation.
  • Concept: the request validator and its pipeline wiring are taught at CreateBookmarkRequestValidator.
  • Walkthrough: one expression-bodied constructor with one rule (DeleteTicketRosterCommandValidator.cs:10-14): EventId must not equal default(EventIdentifierType), message "Event ID is required." and code "Ticket.Roster.DeleteEventIdRequired" (:14). The code is distinct from the import validator's "Ticket.Roster.EventIdRequired", so a client can tell which roster operation refused it.
  • Where it's used: runs ahead of DeleteTicketRosterHandler for DELETE /tickets/roster (TicketsController.cs:298); exercised in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/Validation/TicketValidatorTests.cs.

LinkExistingAccountsCommandValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.LinkExistingAccounts · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/LinkExistingAccounts/LinkExistingAccountsCommandValidator.cs:8 · Level 2 · class (sealed)

  • What it is: the shape gate in front of LinkExistingAccountsHandler: a link run must name a real event.
  • Depends on: LinkExistingAccountsCommand, the EventIdentifierType alias; externals: FluentValidation.
  • Concept: the request validator and its pipeline wiring are taught at CreateBookmarkRequestValidator.
  • Walkthrough: the same single-rule shape as DeleteTicketRosterCommandValidator (LinkExistingAccountsCommandValidator.cs:10-14), with code "Ticket.LinkExisting.EventIdRequired" (:14).
  • Where it's used: runs ahead of LinkExistingAccountsHandler for POST /tickets/link-existing (TicketsController.cs:94). No file outside its own names it: it is reached only through the convention scan that registers every AbstractValidator<T>.

StartTicketRosterImportCommandValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.StartRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportCommandValidator.cs:11 · Level 2 · class (sealed)

  • What it is: the shape gate in front of StartTicketRosterImportHandler: a real event and a non-empty roster file no larger than the cap.
  • Depends on: StartTicketRosterImportCommand, TicketRosterLimits, the EventIdentifierType alias; externals: FluentValidation (Must, WithMessage, WithErrorCode).
  • Concept, one property, two rules, one code. [Rubric §9, API & Contract Design] (assesses whether a contract reports violations in a stable, machine-readable form). The two Must rules on Content share the error code "Ticket.Roster.InvalidUpload" (StartTicketRosterImportCommandValidator.cs:23,26) and differ only in message: a client branches once on "bad upload", and the message tells the human which kind. The size rule also repeats a limit the controller already enforces with [RequestSizeLimit] (TicketRosterImportController.cs:59); the validator is what holds the cap for any caller of the command that does not come through that action.
  • Walkthrough: a block-bodied constructor with two rule chains (:13-27).
    • EventId not default(EventIdentifierType), code "Ticket.Roster.EventIdRequired" (:15-18).
    • Content must not be empty, message "The uploaded roster file is empty." (:20-23), then must be at most TicketRosterLimits.MaxFileBytes (:24-26). The message is interpolated from the constant, MaxFileBytes / (1024 * 1024) (:25), so it reads "2 MB" today (TicketRosterLimits.cs:11) and cannot drift from the limit it describes.
  • Where it's used: runs ahead of StartTicketRosterImportHandler on the commit path of POST /tickets/roster (TicketRosterImportController.cs:111-113); exercised in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/Validation/TicketValidatorTests.cs.

CreateBookmarkHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.UseCases.Create · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/UseCases/Create/CreateBookmarkHandler.cs:18 · Level 9 · class (sealed partial)

  • What it is: the create-or-reactivate use case for a session bookmark. It enforces BR-21 (no duplicate), BR-49 and BR-91 (the session must be bookmarkable), and BR-135 (re-bookmarking revives the soft-deleted row instead of inserting a new one).
  • Depends on: IUnitOfWork, ISessionBookmarkValidationService (Conference-owned), UserSessionBookmarkDTOMapper, IUniqueConstraintViolationDetector, UserSessionBookmark, BookmarkManagementDomainService (called statically, not injected), ErasedUserGuard (called statically), Result / Error, ICommandHandler<in TCommand, TResult>; externals: ILogger<T> with [LoggerMessage] source generation.
  • Concept introduced, the reactivating create and the pre-check-plus-index pair. [Rubric §8, Data Architecture] (assesses whether soft-delete semantics are honored on the write path, not just filtered on reads), [Rubric §6, CQRS & Event-Driven], and [Rubric §7, Microservices Readiness]. Two ideas live here. First, under a soft-delete-everywhere policy (ADR-005) a "create" is not always an insert: the row may already exist with IsDeleted = true, and inserting a second one would both violate the unique index and orphan the audit trail. Second, a uniqueness pre-check in application code is never the guarantee, only the pleasant path: two concurrent requests can both pass it, so the database index has to be the real rule and the handler has to translate its violation back into the same domain error. Both patterns recur in PointsAwarder, which is the best evidence they are the module's convention rather than one-off defensiveness.
  • Walkthrough: five constructor dependencies (CreateBookmarkHandler.cs:18-23), then one HandleAsync (:26-94).
    • Erased-account guard before anything else (:30-34, L207): ErasedUserGuard.EnsureNotErasedAsync(unitOfWork, command.UserId, nameof(CreateBookmarkHandler), ...) refuses a still-valid token belonging to an erased account, so it cannot reactivate the bookmark its erasure soft-deleted nor leave a new one under its id; a failure is returned as-is.
    • Cross-module eligibility next (:36-39): ValidateSessionForBookmarkAsync is a Conference contract, satisfied in-process in the monolith and by a gRPC client when the modules run as separate services (ADR-007). This is the reciprocal half of the bidirectional pair: Conference calls Engagement's BookmarkCountService in the other direction, which is exactly why the AppHost deliberately omits a reciprocal WaitFor.
    • BR-21 duplicate check (:43-54) via ExistsAsync, returning Error.Conflict with code UserSessionBookmarkErrorCodes.Duplicate (:50), the shared constant whose value is "UserSessionBookmark.Duplicate" (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/UserSessionBookmarks/UserSessionBookmarkErrorCodes.cs:13). Naming the code once in the Shared assembly lets a client or a test branch on the same string the handler emits, rather than on a literal repeated at each failure site.
    • BR-135 revival lookup (:56-61): one call to FindIncludingDeletedAsync with asTracking: true, which returns the matching rows already partitioned into (Active, SoftDeleted) and lets the handler discard the active half with _. The framework calls this "the resurrection read" and documents both halves of the contract (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IRepository.cs:198-217): dropping the query filter means "include soft-deleted rows" and nothing more (the tenant filter stays in force), and asTracking: true is required because the row is about to be mutated rather than inserted, since an untracked source would leave the reactivation silently unsaved.
    • The decision itself is delegated to BookmarkManagementDomainService (:63-66): BookmarkManagementDomainService.CreateOrReactivate(deletedBookmark, ...) is called as a static method, not through an injected instance, and returns either a fresh aggregate or the revived one. The handler unwraps it in one step with if (!bookmarkResult.TryGetValue(out var bookmark)) (:65-66), so a failure returns the domain service's errors and the success path holds a non-null bookmark with no Value! dereference. The handler only decides persistence: AddAsync runs solely when there was no deleted row to revive (:68-71).
    • The save is wrapped in a filtered catch (:73-89). uniqueConstraintViolationDetector.IsUniqueConstraintViolation(exception) recognizes the unique index on (UserId, SessionId) firing, logs at Debug, and returns the SAME conflict error the pre-check produces, built from the same UserSessionBookmarkErrorCodes.Duplicate constant (:84-88), so a lost insert race reads to the caller as an ordinary 409 instead of a 500. Note the detector is INJECTED rather than a static helper, which is what keeps the provider-specific error classification swappable per database engine.
    • Success logs at Information and returns the mapped DTO (:91-93). Both log lines are [LoggerMessage] partials (:96-100), so the message templates are compiled rather than formatted per call.
  • Why it's built this way: reactivation preserves the audit fields and any scalar references pointing at the bookmark, which is the whole point of soft delete; and pushing the create-or-reactivate choice into a domain service keeps the invariant testable without a database.
  • Where it's used: resolved as ICommandHandler<CreateBookmarkRequest, Result<UserSessionBookmarkDTO>> by BookmarksController (BookmarksController.cs:38,79), which performs the ownership check first and returns 201 with a /bookmarks/{id} location on success (BookmarksController.cs:81-83). Registered by the convention scan (DependencyInjection.cs:92) and therefore wrapped by the decorator pipeline, so validation, logging, and the transaction are already applied around it.

DeleteTicketRosterHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.DeleteRoster · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/DeleteRoster/DeleteTicketRosterHandler.cs:18 · Level 9 · class (sealed partial)

  • What it is: the post-event roster delete (BR-274, UC-53). Every ticket of one event, of every source event and every status, is soft-deleted, and a later upload for the same event starts from an empty roster.
  • Depends on: IUnitOfWork, TicketImportRunGuard, Ticket, DeleteTicketRosterCommand, Result, ICommandHandler<in TCommand, TResult>; externals: ILogger<T> with [LoggerMessage].
  • Concept introduced, the bulk delete that still goes through the aggregate. [Rubric §8, Data Architecture] (assesses whether soft-delete and audit semantics hold on every write path, bulk ones included). A set-based DELETE would be faster, but it would skip both the soft-delete default (ADR-005) and the audit stamping on save. Calling ticket.Delete() per row keeps both, and the doc comment (DeleteTicketRosterHandler.cs:10-17) names the consequence that matters: the tickets leave every read and the active-row unique indexes at once.
  • Walkthrough: two constructor dependencies (:18-20), one HandleAsync (:23-55).
    • ArgumentNullException.ThrowIfNull(command) (:27), then the import guard: TicketImportRunGuard.RefuseWhileImportingAsync (:30-32; MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketImportRunGuard.cs:32) returns an error while the event's import run is active, which the doc comment says surfaces as 409 because the run would keep upserting into the deleted roster (:16).
    • A tracked GetAllAsync over every ticket with the event's id (:34-39), with no status filter, because the rule covers every status.
    • The loop counts the tickets whose Delete() succeeded (:41-46).
    • Zero deletes returns success with no save (:48-49): an event with no roster, or a repeated request, changes nothing and is harmless.
    • Otherwise one SaveChangesAsync and an Information log with the count (:51-52, partial at :57-58). The command is ITransactional, so the whole set commits or none of it does.
  • Why it's built this way: idempotent-by-outcome (an empty roster is a success, not a NotFound) lets an organizer repeat the action without reading an error, and the import guard keeps a concurrent run from resurrecting rows the delete just removed.
  • Where it's used: resolved by TicketsController as ICommandHandler<DeleteTicketRosterCommand, Result> (TicketsController.cs:49,307-309), which answers 204 for a success (:288-289). Tested in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/DeleteTicketRosterHandlerTests.cs, and used by ProcessTicketRosterImportHandlerTests.cs alongside the import run.

SendTicketInvitesHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.SendTicketInvites · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/SendTicketInvites/SendTicketInvitesHandler.cs:33 · Level 9 · class (sealed partial)

  • What it is: the invite run (BR-270, UC-49). It sends one invite per distinct order email of an event's eligible tickets (Live, unlinked, not yet invited, carrying an email), capped per run, and reports how many emails are left for the next run.
  • Depends on: IUnitOfWork, IEventLiveValidationService and its EventLiveInfo, TicketSettings, TicketImportRunGuard, Ticket, SendTicketInvitesRequest, TicketInvitesResultDTO, Result / Error, ICommandHandler<in TCommand, TResult>; externals: IOptions<T>, TimeProvider, ILogger<T>.
  • Concept introduced, the capped, re-runnable batch whose emails ride the outbox. [Rubric §10, Messaging & Integration] (assesses whether a side effect and the state change that justifies it commit together). Each invited ticket is stamped InvitedOn, and one ticket per email raises TicketHolderInvited before the save, so the outbox captures the events in the same transaction as the stamps (ADR-003; doc comment SendTicketInvitesHandler.cs:18-25): a failed save emails nobody, and a re-run emails only tickets not yet stamped. [Rubric §29, Resilience and Business Continuity] shows in the cap: MaxInvitesPerRun (default 200, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketSettings.cs:17) bounds one run's work, and the Remaining count tells the organizer to run again rather than letting one request send an unbounded batch.
  • Walkthrough: five constructor dependencies (:33-38), HandleAsync (:41-84), three private helpers.
    • Null guard, then the import guard (:45-50): while the event's roster import run is active the run is refused, because the import is still writing the roster the invites would read (:29-30).
    • ReadEligibleOrdersAsync (:107-130) filters on the four eligibility conditions (:115-119), reads tracked only when not a dry run (asTracking: !dryRun, :120), so a dry run's copies cannot be saved, and groups by order email in upload order: the email whose earliest ticket id came first goes first, ties broken by the email (:126-128).
    • The cap is clamped at zero with Math.Max and applied with Take (:54-55); the result DTO counts emails sent, tickets covered and emails remaining (:56-63). A dry run or an empty batch returns here (:65-66), before any Conference call.
    • ReadEventDetailsAsync (:89-102) asks Conference for the event's name and start date. A NotFound passes through as-is (:92-93); any other failure, or a peer that returns a blank name or a default date, becomes an Error.Unavailable with code "Ticket.Invites.EventDetailsUnavailable" (:95-101). That type is the retryable one (HTTP 503: the request was fine, a dependency did not answer; MMCA.Common/Source/Core/MMCA.Common.Shared/Abstractions/ErrorType.cs:61-67), so the run sends nothing and can be retried rather than mailing an invite that cannot name its event.
    • One invitedOn from TimeProvider for the whole run (:72), then InviteOrder per email (:73-78): every ticket of the email is MarkInvited (:134-139), and the announcer is the earliest ticket that names an attendee (:141-144), which calls AnnounceInvitation with the event's name and start date (:146). The doc comment (:22-24) says why the announcer matters: a new account created from the invite carries that attendee's name, which is what lets the UserRegistered name match link the right ticket of a multi-ticket order (BR-272).
    • One save, then an Information log with the three counts (:80-81, partial at :149-150).
  • Why it's built this way: the cap, the stamp-before-send ordering and the fail-closed event read together make the action safe to repeat: whatever happened last time, running it again sends only what is still owed.
  • Where it's used: resolved by TicketsController as ICommandHandler<SendTicketInvitesRequest, Result<TicketInvitesResultDTO>> (TicketsController.cs:45) for POST /tickets/invites (:63), whose [Idempotent] (:64) replays the first response so a retried request does not read "0 sent" (:58-61). PendingTicketInvitationService names its announcer rule as the one it mirrors (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/PendingTicketInvitationService.cs:23,83). Tested in SendTicketInvitesHandlerTests.cs.

StartTicketRosterImportHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.StartRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportHandler.cs:28 · Level 9 · class (sealed partial)

  • What it is: the synchronous half of a roster import (UC-48 step 3). It refuses a bad file at once, then records a TicketImportRun with its staged roster and schedules the processing and a privacy backstop in the same transaction.
  • Depends on: IUnitOfWork, ITicketRosterParser, IEventLiveValidationService, IInternalCommandScheduler, TicketRosterApplier, TicketImportRun, TicketRosterStaging, TicketImportRunGuard, ProcessTicketRosterImportInternalCommand, ExpireTicketRosterImportInternalCommand, TicketRosterImportRunDTO, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept introduced, refuse synchronously, process durably. [Rubric §6, CQRS & Event-Driven] (assesses whether long work leaves the request path without losing the guarantee that it runs). Everything that can refuse the file is checked here so the organizer reads it at once (StartTicketRosterImportHandler.cs:16-19); the batched work then runs as internal commands (ADR-114) scheduled inside the same transaction as the run row, so a rolled-back start leaves neither a run nor queued work (:75-76). [Rubric §30, Compliance, Privacy and Data Governance] shows in the second schedule: an expiry command at TicketImportRun.AbandonAfter (30 minutes, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketImportRun.cs:37) is the backstop that ends a stalled run and clears its staged holder data.
  • Walkthrough: six constructor dependencies (:28-34), the public AlreadyRunningCode constant (:37), HandleAsync (:40-85), two private helpers.
    • The event must exist: a failure from GetEventLiveInfoAsync, NotFound included, is returned as-is (:47-49).
    • The parser turns the bytes into a roster, its errors surfacing unchanged (:51-53).
    • Barcode collision check against the event's existing tickets, read with ignoreQueryFilters: true (:55-59) so soft-deleted rows count too, through TicketRosterApplier.FindBarcodeConflict (:60-62).
    • RetireActiveRunAsync (:91-110) finds a Queued or Running run for the event (:93-97). A live one refuses the commit with TicketImportRunGuard.AlreadyRunning (:102-105); one that has stopped moving is failed with TicketImportRun.AbandonedErrorCode and saved first (:107-109), so the one-active-run-per-event index never sees two.
    • TicketImportRun.Create with the entry count and TicketRosterStaging.Serialize(roster) (:69-71), AddAsync (:73), then a save inside the transaction so the run has its id for the two payloads (:75-77).
    • ScheduleAsync (:113-125) queues ProcessTicketRosterImportInternalCommand(runId) now (:115-119) and ExpireTicketRosterImportInternalCommand(runId) after AbandonAfter (:121-124); both carry only the run id. A scheduling failure fails the command, and the transaction with it (:79-81).
    • Success logs the run, event and total (:83, partial at :127-128) and returns the run DTO (:84).
  • Why it's built this way: an organizer uploading a file needs the file-level verdict in the response, but applying hundreds of rows on the request path would tie the request to the batch. Splitting at the run row gives both, and the abandon rule means a crashed run never blocks the event's next upload for longer than AbandonAfter.
  • Where it's used: resolved by TicketRosterImportController (TicketRosterImportController.cs:38) on the commit path of POST /tickets/roster, answering 202 Accepted with the run DTO (:111-115). Tested in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/RosterImports/StartTicketRosterImportHandlerTests.cs.

LinkExistingAccountsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.LinkExistingAccounts · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/LinkExistingAccounts/LinkExistingAccountsHandler.cs:22 · Level 11 · class (sealed partial)

  • What it is: the organizer's explicit "link existing accounts" run for one event (BR-277, UC-55). Every Live, unlinked ticket whose order email already belongs to an account with a confirmed address is linked by the BR-272 rules.
  • Depends on: IUnitOfWork, IVerifiedUserLookupService (Identity-owned), ExistingAccountLinker, LinkExistingAccountsCommand, TicketAccountLinkResultDTO, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept: a thin handler over a shared static service, the same split CheckInAttendeeHandler makes with CheckInProcessor. The linking rules live once in ExistingAccountLinker.LinkEventAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/ExistingAccountLinker.cs:42), and this handler is only the organizer-triggered entry point to them.
  • Walkthrough: four constructor dependencies (LinkExistingAccountsHandler.cs:22-26), one HandleAsync (:29-49).
    • ArgumentNullException.ThrowIfNull(command) (:33), then a single delegation passing all four dependencies and the event id to ExistingAccountLinker.LinkEventAsync (:35-41).
    • On success, an Information log of the three counts the response carries: tickets linked, tickets left for a barcode claim (an account exists, but the order holds several tickets and no name matches), and tickets with no account (:43-46, partial at :51-52; doc comment :14-16).
    • The result is returned unchanged (:48). The handler issues no save of its own.
  • Why it's built this way: the doc comment (:17-20) states the failure rule: when Identity cannot answer the lookup the run links nothing and fails, so the organizer retries instead of reading a partial answer as the whole roster's. Combined with the command's re-runnable contract, a retry is always safe.
  • Where it's used: resolved by TicketsController as ICommandHandler<LinkExistingAccountsCommand, Result<TicketAccountLinkResultDTO>> (TicketsController.cs:50) for POST /tickets/link-existing (:92,103-105). Tested in MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/UseCases/LinkExistingAccountsHandlerTests.cs.
  • Caveats / not-in-source: where the linker's writes are saved (inside ExistingAccountLinker or only by the transaction decorator around this ITransactional command) is not settled by this file and was not verified here.

CheckInAttendeeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.CheckInAttendee · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/CheckInAttendee/CheckInAttendeeHandler.cs:21 · Level 12 · class (sealed partial)

  • What it is: the organizer scanning path. A scanned (or typed) badge credential comes in, the server resolves it to an attendee, and the shared check-in core records the result.
  • Depends on: IUnitOfWork, IEventLiveValidationService, ICurrentUserService plus its CurrentUserServiceExtensions guard, BadgePayload, AttendeeBadge, CheckInProcessor, CheckInResultDTO, IReadRepository<TEntity, TIdentifierType>, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept introduced, the anti-oracle error and the credential as the sole authority. [Rubric §11, Security] (assesses whether error responses and logs avoid handing an attacker information) and [Rubric §1, SOLID]. Three security decisions are visible in this small file, each with a comment saying why. First, the attendee is NEVER taken from the request: the credential is the only input and the badge row is the sole authority on whose badge it is, while the organizer comes from the caller's token (CheckInAttendeeHandler.cs:15-20). Second, a malformed payload and a well-formed but unknown credential return the SAME error (:43-48, :55-58, via the shared BadgeNotFound() helper at :79-83), because a scanner able to distinguish them would be an oracle for guessing valid credentials. Third, the scanned credential is deliberately absent from the log line (:85-86): it is a bearer value, and a log carrying it would be a badge anyone with log access could replay.
  • Walkthrough: five constructor dependencies (:22-26), one HandleAsync (:29-77).
    • ArgumentNullException.ThrowIfNull(command) (:33), then the caller guard: currentUserService.RequireUserId("CheckIns.Forbidden") (:35-41). That is the framework's extension(ICurrentUserService) member (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35-46), which collapses the read-then-null-check-then-fail block into one call returning Result<UserIdentifierType> and defaults the classification to ErrorType.Forbidden. All four check-in handlers in this unit open the same way with the same code string.
    • BadgePayload.TryExtractCredential(command.Credential, out var credential) (:45), a Try shape so a malformed scan is an ordinary branch rather than an exception.
    • Badge lookup through GetReadRepository (:50-54), not GetRepository: nothing about the badge is mutated here, and using the read repository states that. asTracking: false reinforces it.
    • Delegation to CheckInProcessor.ExecuteAsync with badge.UserId (:60-69). Everything from target validation through idempotency to the write lives there, which is why this handler is short.
    • Logging only on success (:71-74): result.TryGetValue(out var checkIn) unwraps the CheckInResultDTO without a null-forgiving dereference, and the log carries its repeat flag so an operator can see at a glance whether a scan wrote a row or reported an existing one.
  • Why it's built this way: the two organizer entry points differ ONLY in how the attendee is identified, so the identification is all that lives in each handler and the shared rules live once in the processor (CheckInProcessor.cs:10-21), which is a static helper precisely so neither handler gains a dependency it does not own.
  • Where it's used: CheckInsController resolves it as ICommandHandler<CheckInAttendeeRequest, Result<CheckInResultDTO>> (CheckInsController.cs:49,163). The check-in it writes is what later drives AttendeeCheckedInPointsHandler through the AttendeeCheckedIn integration event.

FeedbackAnswerModel

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Feedback/FeedbackAnswerModel.cs:26 · Level 2 · class (public sealed)

  • What it is: the form model for one answer on the two attendee feedback pages. It is the two-way binding target behind every question field, the single declaration site for the free-text length rule that both pages enforce, and the one place that turns an answer back into the string it posts.
  • Depends on: QuestionDTO (its AnswerValueMaxLength constant, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Questions/QuestionDTO.cs:32) and the OptionalEmail attribute from MMCA.Common.UI.Validation. Externals: System.ComponentModel.DataAnnotations ([MaxLength]). It is consumed through ModelValidation.ForProperty and DataAnnotationsModelValidator, both from MMCA.Common.UI.
  • Concept introduced, the annotated form model as the one rule declaration. [Rubric §24, Forms, Validation & UX Safety] assesses whether input rules are declared once or restated per field. The naive Blazor shape writes a MaxLength on the markup, a Counter beside it, and a hand-rolled length check in the submit path: three copies of the same number that drift independently. Here the [MaxLength] attribute at FeedbackAnswerModel.cs:36 is the rule, AnswerValueMaxLength (:33) is the number, and the markup reads the constant for both the input cap and the character counter (EventFeedback.razor:97-98, SessionFeedback.razor:108-109). [Rubric §19, State Management] covers the other half of its job: each page's FeedbackAnswers<TAnswerId> holds a Dictionary<QuestionIdentifierType, FeedbackAnswerModel> of in-progress answers (FeedbackAnswers.cs:25) rather than editing the DTO it will eventually post, so an unsaved edit never round-trips through a server contract. [Rubric §27, Internationalization]: the ErrorMessage is not a sentence but a resource key, "Field.MaxLengthError", resolved by each page's own localizing validator (ADR-027), so the shared model produces a per-page translation without the model knowing anything about locales.
  • Walkthrough
    • public const int AnswerValueMaxLength = QuestionDTO.AnswerValueMaxLength (FeedbackAnswerModel.cs:33) does not restate the number; it reads the one declaration on the shared contract, QuestionDTO.AnswerValueMaxLength = 4000 (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Questions/QuestionDTO.cs:32). The server invariants read the same constant: EventInvariants.AnswerValueMaxLength (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Events/EventInvariants.cs:61) and SessionInvariants.AnswerValueMaxLength (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Domain/Sessions/SessionInvariants.cs:38), and those in turn size the columns (EventQuestionAnswerConfiguration.cs:26, SessionQuestionAnswerConfiguration.cs:26). So the form cap, the domain invariant and the column width are one number with one owner, and a value the form accepts is a value the table can hold.
    • TextValue (:37) is the string? bound by the plain text question type (the email type does not bind it directly), and carries the [MaxLength(AnswerValueMaxLength, ErrorMessage = "Field.MaxLengthError")] annotation (:36).
    • EmailValue (:46-50) is a second view of the same stored value: its getter and setter read and write TextValue (:48-49), so only one string is ever stored and submitted. It exists so the EMAIL question type gets its own rules without touching the text rules: [OptionalEmail(ErrorMessage = "Field.EmailError")] (:44, attribute at MMCA.Common/Source/Presentation/MMCA.Common.UI/Validation/OptionalEmailAttribute.cs:26) lets a blank answer pass (whether an answer is required stays per-question data) while a non-blank one must be a valid address, and the same [MaxLength] (:45) still caps the length. The markup binds it for the email case (EventFeedback.razor:82, SessionFeedback.razor:93).
    • RatingValue (:53) is a plain int with no annotation, because a rating is picked from a star control rather than typed (the markup's RATING branch, EventFeedback.razor:52, SessionFeedback.razor:63). Zero is the unanswered sentinel.
    • AnswerValue(string? questionType) (:58-68) is the bridge back to the wire. Any type other than "Rating" (ordinal, case-insensitive, :60) posts TextValue (:62); a rating posts its number formatted with CultureInfo.InvariantCulture when RatingValue > 0, and null otherwise (:65-67). FeedbackAnswers<TAnswerId> calls it for the required-answer check, the submit payload and the blanked-answer list, so an untouched rating counts as unanswered everywhere and is never posted.
    • The three value members are settable properties, deliberately. MudBlazor binds them two-way with @bind-... (for example @bind-Value on EmailValue, EventFeedback.razor:82), which needs a writable property, so a record with init-only members could not serve as the target. The mutability is a consequence of the binding contract, not a lapse from the workspace's required/init default.
  • Why it's built this way: the type doc (FeedbackAnswerModel.cs:8-25) records the one design tension worth understanding. Both pages render a dynamic question list, so whether a given answer is required is per-question data (QuestionDTO.IsRequired, MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Questions/QuestionDTO.cs:53), not a property of the model. A [Required] attribute here would apply to every question at once and would be wrong for most of them, so required stays on the field's own Required="@question.IsRequired" parameter (the Required parameter on each field in EventFeedback.razor) and only the length rule, which genuinely is per-value, is declared on the model. Lifting the model to a public file-level type shared by both pages, rather than a private nested holder per page, is what makes one declaration serve both forms.
  • Where it's used: seeded one instance per question by FeedbackAnswers<TAnswerId>.SetQuestions (FeedbackAnswers.cs:54), populated by its PreFill (:79, :83), read through AnswerValue on submit, and reset in place by its ClearSavedAnswer (:134-135). A separate prototype instance is constructed in each page's OnInitialized purely to build the validation delegates (EventFeedback.razor.cs:88-90, SessionFeedback.razor.cs:88-90), one for TextValue and one for EmailValue: ModelValidation.ForProperty validates the value handed to it rather than the instance, so one prototype serves the whole dynamic list.
  • Caveats / not-in-source: nothing here enforces the length. The attribute is inert until a validator runs it; the enforcement path is the pages' _validateAnswerText and _validateAnswerEmail delegates on the client and the Conference invariants on the server.

ManualCheckInRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.ManualCheckIn · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/ManualCheckIn/ManualCheckInRequestValidator.cs:9 · Level 2 · class (sealed)

  • What it is: the validator for the organizer's manual fallback. Structurally the same four rules as CheckInAttendeeRequestValidator, with one substitution.
  • Depends on: ManualCheckInRequest, CheckInScope, the UserIdentifierType / EventIdentifierType aliases; externals: FluentValidation.
  • Concept reinforced: the conditional rule and the enum check taught in the previous section apply unchanged, including the identical .When(x => x.Scope == CheckInScope.Session) guard and the same comment about the event staying required for both scopes (ManualCheckInRequestValidator.cs:28-33).
  • Walkthrough: the one line that differs is the first rule (ManualCheckInRequestValidator.cs:13-16): UserId not default(UserIdentifierType) with code "CheckIn.UserId.Required", where the scan path validates a badge Credential instead. That single substitution is the whole difference between the two paths at this layer, and it is the security-relevant one: on this endpoint the attendee is named by the caller, so the endpoint itself is organizer-only rather than the badge row being the authority. Scope (:18-21), EventId (:23-26) and the conditional SessionId (:29-33) are line-for-line the scan validator's rules, messages and error codes included.
  • Why it's built this way: identical error codes across the two paths mean a client shows the same message whichever way an organizer records the check-in, which matters because the two surfaces sit side by side on the same organizer screen.
  • Where it's used: runs ahead of ManualCheckInHandler (CheckInsController.cs:176,187).

SelfHttpWarmupTask

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/SelfHttpWarmupTask.cs:23 · Level 2 · class (sealed, internal)

  • What it is: the Engagement service's startup warm-up. Once Kestrel is listening it replays the hot bookmarks read against this host's own endpoint so routing, authentication, and the middleware pipeline are JIT-compiled before a real attendee request arrives.
  • Depends on: SelfHttpWarmupTaskBase from MMCA.Common.Aspire.Warmup; externals: ASP.NET Core (IServer, IHostApplicationLifetime, IHostEnvironment), IConfiguration, ILogger<T>.
  • Concept reinforced, the cold-start warm-up task (ADR-025). [Rubric §12, Performance & Scalability] (assesses whether first-request latency after a restart or scale-out is managed rather than paid by a user) and [Rubric §13, Observability & Operability] (assesses that readiness reflects an instance's real ability to serve). The class doc states the contract (SelfHttpWarmupTask.cs:6-17): the base class discovers the bound cleartext address, waits for the host lifetime, and issues the configured GETs; the runner registered by AddWarmupReadiness() inside AddServiceDefaults() holds /health/ready not-ready until the task has had its chance, so the orchestrator does not route traffic into a cold instance. Failures are logged and fall back to lazy warm-up on the first real request rather than blocking startup.
  • Walkthrough: a primary-constructor class forwarding all five dependencies to the base (SelfHttpWarmupTask.cs:23-29) and overriding three members.
    • Paths (SelfHttpWarmupTask.cs:33-36), one entry: bookmarks?pageNumber=1&pageSize=10. The comment above it (:31-32) ties the string to the attendee bookmark list under the module-wide [Authorize] policy (BookmarksController, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:35).
    • Name => "SelfHttpWarmup" (:39) and WarmupPaths => Paths (:42), the base's two abstractions.
    • RequireSuccessStatusCode => false (:49), the interesting override. The controller requires an authenticated caller, so the unauthenticated self-request is refused by design. The XML comment (:44-48) makes the argument: the refusal still traverses Kestrel, routing, authentication, and the whole middleware pipeline, which is exactly where the cold-start JIT cost lives, so treating a 401 as a failure would log a spurious warning on every startup.
  • Why it's built this way: the class doc (SelfHttpWarmupTask.cs:9) draws the contrast with Conference's warm-up, which also populates an output cache. This service caches nothing (its base output-cache policy is NoCache, MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:167), so the task buys pipeline JIT only, and it says so rather than pretending to prime a cache it cannot reach. The Identity service ships a same-named task with the same posture over its own hot read (SelfHttpWarmupTask).
  • Where it's used: registered with services.AddWarmupTask<SelfHttpWarmupTask>() in the Engagement service host (Program.cs:173), where the surrounding comment (Program.cs:169-172) repeats the rationale for an operator reading the host file.
  • Caveats / not-in-source: the base type decides how the bound address is discovered and whether the run is skipped under the Testing environment; this file supplies only the paths and the status-code policy.

TicketInvitationGrpcService

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service.Grpc · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/TicketInvitationGrpcService.cs:26 · Level 2 · class (public sealed)

  • What it is: the server-side gRPC endpoint that lets the Identity service ask Engagement whether an email address holds a pending ticket invitation, so Identity can re-issue an invitation whose link expired before the invitee had an account (BR-271, per the class doc at TicketInvitationGrpcService.cs:9-13).
  • Depends on: IPendingTicketInvitationService (primary constructor, :26) and the PendingTicketInvitationDTO it returns; the generated base TicketInvitationService.TicketInvitationServiceBase and the messages from ticket_invitation.proto (namespace MMCA.ADC.Engagement.Contracts.V1, :3); the IsServiceCaller() extension from ServiceCallerClaimsPrincipalExtensions (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/Authentication/ServiceCallerClaimsPrincipalExtensions.cs:21). Externals: Grpc.Core (ServerCallContext, RpcException), System.Globalization.
  • Concept, a service-only lookup that answers the minimum. [Rubric §11, Security] assesses whether authorization is enforced at every boundary rather than assumed from the caller. The answer to this call says whether an address holds a ticket, which is itself personal information, so the class enforces "services only" twice: the host maps it under the ServiceCaller policy (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:286, ServiceTokenDefaults.ServiceCallerPolicy at MMCA.Common/Source/Presentation/MMCA.Common.Grpc/Authentication/ServiceTokenDefaults.cs:29), and the method itself throws PermissionDenied unless context.GetHttpContext().User.IsServiceCaller() holds (TicketInvitationGrpcService.cs:40-43). The doc (:14-19) explains why no user token is ever in play: the one caller is Identity's anonymous sign-in link request, which has no user to forward, so Identity's client always presents its own service token. [Rubric §30, Compliance, Privacy & Data Governance] assesses data minimization: the reply carries only what a new invitation needs (first and last name, the event's name and its first day) and never the ticket id, the barcode or the order (:20-23, the response at :52-61).
  • Walkthrough: MaxEmailLength = 320 (:30) bounds the input. The one override, GetPendingTicketInvitation (:33), null-guards both arguments (:37-38), runs the service-caller check (:40-43), then answers Found = false without touching the database for a blank address or one longer than the cap (:45-48). Otherwise it awaits inner.GetPendingInvitationAsync(request.Email, context.CancellationToken) (:50) and maps a null to Found = false, or a hit to Found = true plus the names and EventStart formatted as "yyyy-MM-dd" with CultureInfo.InvariantCulture (:52-61), a date-only string because the invitation needs the first day, not an instant.
  • Why it's built this way: the same thin server-bridge shape as BookmarkCountsGrpcService and UserEngagementExportGrpcService: the lookup rules live in the in-process service, reused identically in-process and over the wire, and this class owns only the wire posture and the projection (ADR-012). The in-method caller check duplicates the endpoint policy on purpose, so a mapping change in Program.cs cannot silently open the lookup.
  • Where it's used: mapped at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:286; its client half is TicketInvitationServiceGrpcAdapter. Covered by TicketInvitationGrpcServiceTests, the integration TicketInvitationGrpcTests, and the posture checks in GrpcViewAsPostureTests.

UserSessionBookmarkChanged

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.UserSessionBookmarks.DomainEvents · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/UserSessionBookmarks/DomainEvents/UserSessionBookmarkChanged.cs:21 · Level 2 · record (sealed)

  • What it is: the domain event the UserSessionBookmark aggregate raises when a bookmark is created, reactivated, or soft-deleted. It is the one event in this unit with a live subscriber.
  • Depends on: BaseDomainEvent, DomainEntityState, the UserSessionBookmarkIdentifierType / UserIdentifierType / SessionIdentifierType aliases.
  • Concept introduced, the identity hole in a create-time domain event. [Rubric §4, DDD] and [Rubric §8, Data Architecture] (assesses whether the code accounts for what the database, not the object graph, actually decides). The BR-60 single-event shape (one event carrying DomainEntityState instead of an event type per transition) is the module's convention, and this file adds a lesson on top of it. The BookmarkId parameter doc (UserSessionBookmarkChanged.cs:12-18) says the field is ZERO whenever a brand-new bookmark raises Added: identity is generated by the INSERT, the positional record captures the value before that INSERT runs, and nothing re-stamps it afterwards. A reactivated bookmark does carry its real id, because that row already exists. The consequence is stated in the same doc and is the part to remember: handlers correlate on UserId and SessionId, which are both set before the event is raised, and never on BookmarkId. That is a general trap with value-captured events over database-generated keys, not a quirk of this aggregate.
  • Walkthrough: four positional members (UserSessionBookmarkChanged.cs:21-26): State, BookmarkId, UserId, SessionId. Three raise sites, and the shape earns its keep at each: Create raises Added with the still-zero id and a comment saying so (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/UserSessionBookmarks/UserSessionBookmark.cs:55-57); Reactivate raises Added again, and only when Undelete() succeeded (UserSessionBookmark.cs:69-73), which is BR-135 in one line, so a subscriber counting bookmarks sees "one more bookmark exists" for both a fresh star and a revived one; Delete raises Deleted, and only when the soft delete actually flipped (UserSessionBookmark.cs:84-88), so a second delete of an already-deleted bookmark raises nothing and subscribers cannot observe a duplicate fact.
  • Why it's built this way: carrying SessionId as well as UserId means a subscriber can act on the session dimension without loading the aggregate, which is exactly what the one subscriber does.
  • Where it's used: UserSessionBookmarkCacheEvictionHandler subscribes as IDomainEventHandler<UserSessionBookmarkChanged> (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/DomainEventHandlers/UserSessionBookmarkCacheEvictionHandler.cs:43-46) and broadcasts an output-cache eviction to Conference so its cached session reads stop serving a stale bookmark count. Its doc explains why the DOMAIN event is the right hook (:23-30): the create path has a bespoke handler, but the delete path runs on the framework's generic DeleteEntityCommand and has no ADC handler at all, whereas the aggregate raises this one event on all three paths that move a count. Also raised in the domain tests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Domain.Tests/UserSessionBookmarks/UserSessionBookmarkTests.cs:45,58,77,105).
  • Caveats / not-in-source: the per-session bookmark count Conference consumes is served by a live query in BookmarkCountService, not by projecting this event; the subscriber only invalidates Conference's cache of that number. Do not read the event as the backing mechanism for the count itself.

FeedbackAnswers<TAnswerId>

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Feedback/FeedbackAnswers.cs:15 · Level 3 · class (internal sealed, generic)

  • What it is: the answer state of one feedback form, shared by the session and the event feedback pages: the questions in display order, one FeedbackAnswerModel per question, the ids of the answers already saved, and the required questions left unanswered at the last submit. TAnswerId (constrained to struct, FeedbackAnswers.cs:16) is the saved answer's identifier type, so the same class serves both pages.
  • Depends on: FeedbackAnswerModel, QuestionDTO, the QuestionIdentifierType alias. Externals: System.Globalization, LINQ.
  • Concept introduced, page state as a plain class beside a thin page. [Rubric §18, UI Architecture] assesses whether components stay containers while logic lives in testable types. The class doc (FeedbackAnswers.cs:6-13) states the split: the pre-fill, required-answer and submit-payload rules live here in one place, while each page keeps the service calls and every user-visible side effect (toasts, navigation, the dirty flag). [Rubric §19, State Management]: the page discards a stale form by replacing one object (_answerState = new()) rather than clearing four fields, and the generic parameter is what lets SessionFeedback (FeedbackAnswers<SessionQuestionAnswerIdentifierType>) and EventFeedback (FeedbackAnswers<EventQuestionAnswerIdentifierType>) share it without a base page class. [Rubric §24, Forms, Validation & UX Safety]: the required gate here covers what MudForm cannot, because a star rating is not a form input (:30-34).
  • Walkthrough
    • State (:18-35): the private _missingRequired set (:18) and _existingAnswerIds map from question to saved answer id (:19); the public Questions list (:22) and Answers dictionary (:25), both privately settable; HasExistingFeedback (:28), true when any saved id exists, which picks the page's "Update" versus "Submit" button text; and MissingRequired (:35), the read-only view the markup binds to each field's inline error (EventFeedback.razor:61, :75).
    • HasSavedAnswer (:40) and TryGetSavedAnswerId (:46-47) expose the saved ids, which is what drives the per-question Clear button and the delete call.
    • SetQuestions (:51-55) orders the questions by Sort (:53) and starts one blank model per question (:54).
    • PreFill (:63-86) takes (QuestionId, AnswerId, AnswerValue) tuples. The caller filters to its own session or event first, because questions are shared across sessions and events and a foreign answer would match by question id (the doc at :57-61). It skips a question that is not on the form (:69-72), records the saved id (:74), and writes a Rating question's value through int.TryParse with the invariant culture into RatingValue (:76-79) and anything else into TextValue (:83).
    • FlagMissingRequiredAnswers (:93-103) clears the set and adds every required question whose AnswerValue is blank, for every question type, returning true when any gap exists.
    • PendingAnswers (:107-112) projects the answered questions into the one POST-as-upsert payload, leaving blanks out.
    • BlankedSavedAnswers (:120-125) is the counterpart: the saved answers the reader has since blanked. The doc (:114-118) names the bug it prevents: the upsert has no delete semantics and PendingAnswers drops blanks, so without this list a submit would report success while the old answer survived on the server.
    • ClearSavedAnswer (:129-137) forgets a saved id the server deleted and blanks its model (TextValue = null, RatingValue = 0, :134-135; EmailValue follows TextValue).
  • Why it's built this way: every rule that decides "is this answered" routes through FeedbackAnswerModel.AnswerValue, so the required check, the payload and the blanked list cannot disagree about what an unanswered rating is. Keeping I/O out means the class has no dependencies to fake and the pages stay within the code-behind size convention the class doc cites.
  • Where it's used: held as _answerState by EventFeedback (EventFeedback.razor.cs:65) and SessionFeedback (SessionFeedback.razor.cs:65), and bound from both pages' markup. Exercised through the page component tests (EventFeedbackTests, SessionFeedbackTests).
  • Caveats / not-in-source: the class is internal, so it is not part of the Engagement UI assembly's public surface; no dedicated unit-test class for it was established from the brief's usage sites.

TicketClaimRateLimiting

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.RateLimiting · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/RateLimiting/TicketClaimRateLimiting.cs:30 · Level 3 · class (public static)

  • What it is: the per-client-address budget on the attendee ticket claim endpoint (S-ADC-identity-03, per the class doc at TicketClaimRateLimiting.cs:13-22): at most MaxClaimAttemptsPerClientIp claims per ClaimAttemptWindowMinutes from one public address, whichever accounts they come from, on top of the per-account budget the claim handler keeps. It is one named ASP.NET Core rate-limiter policy plus the pure functions that pick its partition.
  • Depends on: TicketSettings (the budget and the window, bound through IOptions<TicketSettings>) and RateLimitPartitions.FixedWindowWithRemainingRetryAfter from MMCA.Common.API.RateLimiting (:9). Externals: Microsoft.AspNetCore.RateLimiting (RateLimiterOptions), System.Threading.RateLimiting (RateLimitPartition), System.Net / System.Net.Sockets (IPAddress, AddressFamily), Microsoft.Extensions.Options.
  • Concept, an IP budget that counts only attributable addresses. [Rubric §11, Security] assesses whether an endpoint that answers a guessable secret (here a ticket barcode) bounds how fast one client can guess. A per-account budget alone does not: an attacker spreads attempts across fresh accounts. This policy adds the address dimension, the same shape as the framework's auth-ip policy on the credential endpoints (:17-19). The remarks (:23-29) state the one subtlety: only PUBLIC addresses are counted. The web UI's server-rendered calls reach the service from a private address inside the deployment with no X-Forwarded-For, so counting that address would pool every web attendee into one bucket; a private, loopback, link-local or unknown address therefore gets no limiter here and stays bounded by the per-account budget. The window is counted per replica.
  • Walkthrough
    • PolicyName = "ticket-claim-ip" (:33) is the name the claim action names in [EnableRateLimiting]; UnattributedPartitionKey = "__unattributed" (:36) is the key every unattributable address shares, and that partition is never limited.
    • AddTicketClaimRateLimiting() (:46-53, a C# 14 extension(IServiceCollection services) block at :38) configures RateLimiterOptions from the bound TicketSettings and adds the policy (:48-50). It is additive to the host's own AddRateLimiter registration, so the framework's rejection handling (429 with Retry-After) applies unchanged (the doc at :40-44).
    • Partition(HttpContext, TicketSettings) (:63-76) null-guards both arguments (:65-66), derives the client key from Connection.RemoteIpAddress (:68), which the shared pipeline has already resolved from the gateway's X-Forwarded-For (:19-21), and returns RateLimitPartition.GetNoLimiter(UnattributedPartitionKey) when the key is null or either setting is <= 0 (the switch-off), otherwise a fixed window of MaxClaimAttemptsPerClientIp permits over ClaimAttemptWindowMinutes (:70-75).
    • PublicClientKey(IPAddress?) (:86-101) returns null for a missing or loopback address (:88-89), maps an IPv4-mapped IPv6 address back to IPv4 (:91-92), keys a public IPv4 address by its string (:94-95) and a public IPv6 address by its /64 prefix (:97-98), so rotating addresses inside one allocated subnet is still one client.
    • IsNonPublicIPv4 (:110-118) rejects 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10 (shared address space), 169.254.0.0/16, 172.16.0.0/12 and 192.168.0.0/16 by a byte switch; IsNonPublicIPv6 (:123-127) rejects link-local, site-local, unique-local and the unspecified address; IPv6Prefix64 (:132-133) hex-encodes the first eight bytes and appends ::/64.
  • Why it's built this way: an app-side named policy rather than a hand-written counter means the limiter, the 429 and the Retry-After header all come from the host's one UseRateLimiter, and the claim action opts in with one attribute. Exposing Partition and PublicClientKey as public static functions keeps the address rules unit-testable without a running pipeline. The defaults are 10 attempts per 60 minutes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/TicketSettings.cs:41, :30); a 0 for either turns the budget off rather than refusing every claim.
  • Where it's used: registered by the Engagement API DependencyInjection (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/DependencyInjection.cs:64) and applied to the claim action by [EnableRateLimiting(TicketClaimRateLimiting.PolicyName)] on TicketsController (TicketsController.cs:135). The per-account half of the budget is ClaimTicketHandler's (its doc at ClaimTicketHandler.cs:26-29). Covered by TicketClaimRateLimitingTests and TicketsControllerTests.
  • Caveats / not-in-source: the window is per replica (:28), so the effective ceiling across a scaled-out service is the budget times the replica count.

EngagementBrokerConsumers

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:20 · Level 4 · class (internal static)

  • What it is: the list of integration events the Engagement service host subscribes to on the broker, held in one static Register method that the host hands to AddBrokerMessaging.
  • Depends on: IBrokerConsumerBuilder and the six event contracts it registers: AttendeeCheckedIn, SessionFeedbackSubmitted, EventFeedbackSubmitted, UserDeleted, UserRegistered and UserEmailVerified.
  • Concept, the subscription list as an assertable value. [Rubric §6, Event-Driven Architecture] assesses whether the events a service consumes are explicit and checkable rather than implied by wiring. The class doc (EngagementBrokerConsumers.cs:9-12) gives the reason for the file: kept out of Program.cs, the subscriptions this host declares can be asserted without booting the host (the ConferenceBrokerConsumers precedent). [Rubric §7, Microservices Readiness]: the remarks (:13-19) record the topology decision that makes a shared event safe. Every subscription lands on this host's one queue (MessageBus:QueueName), and Conference consumes UserRegistered and UserDeleted on its own queue, so each registration (the BR-272 ticket link here, the BR-207 speaker auto-link there) and each erasure reaches both services instead of the two competing for one copy.
  • Walkthrough: Register(IBrokerConsumerBuilder consumers) (:24) chains six RegisterIntegrationEventConsumer<T>() calls (:26-31): AttendeeCheckedIn (the check-in points award), SessionFeedbackSubmitted and EventFeedbackSubmitted (the feedback points awards), UserDeleted (the per-aggregate erasure handlers), and UserRegistered plus UserEmailVerified (the ticket-link handlers). Each registration routes a delivered message through the framework's inbox-guarded consumer (IntegrationEventConsumer<TEvent>) to the in-process handlers for that event, for example AttendeeCheckedInPointsHandler, UserDeletedPointsHandler and UserRegisteredTicketLinkHandler.
  • Why it's built this way: a broker subscription that silently disappears stays invisible until points or erasures stop happening, so the list is a plain value a unit test can read and a bicep test can compare against the deployed Service Bus topology. Redelivery is safe because the consumer side is idempotent (ADR-021), and the transport is the framework's own broker layer (ADR-118). The check-in and points flow these subscriptions serve is ADR-072.
  • Where it's used: passed as EngagementBrokerConsumers.Register to AddBrokerMessaging in the host (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:231, with the numbered comment at :178-186). Asserted by BrokerConsumersTests and cross-checked against the infrastructure template by BrokerTopologyBicepTests.

EventFeedback

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Feedback/EventFeedback.razor.cs:17 · Level 4 · class (partial)

  • What it is: the code-behind for the attendee event-feedback page (@page "/feedback/event/{EventId:int}", EventFeedback.razor:1). It loads the event name and its dynamic question set, pre-fills any answers the attendee already submitted, posts the answered questions back as a single atomic upsert (BR-107, per the class doc comment at EventFeedback.razor.cs:13-16), then deletes any saved answer the attendee blanked. A refused submit reports the server's own stated message and lists its field errors in the page's ErrorSummary, while an unexpected fault keeps a generic toast. A failed load offers a Retry, while an event that does not exist does not. The route id arrives already typed ([Parameter] EventIdentifierType EventId, :25) and a change of that id reloads the form in place.
  • Depends on: IQuestionLookupService, IEventFeedbackUIService, IEventLookupService, IToastService, QuestionDTO, EventQuestionAnswerDTO, FeedbackAnswers<TAnswerId> (the answer state, :65), FeedbackAnswerModel, ModelValidation, DataAnnotationsModelValidator, LatestLoadGuard (the superseding-load guard, :40) and DetailLoadState (through the markup's DetailLoadStateContent, EventFeedback.razor:27). Externals: Blazor NavigationManager, MudBlazor MudForm / BreadcrumbItem, System.Globalization, and from the markup an injected IStringLocalizer<EventFeedback> L (EventFeedback.razor:8) plus the shared UnsavedChangesGuard (EventFeedback.razor:12) and ErrorSummary (EventFeedback.razor:125) components. The failure path also uses the Result type's HasErrorType helper with ErrorType.Unexpected and the NotifyOnFailure toast extension from ResultUiExtensions (EventFeedback.razor.cs:264, :269), and the submit and delete awaits take LifetimeToken.
  • Concept: the dynamic feedback form (the answer state, the validation delegates, the required-answer gate, the UnsavedChangesGuard pairing and the StateHasChanged-before-navigate ordering) is taught on SessionFeedback and is the same shape here: both pages hold their questions, answers, saved ids and missing-required set in one FeedbackAnswers<TAnswerId>, here closed over EventQuestionAnswerIdentifierType (:65). The submit strategy matches the session page: SubmitFeedbackAsync calls FeedbackService.SubmitAnswersAsync once with the whole answered set (EventFeedback.razor.cs:218), so the server applies the batch atomically and there is nothing partial left to report. [Rubric §24, Forms, Validation & UX Safety] still applies: an unanswered required question, rating included, is caught locally before any request (:199-203), an empty submit on an all-optional form sends no batch (:216), and a failed submit leaves _isDirty set so the same Submit button retries. Two things carry over from the session page. First, the submit and delete awaits read LifetimeToken (:32, _cts.LifetimeToken()) instead of _cts.Token: reading Token off a disposed source throws ObjectDisposedException, whereas Dispose cancels before it disposes, so a handler resuming after navigation gets a cancelled token and exits through its OperationCanceledException path. Second, a refused submit goes through ReportSubmitFailure (:261-270): any refusal other than ErrorType.Unexpected is stored in _submitResult (:80, :264-267) so ErrorSummary lists its field errors after the snackbar times out, and one NotifyOnFailure(Toast, L, fallback: L["Snackbar.SubmitFailed"].Value) call (:269) does the toasting for both cases: with a fallback supplied, an ErrorType.Unexpected result (a 500, transport failure or timeout) shows the page's generic Snackbar.SubmitFailed wording instead of its diagnostic text, while a refusal the server stated shows the server's own localized message (MMCA.Common/Source/Presentation/MMCA.Common.UI/Common/ResultUiExtensions.cs:277-279; ADR-027 Decision 9 carve-out per the method's doc comment, EventFeedback.razor.cs:255-260). _submitResult is cleared at the start of each submit (:206).
  • Walkthrough of what differs from SessionFeedback
    • There is no precondition gate and no _preconditionMessage: an event either loads or it does not. OnInitialized (EventFeedback.razor.cs:85-97) builds both validation delegates, _validateAnswerText and _validateAnswerEmail, from one prototype FeedbackAnswerModel and one DataAnnotationsModelValidator(L) (:87-90), and also builds the breadcrumb trail (:91-96).
    • Loading is parameter-driven. OnParametersSetAsync (:99-108) compares EventId with _loadedEventId (:39); a feedback deep link to another event while this form is open reuses the routed instance with only a new EventId, so a new id starts LoadFormAsync (:110) and an unchanged id does nothing.
    • LoadFormAsync (:110-185) first calls _load.Begin() (:113), which supersedes and cancels the previous event's load, then resets everything that belonged to the previous form, _loadNotFound and _answerState = new() included (:116-122). It resolves the event name from EventLookup.GetAllAsync(token) (:127), setting a localized _loadError when the lookup itself fails (:131); when the id is absent from it, it also sets _loadNotFound (:141-142). That flag (:61) picks the markup's DetailLoadStateContent state (EventFeedback.razor:27): NotFound for an event that does not exist, otherwise Failed with a Retry wired to LoadFormAsync. Each await is followed by token.ThrowIfCancellationRequested() (:128, :148, :160), so a superseded load stops rather than writing stale state. The rest (the "Event" questions handed to _answerState.SetQuestions at :156, the saved answers fetched at :159) matches the session page step for step. A cancelled load is swallowed (:173-176), and IsLoading is cleared only when _load.IsCurrent(generation) still holds (:177-184), so a superseded load leaves the flag to the load that replaced it.
    • The pre-fill applies the same cross-entity guard in the page: _answerState.PreFill receives only answers whose EventId matches the current event (:169-171, the filter at :170), because questions are shared across events.
    • SubmitFeedbackAsync (:187-253) validates the form, then runs _answerState.FlagMissingRequiredAnswers(), and returns with a Snackbar.RequiredFields warning if either fails (:189-203). It takes pending from _answerState.PendingAnswers() (:212); if it is non-empty it posts the whole set in one call to SubmitAnswersAsync(EventId, ...) (:216-218), and on failure calls ReportSubmitFailure and returns with _isDirty still set (:219-223). It then deletes every saved answer the attendee blanked, from _answerState.BlankedSavedAnswers(), through TryDeleteSavedAnswerAsync, stopping at the first failed delete with the form still dirty (:229-235), so a submit never reports success while an old answer survives. Only then does it clear _isDirty and toast Snackbar.FeedbackSubmitted with pending.Count (:237-238). The id is the typed parameter, so there is no parse step.
    • DeleteAnswerAsync (:272-287) and the submit's blanked-answer loop share TryDeleteSavedAnswerAsync (:295-311): it returns true when no saved id exists, calls FeedbackService.DeleteAnswerAsync(EventId, answerId, LifetimeToken) (:302), toasts Snackbar.ClearAnswerFailed and returns false on failure (:305-306), and otherwise calls _answerState.ClearSavedAnswer (:309). A cleared answer leaves _isDirty as it is (:276-277): the delete commits only that answer on the server, so unsaved edits to other answers keep the unsaved-changes guard armed.
    • NavigateBack (:313-314) returns to the Conference event detail route, formatting the id with CultureInfo.InvariantCulture. The disposable pattern (:316-339) cancels and disposes _cts and disposes _load (:327-329).
  • Why it's built this way: the page owns orchestration only, all I/O goes through injected UI service interfaces, which keeps it testable under bUnit and swappable per host. A single batch SubmitAnswersAsync call removes the partial-save case entirely: a refusal means nothing was written, so the retry story is a plain resend rather than a per-question accounting. Reloading from OnParametersSetAsync behind a LatestLoadGuard means a route change to a different event cannot leave the previous event's questions or answers on screen, or let a slow earlier load overwrite a newer one. Sharing the answer state with SessionFeedback through FeedbackAnswers<TAnswerId> rather than through a base page class keeps each page self-contained while the answer rules exist once.
  • Where it's used: rendered at /feedback/event/{EventId:int}, reached from the public event detail page's SubmitFeedback (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Events/PublicEventDetail.razor.cs:196). The same route is also expressed as EngagementRoutePaths.EventFeedback(eventId) (EngagementRoutePaths.cs:17). Its dependencies are registered by the Engagement UI DependencyInjection. Component-tested by EventFeedbackTests.
  • Caveats / not-in-source: the markup, the resource strings and UnsavedChangesGuard's own behavior live outside this file; this section covers the code-behind plus the bindings its members exist to serve.

VerifiedParticipantGrpcService

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service.Grpc · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/VerifiedParticipantGrpcService.cs:22 · Level 5 · class (public sealed)

  • What it is: the server-side gRPC endpoint that publishes Engagement's in-process IVerifiedParticipantService to Conference.Service, whose session and event feedback writes must pass the same verified-participant rule (S-ADC-identity-02) the Engagement writes pass (class doc at VerifiedParticipantGrpcService.cs:9-13). Only Engagement's ticket rows can answer the linked-ticket half of that rule, so Conference asks over the wire.
  • Depends on: IVerifiedParticipantService (primary constructor, :22); the generated base VerifiedParticipantService.VerifiedParticipantServiceBase and the IsVerifiedParticipantRequest / IsVerifiedParticipantResponse messages from verified_participant.proto (namespace MMCA.ADC.Engagement.Contracts.V1, :2); the ThrowIfFailure() extension from MMCA.Common.Grpc (:4), whose exception the GrpcResultExceptionInterceptor turns into an RpcException; GetUserId() from MMCA.Common.Shared.Auth (:5, see ClaimsPrincipalExtensions). Externals: Grpc.Core (ServerCallContext, RpcException, Status).
  • Concept, a user-token edge that answers only about the caller. [Rubric §11, Security] assesses whether every exposed surface states its authorization posture and enforces it at the boundary. The doc (:14-19) sets the posture: the host maps the service under the default policy, which authenticates only the forwarded user bearer, so a service token never reaches the method (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:293, rationale at :288-292). Authenticated is not enough, though: the rule's email half reads the caller's own token, and an answer about another account would say whether that account holds a ticket. So the method throws PermissionDenied unless context.GetHttpContext().User.GetUserId() equals request.UserId (:33-36). Contrast TicketInvitationGrpcService, a service-only edge with no user to forward, and BookmarkCountsGrpcService, anonymous because its payload carries no personal data.
  • Walkthrough: one override, IsVerifiedParticipant(request, context) (:26-46). It null-guards both arguments (:30-31), runs the own-account check (:33-36), awaits inner.IsVerifiedParticipantAsync(request.UserId, context.CancellationToken) (:38-40), calls result.ThrowIfFailure() so a Result failure travels as a gRPC status through the interceptor (comment at :42, call at :43), and returns Verified = result.Value (:45).
  • Why it's built this way: the same thin server-bridge shape as the other Engagement gRPC services: the rule lives once in the in-process service and is reused identically in-process and over the wire (ADR-012), while this class owns only the wire posture. Unlike the bare-value bridges, the interface returns a Result, so the class unwraps it with ThrowIfFailure and lets the interceptor own the failure-to-status mapping instead of hand-building a status here.
  • Where it's used: mapped at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:293; its client half is VerifiedParticipantServiceGrpcAdapter, used by Conference. Covered by VerifiedParticipantGrpcServiceTests, the integration VerifiedParticipantGrpcTests and VerifiedParticipantServiceGrpcAdapterTests.

SessionFeedback

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Feedback/SessionFeedback.razor.cs:16 · Level 7 · class (partial)

  • What it is: the code-behind for the attendee session-feedback page (@page "/feedback/session/{SessionId:int}", SessionFeedback.razor:1). It checks three business preconditions before it will render the question form at all, then loads the dynamic question set, pre-fills any answers the attendee already submitted, posts the whole form back in one atomic call, and deletes any saved answer the attendee blanked. The question, answer and saved-id state sits in a FeedbackAnswers<TAnswerId> instance closed over SessionQuestionAnswerIdentifierType (:65), so this class holds the lifecycle, the preconditions and the I/O.
  • Depends on: IQuestionLookupService, ISessionFeedbackUIService, IEntityService<TEntityDTO, TIdentifierType> (bound as IEntityService<SessionDTO, SessionIdentifierType>, SessionFeedback.razor.cs:20), IToastService, FeedbackAnswers<TAnswerId>, LatestLoadGuard, DetailLoadState (through the markup's DetailLoadStateContent, SessionFeedback.razor:27), SessionDTO, QuestionDTO, FeedbackAnswerModel, ModelValidation and DataAnnotationsModelValidator, SessionStatuses.IsEligible for the BR-49 check, plus the IsNotFound() result extension from MMCA.Common.UI.Common. Externals: Blazor NavigationManager, MudBlazor MudForm / BreadcrumbItem, and from the markup an injected IStringLocalizer<SessionFeedback> L (SessionFeedback.razor:8), the shared UnsavedChangesGuard component (SessionFeedback.razor:12) and ErrorSummary (SessionFeedback.razor:136). The failure path also uses the Result helper HasErrorType with ErrorType.Unexpected and the NotifyOnFailure toast extension from ResultUiExtensions (SessionFeedback.razor.cs:292, :297).
  • Concept introduced, the precondition-gated dynamic form. [Rubric §18, UI Architecture] assesses component/logic separation: the markup lives in SessionFeedback.razor, the behavior in this partial class, and the form's answer state in FeedbackAnswers<TAnswerId>, so the page's flow is reviewable apart from its layout and its state rules. [Rubric §24, Forms, Validation & UX Safety] is the load-bearing category here and it shows up four times. First, CheckPreconditions (SessionFeedback.razor.cs:191) refuses before rendering inputs, so when feedback is not permitted the attendee gets one sentence explaining why rather than a form that fails on submit. Second, validation is declarative and single-sourced: _validateAnswerText (:73) and _validateAnswerEmail (:77) are two delegates built from FeedbackAnswerModel's annotations (TextValue and EmailValue) and handed to the text and email fields respectively, so the 4000-character rule is never written twice and the email-format rule lives on the model rather than in the page. Third, a required check covers what MudForm cannot: a star rating is not a form input, so form validation never blocks an unanswered required rating, and the missing-required set on the answer state (FeedbackAnswers<TAnswerId>.MissingRequired, filled by FlagMissingRequiredAnswers, called at :227) does, for every question type, and drives the inline error on each question's field (SessionFeedback.razor:72, :86). Fourth, UnsavedChangesGuard IsDirty="_isDirty" wraps the page, so navigating away with unsaved edits prompts first. The dynamic part is the interesting one: the questions are data, not markup, so the render branches on the DTO's QuestionType. A RATING question gets the star control (SessionFeedback.razor:63); anything else goes through a switch over question.QuestionType?.ToUpperInvariant() (SessionFeedback.razor:88) that picks an email MudTextField bound to EmailValue and validated by _validateAnswerEmail (case "EMAIL", :90-93) or a three-line multiline MudTextField (:106), and each field's required flag and RequiredError come from the DTO rather than from the page. [Rubric §19, State Management] covers the answer state; [Rubric §27, i18n] covers the fact that every visible string, error messages included, is an L["..."] lookup.
  • Walkthrough (teaching order)
    • Injected services (SessionFeedback.razor.cs:18-22) and the [Parameter] SessionIdentifierType SessionId (:24) arrive from the route. The parameter is the typed id alias, and the route template carries the :int constraint (SessionFeedback.razor:1), so the router parses it and the page needs no parse step.
    • LifetimeToken (:31, _cts.LifetimeToken()) is the token the submit and delete awaits use. Reading Token off a disposed CancellationTokenSource throws ObjectDisposedException; Dispose cancels before it disposes, so a handler resuming after the attendee navigated away gets a cancelled token and stops through its OperationCanceledException path (:28-30).
    • IsLoading / IsSubmitting (:41-42) and SubmitButtonText (:44-55) drive the chrome: the button reads "Submitting" while a post is in flight, then "Update" or "Submit" depending on _answerState.HasExistingFeedback (:53). The private state fields hold the load error (:57), the _loadNotFound flag that says the error reports a session that does not exist rather than a failed load (:59-60), the precondition message (:61), the session title (:62), the _answerState (:65), the MudForm reference (:66), the _isDirty flag (:67), the two validation delegates (:73, :77) and _submitResult (:80), the last submit's refusal kept so ErrorSummary can list its field errors. MarkDirty (:82) is the one-line handler every input's @bind-...:after calls.
    • OnInitialized (:85-97) builds both delegates once, by handing a throwaway FeedbackAnswerModel prototype, the model => model.TextValue and model => model.EmailValue selectors and one DataAnnotationsModelValidator(L) to ModelValidation.ForProperty (:87-90), and builds the three-item breadcrumb trail (:91-96). The strongly-typed ForProperty overload (MMCA.Common/Source/Presentation/MMCA.Common.UI/Validation/ModelValidation.cs:69) is the right one here because these fields have no For expression and the value being validated has not been written to a model yet; the localizer resolves the ErrorMessage resource key (ADR-027).
    • Loading is parameter-driven. OnParametersSetAsync (:99-108) compares SessionId with _loadedSessionId (:38); a feedback deep link to another session while this form is open reuses the routed instance with only a new SessionId, so a new id starts LoadFormAsync (:110) and an unchanged id does nothing. LoadFormAsync begins with _load.Begin() (:113), which supersedes and cancels the previous session's load, and resets everything that belonged to the previous form, including _loadNotFound = false and _answerState = new() (:116-123).
    • It then loads the session through SessionService.GetByIdAsync(SessionId, false, token) (:128). The failure branch (:130-139) splits the two reasons apart: _loadNotFound = sessionResult.IsNotFound() (:134) picks the page's own "session not found" wording for a genuine 404 and the generic load failure for anything else (:135-137). The same flag drives the markup's DetailLoadStateContent (SessionFeedback.razor:27), which offers a Retry wired to LoadFormAsync for a failed load and none for a session that does not exist.
    • CheckPreconditions(session) runs next (call at :143), and a returned message stops the load before any questions are fetched (:144-148). Only then does it load the "Session" questions (:151), hand them to _answerState.SetQuestions (:160), fetch the attendee's saved answers (:163), and pre-fill with _answerState.PreFill over only the answers whose SessionId matches this session (:171-175, the filter at :174): questions are shared across sessions, so a foreign answer would otherwise match by question id. Each await is followed by token.ThrowIfCancellationRequested() (:129, :152, :164); OperationCanceledException is swallowed as expected on disposal or supersession (:177-180), and in finally IsLoading is cleared only when _load.IsCurrent(generation) still holds (:181-188), so a superseded load leaves the flag to the load that replaced it.
    • CheckPreconditions (:191-213) encodes three rules, each returning a localized message. BR-91 rejects service sessions (session.IsServiceSession, :194). BR-49 rejects any session SessionStatuses.IsEligible does not allow, an unset Status or "Accepted" (case-insensitive) are the only eligible values (:200), the same shared allow-list Conference applies elsewhere. BR-16 rejects unscheduled sessions, where StartsAt or EndsAt is null (:207), because session feedback is a time-gated action. Returning null means feedback is allowed.
    • SubmitFeedbackAsync (:215) validates the form and toasts a warning if it is invalid (:222), then runs _answerState.FlagMissingRequiredAnswers() and toasts the same Snackbar.RequiredFields warning and returns when it reports a gap (:227-231), so an unanswered required rating, or an entirely empty submit on a form with a required question, never reaches the server. It then takes the answered questions as a pending list of (QuestionId, AnswerValue) tuples from _answerState.PendingAnswers() (:240), which drops blanks. An empty list (possible only when every question is optional) sends no batch, rather than a request the batch endpoint would refuse as empty (:242-244). Otherwise it makes one call, FeedbackService.SubmitAnswersAsync(SessionId, pending, LifetimeToken) (:246), which the interface documents as applied atomically server-side (IFeedbackUIService.cs:52-59). _submitResult is reset to null first (:234). A failure therefore wrote nothing: the page calls ReportSubmitFailure(result) (:249, defined :289-298) and returns with _isDirty still set, so the same Submit button retries. That method stores any result that is not ErrorType.Unexpected in _submitResult (:292-295) so ErrorSummary (SessionFeedback.razor:136) lists the field errors after the snackbar times out, then makes one NotifyOnFailure(Toast, L, fallback: L["Snackbar.SubmitFailed"].Value) call (:297). Because a fallback is supplied, an ErrorType.Unexpected result (a 500, transport failure or timeout) toasts the page's generic Snackbar.SubmitFailed wording rather than its diagnostic text (the ADR-027 Decision 9 carve-out), and a refusal the server stated toasts the server's own localized message (MMCA.Common/Source/Presentation/MMCA.Common.UI/Common/ResultUiExtensions.cs:277-279). After the batch it deletes each saved answer the attendee has since blanked (_answerState.BlankedSavedAnswers()), through the same TryDeleteSavedAnswerAsync the Clear button uses, and returns with the form still dirty at the first failed delete (:254-263): the upsert has no delete semantics, so without this step the submit would report success while the old answer survived. On success it clears _isDirty (:265), toasts the count (:266), then calls StateHasChanged() before NavigateBack() (:269, :271); the inline comment (:267) and the BL0012 suppression note (:268) explain why: the flush lets UnsavedChangesGuard's IsDirty parameter update before NavigateTo fires the LocationChanging handler, otherwise the guard would prompt over changes that were just saved.
    • DeleteAnswerAsync (:300-315) clears one previously-saved answer through TryDeleteSavedAnswerAsync (:323-339) and toasts Snackbar.AnswerCleared when it succeeds. That helper returns true when there is no saved id (:325-328), calls FeedbackService.DeleteAnswerAsync(SessionId, answerId, LifetimeToken) (:330), toasts Snackbar.ClearAnswerFailed and returns false on failure (:331-335), and otherwise calls _answerState.ClearSavedAnswer(questionId) (:337), which removes the id and resets the model (TextValue and RatingValue; EmailValue follows TextValue). A clear leaves _isDirty as it is (:304-305): the delete commits only that answer on the server, so unsaved edits to other answers keep the unsaved-changes guard armed.
    • NavigateBack (:341-342) returns to the Conference session detail route through EngagementRoutePaths.SessionDetails(SessionId). The wire string for each answer comes from FeedbackAnswerModel.AnswerValue, which the answer state calls.
    • Dispose(bool) / Dispose() (:344-367) implement the standard disposable pattern, cancelling and disposing _cts and disposing _load (:355-357) so in-flight loads stop when the attendee leaves.
  • Why it's built this way: pushing the three business rules into one CheckPreconditions method keeps the render path binary (either a precondition message or the form) and makes each BR individually reviewable and individually testable. Keeping the answer state in FeedbackAnswers<TAnswerId> means the page replaces one object to discard a stale form, the pre-fill, required-gate, payload and blanked-answer rules can be read without the lifecycle code around them, and EventFeedback runs the identical rules. The single batch submit is the more consequential choice, and EventFeedback makes the same one: because the server applies a whole session form atomically, there is no partially-saved state to report to the attendee, so the failure path is a plain retry rather than a "3 of 5 saved" message. The cancellation-token discipline (the disposal-safe LifetimeToken on submit and delete, the superseding LatestLoadGuard token on load), the split between a stated refusal and an unexpected fault in ReportSubmitFailure, and the StateHasChanged-before-navigate ordering are correctness, not style.
  • Where it's used: rendered at /feedback/session/{SessionId:int}, reached from the public session detail page's SubmitFeedback (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.UI/Pages/Public/Sessions/PublicSessionDetail.razor.cs:318). The same route is also expressed as EngagementRoutePaths.SessionFeedback(sessionId) (EngagementRoutePaths.cs:18). Its dependencies are registered by the Engagement UI DependencyInjection. Component-tested by SessionFeedbackTests.
  • Caveats / not-in-source: the markup, the resource strings and UnsavedChangesGuard's own behavior live outside this file. The BR numbers in the comments are the page's own claim about which business rule it implements; the authoritative statements live in the ADC specifications guide, not in this file.

BookmarkCountsGrpcService

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service.Grpc · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/BookmarkCountsGrpcService.cs:31 · Level 9 · class (public sealed)

  • What it is: the server-side gRPC endpoint that publishes Engagement's in-process IBookmarkCountService over the wire. It is the counterpart of BookmarkCountServiceGrpcAdapter: the adapter runs inside Conference and speaks gRPC out, this service runs inside Engagement and answers.
  • Depends on: IBookmarkCountService (injected via primary constructor, :31), the generated proto base BookmarkCountService.BookmarkCountServiceBase plus the batch request, response and repeated SessionBookmarkCount messages from bookmark_count.proto (namespace MMCA.ADC.Engagement.Contracts.V1, :2), and ViewAsReadOnlyEndpointAttribute from MMCA.Common.Shared.Auth (:4, applied at :30). Externals: Grpc.Core (ServerCallContext).
  • Concept, the server-side bridge. [Rubric §7, Microservices Readiness], [Rubric §9, API & Contract Design]. This is the producer half of the pattern whose consumer half is taught in Group 13: the module keeps one C# interface, the proto generates an abstract server base, and this thin subclass forwards one to the other. Because the interface did not change when Engagement moved out of the monolith, neither Conference's call sites nor Engagement's BookmarkCountService had to change; only this bridge and its client twin were added. It mirrors, on the Engagement side, Conference's SessionBookmarksGrpcService, completing the bidirectional Conference-Engagement gRPC pair.
  • Concept, a documented unauthenticated trust boundary. [Rubric §11, Security] assesses whether every exposed surface has a stated authorization posture. This endpoint is mapped with an explicit .AllowAnonymous() rather than .RequireAuthorization() (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:270, with the reasoning restated at the call site, :257-269). The anonymity is stated rather than implied because the framework's fallback authorization policy gates every endpoint that declares nothing (SEC-Common-16, Program.cs:267-269), which would have turned a bare omission into a 401. The class doc (:13-24) argues why the requirement is not addable rather than merely absent: the Conference caller serves an [AllowAnonymous] output-cached REST endpoint, SpeakerSessionsController.GetSessionBookmarkCountsAsync (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Speakers/SpeakerSessionsController.cs:71-73), so a cache-miss request from an anonymous visitor carries no bearer for JwtForwardingClientInterceptor to forward, and the public speaker pages would break. The exposure is bounded by the payload (aggregate counts per session id, no PII and no user ids on the wire) and by the network boundary: the Engagement container app (engagementApp, MMCA.ADC/infra/main.bicep:2856) has ingress external: false (main.bicep:2871), so the endpoint stays on the internal service network and the Gateway never routes it. Contrast UserEngagementExportGrpcService, which is mapped .RequireAuthorization() (Program.cs:279) because it carries personal data.
  • Concept, read-only under view-as. The class carries [ViewAsReadOnlyEndpoint] (:30). The doc (:25-28) gives the reason (ADR-137): the speaker GET reaches this method with the view-as bearer, and since every gRPC call is a POST, the view-as guard's METHOD rule would otherwise treat this read as a write and refuse it.
  • Walkthrough: one override, the batch rpc GetBookmarkCountsForSessions(request, context) (:35-53); there is no single-session rpc. It null-guards both arguments with ArgumentNullException.ThrowIfNull (:39-40), materializes the repeated field with a collection expression, [.. request.SessionIds], and awaits the interface's batch method with context.CancellationToken (:42-44), threading the gRPC call's own cancellation token (and therefore the client's deadline) through to the database, then projects the returned dictionary into repeated SessionBookmarkCount messages via AddRange(... Select(...)) (:46-52).
  • Why it's built this way: keeping the wire endpoint a paper-thin forwarder means the real read logic (a COUNT under the soft-delete filter, over the SessionId index UserSessionBookmarkConfiguration declares) lives once and is reused identically in-process and over gRPC. The gRPC server defaults come from the Common service host the Engagement host composes (UseMmcaServiceHostAsync, Program.cs:255; AddGrpcServiceDefaults() at MMCA.Common/Source/Hosting/MMCA.Common.ServiceHost/ServiceHostBuilderExtensions.cs:167), which also installs the GrpcResultExceptionInterceptor; for this method the interceptor has nothing to translate, since the interface returns a bare dictionary rather than a Result.
  • Where it's used: mapped at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:270, served over the service's Http2-only cleartext (h2c) endpoint (ADR-012). Its remote caller is Conference. Covered by BookmarkCountsGrpcServiceTests, the integration BookmarkCountsGrpcTests and AnonymousConferenceReadTests, and the posture checks in GrpcViewAsPostureTests.
  • Caveats / not-in-source: the class doc and the Program.cs comment name the Conference caller and the bicep resource by symbol (SpeakerSessionsController.GetSessionBookmarkCountsAsync, engagementApp) rather than by line, so the line numbers above are this guide's, read from the current files.

ManualCheckInHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.UseCases.ManualCheckIn · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/ManualCheckIn/ManualCheckInHandler.cs:19 · Level 12 · class (sealed partial)

  • What it is: the organizer's manual fallback for when a badge will not scan. No credential is involved: the attendee is named in the request, and after an erased-user check everything is the same core the scan path runs.
  • Depends on: IUnitOfWork, IEventLiveValidationService, ICurrentUserService, ErasedUserGuard, CheckInProcessor, CheckInResultDTO, ICommandHandler<in TCommand, TResult>; externals: TimeProvider, ILogger<T>.
  • Concept reinforced, the shared core with a per-entry-point difference. [Rubric §15, Best Practices & Code Quality] and [Rubric §11, Security]. Compared with CheckInAttendeeHandler, the credential extraction and badge lookup are simply absent; command.UserId goes into the processor as given. The doc comment carries the compensating control (ManualCheckInHandler.cs:14-18): an organizer-only endpoint backs it, which is what makes naming another user acceptable here and unacceptable on the attendee-facing flows in this unit. The payoff is stated in the same comment: a manual check-in and a scanned one produce identical rows and events, so nothing downstream needs to know which door the check-in came through. [Rubric §30, Compliance, Privacy & Data Governance]: because the attendee id arrives in the request body, the handler first runs ErasedUserGuard.EnsureNotErasedAsync (:44, guard at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:26) and returns its failure unchanged (:45-48). The comment (:41-43) names the risk: an organizer working from a stale roster must not leave a check-in under an erased id that no erasure will ever revisit (ADR-005).
  • Walkthrough: five constructor dependencies (:19-24), one HandleAsync (:27-67). ArgumentNullException.ThrowIfNull(command) (:31), the same RequireUserId("CheckIns.Forbidden") caller guard as the scan path (:33-37, the organizer id taken at :39), the erased-user guard on command.UserId (:44-48), the delegation to CheckInProcessor.ExecuteAsync (:50-59), and a success-only Information log, gated on the same result.TryGetValue(out var checkIn) unwrap as the scan path (:61-64), whose template differs from the scan path only by the word "manually" (:69-75), which is what lets an operator tell the two apart in the logs even though the rows are identical.
  • Why it's built this way: keeping the fallback on exactly the same core avoids the classic drift where the rarely used path slowly stops enforcing a rule the main path gained. The erased-user check sits in front of that core because this is the entry point where the attendee id is typed in rather than resolved from a badge.
  • Where it's used: CheckInsController (injected at CheckInsController.cs:50, called from ManualCheckInAsync at :134).

UserEngagementExportGrpcService

MMCA.ADC.Engagement.Service · MMCA.ADC.Engagement.Service.Grpc · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/UserEngagementExportGrpcService.cs:26 · Level 12 · class (public sealed)

  • What it is: the server-side gRPC endpoint that publishes Engagement's in-process IUserEngagementExportService to the Identity service, so Identity can fold a user's Engagement-owned personal data into the aggregated data-subject export document. Same server-bridge shape as BookmarkCountsGrpcService, with two extra concerns: only the subject (or a privileged caller) may read the export, and timestamps and enums have to survive a proto3 wire crossing.
  • Depends on: IUserEngagementExportService (primary constructor, :27) and its DTOs from MMCA.ADC.Engagement.Shared.Exports (:4); the generated base UserEngagementExportService.UserEngagementExportServiceBase and the messages from user_engagement_export.proto (namespace MMCA.ADC.Engagement.Contracts.V1, :3); the framework's GrpcWireFormat from MMCA.Common.Grpc (:6); GetUserId() / HasRole from MMCA.Common.Shared.Auth (:7, see ClaimsPrincipalExtensions), and RoleNames.Organizer (:5). Externals: Grpc.Core (ServerCallContext, RpcException), System.Globalization (:1).
  • Concept, cross-service data-subject export as a purpose-built read contract. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether a real data-subject-access and portability path exists; [Rubric §7, Microservices Readiness] assesses talking through explicit contracts. Identity owns the export document but not Engagement's data, so it depends only on the narrow interface; this class is the producer half over the wire, twin to the client-side UserEngagementExportServiceGrpcAdapter. The class doc (:12-18) enumerates session bookmarks, submitted session questions, the points ledger, leaderboard participation, and check-in history; the method also forwards poll votes, question upvotes and ticket records, which the doc comment does not name (:96-125). Unlike the bookmark-count endpoint, this one is mapped .RequireAuthorization() (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:279, with the contrast drawn at :252), which is the posture difference personal data justifies.
  • Concept, the subject check behind a forwarded token. [Rubric §11, Security]. The edge forwards the end user's JWT, so an authenticated caller is not yet an authorized one: the method throws PermissionDenied unless the caller's own user id equals request.UserId or the caller holds RoleNames.Organizer, the export privilege Identity's export endpoint grants (:37-45). There is no service-caller bypass: the edge is mapped with the default policy, which authenticates only the user bearer, so a service token never reaches this check (:39-40, Program.cs:279). Without the check any signed-in user could request another user's export by id.
  • Concept, proto3 has no nulls and no DateTime. [Rubric §9, API & Contract Design]. Three encoding decisions are made here and mirrored exactly on the client:
    • Timestamps: SQL Server hands back DateTimeKind.Unspecified values, and the round-trip "O" format omits the Z marker for that kind, so each value goes through GrpcWireFormat.FormatUtc (:62, :69, :78, :100, :105), which stamps DateTimeKind.Utc before formatting (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/GrpcWireFormat.cs:42-43). The format is written once in the framework and called by both ends of the contract. The doc comment (:20-25) is careful about what this is: the stored values are already UTC, so this restores a marker rather than converting an instant. CheckedInOn is a DateTimeOffset, already carrying its offset, and is formatted as-is with "O" (:92-94); the ticket's InvitedOn and LinkedOn are also formatted directly with "O" (:119, :124).
    • Absent values: an absent leaderboard name travels as the empty string (:55-57), an absent SessionId/SponsorId as 0 (:87-90), and an absent ticket OrderEmail or InvitedOn as the empty string (:116-119), each with the comment naming the client-side inverse.
    • Enums: ActivityType (:73-75), Scope (:82-84) and the ticket's LinkMethod (:121-123) cross as their numeric values, justified in place: the points activity numbers are part of the idempotency key, the scope numbers are named literally in the SQL index filters (CheckInConfiguration, CheckInConfiguration.cs:25-27), and the link-method numbers are persisted, so none is ever renumbered.
  • Walkthrough: one overridden method, GetUserEngagementExport(request, context) (:30-128). It null-guards both arguments (:34-35), runs the subject check (:41-45), awaits inner.GetUserEngagementExportAsync(request.UserId, context.CancellationToken) (:47-49), then builds the response: the two scalar leaderboard fields in the initializer (:51-58), then seven AddRange(... Select(...)) projections filling the repeated fields: bookmarks (:59-63), submitted questions with their Text (:64-70), points entries (:71-79), check-ins (:80-95), poll votes (:96-101, LivePollId, OptionId and a FormatUtc CreatedOn), question upvotes (:102-106, QuestionId and a FormatUtc CreatedOn) and tickets (:107-125: event id, source event name, external ticket id, ticket type, attendee names, order email, invite and link timestamps, link method).
  • Why it's built this way: keeping the endpoint a thin forwarder leaves the real work (server-side projections that the soft-delete query filter already narrows to active rows) in UserEngagementExportService, reused identically in-process and over gRPC (ADR-012). Because the read returns a DTO rather than a Result, the GrpcResultExceptionInterceptor has no failure trailer to translate and a transport fault becomes a gRPC status the caller's resilience pipeline handles; the subject check is the one deliberate RpcException.
  • Where it's used: mapped at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:279. Its remote caller is Identity's ExportUserDataHandler via UserEngagementExportServiceGrpcAdapter. Covered by UserEngagementExportGrpcServiceTests, the integration UserEngagementExportGrpcTests, UserDataExportGrpcCallerTests and the posture checks in GrpcViewAsPostureTests.

IPointsAwarder

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/IPointsAwarder.cs:19 · Level 3 · interface

  • What it is: the single write path into the points ledger. One method: award the configured points for one activity, or do nothing when the rule is off or the attendee already earned that exact award.
  • Depends on: PointsActivityType, PointsSubjectKeys (named in the parameter docs), Result, the UserIdentifierType alias.
  • Concept introduced, the deliberately vocabulary-free contract. [Rubric §3, Clean Architecture] (assesses whether abstractions are stated in terms the layer owns rather than in terms of an outer concern) and [Rubric §15, Best Practices & Code Quality]. The doc comment argues the design explicitly (IPointsAwarder.cs:10-17): neither this interface nor the PointsEntry entity names an event, a session, a check-in, or any other ADC concept. An award is a user, an activity, an opaque subject key, and a timestamp. That is what would make lifting the ledger (the entity, this awarder, and the read queries) into MMCA.Common a MOVE rather than a rewrite, and it is the same "extract reusable infrastructure, keep the vocabulary local" instinct the workspace applies everywhere. The ADC-specific part stays in the thin award adapters that translate a module event into an (activity, subjectKey) pair, for example AttendeeCheckedInPointsHandler. [Rubric §1, SOLID] also applies at the interface-segregation level: one method, one reason to call it.
  • Walkthrough: Task<Result> AwardAsync(UserIdentifierType userId, PointsActivityType activity, string subjectKey, DateTime occurredOnUtc, CancellationToken cancellationToken = default) (IPointsAwarder.cs:35-40). The return contract is the part to read carefully (IPointsAwarder.cs:30-34): the result succeeds when the award EXISTS after the call, whether this call created it, an earlier call did, or the rule is configured to award nothing. It fails only when the entry itself is invalid, which the doc calls a caller bug rather than a retryable condition. Callers therefore never need to distinguish "awarded" from "already awarded", which is what lets a broker redelivery run straight through.
  • Why it's built this way: stating idempotency, the per-rule kill switch, and the value snapshot once in the contract (IPointsAwarder.cs:6-9) means each new earn rule is a small adapter rather than a re-derivation of the same three concerns.
  • Where it's used: registered by hand as scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:87, with the comment at :83-86 explaining that a plain service is invisible to the handler convention scan below it) and implemented by PointsAwarder. Consumers resolve it from their own scope: AttendeeCheckedInPointsHandler (.../Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:48), EventFeedbackSubmittedPointsHandler (.../EventFeedbackSubmittedPointsHandler.cs:38), SessionFeedbackSubmittedPointsHandler (.../SessionFeedbackSubmittedPointsHandler.cs:40), and SessionQuestionSubmittedPointsHandler (.../Points/DomainEventHandlers/SessionQuestionSubmittedPointsHandler.cs:78).

CurrentEventNotificationScopeProvider

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Notifications · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Notifications/CurrentEventNotificationScopeProvider.cs:30 · Level 3 · sealed partial class

  • What it is: ADC's implementation of the framework's notification scope hook. It answers "which conference event is in focus right now" as the opaque string event:{EventId}, so a notification sent for an event that has since ended stops surfacing once the next event becomes the current one.
  • Depends on: INotificationScopeProvider (the framework contract it implements), NotificationScopeKey (the canonical key formatter), ILiveEventUIService, LiveEventLookup and LiveEventContext (the resolution source). Externals: TimeProvider, System.Threading.Lock, ILogger<T> with source-generated [LoggerMessage] methods.
  • Concept introduced, the app-supplied scope over a framework-owned mechanism. [Rubric §3, Clean Architecture] and [Rubric §12, Performance & Scalability] assess whether a cross-cutting concern is expressed as a framework extension point the application fills in rather than as application logic baked into the framework. MMCA.Common knows notifications carry an optional scope key (ADR-024) and nothing more; the meaning of that string is ADC's business, and the type doc says so directly (CurrentEventNotificationScopeProvider.cs:11-12: to the framework it is just an opaque string).
  • Concept introduced, failing closed on a view filter. [Rubric §11, Security]. The framework contract is blunt about the direction of failure: implementations must never throw, and in an application whose notifications are all scoped they must fail closed, returning the last known key rather than null, because null on that contract means "unscoped" and silently widens the view to every notification (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Notifications/INotificationScopeProvider.cs:9-14). ADC is such an application, so this provider never answers null. The remarks block (:20-24) spells out the consequence: an instance that has never resolved an event answers with the UnresolvedScopeKey sentinel, event:0 (:39), a well-formed key (it satisfies NotificationScopeKey.Pattern, so the hub's channel-key guard accepts it) that no row carries, so the reader sees an empty inbox instead of everyone's.
  • Walkthrough:
    • The primary constructor (:30-33) takes the live-event service, a TimeProvider and a logger, and the class declares INotificationScopeProvider. UnresolvedScopeKey is composed from NotificationScopeKey.EventPrefix (:39, and MMCA.Common/Source/Core/MMCA.Common.Shared/Notifications/NotificationScopeKey.cs:23) so the sentinel cannot drift from the prefix the pattern at NotificationScopeKey.cs:32 accepts. CacheDuration is five minutes (:41).
    • The cache is two fields plus a Lock (:46-48). The comment above them (:43-45) is the concurrency reasoning worth reading: the lock guards the two fields only, the refresh runs outside it (a Lock cannot be held across an await), so two callers racing an expired cache both fetch. That is accepted deliberately, because the events read is idempotent and both callers converge on the same key, which beats serializing every poll behind a gate.
    • GetCurrentScopeKeyAsync(ct) (:51) takes the lock, returns the cached key while it is still fresh (:53-59), then resolves outside the lock: liveEventService.GetCurrentEventAsync(ct) now answers a three-state LiveEventLookup (failed, none, or found: MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventLookup.cs:3-10), and the provider reads only its .LiveEvent (:64, property at LiveEventLookup.cs:25), so a failed read and "no published event" both arrive here as null. When an event comes back it builds the key through NotificationScopeKey.ForEvent (:67), which formats the identifier under CultureInfo.InvariantCulture (NotificationScopeKey.cs:48-49) so a culture with non-ASCII digits cannot produce a key the pattern rejects.
    • The two unresolved paths log and fall through, and both leave scopeKey null. A null LiveEvent logs at Information (:71, :139-140); because LiveEventService answers an unreadable events API with LiveEventLookup.Failed rather than throwing (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/SessionLive/LiveEventService.cs:23-28), an ordinary API outage lands on this path too. A lookup that still throws is caught and logged at Warning (:75-79, :136-137); the general catch carries a scoped CA1031 suppression whose justification states the contract, a failed lookup is logged and caches nothing, so the next call retries it (:74, :76).
    • The fail-closed answer (:81-86) returns LastResolvedOrSentinel() (:128-134), the last key this instance resolved or event:0. Nothing is cached on that path (:83-84) and the expiry is left alone (:125-126), so the very next call retries the lookup rather than serving a stale answer for a whole window.
    • The write-back (:88-92) caches only a successful resolution, stamping _cacheExpiresOn five minutes out from the injected clock.
    • GetCurrentScopeDisplayNameAsync(ct) (:107-121) is the optional half of the contract (a default interface method, INotificationScopeProvider.cs:41): it returns the current event's name, read off the same .LiveEvent, for a send surface to caption its target (:111-112), and fails closed the way that member defines it, by returning null so a missing caption hides information rather than stating the wrong audience (:118-119, logged at Debug via :142-143). Its catch carries the same scoped CA1031 suppression, justified as "the scope display name is cosmetic" (:114).
  • Why it's built this way: the caching is not premature. Both notification HTTP services ask for the scope on every call (NotificationInboxService.cs:180, PushNotificationService.cs:34) and NotificationBell polls the unread count on a PeriodicTimer whose default interval is 30 seconds (NotificationBell.razor.cs:127, MMCA.Common/Source/Presentation/MMCA.Common.UI/Common/Settings/NotificationBellOptions.cs:23), so an uncached provider would put an events fetch behind every poll. [Rubric §12, Performance & Scalability] and [Rubric §31, Cost/FinOps] both land on that arithmetic. [Rubric §13, Observability & Operability]: the three [LoggerMessage] methods are source-generated and each message states what the operator loses, not just that something failed. The registration is the other deliberate detail: services.AddScoped<INotificationScopeProvider, CurrentEventNotificationScopeProvider>() (MMCA.ADC.Engagement.UI/DependencyInjection.cs:87) uses plain AddScoped so it overrides the NullNotificationScopeProvider that AddNotificationUI registers with TryAddScoped (MMCA.Common/Source/Presentation/MMCA.Common.UI/Notifications/DependencyInjection.cs:24), which keeps the two calls order-independent (DependencyInjection.cs:81-83); the line above it (:86) registers the clock with TryAddSingleton(TimeProvider.System), a TryAdd because AddOfflineWriteQueue earlier in the same method (and AddUIShared on the heads that call it) already registers the system clock (:84-85).
  • Where it's used: resolved by the framework's notification services listed above, and by the send page for its targeting caption (MMCA.Common/Source/Presentation/MMCA.Common.UI/Pages/Notifications/NotificationSend.razor.cs:78); never called directly by an ADC page. Covered by CurrentEventNotificationScopeProviderTests.
  • Caveats / not-in-source: the cache is per instance and the registration is scoped, so on Blazor Server the window is per circuit, not per user or per process. How long a stale key can survive an event rollover is therefore bounded by the five-minute window, not by any invalidation signal.

AttendeeCheckedIn

MMCA.ADC.Engagement.Shared · MMCA.ADC.Engagement.Shared.CheckIns.IntegrationEvents · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/CheckIns/IntegrationEvents/AttendeeCheckedIn.cs:25 · Level 3 · record (sealed)

  • What it is: the cross-module announcement that an attendee was checked in. One record carries every check-in shape: an organizer badge scan, the manual organizer fallback, a self-recorded sponsor booth visit, and a room check-in.
  • Depends on: BaseIntegrationEvent (the base it derives from, AttendeeCheckedIn.cs:33) and the module identifier aliases (UserIdentifierType, EventIdentifierType, SessionIdentifierType, SponsorIdentifierType). It names CheckInScopeNames only in its documentation, never as a type in its signature. It carries an explicit wire name through [EventName("Engagement.AttendeeCheckedIn.v1")] (:23), so the contract on the broker does not move when the CLR type is renamed or relocated. Externals: DateTimeOffset.
  • Concept introduced, the wire contract written for consumers you cannot redeploy. [Rubric §9, API & Contract Design] assesses whether contracts are versionable rather than merely correct today, and this record makes three deliberate choices for that. First, Scope is a string (:26), not the CheckInScope enum: the doc comment (:11-14) states the reason, which is that adding a scope later stays an additive change for a consumer that has not been rebuilt, where an unknown enum member would deserialize into a value the consumer's own enum cannot name. Second, SponsorId is optional and last (:31), with the doc comment (:22) recording that placement so a consumer keeps deserializing payloads written before sponsor visits existed. Third, the v1 suffix in the event name (:23) makes the version part of the routed contract rather than an implicit property of the assembly. [Rubric §6, CQRS & Event-Driven] covers the delivery half: this is an integration event, not a domain event, so it does not merely dispatch in process. It is captured with the row that produced it and published by the outbox processor (ADR-003). [Rubric §7, Microservices Readiness] applies because the payload is all scalars: nothing on it can only be resolved inside the Engagement process.
  • Walkthrough: seven positional members. UserId (:25) is the attendee. Scope (:26) is one of the CheckInScopeNames string constants. EventId (:27) is set for every scope, which is what lets a consumer bucket any check-in by conference without a lookup. SessionId (:28) is nullable and set only for a Session scope. CheckedInByUserId (:29) records who performed the check-in, an organizer for a scan and the attendee themselves for a self-recorded visit (:20), which is what keeps self-recorded rows distinguishable downstream. CheckedInOn (:30) is the recorded instant. SponsorId (:31) is the trailing optional member, defaulted to null.
  • Why it's built this way: the doc comment (:6-10) ties the event to the aggregate factory: it is added inside CheckIn.Create (CheckIn.cs:112-119) rather than in a handler, so the outbox captures it in the same transaction as the row. That gives the property the points economy depends on: a persisted check-in has published exactly one event, and a duplicate scan, which short-circuits before the factory, publishes none. Note the raise call is AddDomainEvent (CheckIn.cs:112): the framework's dual-dispatch treats an IIntegrationEvent added to an aggregate as outbox-bound, so an aggregate raises both kinds through one API. See ADR-072 for the surrounding badge-and-points decision.
  • Where it's used: raised by CheckIn (CheckIn.cs:112), consumed by AttendeeCheckedInPointsHandler. The Engagement service subscribes its own receive endpoint to this type (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:26), which the host's composition comment (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:214-221) calls out as ADC's first broker self-consumption: the message leaves this process through the broker and comes back to it, except under the InProcess test transport, where it is delivered in process so the integration tier exercises the same handler without a broker.

LiveChannelPublishProcessor

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Live · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Live/LiveChannelPublishProcessor.cs:43 · Level 3 · class (sealed partial)

  • What it is: the single background reader that drains LiveChannelPublishQueue and forwards each queued broadcast to ILiveChannelPublisher, resolving each coalesced tally slot to the newest tally it holds (LiveChannelPublishProcessor.cs:10-13). It is the piece that keeps live-layer broadcasts (poll opened, results changed, question approved) off the command request path, and it drains what is still queued when the host stops.
  • Depends on: LiveChannelPublishQueue (the concrete queue, injected as itself for its Reader, Resolve and Complete(), LiveChannelPublishProcessor.cs:44), ILiveChannelPublisher resolved per item (:139), and BestEffort (:133). Externals: BackgroundService from Microsoft.Extensions.Hosting, IServiceScopeFactory, and ILogger.
  • Concept introduced, the single-reader hosted drain. [Rubric §12, Performance & Scalability] assesses what work sits on the request path: a command handler here never awaits a broadcast, it enqueues, and this worker pays the network cost afterwards. [Rubric §29, Resilience & Business Continuity] is the reason the loop looks the way it does: the publish is best effort (BR-229, ADR-039), so no failure is allowed to escape the drain, and a down or hung Notification peer costs at most the adapter's own deadline per item and can never crash the host or fail a command (:18-22). [Rubric §13, Observability & Operability] covers the diagnostics: the swallow is delegated to BestEffort, so a peer that has quietly stopped accepting broadcasts is countable on the besteffort.dispatch.failed meter rather than being a Warning nobody alerts on (:23-30, and the counter itself at MMCA.Common/Source/Core/MMCA.Common.Application/Services/Resilience/BestEffort.cs:109-110). The queue counts its own backpressure drops separately (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveChannelPublishQueue.cs:142-159). [Rubric §29, Resilience, Reliability & Business Continuity] covers the lifetime mismatch this class exists to bridge: a BackgroundService is a singleton while the gRPC publisher adapter is registered scoped, so the worker opens one scope per item (:138-139). The same section covers the shutdown posture: a scale-in or revision swap stops a replica mid-session, so StopAsync drains the queue instead of dropping it, inside one fixed budget (:31-41, :52).
  • Walkthrough
    • The primary constructor (:43-46) takes the queue, an IServiceScopeFactory and a logger. The class is sealed partial since the shutdown warning is a source-generated [LoggerMessage] (:148-151); the per-item swallow still lives inside BestEffort.
    • PublishOperationPrefix (:49) is the constant "live-channel-publish:". It is completed per item with the work item's event name (:134) to form the best-effort operation name. The comment above the class (:26-29) explains the cardinality reasoning: the event name is a small fixed set of channel constants and is therefore safe as a metric tag, while the channel key is per session and is deliberately left out because fanning the tag out tells an operator nothing they can act on.
    • ExecuteAsync (:87) is a two-level loop: WaitToReadAsync(stoppingToken) (:91-92) waits for work, then an inner TryRead loop (:96-99) publishes each item. Both loops check stoppingToken.IsCancellationRequested first (:91, :96), so an item is never dequeued after the stop: it would be published on the cancelled token and lost, and is left for the shutdown drain (:94-95). There is exactly one of these loops in the process, and the queue is created with SingleReader = true (LiveChannelPublishQueue.cs:60), so the drain reads this replica's queue in FIFO order. That is NOT a delivery-order promise, and the class doc says so (LiveChannelPublishProcessor.cs:13-16): handlers enqueue after their own commits in no fixed order and every replica has its own queue, so clients rely on the tallies' monotonic TalliedAtTicks marker to ignore a stale one (LiveChannelPublishQueue.cs:21-27).
    • PublishAsync (:127-130) is the shared per-item path, used by both the live loop and the drain, and it starts by resolving what was dequeued: queue.Resolve(dequeued) (:128) returns a structural item as itself, and a coalesced tally slot as the newest tally its key holds, freeing the slot, or null when the slot is already empty (LiveChannelPublishQueue.cs:118-134), in which case nothing is published (:130). This is the read half of the queue's latest-wins coalescing (LiveChannelPublishQueue.cs:11-19): a burst of votes on one poll costs one publish per drain pass rather than one per vote.
    • PublishResolvedAsync (:132-146) hands the body to BestEffort.ExecuteAsync (:133) with the operation name, the logger, the publish lambda and the caller's token. Inside the lambda an async DI scope is created (:138), the publisher is resolved from it (:139), and PublishAsync is awaited with the work item's channel key, event name and pre-serialized payload plus the token the helper passes in (:140-144).
    • StopAsync (:55-84) is the shutdown drain. It first closes the queue with queue.Complete() (:59), so the drain sees a finite set of items, then creates one ShutdownDrainBudget of 5 seconds (:52) and links it to the host's token (:61-62). base.StopAsync(drain.Token) (:69) cancels the stopping token and waits, inside the budget, for ExecuteAsync to return. Only if the worker has let go of the reader (ExecuteTask is null || ExecuteTask.IsCompleted, :74) does DrainRemainingAsync (:111-124) publish the remainder in FIFO order on the drain token, which exists because the gRPC publisher fails a cancelled call immediately (:35-36). Whatever is left (queue.Reader.Count, :79) is logged by the generated LogShutdownDrainAbandoned warning (:82, :148-151) and abandoned.
    • Cancellation is separated from failure, and the split is shared rather than local: BestEffort rethrows the caller's own cancellation instead of recording it as a failure (BestEffort.cs:59), and both the live loop (:102-107) and the drain (:120-123) catch that rethrow when their own token is cancelled and return quietly.
  • Why it's built this way: the enqueue side cannot block and cannot fail, so backpressure has to be resolved somewhere. It is resolved in the queue, not here: tallies are coalesced to one slot per key, and the channel is bounded at 1024 items with BoundedChannelFullMode.DropOldest (LiveChannelPublishQueue.cs:34, :59) as the last resort when the drain itself is stuck, at which point only the structural backlog beyond capacity is lost (LiveChannelPublishQueue.cs:17-19). A DropOldest write always succeeds, so the queue registers an itemDropped callback (LiveChannelPublishQueue.cs:63, reasoning at :53-55) as the only way a discard becomes observable. This worker's job is to be the one reader of that channel, to turn each tally slot into its latest tally, to make its swallowed failures countable rather than merely logged, and to drain on stop. The drain is bounded on purpose: the whole stop shares one 5-second budget, well inside the 30-second Container Apps and host shutdown grace (:38-39), so a hung Notification peer cannot hold the host. The in-flight publish is NOT allowed to finish, because it runs on the stopping token and the cancellation aborts it (:36-37, :64-68), and the check-then-TryRead pair is two steps, so a stop landing between them can still lose one dequeued item (:64-68).
  • Where it's used: registered as a hosted service by the module's infrastructure registration (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:26), so it starts with any host that boots the Engagement module. Its producers are the live-layer handlers that hold ILiveChannelPublishQueue (for example MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/Open/OpenLivePollHandler.cs:24 and .../SessionQuestions/UseCases/Submit/SubmitQuestionHandler.cs:29). In the deployed topology the publisher is the gRPC adapter targeting Notification's dedicated Http2 endpoint (ADR-012). Covered by LiveChannelPublishProcessorTests.
  • Caveats / not-in-source: whether a given deployment actually reaches a Notification peer is configuration and runtime, not source. Nothing in this file retries a failed publish; a dropped or failed broadcast is gone, which is the stated contract rather than an omission. The shutdown drain is best effort too: the in-flight item, any item lost to the dequeue race, and anything left when the 5-second budget expires are not delivered.

UserSessionBookmarkCacheEvictionHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.DomainEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/DomainEventHandlers/UserSessionBookmarkCacheEvictionHandler.cs:38 · Level 3 · class (sealed)

  • What it is: the handler that requests an output-cache eviction on the Conference service every time a bookmark is created, reactivated or removed, so Conference's cached session reads stop serving a stale bookmark count. It only raises a flag; the broadcast itself belongs to BookmarkCacheEvictionProcessor.
  • Depends on: IDomainEventHandler<in TDomainEvent> implemented over UserSessionBookmarkChanged (:39), BookmarkCacheEvictionSignal, the coalescing flag injected through the primary constructor (:38), and ConferenceCacheTags, the Conference.Shared constant its tag aliases (:1, :47). The broadcast types, OutputCacheEvictionRequested and BestEffort, are used by the processor, not by this handler (BookmarkCacheEvictionProcessor.cs:7-8).
  • Concept introduced, evicting a cache you do not own. [Rubric §12, Performance & Scalability] assesses whether a cross-cutting concern is solved once at the right layer. ASP.NET Core's output cache is per host: IOutputCacheStore is a local store, so a write in the owning service leaves a stale cached response sitting in front of every other process until its TTL expires (MMCA.Common/Source/Core/MMCA.Common.Domain/IntegrationEvents/OutputCacheEvictionRequested.cs:10-13). Bookmark counts are the sharp case: they are owned by Engagement but served by Conference. The class comment (:12-18) names the symptom that motivated the class, a speaker watching their dashboard seeing a star land up to a minute later, and the previous answer, a short TTL, which is a floor rather than a fix. The fix is to make eviction an event like any other: the processor this handler feeds publishes OutputCacheEvictionRequested carrying one tag, and the Conference host's own eviction handler drops that tag on arrival (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:259, and the reasoning at :204-215). [Rubric §7, Microservices Readiness] is why it has to be an event at all: under database-per-service (ADR-006) and process-per-service, Engagement has no handle on the other host's cache store, so the broker is the only reachable path. [Rubric §29, Resilience & Business Continuity] covers the failure posture: the publish runs through BestEffort inside the processor (BookmarkCacheEvictionProcessor.cs:26-29), so a failure becomes one Warning plus one metric and the stale entry expires on Conference's own TTL exactly as it did before this existed. The TTL stays deliberately, as the backstop for a dropped or delayed message (Program.cs:212-214).
  • Concept introduced, pacing a burst by raising a flag instead of publishing. [Rubric §12, Performance & Scalability] assesses whether per-event work scales with load. Publishing one eviction per star would keep Conference's session cache permanently cold when a changeover produces a burst of stars (:21-25). The handler therefore does no I/O: HandleAsync calls signal.Request() (:58), a TryWrite into the signal's single pending slot (BookmarkCacheEvictionSignal.cs:42). The single-reader hosted processor (BookmarkCacheEvictionProcessor.cs:35, registered at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:27) broadcasts at once when idle, then waits one pacing window and sends ONE trailing broadcast for everything that arrived meanwhile (BookmarkCacheEvictionProcessor.cs:17-23). A burst costs one eviction per window per replica, not one per star.
  • Concept introduced, subscribing to the aggregate rather than to the use case. [Rubric §6, CQRS & Event-Driven] assesses where a reaction is hooked. The obvious hook is the create command handler, but the delete path runs on the framework's generic DeleteEntityCommand<TEntity, TIdentifierType> and has no ADC handler at all to add a line to. UserSessionBookmarkChanged is raised by the aggregate itself on every path that moves a count (UserSessionBookmark.cs:57 on create, :73 on reactivate, :88 on delete), so subscribing to the domain event covers all three with one class and leaves the delete flow untouched (:28-32). It also inherits the dispatch guarantee: domain-event dispatch is deferred until after the transaction commits and dropped on rollback, so no eviction is ever requested for a bookmark that did not persist (:32-34).
  • Walkthrough
    • The primary constructor (:38) takes only the BookmarkCacheEvictionSignal (:37). It needs no scope factory or logger, because it never reaches the scoped event bus: that is the processor's job.
    • SessionsCacheTag (:47) is a public const alias of ConferenceCacheTags.Sessions, whose value is "conference:sessions" (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Shared/Caching/ConferenceCacheTags.cs:24). Its doc comment (:41-46) is the load-bearing part: the tag string IS the contract between the two hosts, so the handler takes it from the same constant Conference registers its cache policies with (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:190, :202, :216). Both sides reading one constant is the point of that type, whose own comment records that a policy and an eviction spelling a tag differently fail silently, the stale entry simply living out its TTL (ConferenceCacheTags.cs:6-7). The compiler now enforces the agreement, at the cost of an Application-layer reference to MMCA.ADC.Conference.Shared (:1).
    • HandleAsync (:50) is synchronous: it null-guards (:54), calls signal.Request() (:58) and returns Task.CompletedTask (:59). The publish through the event bus, with its outbox persistence (ADR-003), happens in BookmarkCacheEvictionProcessor.
    • The handler deliberately does not filter on domainEvent.State, and the comment says why (:56-57): every state the aggregate raises (Added on create and reactivate, Deleted on removal) moves the count Conference has cached.
  • Why it's built this way: the alternative shapes each fail on something concrete. Hooking the command handlers misses the generic delete. Calling EvictByTagAsync locally does nothing, because the cache entries are in another process. Publishing per star would keep Conference's cache cold under burst load. Raising a coalescing flag from the aggregate's own event, and letting a paced best-effort processor do the broadcast, covers every write path, crosses the process boundary, and cannot hurt the write it reacts to. The caching strategy this fits into is ADR-026, and the authenticated-read caching it evicts is ADR-040.
  • Where it's used: registered as a singleton by the convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92, reaching MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:52-53). Its counterpart on the receiving side is OutputCacheEvictionHandler, registered on the Conference host. Covered by UserSessionBookmarkCacheEvictionHandlerTests.
  • Caveats / not-in-source: the Conference host comment records that both halves are needed, the handler and the broker consumer, and that registering only one is a silent no-op (Program.cs:258); nothing in this file can detect that the other half is missing. Whether the broadcast actually reaches Conference is broker configuration and runtime, not source.

IEventFeedbackUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Feedback/IFeedbackUIService.cs:23 · Level 3 · interface

  • What it is: the UI contract for submitting and reading a user's own answers to event feedback questions.
  • Depends on: EventQuestionAnswerDTO, Result, and the EventIdentifierType / QuestionIdentifierType / EventQuestionAnswerIdentifierType aliases. Externals: BCL Task.
  • Concept introduced, POST-as-upsert (BR-107). [Rubric §9, API & Contract Design] assesses how idempotent write semantics are expressed to clients. The only write is SubmitAnswersAsync (IFeedbackUIService.cs:25-32), and it is one method for both the first submit and every edit: it creates or replaces the caller's answers to the whole form, so the UI never branches on create-versus-update and never has to know whether an answer already exists. That is what lets EventFeedback retry a failed submit by pressing the same button. The type doc names the rule outright (:19-22). This is the cross-module UI service abstraction of ISessionBookmarkUIService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/UserSessionBookmarks/ISessionBookmarkUIService.cs:15) specialized to feedback, with the same "every member answers with a Result" contract (ISessionBookmarkUIService.cs:9-12, and this type's own doc at IFeedbackUIService.cs:21).
  • Walkthrough (IFeedbackUIService.cs:23-44): three members. SubmitAnswersAsync(eventId, answers, ct) takes IReadOnlyList<(QuestionIdentifierType QuestionId, string AnswerValue)> and returns Result<IReadOnlyList<EventQuestionAnswerDTO>>, every saved answer; the server applies the form atomically, so the result is all-or-nothing (:25-32). GetMyAnswersAsync(eventId, ct) returns the caller's answers for one event (:34-37), which is what the page pre-fills from (EventFeedback.razor.cs:159). DeleteAnswerAsync(eventId, answerId, ct) removes one by its server-assigned id and returns the valueless Result (:39-43). There is no single-answer submit: a page that changes one answer still submits through the batch member. Note the answer value crosses as a plain string: rating and text questions share one transport shape and the question type decides how it is read back.
  • Why it's built this way: it is kept as its own type rather than folded into one generic contract with its session twin ISessionFeedbackUIService, because the answer DTOs and the identifier aliases differ and a shared generic would buy nothing at three members apiece. The two twins declare the same three members in the same order (:50-71), so they stay parallel member for member.
  • Where it's used: implemented by EventFeedbackService (EventFeedbackService.cs:14), registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:52), consumed by EventFeedback (EventFeedback.razor.cs:20, submitting at :218, deleting at :302).

IQuestionLookupService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Feedback/IFeedbackUIService.cs:11 · Level 3 · interface

  • What it is: a small read contract that loads the feedback questions to render, filtered by whether they apply to an Event or a Session.
  • Depends on: QuestionDTO, a Conference-owned contract (IFeedbackUIService.cs:2), and Result. Externals: BCL Task.
  • Concept, the cross-module UI read. [Rubric §18, UI Architecture] and [Rubric §7, Microservices Readiness]. Feedback lives in Engagement but the questions are Conference-owned, so this contract lets the Engagement UI pull them through the same authenticated HTTP layer without a compile-time reference to Conference internals: only the shared QuestionDTO crosses the boundary. This is a different trade-off from the mirrored shape on NowNextSessionInfo, and the difference is worth noticing: a .Shared DTO is a published contract project both sides may reference, while a mirror is what you write when you do not want the reference at all.
  • Walkthrough (IFeedbackUIService.cs:11-17): one method, GetQuestionsAsync(questionEntity, ct), where questionEntity is the string discriminator ("Event" or "Session"), returning Result<IReadOnlyList<QuestionDTO>>. The discriminator is a bare string rather than an enum, so a typo at a call site is a runtime empty list, not a compile error; both call sites pass a literal (EventFeedback.razor.cs:104).
  • Why it's built this way: keeping the question read on its own interface rather than duplicating it on both feedback services means one implementation serves both pages, and the discriminator stays the only difference between the two calls.
  • Where it's used: implemented by QuestionLookupService (QuestionLookupService.cs:19), registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:51), consumed by both EventFeedback (EventFeedback.razor.cs:19, :104-105) and SessionFeedback (SessionFeedback.razor.cs:18) to build their question lists.

ISessionFeedbackUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Feedback/IFeedbackUIService.cs:50 · Level 3 · interface

  • What it is: the UI-side contract for session feedback, three members covering the whole attendee-facing lifecycle of an answer: submit a whole form at once, read back what the caller already answered, and remove an answer (IFeedbackUIService.cs:50-71). It is the third of three interfaces declared in one file, beside IQuestionLookupService (:11) and IEventFeedbackUIService (:23).
  • Depends on: Result and Result<T> from MMCA.Common.Shared.Abstractions (:4), SessionQuestionAnswerDTO and QuestionDTO from the Conference contracts (:1-3), plus the SessionIdentifierType, QuestionIdentifierType and SessionQuestionAnswerIdentifierType aliases. No BCL dependency beyond Task and CancellationToken.
  • Concept introduced, the Result-typed client contract. Every member here answers with a Result rather than a nullable DTO or a bare Task, and the class doc states it outright (:48). [Rubric §9, API & Contract Design] assesses whether a client abstraction preserves the distinctions the server makes: a nullable return collapses "no such answer", "you are not allowed" and "the network is down" into one null, while a Result keeps the server's own ErrorType and error code intact all the way to the page. [Rubric §24, Forms/Validation/UX Safety] is the front-end consequence: a feedback form can render the server's validation message for the field that failed instead of a generic banner. The pattern itself is taught in the primer and ADR-013; what is new at this layer is that the transport now speaks it too, through ProblemDetailsResultReader and HttpResultExecutor.
  • Walkthrough
    • SubmitAnswersAsync (:56-59) is the only write, taking IReadOnlyList<(QuestionIdentifierType QuestionId, string AnswerValue)> and returning every saved answer. It is a POST-as-upsert (BR-107, :48): the caller never has to know whether it is creating first answers or replacing existing ones. Its doc comment carries the contract that matters most (:52-55): the server applies the form atomically, so the result is all-or-nothing. That is the difference between a form that half-saves on a flaky connection and one that does not.
    • GetMyAnswersAsync (:61-64) reads the caller's own answers for a session. No user identifier appears in the signature: the server scopes the read to the token holder.
    • DeleteAnswerAsync (:66-70) removes one answer by identifier, with the owning sessionId alongside it, and returns the valueless Result.
  • Why it's built this way: keeping the contract in the UI layer over Shared DTOs only is what lets SessionFeedback be bUnit-tested against a mock with no HTTP in sight. [Rubric §1, SOLID]: the contract carries one write, the whole-form submit, rather than a single-answer method beside it, so there is one write path with one guarantee to reason about.
  • Where it's used: implemented by SessionFeedbackService and registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:53); injected by SessionFeedback (SessionFeedback.razor.cs:19), which drives all three members (:163, :246, :330).
  • Caveats / not-in-source: the interface says nothing about idempotency. That the batch submit carries an Idempotency-Key is an implementation decision, described at SessionFeedbackService.

IVerifiedParticipantGate

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/IVerifiedParticipantGate.cs:11 · Level 3 · interface

  • What it is: the verified-participant rule (S-ADC-identity-02) as a contract. An engagement write that shapes what other attendees see or awards points (a poll vote, a question upvote, a question, a self-recorded room check-in or sponsor visit) is accepted only from an account with a linked ticket or a confirmed email; reads stay open to every signed-in account (IVerifiedParticipantGate.cs:5-10).
  • Depends on: Result and Result<T>, ErrorType (named in the docs as the refusal's type), VerifiedParticipantGate (whose code constant the docs name), the UserIdentifierType alias. Externals: BCL Task.
  • Concept introduced, the participation gate in front of a write. [Rubric §11, Security] in its anti-abuse sense: without the rule, a free account nobody has verified votes, upvotes and earns points like an attendee (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Participants/VerifiedParticipantSettings.cs:13-21). The rule is stated once, behind an interface, and every qualifying handler asks it before it writes rather than re-deriving "who may take part". [Rubric §1, SOLID] covers the shape: two members, both answering with a Result, so a refusal flows back to the caller as a Forbidden failure rather than an exception, and a handler test can substitute the whole rule.
  • Walkthrough: two members.
    • RequireCaller(string forbiddenCode) (:19) returns the calling account's id from the request principal, or a Forbidden error coded with the caller's own forbiddenCode when the request carries none (:13-18). The code is a parameter so each handler keeps its own refusal vocabulary (the room check-in passes "CheckIns.Forbidden", MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:64).
    • EnsureVerifiedAsync(userId, source, cancellationToken) (:31-34) succeeds when Engagement:RequireVerifiedParticipant is off, when the account's email is confirmed, or when it holds a live linked ticket, and otherwise fails Forbidden with VerifiedParticipantGate.VerifiedParticipantRequiredCode (:21-26). source is the calling handler's name, carried into the error for attribution (:28).
  • Why it's built this way: the rule spans two modules and several handlers, so it needs exactly one definition. Splitting "who is calling" from "may they take part" lets a handler that already knows its user (the live layer passes the id through LiveScopeGate) skip the first step, while the self-recorded check-ins use both.
  • Where it's used: registered scoped against VerifiedParticipantGate (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:65, with the comment at :62-64). Consumed by RecordRoomCheckInHandler (RecordRoomCheckInHandler.cs:50, verifying at :77), RecordSponsorVisitHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:40, verifying at :66), LiveScopeGate for the live writes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Live/LiveScopeGate.cs:42, delegating at :57-58), and VerifiedParticipantService (VerifiedParticipantService.cs:15).
  • Caveats / not-in-source: whether a deployment runs with the rule on is configuration: RequireVerifiedParticipant defaults to true (VerifiedParticipantSettings.cs:21) and is bound from the Engagement section (:11).

VerifiedParticipantService

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantService.cs:15 · Level 4 · class (internal sealed)

  • What it is: the in-process implementation of the cross-module IVerifiedParticipantService. It answers the verified-participant question for the Conference module by running this module's own IVerifiedParticipantGate (VerifiedParticipantService.cs:6-13).
  • Depends on: IVerifiedParticipantService (the Shared contract it implements), IVerifiedParticipantGate (its only constructor dependency, :15), Result, the UserIdentifierType alias.
  • Concept introduced, one rule answered across a module boundary. [Rubric §7, Microservices Readiness]: Conference's session and event feedback writes must pass the same rule, but the linked-ticket half reads Engagement's own ticket rows, which Conference cannot see under database-per-service (ADR-006). So Conference asks through a Shared interface, and in the split topology the Engagement service answers it over gRPC (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:288-293). [Rubric §9, API & Contract Design]: the contract answers a question (Result<bool>) rather than passing on the gate's refusal, so the calling module composes its own error.
  • Walkthrough: one method, IsVerifiedParticipantAsync(userId, cancellationToken) (:18-26). It calls gate.EnsureVerifiedAsync with nameof(VerifiedParticipantService) as the source (:23-24) and returns Result.Success(verified.IsSuccess) (:25). The comment states why that mapping is safe: the gate's only failure is its forbidden refusal, which is the "no" answer here (:22).
  • Why it's built this way: the class doc (:9-12) is the argument. The switch, the email claim of the request principal and the linked-ticket lookup are exactly the ones every Engagement write uses, and across the service boundary the request principal is the end user's forwarded token, so the email half reads the same claim it reads for an Engagement write. Reusing the gate rather than re-implementing the rule keeps the two modules from drifting apart.
  • Where it's used: registered scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:69, comment at :67-68). Exposed to Conference by VerifiedParticipantGrpcService (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/VerifiedParticipantGrpcService.cs:22), whose client side is VerifiedParticipantServiceGrpcAdapter, swapped in for the interface by services.Replace (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:133). The Conference caller is its feedback participant gate (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Participants/FeedbackParticipantGate.cs:47). Covered by VerifiedParticipantServiceTests.
  • Caveats / not-in-source: the class is internal, so nothing outside the module reaches it except through the interface. Whether a given Conference host actually reaches the Engagement service is deployment configuration, not source.

EventFeedbackService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Feedback/EventFeedbackService.cs:12 · Level 5 · sealed class

  • What it is: the HTTP implementation of IEventFeedbackUIService, backed by the eventquestionanswers resource (EventFeedbackService.cs:16). Its submit call is a POST-as-upsert: the same POST creates first answers or replaces existing ones (BR-107, per the class doc at :9-11).
  • Depends on: IEventFeedbackUIService, AuthenticatedServiceBase (whose SendRequestAsync runs every call through HttpResultExecutor and ProblemDetailsResultReader), ITokenStorageService, EventQuestionAnswerDTO, PagedCollectionResult<T>. Externals: IHttpClientFactory, System.Net.Http.Json, System.Globalization.
  • Concept: the authenticated-retried-HTTP shape is taught at BookmarkApiClient (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21), which also dispatches through the base's SendRequestAsync (BookmarkApiClient.cs:39). Each call here only supplies the HTTP action; the base creates the authenticated client, runs the action through the retry policy and reads the response into a Result (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171-190, body-less overload at :201). What this pair of feedback services adds is the upsert contract: [Rubric §9, API & Contract Design] assesses whether a client has to know which of create or update applies, and here it does not, which is what lets the feedback page post the whole form the same way regardless of whether the attendee is answering or revising.
  • Walkthrough
    • SubmitAnswersAsync (:19-40) is the only write. It null-checks the list (:24), projects the tuples into an anonymous object { EventId, Answers = [{ QuestionId, AnswerValue }] } (:26-30) rather than a named request record, POSTs it to eventquestionanswers/batch (:35-37), and Maps the returned List<EventQuestionAnswerDTO> to the interface's IReadOnlyList (:39). The idempotency key is passed as the idempotencyKey: argument, NewIdempotencyKey() (:39): the argument is evaluated once per call, before the retry pipeline runs, so every attempt carries the same key and a timed-out submit is answered from the stored outcome instead of re-applying the form (:32-34).
    • GetMyAnswersAsync (:43-52) calls the dedicated caller-scoped route eventquestionanswers/mine?eventId={eventId} (:49), which the server exposes as [HttpGet("mine")] (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Events/EventQuestionAnswersController.cs:216). Note what it does not do: there is no user filter and no page size in the query, because the endpoint scopes to the caller server-side. The envelope is read as a PagedCollectionResult<T> and Mapped to a bare IReadOnlyList with a collection expression (:52), so the page never sees the paging wrapper.
    • DeleteAnswerAsync (:55-65) DELETEs by answer id with the owning eventId as a query parameter (:62) through the body-less SendRequestAsync overload, and returns the valueless Result.
  • Why it's built this way: every call passes the caller's CancellationToken into SendRequestAsync, which hands it to the retry policy (AuthenticatedServiceBase.cs:185), so Polly's backoff waits are cancellable and a page that navigates away does not keep a doomed retry alive. Minting the key as an argument rather than inside the retried delegate matters because the base retries a POST only when its request carries an Idempotency-Key (AuthenticatedServiceBase.cs:38-39), and a per-attempt key would defeat the server's dedup (:58-62).
  • Where it's used: registered scoped as IEventFeedbackUIService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:52); injected by EventFeedback (EventFeedback.razor.cs:20), which is the only consumer. Covered by EventFeedbackServiceTests, including that the batch call sends the whole form in one request and carries an Idempotency-Key header (EventFeedbackServiceTests.cs:101, :131) and that a retrying call cancelled during backoff stops without waiting out the sleep (:73).
  • Caveats / not-in-source: the read carries no pageSize (:49); the page size the mine route applies is a server-side decision, not visible from this client. The server still exposes a single-answer [HttpPost] route beside [HttpPost("batch")] (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Events/EventQuestionAnswersController.cs:260, :287); this client calls only the batch route.

SessionFeedbackService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Feedback · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Feedback/SessionFeedbackService.cs:12 · Level 5 · sealed class

  • What it is: the HTTP implementation of ISessionFeedbackUIService, backed by the sessionquestionanswers resource (:16). The session-scoped counterpart of EventFeedbackService, with the same POST-as-upsert contract (BR-107, class doc :9-11) and the same three calls.
  • Depends on: ISessionFeedbackUIService, AuthenticatedServiceBase (whose SendRequestAsync runs every call through HttpResultExecutor and ProblemDetailsResultReader, and whose request client attaches the IdempotencyHeaders key), ITokenStorageService, SessionQuestionAnswerDTO, PagedCollectionResult<T>. Externals: IHttpClientFactory, System.Net.Http.Json, System.Globalization.
  • Concept introduced, the client half of request idempotency. The auth, retry and Result-reading story is taught at BookmarkApiClient (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21) and the upsert contract at EventFeedbackService; neither is re-taught. What is worth reading here is SubmitAnswersAsync, and specifically where its idempotency key is minted. [Rubric §29, Resilience & Business Continuity] assesses whether a retry can be taken safely, and the inline comment at :32-34 is the reason it can be: the key is passed as the idempotencyKey: argument (:39), which is evaluated once per call, before the retry pipeline runs. A key generated per attempt would differ each time, the server could not recognize the retry, and a timed-out submit would re-apply the whole form. The base's request client sets the key as a default request header on the one HttpClient that serves every attempt (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:232-242, used at :184), and the same base retries a POST only when the request carries such a key (:38-39). The generator itself is inherited: NewIdempotencyKey() is a compact GUID (AuthenticatedServiceBase.cs:65), and its remarks (:57-63) say the same thing from the framework side. The server end is ADR-017, applied to this route by the [Idempotent] attribute (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Sessions/SessionQuestionAnswersController.cs:287-288).
  • Walkthrough
    • SubmitAnswersAsync (:19-40) is the only write. It null-checks the answers list (:24), projects the tuples into an anonymous { SessionId, Answers = [{ QuestionId, AnswerValue }] } body (:26-30), POSTs to sessionquestionanswers/batch with the idempotency key (:35-39), and Maps the returned List<T> to the interface's IReadOnlyList (:39). The server applies the form atomically, so one Result covers the whole submit.
    • GetMyAnswersAsync (:43-52) reads the caller's answers from the dedicated sessionquestionanswers/mine?sessionId={sessionId} route (:49; server side [HttpGet("mine")] at MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/Sessions/SessionQuestionAnswersController.cs:216) and unwraps the envelope (:52).
    • DeleteAnswerAsync (:55-65) DELETEs by answer id with sessionId as a query parameter (:62).
    • All three calls pass the caller's CancellationToken into SendRequestAsync (:38, :52, :65), which hands it to the retry policy (AuthenticatedServiceBase.cs:185).
  • Why it's built this way: a session feedback form is several answers a person filled in at once, and half-applying it on a flaky conference wifi connection would be worse than failing outright. The batch endpoint plus the replayed idempotency key is what turns "submit the form" into a single atomic, safely retryable operation.
  • Where it's used: registered scoped as ISessionFeedbackUIService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:53); injected by SessionFeedback (SessionFeedback.razor.cs:19), which reads existing answers (:163), submits the whole pending form through the batch call (:246) and deletes single answers (:330). [Rubric §14, Testability]: SessionFeedbackServiceTests covers nine facts, including that the batch call sends the whole form in one request (:21) and that it carries an Idempotency-Key header (:51), that a domain-exception response becomes a failure carrying the server's own message (:69, :150), that the read targets the caller-scoped mine route and that an empty envelope reads as an empty list (:90, :121), and that an already-cancelled token aborts before a request is sent (:168).
  • Caveats / not-in-source: the server still exposes a single-answer [HttpPost] route, itself [Idempotent] (SessionQuestionAnswersController.cs:260-261), but this client never calls it: every submit goes through the batch route. The read carries no pageSize, same as the event side.

PointsSwitch

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsSwitch.cs:16 · Level 9 · sealed class

  • What it is: the one answer to "what is this activity worth right now": the configured award for the activity, or 0 when that rule is configured to 0 (the per-rule kill switch) or the whole points game is off (PointsSwitch.cs:8-13).
  • Depends on: PointsSettings via IOptions<T>, EngagementFeatures (the Engagement.Points flag), the PointsActivityType enum. Externals: IFeatureManager from Microsoft.FeatureManagement, IOptions<T>.
  • Concept introduced, two switches read through one door. [Rubric §17, DevOps & Deployment] assesses whether operational levers are configuration rather than code. Points have two: a per-rule value in configuration, where 0 takes one earn rule out of service, and a game-wide feature flag, EngagementFeatures.Points (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/EngagementFeatures.cs:85), documented as a permanent capability switch rather than a rollout toggle (EngagementFeatures.cs:80-81). The class doc names the reason they share one reader: the awarder writes nothing for a 0, and the room check-in reports points paused for it, so both read the same two switches (PointsSwitch.cs:11-12). Two call sites asking the same question through two code paths is how a paused game ends up still awarding, or a live game reporting "paused".
  • Walkthrough: one method, GetAwardAsync(activity, cancellationToken) (:22). It honors cancellation first (:24), then reads settings.Value.GetPointsFor(activity) (:28) and returns 0 straight away when the value is 0 or below (:29-30); the comment notes that this check needs no flag read, so it runs first (:26-27). Only a positive value consults the feature manager, returning the value when EngagementFeatures.Points is enabled and 0 otherwise (:32). An activity PointsSettings does not map reads as 0 too (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSettings.cs:58).
  • Why it's built this way: answering with a plain number keeps both callers' logic unchanged: "worth 0 or less" already meant "do nothing" to the awarder, so the game-wide flag folds into the same test without a new branch. Checking the configured value before the flag skips an async flag read for a rule that is already off.
  • Where it's used: registered scoped (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:88). Consumed by PointsAwarder (PointsAwarder.cs:38, read at :55) and by RecordRoomCheckInHandler, which reports points paused when the session check-in award reads 0 or below (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:95-98).
  • Caveats / not-in-source: which provider backs IFeatureManager, and therefore how fast a flag flip reaches a running replica, is host configuration, not visible here.

VerifiedParticipantGate

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Participants · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Participants/VerifiedParticipantGate.cs:24 · Level 9 · sealed class

  • What it is: the implementation of IVerifiedParticipantGate. It applies the verified-participant rule (S-ADC-identity-02) for the calling account, reading the confirmed email from the caller's own token and falling back to a linked-ticket lookup in this module's database (VerifiedParticipantGate.cs:13-20).
  • Depends on: IUnitOfWork and IEntityReader<TEntity, TIdentifierType> (the ticket read), ICurrentUserService (the request principal), VerifiedParticipantSettings via IOptions<T>, Ticket and TicketStatus, ParticipantErrorCodes, ClaimNames, Result. Externals: IOptions<T>, System.Security.Claims.
  • Concept introduced, a cheap token check before a database read. [Rubric §12, Performance & Scalability] and [Rubric §7, Microservices Readiness]: whether an address is confirmed is Identity's fact, but asking Identity on every vote would put a cross-service call on the conference-day hot path. The class doc records the arrangement instead (:14-18): Identity mints email_verified=false on every token of an unconfirmed account and no claim at all on a confirmed one, so the check costs no call, and an account that confirms its address is recognized from its next token. Only when the token does not settle it is the ticket table read, and that table is this module's own (:18-19). [Rubric §11, Security] covers the guard in HasConfirmedEmail (:58-70): the claim counts only when the request principal IS the account being checked (:65-66), because a principal for another account, or none (a service token), proves nothing about this account's address (:59-61).
  • Walkthrough
    • VerifiedParticipantRequiredCode (:30) re-exports ParticipantErrorCodes.VerifiedParticipantRequired, whose value is "Engagement.VerifiedParticipantRequired" (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Participants/ParticipantErrorCodes.cs:13).
    • RequireCaller(forbiddenCode) (:33-34) delegates to the framework's RequireUserId extension on the current-user service (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35).
    • EnsureVerifiedAsync(userId, source, ct) (:37-56) succeeds immediately when the switch is off or the email is confirmed (:42-43). Otherwise it asks the ticket reader whether a ticket exists with LinkedUserId == userId and Status == TicketStatus.Live, for any event (:45-48), and on a miss fails Error.Forbidden with the required code, a message that tells the attendee both ways in (claim the ticket under My tickets, or follow the confirmation link), and the caller's source (:50-55).
    • HasConfirmedEmail(userId) (:63-70) reads ClaimNames.EmailVerified ("email_verified", MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Shared/Authorization/ClaimNames.cs:33) and treats anything other than a case-insensitive "False" as confirmed (:68-69), which is what makes an absent claim mean "confirmed".
  • Why it's built this way: the order of the checks is the cost order. The configuration switch and the token claim are in-memory reads; the ticket ExistsAsync is the only database round trip, and it runs only for an account whose token says unconfirmed. Typing the reader as IEntityReader<Ticket, TicketIdentifierType> (:45) keeps this class on the read-only side of the repository contract.
  • Where it's used: registered scoped as IVerifiedParticipantGate (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:65); every consumer reaches it through that interface (see there). Covered by VerifiedParticipantGateTests.
  • Caveats / not-in-source: the email half is only as fresh as the caller's token: an account that confirms its address mid-session is refused until its next refresh or sign-in unless it also holds a linked ticket (:17-18). That Identity omits the claim for a confirmed account is a property of Identity's token issuance, stated here but not enforced by this file.

PointsAwarder

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.Services · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:36 · Level 10 · class (sealed partial)

  • What it is: the only implementation of IPointsAwarder. It writes one award idempotently, or writes nothing when the rule or the whole points game is switched off or the account has been erased.
  • Depends on: IUnitOfWork, PointsSwitch (which reads PointsSettings and the EngagementFeatures Points flag), PointsEntry, ErasedUserGuard, IUniqueConstraintViolationDetector, Result; externals: ILogger<T> with [LoggerMessage].
  • Concept introduced, the configuration kill switch and the value snapshot. [Rubric §17, DevOps & Deployment] (assesses whether operational levers are configuration rather than code), [Rubric §8, Data Architecture], and [Rubric §11, Security] in its anti-abuse sense. Three ideas are stated once here so no earn rule has to restate them. (1) The stored Points value is a SNAPSHOT of the configured award at the moment it was earned (PointsAwarder.cs:14-17), so retuning the economy mid-conference changes what the NEXT award is worth and never rewrites history: a total is always explainable by what the rules said when it was earned. (2) The unique index on (UserId, ActivityType, SubjectKey) is the source of truth for both idempotency and anti-farming (:20-23), which is what makes a replayed broker message and a farmed scan both land exactly once. (3) A configured 0 is a per-rule kill switch that takes one earn rule out of service without a deploy, and the game-wide EngagementFeatures.Points flag is honored at this same write path, so with the game off nothing is written and turning it back on later never reveals points earned while it was off (:25-30).
  • Walkthrough: four constructor dependencies (PointsAwarder.cs:36-40), one method (:43-104).
    • Kill switches (:50-60): pointsSwitch.GetAwardAsync(activity, cancellationToken) (:55); when the value is <= 0 it logs at Debug and returns success without writing. PointsSwitch answers 0 for a rule configured to 0 and for every rule while the points flag is off (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsSwitch.cs:22-32). Underneath, GetPointsFor maps each of the six activities to its configured property and returns 0 only for an activity it does not map (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSettings.cs:49-59). Every mapped property carries a non-zero default (PointsSettings.cs:19-38), so a missing configuration entry keeps its default award, and switching a rule off takes a deliberate 0, which is what the comment at :50-54 states. Writing nothing (rather than a zero-value row) keeps the ledger free of entries that would otherwise have to be filtered out of every read, and the success no-op keeps the calling adapter from logging its award-rejected warning (:53-54).
    • Erased-account guard (:62-69): ErasedUserGuard.EnsureNotErasedAsync checks the ErasedUser record for the user (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:26). The guard itself returns a Forbidden failure, but here it is turned into a success no-op, logged at Debug, exactly like the disabled rule above, so the calling adapter does not log its award-rejected warning. Because every points adapter (the Conference feedback event included) comes through this method, the one check covers them all (:62-64).
    • Idempotency pre-check (:73-82): ExistsAsync on (UserId, ActivityType, SubjectKey). The comment (:73-74) enumerates what lands here: a repeat scan, a second answer to the same feedback form, and a broker redelivery. All three leave as a clean success.
    • Create (:84-86): PointsEntry.Create validates its own invariants and returns a Result (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/PointsEntry.cs:75), unwrapped with TryGetValue(out var entry) so the entry is non-null on the success branch. A failure here is the one case that propagates as a failure, because it means the caller passed something invalid.
    • Save with a race backstop (:88-100): the same IsUniqueConstraintViolation filter as CreateBookmarkHandler, but the verdict is the opposite one. Here a lost race is a SUCCESS (:93-99), because "the award the caller wanted now exists" is exactly the outcome requested; a bookmark create, by contrast, is a user-visible action whose duplicate the user should be told about.
    • Five [LoggerMessage] partials (:106-119): rule switched off (configured to 0 or the game off, :106), erased account, already awarded, and lost race all log at Debug, while an actual award logs at Information, so the conference-day log volume tracks real awards rather than no-ops.
  • Why it's built this way: the class doc is explicit that the pre-check "is not the rule" (:22-23). Reading the index as the authority and the pre-check as an optimization is what keeps the concurrent case correct rather than merely unlikely.
  • Where it's used: registered as IPointsAwarder (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:87) and called by the four award adapters listed under IPointsAwarder. Read back by PointsService and by the data-subject export, where the ledger and the check-in history are exported as separate collections (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Exports/UserEngagementExportService.cs:40-45, :116-117).

IPointsUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Points/IPointsUIService.cs:14 · Level 3 · interface

  • What it is: the UI contract for the points game surfaces: the attendee's own ledger, the leaderboard and its opt-in switch, and the organizer rollup.
  • Depends on: MyPointsDTO, LeaderboardEntryDTO, PointsOverviewDTO, Result. Externals: BCL Task. The UI service abstraction itself is taught on ISessionBookmarkUIService (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/UserSessionBookmarks/ISessionBookmarkUIService.cs:15).
  • Concept introduced, the server-owned identity on a write. [Rubric §11, Security] assesses whether a client can influence data it should not own. SetLeaderboardParticipationAsync(participate, ct) (:41) takes a single boolean and nothing else, and the doc says why (:35-38): the published name is taken from the caller's token server-side, never from this call. A client that could pass its own display name could publish someone else's, so the parameter simply does not exist. The same discipline shapes GetMyPointsAsync (:23-26), which carries no user identifier at all: "mine" is whoever the bearer token says it is.
  • Concept, opt-in as the default privacy posture. [Rubric §30, Compliance, Privacy & Data Governance] assesses how personal data reaches a public surface. Points accrue for every attendee, but the leaderboard shows only those who opted in, under the name they published at opt-in (:28-31), and the opt-in is an explicit write the attendee makes. [Rubric §9, API & Contract Design] covers the rest of the shape: like every service in this module, every member answers with a Result, so a refusal is data the page renders and only the caller's own cancellation still propagates (:9-12).
  • Walkthrough (IPointsUIService.cs:14-51):
    • GetMyPointsAsync(pageNumber = 1, pageSize = 20, ct) (:23-26) returns the running total, the opt-in state and one page of awarded entries, newest first, in a single MyPointsDTO. The three concerns travel together because the "my points" page renders them as one screen.
    • GetLeaderboardAsync(ct) (:33) returns the whole public leaderboard as one list, with no paging parameters: it is a short, capped list by nature.
    • SetLeaderboardParticipationAsync(participate, ct) (:41) joins or leaves, returning a bare Result because there is nothing to read back.
    • GetPointsOverviewAsync(recentCount = 20, ct) (:48-50) is the organizer rollup, with the recent-entry count as the only knob; organizer only (:43-45).
  • Why it's built this way: one interface for four related reads and one write keeps the whole points vocabulary and its single points resource (PointsService.cs:20) in one place, in the same shape as ICheckInUIService does for check-in (ADR-072 defines the check-in and points model together).
  • Where it's used: implemented by PointsService (PointsService.cs:14-16), registered scoped (MMCA.ADC.Engagement.UI/DependencyInjection.cs:61), and injected into two pages: MyPoints (MyPoints.razor.cs:28, reading at :75 and :85 and writing the opt-in at :117) and OrganizerPointsOverview (OrganizerPointsOverview.razor.cs:24, reading at :46).

EventFeedbackSubmittedPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/EventFeedbackSubmittedPointsHandler.cs:27 · Level 4 · class (sealed partial)

  • What it is: the award adapter that turns Conference's EventFeedbackSubmitted into an event-scoped points award. It is one of the handlers in this folder and the simplest of them.
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over EventFeedbackSubmitted (:30), which is the framework base that implements IIntegrationEventHandler<in TIntegrationEvent>; IPointsAwarder (resolved from the supplied scope, :38), PointsSubjectKeys (:40) and PointsActivityType (:44). Externals: IServiceScopeFactory and a source-generated [LoggerMessage] (:53-54), which is why the class is partial.
  • Concept introduced, the thin award adapter. [Rubric §3, Clean Architecture] assesses where knowledge sits. The rule the module protects is stated on IPointsAwarder (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/IPointsAwarder.cs:10-17): neither the awarder nor the ledger entity names an event, a session or a check-in, so an award is a user, an activity, an opaque subject key and a timestamp. All the conference vocabulary lives in adapters like this one, which is what would make lifting the ledger into MMCA.Common a move rather than a rewrite. [Rubric §1, SOLID] shows up twice: mapping lives here while idempotency and the per-rule kill switch live once in the awarder, and the two blocks every integration handler would otherwise repeat (the DI scope preamble and the log-and-rethrow envelope) live once in the base (MMCA.Common/Source/Core/MMCA.Common.Application/DomainEvents/ScopedIntegrationEventHandlerBase.cs:66-104). [Rubric §6, CQRS & Event-Driven] covers the delivery posture: the base propagates exceptions rather than swallowing them, so delivery stays at-least-once and redelivery is normal (ScopedIntegrationEventHandlerBase.cs:26-33), which is why this handler is written to be safely repeatable rather than to guard against a second call.
  • Walkthrough: the class overrides HandleScopedAsync (:33-36) instead of HandleAsync. The base has already null-guarded the event and opened the per-delivery async scope, and hands in that scope's IServiceProvider (ScopedIntegrationEventHandlerBase.cs:68-94), so the body is only its own resolutions plus its own logic: resolve the scoped IPointsAwarder (:38), build the subject key with PointsSubjectKeys.ForEvent(integrationEvent.EventId) (:40), which delegates to NotificationScopeKey.ForEvent and therefore produces the invariant-culture event:{id} string (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSubjectKeys.cs:19-20, MMCA.Common/Source/Core/MMCA.Common.Shared/Notifications/NotificationScopeKey.cs:48-49), then award PointsActivityType.EventFeedback at the event's own SubmittedOnUtc (:42-47). A rejected award (the awarder returning a failure rather than throwing) is logged at Warning and not rethrown (:49-50), because the awarder only fails when the entry itself is invalid, which is a caller bug rather than a retryable condition (IPointsAwarder.cs:30-34). An exception takes the other path: the base logs it once and lets it propagate so the delivery is retried.
  • Why it's built this way: the class comment (:13-18) states the multiplicity fact that makes this handler safe to keep this simple. Event feedback writes one answer row per question (BR-107), so one submitted form arrives here as several events. Nothing counts them: they all resolve to the same event subject key, and the awarder's uniqueness rule collapses them into a single award. That same property is what makes a broker redelivery a no-op, so no dedupe logic is written twice.
  • Where it's used: registered by the convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92), which reaches MMCA.Common's singleton registration for every IIntegrationEventHandler<> implementation (MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:55-56); the singleton lifetime is exactly why the base opens a scope per delivery (:19-23). The Engagement service subscribes the matching consumer (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:28). Covered by EventFeedbackSubmittedPointsHandlerTests.

SessionFeedbackSubmittedPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/SessionFeedbackSubmittedPointsHandler.cs:29 · Level 4 · class (sealed partial)

  • What it is: the award adapter for session feedback, mapping Conference's SessionFeedbackSubmitted onto a session-scoped award. The structural twin of EventFeedbackSubmittedPointsHandler.
  • Depends on: the same set as its sibling, with SessionFeedbackSubmitted as the base's closed type (:32) and IPointsAwarder resolved from the scope the base supplies (:40).
  • Concept: the thin award adapter is taught on EventFeedbackSubmittedPointsHandler; the same reasoning applies unchanged. [Rubric §15, Best Practices & Code Quality] is worth naming here: the two files are near-identical and are deliberately kept separate rather than folded into one generic handler, because each is bound to a different event type at the DI boundary and, once ScopedIntegrationEventHandlerBase<TIntegrationEvent> absorbed the scope and error plumbing, what is left to share is five lines of mapping.
  • Walkthrough of what differs: only two lines. The subject key is built with PointsSubjectKeys.ForSession(integrationEvent.SessionId) (:42), producing session:{id} (PointsSubjectKeys.cs:25-26, NotificationScopeKey.cs:54-55), and the activity is PointsActivityType.SessionFeedback (:46). Everything else, the HandleScopedAsync override (:35-38), the awarder resolution (:40), the SubmittedOnUtc timestamp (:48) and the log-and-continue path for a rejected award (:51-52), matches the event handler line for line.
  • Why it's built this way: the class comment (:14-20) is explicit that Conference raises this event once per newly created answer, so one submission normally arrives here as several events, and nothing here counts them: they all resolve to the same session subject key and the awarder's uniqueness rule collapses them into a single award.
  • Where it's used: registered by the convention scan as a singleton (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92, MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:55-56); the consumer is wired at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:27. Covered by SessionFeedbackSubmittedPointsHandlerTests.

SessionQuestionSubmittedPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.DomainEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/DomainEventHandlers/SessionQuestionSubmittedPointsHandler.cs:53 · Level 4 · class (sealed partial)

  • What it is: the award adapter for session Q and A. It awards PointsActivityType.QuestionAsked the first time an attendee asks a question in a session. It is the one award adapter in the module that rides a domain event rather than an integration event, which makes it the best place in this chapter to see the two delivery models side by side.
  • Depends on: IDomainEventHandler<in TDomainEvent> implemented over SessionQuestionChanged (:55), BestEffort wrapping the award (:81), IPointsAwarder resolved per event (:87), PointsActivityType (:93), PointsSubjectKeys (:94) and DomainEntityState (:65). Externals: IServiceScopeFactory, ILogger, and three source-generated [LoggerMessage] methods (:104-111), which is why the class is partial.
  • Concept introduced, choosing at-most-once on purpose. [Rubric §6, CQRS & Event-Driven] assesses whether a delivery guarantee is a decision or an accident. Its siblings in Points/IntegrationEventHandlers all consume outbox-published integration events, which are at-least-once and survive a crash. This one subscribes to an in-process domain event, and the class comment (:30-39) argues the trade-off explicitly: dispatch happens after the question's transaction commits, so a crash in the window between the commit and this handler loses one small award and nothing else, no question is lost and no total is corrupted. The alternative (a second outbox contract, a broker round trip and inbox dedup for a handful of points) buys durability the feature does not need. [Rubric §29, Resilience & Business Continuity] is the same paragraph read from the operations side, and it names the exit: promoting the path later is a one-file change on each side, the aggregate raises an integration event instead and this class becomes an IIntegrationEventHandler. Contrast UserDeletedPointsHandler, which sits on the integration path and deliberately lets an exception propagate, because a missed erasure is not a missed nicety.
  • Concept introduced, taking everything off the event rather than reading it back. [Rubric §15, Best Practices & Code Quality] assesses whether a class works with the data it is actually given. The comment at :22-29 records the trap this file is written around: SessionQuestionChanged is captured by value while the aggregate is still new, so on the Added path its QuestionId is zero (the identity is generated by the INSERT, which has not run when the event is raised, and the event is never re-stamped). The event contract states the same rule at its own source (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/SessionQuestions/DomainEvents/SessionQuestionChanged.cs:16-22) and carries UserId and SessionId precisely because they are set before the raise (:24-28). This handler therefore reads no row at all: the two fields it needs come off the event, so there is no read-back to get wrong.
  • Concept introduced, the subject key as the anti-farming rule. The subject key is the session, never the question (:94), so an attendee who asks five questions in one session earns once. [Rubric §8, Data Architecture] is why that holds under concurrency: the limit is enforced by the ledger's unique index inside PointsAwarder rather than by counting here (:18-20), so two simultaneous submissions cannot both slip past a read-then-write check.
  • Walkthrough
    • The primary constructor (:53-55) takes an IServiceScopeFactory and a logger. Domain event handlers are registered as singletons by the framework's convention scan (MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:52-53), which is why this class opens its own scope instead of injecting scoped services (:48).
    • HandleAsync (:61) null-guards the event (:63), then returns unless the state is DomainEntityState.Added (:65-69). SessionQuestionChanged is raised for moderation and deletion too (SessionQuestion.cs:149, :158, :190, :234), so this filter is what keeps a moderator approving a question from paying the asker a second time. The skip is logged at Debug (:67, :104-105).
    • The second guard rejects a defaulted UserId (:71-78). The comment (:73-75) is worth reading as a lesson in log-level choice: the path is unreachable through the aggregate, because the Create invariants reject a default user, so reaching it can only mean a new raise site forgot to pass the asker, and a silent skip there would award nobody without a trace. It is therefore a Warning (:76, :107-108), not a silent return.
    • The award runs inside a BestEffort.ExecuteAsync call (:81, comment :80) named by the OperationName const "session-question-points-award" (:58). Inside its delegate one async DI scope is opened (:86) and the scoped IPointsAwarder resolved (:87). AwardAsync is called with the event's UserId, PointsActivityType.QuestionAsked, PointsSubjectKeys.ForSession(domainEvent.SessionId), domainEvent.DateOccurred and the wrapper's own token (:91-96). The comment (:89-90) explains the timestamp choice: DateOccurred is stamped when the aggregate raised the event (MMCA.Common/Source/Core/MMCA.Common.Domain/DomainEvents/BaseDomainEvent.cs:28), which is when the attendee actually asked, so no clock has to be injected here.
    • A rejected award (the awarder returning a failure) logs at Warning (:98-99, :110-111).
    • There is no local try/catch. BestEffort.ExecuteAsync swallows a thrown award failure and rethrows only the caller's own cancellation, so the handler carries no CA1031 suppression and no bespoke failure log message: the failure is reported by the helper as one Warning plus one besteffort.dispatch.failed increment (class comment :43-45, ADR-096). [Rubric §13, Observability & Operability] covers the discipline around it: the swallow is never silent, and the class comment states the rule that every declining path says so at a level matching how surprising it is (:41-43).
  • Why it's built this way: both guards exist so the game can never damage the feature it decorates. The state filter keeps the ledger honest, the BestEffort wrapper keeps a points outage from becoming a Q and A outage, and taking the asker off the event removes the only lookup that could quietly award nobody. The swallow is also why this class implements IDomainEventHandler<in TDomainEvent> directly rather than deriving from the framework's SafeDomainEventHandler<TDomainEvent>: it wants the exception to stop here, not to be logged and rethrown. The points design as a whole is ADR-072.
  • Where it's used: discovered and registered as a singleton by ScanModuleApplicationServices<ClassReference>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92), and invoked by the framework's domain event dispatcher after the Q and A write path's SaveChangesAsync. Its raise site is SessionQuestion.Create (SessionQuestion.cs:124). Covered by SessionQuestionSubmittedPointsHandlerTests.
  • Caveats / not-in-source: how many points QuestionAsked is worth, and whether the rule is switched off at all, is configuration read inside PointsAwarder, not here.

BookmarkCacheEvictionProcessor

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Caching · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Caching/BookmarkCacheEvictionProcessor.cs:35 · Level 4 · sealed class

  • What it is: a BackgroundService that turns "a bookmark changed" into at most one cross-service cache eviction every ten seconds per replica. It drains the capacity-one flag held by BookmarkCacheEvictionSignal and publishes an OutputCacheEvictionRequested for the Conference session tag, so Conference's cached session reads and batched star counts stop serving stale numbers.
  • Depends on: BookmarkCacheEvictionSignal (:36), UserSessionBookmarkCacheEvictionHandler for the SessionsCacheTag constant (:73), BestEffort (:62). Externals: BackgroundService, IServiceScopeFactory, TimeProvider, ILogger, IEventBus, OutputCacheEvictionRequested.
  • Concept introduced, coalescing with a flag and a pacing delay. [Rubric §10, Performance & Scalability] assesses whether a hot write path can hammer a shared cache. Two pieces cooperate. The signal is a Channel<bool> bounded at one with BoundedChannelFullMode.DropWrite (BookmarkCacheEvictionSignal.cs:27-33), so any number of Request() calls made while one is pending collapse into that one (:42). The processor then sleeps PacingWindow (ten seconds, :46) after each broadcast (:79). Together the pacing, not the bookmark rate, sets the eviction rate: at a session changeover hundreds of attendees star sessions in the same minute, and an eviction per star would keep the session cache permanently cold and send every read to Conference's database (the signal's remarks, BookmarkCacheEvictionSignal.cs:11-18). The pacing window is worst-case six evictions a minute per replica (doc comment :41-45).
  • Walkthrough
    • ExecuteAsync (:52) loops on signal.Reader.WaitToReadAsync and does a single TryRead to empty the flag (:60), so anything raised after that read is the next broadcast's business.
    • The publish runs inside BestEffort.ExecuteAsync (:62) under the operation name "bookmark-cache-evict-broadcast" (:49). It opens a fresh async scope (:67), resolves IEventBus (:68) and publishes OutputCacheEvictionRequested with Tags = [UserSessionBookmarkCacheEvictionHandler.SessionsCacheTag] (:70-75). A failed publish is a Warning plus a metric, never an exception out of the loop.
    • Task.Delay(PacingWindow, timeProvider, stoppingToken) (:79) takes the injected TimeProvider, so tests drive the pacing with a fake clock rather than waiting ten real seconds.
    • An OperationCanceledException raised while the host is stopping is caught and ends the loop (:82); a request still pending at that moment is covered by Conference's TTL backstop (comment :84).
  • Why it's built this way: the eviction is a convenience over a TTL, not a correctness mechanism, so it is best effort and never blocks or fails the bookmark command that raised it (the signal's Request never blocks or fails, BookmarkCacheEvictionSignal.cs:21-22). The processor is a long-lived singleton, so it opens a scope per publish rather than holding a scoped bus. The wider caching story is ADR-040, the helper is ADR-096 and the in-process work-queue shape is ADR-121.
  • Where it's used: raised through the signal by UserSessionBookmarkCacheEvictionHandler; the signal and processor are registered in the module's Application and Infrastructure DependencyInjection.cs, and the Conference service host references it (MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs). Covered by BookmarkCacheEvictionProcessorTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure.Tests/Caching/BookmarkCacheEvictionProcessorTests.cs).
  • Caveats / not-in-source: one flag per replica, so with several Engagement replicas each broadcasts independently; the code does not dedupe across replicas. The Conference-side TTL value is not defined in this file.

ExpireTicketRosterImportInternalCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ExpireRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ExpireRosterImport/ExpireTicketRosterImportInternalCommand.cs:14 · Level 4 · record (public sealed)

  • What it is: the delayed privacy backstop of one roster import run. A durable internal command whose whole payload is the run id (:14), handled by ExpireTicketRosterImportHandler.
  • Depends on: IInternalCommand (:1, :14) and InternalCommandNameAttribute, which names it Engagement.ExpireTicketRosterImport.v1 (:13); the TicketImportRunIdentifierType alias. No externals.
  • Concept introduced, a deadline scheduled as a second command. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether personal data has a bounded lifetime. The doc comment (:5-11) states the contract: the command is scheduled in the same transaction as the run and falls due TicketImportRun.AbandonAfter later, which is 30 minutes (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketImportRun.cs:37). When it runs, a still-active run is ended as abandoned and any run's staged roster is cleared, so the uploaded file's holder data cannot outlive the run by more than that window. [Rubric §29, Resilience & Business Continuity] covers the failure it exists for: it only matters when ProcessTicketRosterImportInternalCommand never got to end the run because its row dead-lettered (:8-10). The doc cites ADR-005 (erasure) and ADR-114 (the durable internal-command queue).
  • Walkthrough: a positional record with one member, RunId (:14). The versioned name on the attribute (:13) is what the internal-command queue identifies the row by, not the CLR type name.
  • Where it's used: scheduled by StartTicketRosterImportHandler with the TicketImportRun.AbandonAfter delay, right after the processing command (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportHandler.cs:121-123); handled by ExpireTicketRosterImportHandler. Named in MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Cqrs/CommandValidatorCoverageTests.cs and exercised by ExpireTicketRosterImportHandlerTests and StartTicketRosterImportHandlerTests.

ITicketUIService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Tickets/ITicketUIService.cs:20 · Level 4 · interface (public)

  • What it is: the UI-side contract for everything ticket-related a page can do. Organizers dry-run, import, track, invite, link, summarize, report on and delete an event's TicketLeap roster; an attendee reads their own tickets and claims one by barcode. Eleven members, every one returning a Result or Result<T>.

  • Depends on: Result; the EventIdentifierType alias; the DTOs TicketRosterImportResultDTO, TicketRosterImportRunDTO, TicketInvitesResultDTO, TicketAccountLinkResultDTO, TicketRosterSummaryDTO, RosterInsightsDTO, EngagementInsightsDTO and MyTicketDTO. Externals: ReadOnlyMemory<byte>, CancellationToken.

  • Concept introduced, dry run then commit over the same bytes. [Rubric §24, Forms, Validation & UX Safety] assesses whether a destructive action can be previewed first. DryRunRosterAsync (:33) reports the counts the commit would produce and writes nothing (:22-24); StartRosterImportAsync (:48) then commits the reviewed file as a background run and answers the queued run, with a conflict when the event's previous run is still active (:39-42). Both take the file as ReadOnlyMemory<byte> rather than a stream, because the page reads the picked file once and posts the same bytes twice: a browser file stream cannot be read twice (:28-29). [Rubric §18, UI Architecture] covers the shape: pages depend on this interface, so the transport stays out of the components and bUnit tests substitute it. [Rubric §30, Compliance, Privacy & Data Governance] shows in the insights docs: the roster report is aggregate only and its domain-mix cells carry the server-applied small-number rule (:92-96), and every count of 1 or 2 in the activity report arrives already withheld (:103-107). [Rubric §11, Security] shows on ClaimAsync (:135): an unknown barcode, a ticket linked elsewhere and a voided ticket answer the one indistinguishable NotFound, so the claim endpoint cannot be used to probe which barcodes exist (:125-131).

  • Walkthrough

    Member File:Line What it answers
    DryRunRosterAsync(eventId, content, fileName) ITicketUIService.cs:33 the would-be counts, nothing written
    StartRosterImportAsync(eventId, content, fileName) ITicketUIService.cs:48 the queued import run
    GetRosterImportAsync(eventId) ITicketUIService.cs:60 the latest run's status and processed-of-total; NotFound when there is none (:54-57)
    SendInvitesAsync(eventId, dryRun) ITicketUIService.cs:70 one invite per eligible order email, up to the per-run cap (:64-66)
    LinkExistingAccountsAsync(eventId) ITicketUIService.cs:81 tickets linked to existing confirmed accounts, re-runnable (:75-78)
    GetSummaryAsync(eventId) ITicketUIService.cs:88 the roster adoption funnel
    GetRosterInsightsAsync(eventId) ITicketUIService.cs:99 roster-only reports A1 to A6
    GetEngagementInsightsAsync(eventId) ITicketUIService.cs:110 roster-plus-activity reports B1 to B4, degraded rather than failed on a cross-service lookup failure (:105-106)
    DeleteRosterAsync(eventId) ITicketUIService.cs:117 deletes the whole roster after the event
    GetMyTicketsAsync() ITicketUIService.cs:123 the caller's linked tickets, the caller taken from the token
    ClaimAsync(eventId, barcode) ITicketUIService.cs:135 the claimed ticket; the same NotFound for an unknown barcode, a ticket linked to another account and a voided ticket, so the server never confirms which barcodes exist, and Conflict only as the idempotency filter's answer to a duplicate of a claim still in flight (:125-131)

    The first nine are organizer-only (engagement:tickets:manage, :22-24); the last two are the attendee's.

  • Where it's used: implemented by TicketService and registered as services.AddScoped<ITicketUIService, TicketService>() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/DependencyInjection.cs:65). Injected by TicketRosterUpload, TicketRoster, TicketInsights and MyTicketsPanel, and substituted in their bUnit tests (TicketRosterTests, TicketRosterUploadImportRunTests, TicketInsightsTests, TicketRosterFailureWordingTests, MyBadgeTests).

  • Caveats / not-in-source: the permission is enforced by the server endpoints, not by this interface; the doc comments only name it.


ProcessTicketRosterImportInternalCommand

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ProcessRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportInternalCommand.cs:21 · Level 4 · record (public sealed)

  • What it is: the durable trigger that applies one committed roster import run in batches (:6-11). Like its sibling ExpireTicketRosterImportInternalCommand, the payload is the run id only (:21).
  • Depends on: IInternalCommand and IHasTimeout (:1-2, :22); InternalCommandNameAttribute naming it Engagement.ProcessTicketRosterImport.v1 (:20).
  • Concept introduced, the markers a background command leaves off. [Rubric §6, CQRS & Event-Driven] assesses how commands opt into pipeline behavior; here the omissions are the design, and the remarks (:12-18) justify each. It is neither IRequiresPermission nor IFeatureGated: the organizer's permission and the feature flag were checked when the run started, and a refusal at this point would retry into a dead letter with the staged roster still on the run. It is not ITransactional either: each batch commits on its own so the processed count other replicas read moves as the run goes (ADR-107). [Rubric §30, Compliance, Privacy & Data Governance]: the holder data stays on the run, where every ending of the run clears it, so the internal-command row, kept for the queue's retention window, never holds a name or an address (:7-10).
  • Walkthrough: the positional RunId (:21) and one member, Timeout => TimeSpan.FromMinutes(10) (:28), the per-attempt execution budget. Its doc (:24-27) ties it to the backstop: ten minutes sits well under TicketImportRun.AbandonAfter (30 minutes, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketImportRun.cs:37), so the expiry never fires on a run that is still applying batches.
  • Why it's built this way: the queue is ADR-114's durable internal-command store, so an upload survives a restart between the commit and the processing.
  • Where it's used: scheduled with no delay by StartTicketRosterImportHandler (StartTicketRosterImportHandler.cs:115-117) and handled by ProcessTicketRosterImportHandler. The host comments in MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:175-184 and MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:322 name it as the reason the verified-user lookup edge must accept a service token: the import runs with no HttpContext, so there is no organizer bearer to forward.
  • Caveats / not-in-source: the retry count and back-off between attempts belong to the internal-command processor's configuration, not to this record.

PointsService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Points/PointsService.cs:14 · Level 5 · sealed class

  • What it is: the HTTP implementation of IPointsUIService against the points resource (PointsService.cs:18). Four calls, four endpoints, no client-side computation of any kind.
  • Depends on: IPointsUIService, AuthenticatedServiceBase (:16), whose SendRequestAsync overloads wrap HttpResultExecutor and ProblemDetailsResultReader for it, ITokenStorageService, MyPointsDTO, LeaderboardEntryDTO, SetLeaderboardParticipationRequest, PointsOverviewDTO. Externals: IHttpClientFactory, System.Net.Http.Json, System.Globalization.
  • Concept: the authenticated-HTTP shape from BookmarkApiClient (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Bookmarks/BookmarkApiClient.cs:21), applied to a surface where authentication is doing four different jobs at once. The class doc (:9-13) enumerates them, and they are worth reading as a [Rubric §11, Security] exercise: the ledger read and the leaderboard opt-in are caller-scoped ("my points"), the leaderboard read is caller-agnostic but still requires a signed-in attendee (PointsController.cs:35), and the overview is role-gated on the server (PointsController.cs:122). The client enforces none of that and does not try to: it attaches the token and lets the server decide, which is why a 403 arrives as a Forbidden failure the page can render rather than as a page that guessed wrong about permissions.
  • Walkthrough (in interface order)
    • GetMyPointsAsync (:21-31) GETs points/me?pageNumber=&pageSize= with invariant formatting (:28) and returns MyPointsDTO. No user id is sent; the server reads the caller from the token (PointsController.cs:50).
    • GetLeaderboardAsync (:34-37) GETs points/leaderboard, reads a List<LeaderboardEntryDTO> (:35) and Maps it to the interface's IReadOnlyList (:37). The variance cast is the only transformation: the ordering and the ranks are the server's.
    • SetLeaderboardParticipationAsync (:40-52) PUTs a SetLeaderboardParticipationRequest carrying only the boolean (:46) to points/me/leaderboard-participation. The inline comment (:44-45) explains the shape of the round trip: the endpoint answers 204 with no body (PointsController.cs:100), so the method goes through the body-less SendRequestAsync overload (:41), returns the valueless Result, and the caller re-reads its own points to pick up the new opt-in state and display name.
    • GetPointsOverviewAsync (:55-64) GETs points/overview?recentCount= (:61) for the organizer rollup.
    • Each method supplies only the HTTP call as a lambda; the inherited SendRequestAsync does the rest. The generic overload (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171-189) runs inside HttpResultExecutor.ExecuteAsync, creates the authenticated client once, sends the lambda through the shared retry policy (AuthenticatedServiceBase.cs:185) and reads the response with ProblemDetailsResultReader.ReadAsync<T> (:186); the body-less overload (AuthenticatedServiceBase.cs:201-217) does the same with the non-generic reader. None of the four passes an idempotency key: three are reads and the opt-in PUT sets a boolean, so a repeated attempt lands in the same state.
  • Why it's built this way: every number the game shows (totals, per-activity breakdowns, ranks) is computed server-side and arrives as a DTO, so there is no client-side scoring logic to keep in step with the earn rules. [Rubric §30, Compliance, Privacy & Data Governance]: the leaderboard is opt-in, so publishing a name is an explicit act with its own endpoint rather than a side effect of earning points. See ADR-072 for the surrounding decision.
  • Where it's used: registered scoped as IPointsUIService (MMCA.ADC.Engagement.UI/DependencyInjection.cs:61); consumed by MyPoints (MyPoints.razor.cs:28, called at :97, :107, :139) and OrganizerPointsOverview (OrganizerPointsOverview.razor.cs:24, called at :61). The whole controller sits behind the EngagementFeatures.Points gate (PointsController.cs:34, see EngagementFeatures and ADR-031).
  • Caveats / not-in-source: there is no PointsServiceTests file in the UI test project; coverage comes through the bUnit page tests (MyPointsTests, OrganizerPointsOverviewTests), which mock IPointsUIService. How points are earned and what each activity is worth is server-side rule, nothing in this file.

TicketService

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Services.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Tickets/TicketService.cs:24 · Level 5 · class (public sealed)

  • What it is: the HTTP implementation of ITicketUIService over the tickets endpoints (Endpoint, :28). Every call is authenticated; the roster, invite, summary and delete calls are permission-gated on the server, while claim and my-tickets take the attendee from the token (class doc :14-18).
  • Depends on: AuthenticatedServiceBase (:26), which supplies the two SendRequestAsync overloads (MMCA.Common/Source/Presentation/MMCA.Common.UI/Services/Api/AuthenticatedServiceBase.cs:171, :201), the shared RetryPolicy (AuthenticatedServiceBase.cs:41) and NewIdempotencyKey (AuthenticatedServiceBase.cs:65), and through them HttpResultExecutor, ProblemDetailsResultReader and IdempotencyHeaders; ImportConventions; the request bodies SendTicketInvitesRequest and ClaimTicketRequest. Externals: IHttpClientFactory, MultipartFormDataContent, ReadOnlyMemoryContent, MediaTypeHeaderValue.
  • Concept introduced, one idempotency key per logical write, minted outside the retry. [Rubric §29, Resilience & Business Continuity] assesses whether a retried request can double-apply. The remarks (:19-23) state the rule: the four writes the API marks [Idempotent] (roster upload, invites, link-existing, claim) carry one Idempotency-Key per logical operation, minted outside the retry pipeline. Each of the four passes idempotencyKey: NewIdempotencyKey() to SendRequestAsync (:86, :100, :113, :181); the base builds one client per logical operation, puts the key in its default headers (AuthenticatedServiceBase.cs:232-243) and only then hands it to RetryPolicy.ExecuteAsync (AuthenticatedServiceBase.cs:184-185), so every attempt states the same key and a retried send replays the first answer instead of running twice. [Rubric §24, Forms, Validation & UX Safety] covers the upload: retrying a multipart post is normally unsafe because a stream is consumed, but the bytes are already in memory (at most TicketRosterLimits.MaxFileBytes, checked by the page), so each attempt builds a fresh form over them inside the lambda (:67-69, :74-81).
  • Walkthrough
    • DryRunRosterAsync (:31-36) and StartRosterImportAsync (:39-44) both delegate to PostRosterAsync<T> with dryRun: true or false.
    • PostRosterAsync<T> (:60-86) posts one multipart form to tickets/roster (:83); the dry run answers 200 with the counts and the commit 202 with the queued run (:58-59). The parts are the file as text/csv (:78) named roster.csv when the picked name is blank (:79), eventId (:80) and the dry-run part named by ImportConventions.DryRunFieldName (:81). The comment (:72-73) records why the names matter: they bind to the controller's IFormFile parameter and two [FromForm] arguments, and a renamed part binds to its default and fails validation.
    • GetRosterImportAsync (:47-56) reads tickets/roster/import?eventId= (:53), the progress poll for the background run.
    • SendInvitesAsync (:89-100) posts a JSON SendTicketInvitesRequest to tickets/invites (:96-97); LinkExistingAccountsAsync (:103-113) posts an empty body to tickets/link-existing?eventId= (:109-110); GetSummaryAsync (:116-125) reads tickets/summary (:122).
    • GetRosterInsightsAsync (:128-131) and GetEngagementInsightsAsync (:134-137) share GetInsightsAsync<T> (:139-146), which builds tickets/insights/{kind} (:143) for the kinds roster and engagement.
    • DeleteRosterAsync (:149-158) sends DELETE tickets/roster?eventId= (:155) through the body-less SendRequestAsync overload (:152), which reads it with the non-generic ProblemDetailsResultReader.ReadAsync (AuthenticatedServiceBase.cs:214).
    • GetMyTicketsAsync (:161-164) reads tickets/mine (:163) and maps the List<MyTicketDTO> to IReadOnlyList<MyTicketDTO> (:164).
    • ClaimAsync (:167-182) throws on a blank barcode before any I/O (:172), trims it into a ClaimTicketRequest (:177) and posts to tickets/claim (:178).
  • Why it's built this way: every method supplies only its HTTP call as a lambda and lets the inherited SendRequestAsync wrap it in HttpResultExecutor.ExecuteAsync, the retry policy and ProblemDetailsResultReader (AuthenticatedServiceBase.cs:179-188), so a server ProblemDetails becomes a Result failure the page can branch on rather than an exception it has to catch, and the key-before-retry ordering lives once in the base instead of in each method.
  • Where it's used: registered at MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/DependencyInjection.cs:65; reached through ITicketUIService by TicketRosterUpload, TicketRoster (including its TicketRoster.Invites.razor.cs partial), TicketInsights and MyTicketsPanel. The server side is TicketsController and TicketRosterImportController.
  • Caveats / not-in-source: which routes each controller actually serves is defined server-side; this file only fixes the client URLs.

UserDeletedPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/UserDeletedPointsHandler.cs:38 · Level 8 · class (sealed partial)

  • What it is: the erasure handler for the leaderboard. When Identity deletes an account, this takes the entry off the public board and overwrites the display name it published there. It is the one consumer in this folder that awards nothing.
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserDeleted (:40), IUnitOfWork (:50), the IRepository<TEntity, TIdentifierType> it obtains for LeaderboardOptIn (:51) and that aggregate's own Delete() / EraseDisplayName() members (:69, :81). Externals: IServiceScopeFactory, source-generated [LoggerMessage] (:96-103).
  • Concept introduced, cross-database erasure by event. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether a deletion promise actually reaches every copy of the data. Under database-per-service (ADR-006) Identity cannot delete a row in the Engagement database, so an erasure has to travel as an event and be carried out by the owning service. The class comment (:13-21) names the exact scope: the leaderboard is the one place Engagement holds a name rather than a scalar id, LeaderboardOptIn.DisplayName is a snapshot the attendee published at opt-in, and without this handler that name would keep sitting in the table after the account was erased. It also names what is deliberately left alone: the points ledger, because a PointsEntry carries a scalar user id and an opaque subject key and names nobody, the same posture already applied to session bookmarks. That is the ADR-005 distinction between soft-delete for lifecycle and erasure for personal data, applied per column rather than per table. [Rubric §29, Resilience & Business Continuity] covers the retry posture stated at :26-27: exceptions are deliberately not caught, so a failure is logged once by the base and then propagates, and the outbox and the broker retry it rather than acking it away with a log line (MMCA.Common/Source/Core/MMCA.Common.Application/DomainEvents/ScopedIntegrationEventHandlerBase.cs:26-33). The award adapters share that exception posture, because they share the base; what differs is what they do with a rejected award, which they log and move past, whereas this handler has no such branch: a missed point is a nuisance, a missed erasure is a broken promise.
  • Walkthrough
    • HandleScopedAsync (:43-46) is the override; the base has null-guarded the event and opened the per-delivery scope. The body takes the user id (:48), then reaches the scoped IUnitOfWork (:50) and a tracked repository for LeaderboardOptIn (:51) out of the supplied provider.
    • The read (:56-61) is the subtle line. It passes asTracking: true (mutations follow) and ignoreQueryFilters: true, and the comment (:53-55) explains that the flag is load-bearing here for the opposite reason it is used on the join path: an attendee who left the board earlier still has a soft-deleted row carrying the published name, and a filtered read would walk straight past the very row that has to be erased.
    • The loop (:65-84) does two independent things per row. If the row is not already deleted it calls Delete() and, on failure, logs and moves to the next row rather than aborting the batch (:67-77). If the display name is not already erased it calls EraseDisplayName() (:79-83). Either action sets changed.
    • When nothing changed the handler logs and returns without a save (:86-90); otherwise it saves once for the whole batch and logs the row count (:92-93).
  • Why it's built this way: the two-flag loop is what makes the handler idempotent in both directions (:22-25): an account that never joined the board has no row and writes nothing, and an account already off the board with an erased name reaches the same end state and writes nothing again. At-least-once delivery makes redelivery normal, so that property is a requirement rather than a nicety.
  • Where it's used: registered as a singleton by the convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92, MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:55-56), with the consumer wired at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29; the host's composition comment (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:208-212) records that this is the one consumer here that earns nothing. Covered by UserDeletedPointsHandlerTests.
  • Caveats / not-in-source: the privacy commitment the comment cites (PRIVACY.md section 5) lives in the ADC repo's private docs, not in this file. What EraseDisplayName() writes in place of the name is defined on LeaderboardOptIn.

ExpireTicketRosterImportHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ExpireRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ExpireRosterImport/ExpireTicketRosterImportHandler.cs:14 · Level 8 · class (public sealed partial)

  • What it is: the handler for ExpireTicketRosterImportInternalCommand. It ends a run that is still active, or still holds its staged roster, as abandoned.
  • Depends on: ICommandHandler<in TCommand, TResult> (:17), IUnitOfWork (:15), TicketImportRun and Result. Externals: TimeProvider, ILogger<T> with source-generated [LoggerMessage].
  • Concept, a backstop that is harmless when it is late. [Rubric §29, Resilience & Business Continuity] assesses whether a redelivered or stale job can do damage. HandleAsync (:20-42) returns success with no write when the run is gone (:30-31) or already ended with no staged roster (:33-34), so the normal case, where processing finished long before the 30-minute timer, is a no-op. Otherwise it calls run.Fail(TicketImportRun.AbandonedErrorCode, now) (:36) and saves (:41). [Rubric §13, Observability & Operability]: the Warning LogAbandoned (:45-46) fires only when Fail reports that it ended the run (:36-39), and it records how far the run got (Processed of Total) and that the staged roster was cleared.
  • Walkthrough: the run is loaded tracked by id (:26-29), the two early returns follow (:30-34), then the fail, the conditional log and the save (:36-41).
  • Where it's used: dispatched by the internal-command processor (InternalCommandProcessor) for the row StartTicketRosterImportHandler schedules (StartTicketRosterImportHandler.cs:121-123). The same abandoned code is applied inline when a new upload finds an abandoned active run (StartTicketRosterImportHandler.cs:102-109). Covered by ExpireTicketRosterImportHandlerTests.
  • Caveats / not-in-source: what Fail clears on a run that has already ended, and when it returns false, is decided in TicketImportRun; this handler saves at :41 either way.

ProcessTicketRosterImportHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ProcessRosterImport · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ProcessRosterImport/ProcessTicketRosterImportHandler.cs:29 · Level 11 · class (public sealed partial)

  • What it is: the handler for ProcessTicketRosterImportInternalCommand. It applies a committed run's staged roster to the event's tickets in batches, voids the tickets the file no longer lists, links tickets to existing confirmed accounts, and completes the run; any fault ends the run as failed.
  • Depends on: ICommandHandler<in TCommand, TResult> (:34), IUnitOfWork (:30), IVerifiedUserLookupService (:32), TicketImportRun, Ticket, TicketRosterStaging, TicketRosterApplier, TicketRosterCounts, ExistingAccountLinker, TicketRosterImportErrorCodes and Result. Externals: IServiceScopeFactory, TimeProvider, ILogger<T> with [LoggerMessage].
  • Concept introduced, resumable batches with committed progress. [Rubric §29, Resilience & Business Continuity] assesses whether long work survives a crash midway. Each pass of the loop takes roster.Entries.Skip(run.Processed).Take(BatchSize) (:116), applies it, then records the batch on the run and saves (:122-123), so the run's Processed count and the tickets it describes commit together. An OperationCanceledException (host shutdown or the attempt's timeout) is rethrown (:74-78) and the retry resumes at the committed progress. [Rubric §8, Data Architecture]: barcodes the file moves between its own tickets are parked first, in their own save, so no batch ever holds one barcode twice whichever batches the two tickets fall in (:107-111). The load reads every ticket of the event with ignoreQueryFilters: true (:99-104), so filtered rows are in the set the applier compares against.
  • Concept introduced, failing the run on a clean context. [Rubric §15, Best Practices & Code Quality]. The catch-all (:80) carries a scoped CA1031 suppression whose justification is on the pragma itself (:79): any fault fails the run in a fresh scope, is logged, and the handler returns success so the queue does not retry a run already marked failed. FailInFreshScopeAsync (:145-159) creates a new scope (:147), reloads the run there, fails it and saves, because the original context may still hold the change set that faulted (doc :144). A failed Result from ApplyAsync takes the same path with its first error code (:68-72). [Rubric §30, Compliance, Privacy & Data Governance]: a redelivery after the run ended applies nothing, but if a staged roster is somehow still present it is anonymized and saved anyway (:53-64), so the guarantee that a finished run holds no file data is unconditional.
  • Walkthrough
    • BatchSize = 100 (:37) and FailedCode = TicketRosterImportErrorCodes.Failed (:40) are public constants.
    • HandleAsync (:43-88) loads the run tracked (:49-52), handles the ended-run redelivery (:53-64), then runs ApplyAsync inside the try (:66-85).
    • ApplyAsync (:90-142) deserializes the staged roster and fails with an Error.Unexpected coded Ticket.Import.StagingUnreadable when it cannot (:92-96; the run then fails with that code through the :68-72 path), builds a TicketRosterApplier over the loaded tickets (:105), parks swapped barcodes (:109-111), loops the batches with addNew: true (:114-124), saves the voids from VoidMissing (:126-127), calls ExistingAccountLinker.LinkEventAsync (:129-135), and completes the run with the voided count and the linked count, which is 0 when the link step failed (:137-138). A lookup failure therefore never fails the upload, matching the host comment at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:175-184.
    • Three [LoggerMessage] methods (:161-168): Information on completion with the counts, Error with the exception on a fault, Warning when a run ends as failed.
  • Why it's built this way: the command is deliberately not transactional (see its section), so this handler owns its commit points; the durable queue is ADR-114 and the per-handler transaction contract is ADR-107.
  • Where it's used: dispatched by InternalCommandProcessor for the row StartTicketRosterImportHandler schedules (StartTicketRosterImportHandler.cs:115-117). Its progress is what GetTicketRosterImportHandler answers and TicketRosterUpload polls through TicketService.GetRosterImportAsync. Covered by ProcessTicketRosterImportHandlerTests.

AttendeeCheckedInPointsHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/IntegrationEventHandlers/AttendeeCheckedInPointsHandler.cs:45 · Level 12 · class (sealed partial)

  • What it is: the award adapter for check-ins. It turns an AttendeeCheckedIn into the (activity, subject key) pair the ledger understands and hands it to IPointsAwarder. It is the richest of the award adapters because the incoming scope is a string that has to be mapped, and because session check-ins are also gated by a once-per-time-slot rule (:27-36).
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over AttendeeCheckedIn (:48), IPointsAwarder (:69), SessionTimeSlotPoints (:93-99), IEventLiveValidationService (:94), ErrorType (:104), CheckInScopeNames (:122, :129, :140), PointsActivityType and PointsSubjectKeys (:124-125, :132-133, :143-144). Externals: IServiceScopeFactory, IUnitOfWork, StringComparison.Ordinal, source-generated [LoggerMessage] (:153-160).
  • Concept introduced, treating an unknown contract value as data, not as a fault. [Rubric §6, CQRS & Event-Driven] assesses how a consumer behaves when the producer is ahead of it. The class comment (:20-26) states the rule: the scope arrives as a wire string rather than an enum, so a value this build has never heard of is normal contract evolution, and the handler logs a warning and awards nothing instead of throwing and dead-lettering a message that no retry could ever fix. [Rubric §29, Resilience & Business Continuity] is the practical consequence: an unmappable payload cannot wedge the queue. The time-slot lookup deliberately takes the opposite stance for a genuine fault (:30-35): when Conference cannot be reached the handler throws so the delivery is retried, rather than awarding in breach of the rule or silently dropping a legitimate award. [Rubric §3, Clean Architecture] is the same boundary its siblings keep, stated in this file's own words (:18-19): all the ADC vocabulary lives here and the awarder below it knows nothing about events or sessions.
  • Walkthrough
    • HandleScopedAsync (:51-79) is the override. The base has already null-guarded the event and opened the delivery scope, so the first thing the body does is call TryMapAward (:56), before resolving anything: an unmappable event costs no service resolution and no database work, only the warning at :58.
    • For a SessionCheckIn activity only (:62), it then asks HasEarlierCheckInInTimeSlotAsync (:63, defined at :87-111) whether an earlier overlapping session check-in already earned the slot. If so it logs at Information (:65, :156-157) and returns without awarding; event and sponsor awards never reach this check. The helper delegates to SessionTimeSlotPoints.HasEarlierOverlappingCheckInAsync (SessionTimeSlotPoints.cs:52), resolving the IUnitOfWork and IEventLiveValidationService from the delivery scope (:93-94). Its failure policy (:101-110): success returns the answer, a NotFound from Conference means the rule cannot apply so the award proceeds (:104-105), and any other failure throws InvalidOperationException naming the error codes, which fails the delivery so it is retried.
    • Then it resolves the scoped IPointsAwarder from the supplied provider (:69) and awards with the event's CheckedInOn.UtcDateTime (:71-76). A rejected award is logged at Warning with the activity, the user and the subject key (:78-79), not rethrown.
    • TryMapAward (:117) is three ordinal string comparisons in scope order. Event maps to PointsActivityType.EventCheckIn scoped by PointsSubjectKeys.ForEvent (:122-126). Session maps to SessionCheckIn only when the payload actually carries a session id, using a property pattern (:129-134). Sponsor maps to SponsorVisit under the same condition on the sponsor id (:140-145), and the comment above it (:137-139) explains why a Sponsor scope with no sponsor id falls through to the same log-and-skip as an unknown scope: an award scoped to nothing would collide with every other sponsor-less payload on the ledger's uniqueness rule.
    • The fall-through sets activity = default, an empty subject key, and returns false (:148-150), which is the single exit the caller's guard reads.
  • Why it's built this way: this handler is where the module's most interesting delivery property lives. The event is published by the same service that consumes it, so the check-in write and the award are two separate transactions joined by the broker (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:214-221). That keeps the scan endpoint's latency independent of the points write and lets the award retry on its own. The same comment records the fallback if a deployment ever has trouble with the round trip (:215-217): the award could move to an in-module domain event handler on the same CheckIn creation, which is a one-file change because the module already awards session-question points that way, through SessionQuestionSubmittedPointsHandler.
  • Where it's used: registered as a singleton by the convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92, MMCA.Common/Source/Core/MMCA.Common.Application/DependencyInjection.ModuleScanning.cs:55-56), which is why the base opens a scope per delivery (:23-27); the consumer is wired at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:26. Covered by AttendeeCheckedInPointsHandlerTests.
  • Caveats / not-in-source: how many points each activity is worth, and whether a rule is switched off, is decided inside PointsAwarder from configuration, not here.

TicketInvitationServiceGrpcAdapter

MMCA.ADC.Engagement.Contracts · MMCA.ADC.Engagement.Contracts · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/TicketInvitationServiceGrpcAdapter.cs:14 · Level 5 · class (internal sealed)

  • What it is: the client-side gRPC adapter that implements IPendingTicketInvitationService on top of the generated TicketInvitationService.TicketInvitationServiceClient (:14-15, BR-271). It is what Identity resolves when a sign-in link is requested for an address that holds no account yet and it needs to know whether a ticket invitation still stands.
  • Depends on: IPendingTicketInvitationService and PendingTicketInvitationDTO from MMCA.ADC.Engagement.Shared.Tickets.Invitations (:3); the generated client and its GetPendingTicketInvitationRequest message (:2). Externals: System.Globalization (:1), the Grpc.Net client factory.
  • Concept, the third same-interface transport swap. [Rubric §7, Microservices Readiness]. This is the pattern BookmarkCountServiceGrpcAdapter introduced: the consumer keeps depending on the C# interface and the generated types never leave this assembly (class doc :7-13). [Rubric §29, Resilience & Business Continuity]: the adapter sets no deadline of its own. The call passes only the caller's token (:22-24), so it gets the framework default that AddTypedGrpcClient installs on every typed client: GrpcDefaultDeadlineInterceptor (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:125, :121) applies HttpResilienceDefaults.GrpcCallDeadline, five seconds (MMCA.Common/Source/Core/MMCA.Common.Shared/Resilience/HttpResilienceDefaults.cs:87), to any unary call whose caller set none. A hung (not refused) Engagement peer therefore still fails fast while Identity answers an anonymous request. [Rubric §9, API & Contract Design]: the wire answer is a Found flag plus the event's first day as a yyyy-MM-dd string, and an answer whose date does not parse is treated as no invitation rather than sent with a default date (:26-32).
  • Walkthrough: GetPendingInvitationAsync(email, cancellationToken) (:18-35) guards email with ArgumentNullException.ThrowIfNull (:20), calls GetPendingTicketInvitationAsync with the caller's token (:22-24), returns null when Found is false or DateOnly.TryParseExact(..., "yyyy-MM-dd", CultureInfo.InvariantCulture, ...) fails (:28-32), and otherwise builds new PendingTicketInvitationDTO(FirstName, LastName, EventName, eventStart) (:34).
  • Why it's built this way: transport failures are not caught here; they propagate to the caller, which logs them and sends nothing (:11-12), so an Engagement outage can never change the answer an anonymous caller sees.
  • Where it's used: registered by DependencyInjection.AddEngagementTicketInvitationClient() (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:100-108), which the Identity service calls at MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:291. The consumer is SendSignInLinkHandler (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/SendSignInLink/SendSignInLinkHandler.cs:49). Its server-side twin is TicketInvitationGrpcService; there is no disabled stub, since EngagementModule.Register only calls AddEngagementModule() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/EngagementModule.cs:24-25). Covered by MMCA.ADC/Tests/Services/MMCA.ADC.Services.Tests/Invitations/TicketInvitationGrpcServiceTests.cs.

VerifiedParticipantServiceGrpcAdapter

MMCA.ADC.Engagement.Contracts · MMCA.ADC.Engagement.Contracts · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/VerifiedParticipantServiceGrpcAdapter.cs:21 · Level 5 · class (internal sealed)

  • What it is: the client-side gRPC adapter that implements IVerifiedParticipantService on top of the generated VerifiedParticipantService.VerifiedParticipantServiceClient (VerifiedParticipantServiceGrpcAdapter.cs:21-22, S-ADC-identity-02). It is what Conference resolves when a session or event feedback write needs to know whether the caller is a verified participant.
  • Depends on: IVerifiedParticipantService from MMCA.ADC.Engagement.Shared.Participants (:3); the generated client and its IsVerifiedParticipantRequest message (:2); the framework's RpcException.ToResult decoder from MMCA.Common.Grpc (:4); Result (:5). Externals: Grpc.Core for RpcException (:1), the Grpc.Net client factory.
  • Concept, the same-interface transport swap, answered as a Result. [Rubric §7, Microservices Readiness]: this is the pattern BookmarkCountServiceGrpcAdapter introduced, with the consumer depending on the C# interface and the generated types never leaving this assembly (class doc :9-13). [Rubric §29, Resilience & Business Continuity], [Rubric §9, API & Contract Design]: where the bookmark-count interface returns a plain value, so a transport fault surfaces as an exception, this interface returns Result<bool>, and the adapter turns every RpcException into a failure result (:40-46), whether the server sent structured error trailers or the transport failed with none (comment :42-44). The class doc gives the reason (:14-19): the caller decides what an unanswered question means instead of failing the feedback write with a 500. The adapter sets no deadline of its own; the call passes only the caller's token (:31-36), so the framework default that AddTypedGrpcClient installs applies (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:85-86, :132).
  • Walkthrough: IsVerifiedParticipantAsync(userId, cancellationToken) (:25-47) sends IsVerifiedParticipantRequest { UserId = userId } with the caller's token (:31-36) and returns Result.Success(response.Verified) (:38); the catch (RpcException ex) (:40) returns ex.ToResult<bool>(cancellationToken) (:45).
  • Why it's built this way: a feedback write is always an authenticated user request, and the server maps the edge under the default user-bearer policy and answers only for the caller's own account, so the client forwards the end user's token and does not opt in to the service token (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:115-120). The AppHost records that the feedback rule falls back to its confirmed-email half while Engagement is unreachable (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:273-275); that fallback belongs to the consumer, not to this adapter.
  • Where it's used: registered by DependencyInjection.AddEngagementVerifiedParticipantClient() (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:128-136), which the Conference service calls at MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:362. The consumer is FeedbackParticipantGate (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.Application/Participants/FeedbackParticipantGate.cs:35). Its server-side twin is VerifiedParticipantGrpcService (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/VerifiedParticipantGrpcService.cs:22), and its in-process twin is VerifiedParticipantService. Covered by MMCA.ADC/Tests/Services/MMCA.ADC.Services.Tests/Participants/VerifiedParticipantServiceGrpcAdapterTests.cs.
  • Caveats / not-in-source: what counts as a verified participant is decided server-side by VerifiedParticipantService, not here, and how ToResult maps a gRPC status to an error type lives in MMCA.Common.Grpc.

PointsController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:37 · Level 6 · class (sealed)

  • What it is: the REST surface for the points game: the caller's own ledger, the public leaderboard, joining or leaving that leaderboard, and the organizer rollup.
  • Depends on: ApiControllerBase, four handlers over ICommandHandler<in TCommand, TResult> / IQueryHandler<in TQuery, TResult> (PointsController.cs:38-41), the queries GetMyPointsQuery, GetLeaderboardQuery and GetPointsOverviewQuery, the request SetLeaderboardParticipationRequest, the contracts MyPointsDTO, LeaderboardEntryDTO and PointsOverviewDTO, plus EngagementFeatures, EngagementPermissions, HasPermissionAttribute, RefuseMachineClientsAttribute and Result. Externals: ASP.NET Core MVC, Asp.Versioning, [FeatureGate], and [Range] from System.ComponentModel.DataAnnotations.
  • Concept introduced, the surface with no ownership argument. [Rubric §11, Security] assesses how ownership is enforced per endpoint. Contrast this controller with BookmarksController, which has to bind a body field, a query argument and a stored row to the caller in three different ways. Here the class comment (:25-28) states the design instead: nothing on this surface takes a user id. The three attendee endpoints resolve the caller from the token inside their handlers, so there is no argument a caller could change, and the one endpoint that reads across every attendee returns no attendee identity at all. [Rubric §30, Compliance, Privacy & Data Governance] is the other half: the leaderboard serves only the display-name snapshot an attendee published at opt-in (:71-74), so rendering the board makes no call into Identity and exposes nothing an attendee did not choose to publish, and the organizer overview carries activity, points and timestamps only (:118-119). [Rubric §9, API & Contract Design] covers the paging arguments: pageNumber/pageSize (:55-56) and recentCount (:127) are [Range]-validated and select how much comes back, never whose data it is (:46-48).
  • Walkthrough (endpoints in file order)
    • GetMyPointsAsync (:54), GET me: dispatches GetMyPointsQuery with the paging pair defaulting to page 1 of 20 (:55-56, :60), returning the running total, the caller's leaderboard status and a page of ledger entries.
    • GetLeaderboardAsync (:79), GET leaderboard: dispatches a parameterless GetLeaderboardQuery (:83). The board length is fixed by configuration (Points:LeaderboardSize), not by the caller (:73-74).
    • SetLeaderboardParticipationAsync (:104), PUT me/leaderboard-participation: the one write. The request carries only a boolean because the published display name is taken from the caller's token server-side and never from the body (:94-95), and it answers 204 (:101, :112).
    • GetPointsOverviewAsync (:126), GET overview: the only endpoint with a permission, [HasPermission(EngagementPermissions.PointsViewOverview)] (:122).
    • The whole controller is behind [FeatureGate(EngagementFeatures.Points)] (:34) with a bare [Authorize] (:35) as the floor, and [RefuseMachineClients] (:36) keeps a client-credentials caller off an attendee surface (ADR-140).
  • Why it's built this way: designing the routes so no endpoint accepts an identity is a cheaper guarantee than checking one. There is no filter to forget and no claim comparison to invert, which is the failure mode the ownership checks on BookmarksController exist to prevent. See ADR-072 for the points design and ADR-033 for the ownership axis this surface sidesteps.
  • Where it's used: mounted at /points by [Route("[controller]")] (:32) behind the Gateway; consumed by MyPoints and OrganizerPointsOverview through IPointsUIService. Covered by PointsControllerTests, and checked for the machine-client attribute by MachineClientParticipationTests.
  • Caveats / not-in-source: Points:LeaderboardSize and the per-activity point values are configuration, read by the handlers rather than by this controller. Note also that the one write here carries no [Idempotent], unlike the four POSTs on CheckInsController: setting participation is a PUT of an absolute value, so a replay lands on the same state without help.

TicketImportRunMapping

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.DTOs · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/DTOs/TicketImportRunMapping.cs:7 · Level 6 · class (static, internal)

  • What it is: the one hand-written mapping from a TicketImportRun to the TicketRosterImportRunDTO status the roster upload component polls (TicketImportRunMapping.cs:6).
  • Depends on: TicketImportRun and TicketRosterImportRunDTO. Externals: ArgumentNullException.
  • Concept: manual DTO mapping, taught in the primer; nothing new here. [Rubric §30, Compliance, Privacy & Data Governance] is the one point worth noticing: the summary states that the staged roster never leaves the server (:9), and the initializer bears it out by copying progress, counts and an error code only, so a status poll can never carry an attendee row.
  • Walkthrough
    • ToDto (:12) is an extension on the run; it guards a null run (:14) and builds the DTO in one object initializer (:16-30).
    • It copies the identity and progress (RunId from Id, EventId, Status, Total, Processed, :18-22), the six outcome counts (Added, Updated, Unchanged, Voided, Reinstated, LinkedExistingAccounts, :23-28) and ErrorCode (:29).
  • Where it's used: StartTicketRosterImportHandler returns run.ToDto() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/StartRosterImport/StartTicketRosterImportHandler.cs:84), which TicketRosterImportController answers as the 202 body of a commit. The class is internal, so it stays inside the Application assembly.
  • Caveats / not-in-source: that is the only ToDto call in the Tickets use cases; how GetTicketRosterImportHandler builds the same DTO for the status read is not covered by this section.

TicketRosterImportController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketRosterImportController.cs:36 · Level 6 · class (sealed)

  • What it is: the REST surface for the TicketLeap roster upload (BR-268, UC-48): a dry run that reports counts, a commit that queues a durable background import run, and a read of that run's status (TicketRosterImportController.cs:24-30).
  • Depends on: ApiControllerBase, three injected handlers over ICommandHandler<in TCommand, TResult> and IQueryHandler<in TQuery, TResult> (:37-39), the use-case types ImportTicketRosterCommand, StartTicketRosterImportCommand and GetTicketRosterImportQuery, the contracts TicketRosterImportResultDTO and TicketRosterImportRunDTO, TicketRosterLimits, the CSV upload helper from MMCA.Common.API.Uploads (its result is a CsvUpload), CsvReader and CsvTable, plus IdempotentAttribute, HasPermissionAttribute, EngagementPermissions, EngagementFeatures, Error and Result. Externals: ASP.NET Core MVC (IFormFile, [RequestSizeLimit], [FromForm]), Asp.Versioning, [FeatureGate].
  • Concept introduced, a long write answered as a queued run. [Rubric §9, API & Contract Design] assesses whether the contract tells a client what happened. One route, POST roster, has two outcomes by design: a dry run answers 200 with the counts, and a commit answers 202 Accepted with the queued run (:61-62), because a whole roster is applied in batches by a background run whose progress GET roster/import reports (:42-45). A second commit while the event's run is active answers 409 (:44-45, :66). [Rubric §12, Performance & Scalability] is the reason for the split: the request returns as soon as the run is queued instead of holding a connection open for the whole apply, and the body is capped twice, by [RequestSizeLimit(TicketRosterLimits.MaxRequestBytes)] (:59) on the request and by TicketRosterLimits.MaxFileBytes on the file buffer (:77-78).
  • Concept, parse once at the edge. The upload is read into one buffer of exactly the declared length and parsed as CSV before any handler runs (:73-84): a missing, empty, oversize or truncated file answers Ticket.Roster.FileRequired (:80), text that is not CSV answers the reader's own code, and a file made only of white space answers CsvReader's EmptyCode from the controller itself (:88-97), because the reader would read a line of spaces as a one-cell header (:89-90). The raw bytes then go unchanged to whichever command runs (:100).
  • Walkthrough (members in file order)
    • ImportRosterAsync (:67), POST roster: binds the IFormFile, a [FromForm] eventId and dryRun defaulting to false (:68-71). After the edge checks it dispatches ImportTicketRosterCommand and answers Ok for a dry run (:102-108), otherwise dispatches StartTicketRosterImportCommand and answers Accepted (:111-115). It carries [Idempotent] (:58): the remarks (:52-56) explain that a replay spares a second upload on a dropped response and, for a commit, answers the run the first request started instead of a 409 against it (ADR-017).
    • GetImportAsync (:129), GET roster/import?eventId= (UC-48): dispatches GetTicketRosterImportQuery for the event's latest run (:134); an event with no run answers 404 (:118-120).
    • IsBlank (:141-143): true when every header and every field is white space.
  • Why it's built this way: the class comment (:24-30) places this controller as a sibling of TicketsController under the same /tickets prefix ([Route("Tickets")], :32) with the same posture: authenticated (:35), [HasPermission(EngagementPermissions.TicketsManage)] on every action (:60, :125), and behind [FeatureGate(EngagementFeatures.Tickets)] (:34), so with the flag off every route answers 404 (ADR-031).
  • Where it's used: fronted by the YARP Gateway on the /tickets prefix. Covered by TicketRosterImportControllerTests; the upload helper it calls is covered by FormFileCsvUploadTests.
  • Caveats / not-in-source: unlike TicketsController it carries no [RefuseMachineClients]. It is on the allow-list in MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Api/MachineClientParticipationTests.cs:69-70, with the reason that every action needs tickets:manage (ADR-140). The byte limits are constants on TicketRosterLimits; their values are not restated here.

AdminFeatureFlagsController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/AdminFeatureFlagsController.cs:23 · Level 7 · class (sealed)

  • What it is: the Engagement service's feature-flag administration: every EngagementFeatures kill switch with its configured value, stored override and effective value, plus setting and clearing an override (AdminFeatureFlagsController.cs:8-14). The class body is empty; all behavior is inherited.
  • Depends on: FeatureFlagsControllerBase (:24) and IFeatureFlagAdministrationService (:23), with EngagementFeatures as the flag set it exposes. Externals: ASP.NET Core MVC, Asp.Versioning.
  • Concept: the per-service administration controller. [Rubric §7, Microservices Readiness]: each flag-owning service mounts its own controller because each keeps its overrides in its own database (:12-13), so the shared FeatureFlagAdmin page reads this service's flags from the Admin/Engagement/FeatureFlags prefix ([Route], :21) rather than from a central store (ADR-031). [Rubric §11, Security]: the base class gates every action on features:manage, which ADC grants to Organizer and never to ContentEditor through EngagementPermissionGrants (:16-17).
  • Where it's used: the same shape is mounted by the Conference service (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/FeatureFlags/AdminFeatureFlagsController.cs). It carries no [RefuseMachineClients] and is on the allow-list in MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Api/MachineClientParticipationTests.cs:61-62 because every action needs features:manage.

MyTicketProjection

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.DTOs · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/DTOs/MyTicketProjection.cs:12 · Level 7 · class (static, internal)

  • What it is: the one projection of a linked Ticket to MyTicketDTO, shared by the my-tickets query (run as SQL) and the claim response (run in memory), so both answer the same shape (MyTicketProjection.cs:7-11).
  • Depends on: Ticket and MyTicketDTO. Externals: System.Linq.Expressions.
  • Concept: one expression, two execution sites. [Rubric §15, Best Practices & Code Quality]: rather than a mapper method plus a hand-copied Select, the projection is held as an Expression<Func<Ticket, MyTicketDTO>> (:15), which EF Core can translate into the query and which the in-memory path compiles, so the two outputs cannot drift. [Rubric §12, Performance & Scalability]: the query path selects only the nine DTO columns instead of loading the entity.
  • Walkthrough
    • Selector (:15-26) copies the ticket id, event id, source event and ticket type names, the attendee's first and last name and the status (:17-23), and unwraps LinkMethod and LinkedOn with !.Value (:24-25). That is safe only because the projection is applied to linked tickets, which always carry both (:10).
    • ToDTO (:34) compiles the selector on every call. The comment (:28-31) justifies it: it serves the claim response only, one ticket per request, so caching the delegate would buy nothing measurable.
  • Where it's used: GetMyTicketsHandler passes MyTicketProjection.Selector to its query (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/GetMyTickets/GetMyTicketsHandler.cs:36), and ClaimTicketHandler calls ToDTO for both of its success paths (.../Tickets/UseCases/ClaimTicket/ClaimTicketHandler.cs:90, :105). Both feed TicketsController.
  • Caveats / not-in-source: applied to an unlinked ticket, the !.Value unwraps would throw in memory; nothing in this class enforces the linked precondition, the callers do.

TicketsController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/TicketsController.cs:44 · Level 7 · class (sealed)

  • What it is: the REST surface for the TicketLeap ticket roster once it is loaded: the organizer's invites, link-existing-accounts run, adoption summary, insights, CSV export and delete, and the attendee's barcode claim and own tickets (TicketsController.cs:28-37). The upload itself lives on TicketRosterImportController.
  • Depends on: ApiControllerBase, eight injected handlers over ICommandHandler<in TCommand, TResult> and IQueryHandler<in TQuery, TResult> (:45-52), the requests and use-case types SendTicketInvitesRequest, ClaimTicketRequest, GetMyTicketsQuery, GetTicketRosterSummaryQuery, DeleteTicketRosterCommand, LinkExistingAccountsCommand, GetRosterInsightsQuery and GetEngagementInsightsQuery, the contracts TicketInvitesResultDTO, MyTicketDTO, TicketRosterSummaryDTO, TicketAccountLinkResultDTO, RosterInsightsDTO and EngagementInsightsDTO, TicketInsightsReport and TicketInsightsCsv, TicketClaimRateLimiting, plus IdempotentAttribute, HasPermissionAttribute, RefuseMachineClientsAttribute, EngagementPermissions, EngagementFeatures, Error and Result. Externals: ASP.NET Core MVC, [EnableRateLimiting], Asp.Versioning, [FeatureGate].
  • Concept introduced, two audiences on one surface. [Rubric §11, Security] assesses whether each endpoint carries the weakest authorization that is still correct. Seven of the nine actions are organizer actions with [HasPermission(EngagementPermissions.TicketsManage)] (:67, :96, :175, :198, :222, :248, :299); the attendee pair, claim and mine, carries none, because both take the attendee from the token rather than the request (:116-117, :153-154; BR-269 in the class comment, :34-35). The claim endpoint adds enumeration resistance: an unknown barcode, a ticket linked to another account and a voided ticket all answer the same 404, so the endpoint does not confirm which barcodes exist (:117-119). Two budgets answer 429 when spent (:119-123, :141): each signed-in account has one, kept by the handler, and each public client address has one across every account it uses, the ticket-claim-ip policy that TicketClaimRateLimiting names (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/RateLimiting/TicketClaimRateLimiting.cs:33) and [EnableRateLimiting(TicketClaimRateLimiting.PolicyName)] attaches (:135). Private addresses, such as the UI host's server-rendered calls, are not counted per address (:122-123).
  • Concept, privacy by aggregation. [Rubric §30, Compliance, Privacy & Data Governance]: the two insights reads are aggregate only (BR-278). The roster report carries no name, email address or account id and withholds a count of 1 or 2 in the email-domain mix (:192-193); the engagement report withholds every count of 1 or 2 on the server (:216). The CSV export writes a withheld count as "fewer than 3" and never the number behind it (:241-242).
  • Concept, idempotency for an accurate answer. [Rubric §29, Resilience & Business Continuity]: the three POSTs carry [Idempotent] (:66, :95, :134), and the remarks argue it differently from the check-in surface. A second invites or link-existing execution would be harmless but would report 0 sent or 0 linked, so the replay exists to keep the organizer's answer the one the first execution gave (:61-63, :90-92); a repeated claim already answers 200 with the same ticket (:130-131) (ADR-017).
  • Walkthrough (endpoints in file order)
    • SendInvitesAsync (:72), POST invites (BR-270): one invite per eligible order email, up to a per-run cap, and a re-run sends only to tickets not yet invited or linked (:54-56).
    • LinkExistingAccountsAsync (:101), POST link-existing?eventId= (BR-277, UC-55): links roster tickets to accounts that already exist with a confirmed address; when the Identity lookup is unavailable nothing is linked and the run fails (:84-85).
    • ClaimAsync (:142), POST claim (BR-273): links a ticket to the caller by barcode, answering 200 again for a ticket already linked to the caller (:114-125). A 409 comes only from the idempotency filter, for a duplicate of a claim still in flight (:123-124).
    • GetMineAsync (:160), GET mine (UC-51): dispatches a parameterless GetMyTicketsQuery (:163).
    • GetSummaryAsync (:178), GET summary?eventId= (UC-52): the adoption funnel of tickets, invited, linked, voided and pending-invite counts.
    • GetRosterInsightsAsync (:201) and GetEngagementInsightsAsync (:225), GET insights/roster and GET insights/engagement (UC-56): the A1 to A6 and B1 to B4 reports. A failed Conference lookup degrades the engagement report and is flagged in it rather than failing the request (:216-217).
    • ExportInsightsAsync (:252), GET insights/export?eventId=&report=: rejects an undefined TicketInsightsReport with Ticket.Insights.UnknownReport (:257-264), reuses whichever insights handler owns the report (:266-285), renders it through TicketInsightsCsv and returns File(...) with a UTF-8 byte-order mark, the text/csv content type and a file name built from report, event and generation time (:287-290). The dedicated route follows ADR-078 (:240-241).
    • DeleteRosterAsync (:303), DELETE roster?eventId= (BR-274): deletes the whole roster after the event and answers 204, including for an event with no roster (:293-294, :313).
  • Why it's built this way: every action except the export is a pure dispatch followed by HandleFailure(result.Errors) or the success result, so the rules (invite caps, the per-account claim budget, the withheld-count threshold) live in handlers that are unit testable without HTTP. The per-address claim budget is the one limit attached in this file, as a named rate-limit policy rather than handler logic, because it has to count across accounts. The whole surface sits behind [FeatureGate(EngagementFeatures.Tickets)] (:41), so with the flag off every route answers 404 (ADR-031), with [Authorize] (:42) as the floor and [RefuseMachineClients] (:43) refusing a client-credentials caller (ADR-140).
  • Where it's used: mounted at /tickets by [Route("[controller]")] (:39) and fronted by the YARP Gateway; the attendee side is consumed by MyTicketsPanel and the organizer side by the ticket pages, through ITicketUIService. Covered by TicketsControllerTests and, for the per-address policy, by MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/RateLimiting/TicketClaimRateLimitingPipelineTests.cs.
  • Caveats / not-in-source: the invite cap, the per-account claim budget and the withheld-count threshold are enforced in the handlers and settings, and the per-address permit count and window are configured in TicketClaimRateLimiting, not in this file. Which UI component calls which endpoint is inferred from the type map rather than traced call by call.

CheckInsController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/CheckInsController.cs:44 · Level 8 · class (sealed)

  • What it is: the REST surface for QR badge check-in. Eight endpoints covering the attendee's own badge and its reissue, the organizer scan, its manual fallback and the organizer's badge reissue, the two attendee self-recorded scan surfaces (sponsor booth, room), and the organizer attendance rollup (class comment CheckInsController.cs:27-31).
  • Depends on: ApiControllerBase (for HandleFailure), nine injected handlers over ICommandHandler<in TCommand, TResult> and IQueryHandler<in TQuery, TResult> (:45-53), the request and result contracts CheckInAttendeeRequest, ManualCheckInRequest, SponsorVisitRequest, RoomCheckInRequest, CheckInResultDTO, SponsorVisitResultDTO, RoomCheckInResultDTO, MyBadgeDTO, AttendanceStatsDTO, the use-case types GetMyBadgeQuery, GetOrCreateMyBadgeCommand, RegenerateMyBadgeCommand, RegenerateAttendeeBadgeCommand and GetAttendanceStatsQuery, plus IdempotentAttribute, NonIdempotentAttribute, HasPermissionAttribute, RefuseMachineClientsAttribute, EngagementFeatures, EngagementPermissions, ErrorType and Result. Externals: ASP.NET Core MVC, Asp.Versioning, and Microsoft.FeatureManagement.Mvc's [FeatureGate].
  • Concept introduced, the authorization ladder on one controller. [Rubric §11, Security] assesses whether each endpoint carries the weakest authorization that is still correct. This controller has three rungs, and reading them top to bottom is the fastest way to understand the whole check-in feature. The class-level [Authorize] (:42) is the floor: authenticated, no policy, no role, with [RefuseMachineClients] (:43) keeping client-credentials callers off it entirely (ADR-140). Four endpoints add [HasPermission(EngagementPermissions.CheckInManage)] (:122, :154, :178, :262), which is the organizer rung. The remaining four deliberately stay at the floor, and the doc comments say why: my-badge and its reissue (:56-57, :97) and the two self-recorded scans (:196-197, :227-228) take the attendee from the token and never from the request, so there is no ownership argument a caller could tamper with and therefore no ownership check to get wrong. [Rubric §9, API & Contract Design] covers the other decision worth studying: a repeat scan answers 200 with an AlreadyCheckedIn flag rather than 409 (:142-145, :230-231), because at a door a second scan is a normal event, not a client error, and the organizer needs to see whose badge it is either way. The room endpoint extends the same rule to points: being checked in to another session in the same time slot, or session points being switched off (Points:SessionCheckIn at 0), still answers 200 with the check-in recorded, reporting the difference through EarnsPoints false and PointsPaused true rather than through an error status (:231-235). [Rubric §12, Performance & Scalability] covers feature gating: the whole controller is behind EngagementFeatures.CheckIn (:41) and the two self-service endpoints add their own gates (:209, :244), so a disabled surface answers 404 rather than 403 (ADR-031).
  • Concept introduced, idempotency decided per POST. Four of the six POSTs carry [Idempotent] (:153, :177, :208, :243), the framework's replay cache (ADR-017, IdempotentAttribute). The doc comments are careful about why that is safe rather than merely convenient, and they are worth reading as a checklist: the endpoint's response must not drift within the retry window. For the scan and manual paths the argument is that a repeat already answers the same 200 (:148-150, :174), so a replayed response says exactly what a re-executed one would; for sponsor visits it is AlreadyVisited (:204-205); for room check-in the comment adds the load-bearing extra clause, that the session is resolved server-side (:238-240), so nothing in the response depends on a value that could change mid-retry. The two badge reissues fail that test and say so with NonIdempotentAttribute and a stated reason (:101, :123): every call rotates the credential, so a replayed response could hand back a code a later reissue already revoked, while a retried reissue is harmless because it only rotates the code once more. [Rubric §29, Resilience & Business Continuity] is what this buys: a conference-day network that is dropping responses stops costing a second database round trip per retry, and no replay ever serves a revoked badge.
  • Walkthrough (endpoints in file order)
    • GetMyBadgeAsync (:68), GET my-badge: reads first, mints only when needed. It dispatches GetMyBadgeQuery (:71-73) and returns the existing badge on success (:75-78). Only a NotFound failure falls through to GetOrCreateMyBadgeCommand (:80, :86-92), and not for a read-only "View as" session: User.IsViewAs() (:81) sends that caller the query's 404, which the badge page renders as its "no badge yet" state, because every command is refused for a View-as session (:59-62). The action declares that 404 alongside 200 and 403 (:65-67).
    • RegenerateMyBadgeAsync (:105), POST my-badge/regenerate: dispatches a parameterless RegenerateMyBadgeCommand and returns the new credential; every earlier copy of the badge (a printout, a screenshot) stops scanning, the ADR-072 revocation of a leaked badge, and a caller with no badge answers 404 CheckIns.BadgeNotIssued (:95-99).
    • RegenerateAttendeeBadgeAsync (:127), POST badges/{userId}/regenerate: the organizer's desk-side reissue, dispatching RegenerateAttendeeBadgeCommand(userId). It answers 204 and never the new credential, which only the attendee sees (:117-120, :137).
    • CheckInAsync (:159), POST: the organizer scan path, dispatching CheckInAttendeeRequest to CheckInAttendeeHandler. Declares 400, 403 and 404 alongside the 200 (:155-158).
    • ManualCheckInAsync (:183), POST manual: the fallback for a dead phone, a head with no camera, or an attendee found by name search (:170-172), same permission and same outcome shape.
    • RecordSponsorVisitAsync (:213), POST sponsor-visits: attendee self-service behind EngagementFeatures.SponsorVisits (:209). The response carries the sponsor name so the landing page needs one round trip (:200-201).
    • RecordRoomCheckInAsync (:248), POST room-visits: attendee self-service behind EngagementFeatures.RoomCheckIn (:244). The session is never client supplied; the server resolves it from the room plus the configured grace window and answers 404 CheckIns.NoCurrentSession when nothing is running there (:228-230). A 200 can carry EarnsPoints false for a second session in the same time slot, and PointsPaused true when Points:SessionCheckIn is 0 (:231-235).
    • GetAttendanceStatsAsync (:265), GET stats?eventId=: the organizer rollup, with the event id [FromQuery, Required] (:266) and no paging arguments.
    • Every action after my-badge is the same three lines: dispatch the handler, then HandleFailure(result.Errors) or the success result (Ok(result.Value), or NoContent() for the organizer reissue). The read-then-mint branch on my-badge is the only control flow in the file, and no business rule lives here.
  • Why it's built this way: the class comment (:27-37) records the scoping fact that explains the whole surface: the conference runs door and arrival check-in through TicketLeap (:33-35), so the Event scope here is not a door process. Session check-in is the working path, and Event scope stays available for a future info-desk or points-activation use. Keeping the endpoints thin keeps the decisions (idempotency of the business rule, session resolution, badge verification, badge rotation, points eligibility) in handlers that are unit testable without HTTP (ADR-072). Splitting my-badge into a query plus a conditional command is what lets a read-only View-as session see an attendee's badge without the write being attempted.
  • Where it's used: mounted at /checkins by [Route("[controller]")] (:39) and fronted by the YARP Gateway. Its clients are the organizer scanning UI and the two attendee landing pages, RoomCheckIn and SponsorVisit, through ICheckInUIService. Covered by CheckInsControllerTests.
  • Caveats / not-in-source: which features are switched on in a given environment is configuration. The permission-to-role mapping behind EngagementPermissions.CheckInManage is resolved by the auth layer, not here, and the idempotency key header and retention window are the framework filter's, not this controller's. How EarnsPoints and PointsPaused are computed, and how a reissue rotates the credential, live in the handlers and result DTOs, not in this controller. User.IsViewAs() is an extension imported from MMCA.Common.Shared.Auth; its claim test is not restated here. Which UI surface calls the two reissue endpoints is not traced here.

BookmarkCountServiceGrpcAdapter

MMCA.ADC.Engagement.Contracts · MMCA.ADC.Engagement.Contracts · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/BookmarkCountServiceGrpcAdapter.cs:14 · Level 9 · class (internal sealed)

  • What it is: a hand-written client-side adapter that implements the C# interface IBookmarkCountService on top of the proto-generated gRPC client. It is what Conference resolves for IBookmarkCountService now that Engagement runs as its own process.
  • Depends on: IBookmarkCountService from MMCA.ADC.Engagement.Shared.UserSessionBookmarks (:2); the generated BookmarkCountService.BookmarkCountServiceClient and the request/response messages from bookmark_count.proto (namespace MMCA.ADC.Engagement.Contracts.V1, :1). Externals: the Grpc.Net client factory that supplies the injected client.
  • Concept, the gRPC adapter (same interface, different transport). [Rubric §7, Microservices Readiness] assesses whether modules talk through explicit, extractable contracts; [Rubric §9, API & Contract Design] assesses stable wire contracts. The in-process BookmarkCountService and this remote adapter implement the same interface, so a consumer swaps transport by swapping one DI registration and never edits a call site (ADR-007, ADR-008). Watch the name overlap: the generated proto service type is also called BookmarkCountService (in ...Contracts.V1), and this adapter's primary constructor takes its nested BookmarkCountServiceClient (:14-15); that generated type is distinct from the Application-layer class of the same name.
  • Concept, the per-call deadline comes from the framework, not the adapter. [Rubric §29, Resilience & Business Continuity]. The call sets no deadline; it passes only the caller's token (:27). The typed client that AddTypedGrpcClient registers carries GrpcDefaultDeadlineInterceptor (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:125, :132), which gives every unary call without a caller-set deadline HttpResilienceDefaults.GrpcCallDeadline, five seconds (MMCA.Common/Source/Core/MMCA.Common.Shared/Resilience/HttpResilienceDefaults.cs:87; behavior documented at DependencyInjection.cs:85-86). A hung peer therefore turns into a fast DeadlineExceeded status instead of stalling a speaker-dashboard request.
  • Walkthrough: the adapter has one member, the batch read. GetBookmarkCountsForSessionsAsync(sessionIds, cancellationToken) (:18-30) fills the repeated SessionIds field with AddRange (:22-23), sends the request with the caller's token (:25-27), and rebuilds a dictionary from the repeated response pairs with response.Counts.ToDictionary(c => c.SessionId, c => c.Count) (:29). This is the N+1 avoidance for a speaker dashboard listing many sessions: one round trip instead of one per session. The interface returns a plain dictionary, not a Result, so there is no failure trailer to parse: a transport fault surfaces as an RpcException.
  • Where it's used: registered by DependencyInjection.AddEngagementBookmarkCountClient(), which the Conference service calls at MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:361. Its server-side twin is BookmarkCountsGrpcService. Covered alongside that twin in MMCA.ADC/Tests/Services/MMCA.ADC.Services.Tests/Bookmarks/BookmarkCountsGrpcServiceTests.cs.
  • Caveats / not-in-source: the dictionary rebuild assumes the server never returns duplicate SessionId pairs; ToDictionary would throw on a duplicate key. Nothing in this file enforces that; it rests on the server's projection, which this section does not restate.

LivePollVotingController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/LivePollVotingController.cs:37 · Level 10 · class (sealed)

  • What it is: the attendee-facing half of the live poll layer: list the open polls for an event or session with the caller's own vote, read one poll's tallies, and cast (or change) a vote (LivePollVotingController.cs:21-30). It was split out of LivePollsController, which keeps authoring and lifecycle, so that controller stays within the constructor-dependency ceiling; it keeps the same [Route("LivePolls")] prefix (:32), action templates, feature gate and [Authorize] posture, so no URL changed in the split (:23-27).
  • Depends on: ApiControllerBase, three injected handlers over ICommandHandler<in TCommand, TResult> and IQueryHandler<in TQuery, TResult> (:38-40), ASP.NET Core's IAuthorizationService (:41), ICurrentUserService (:42), the use-case types GetOpenPollsQuery, GetPollResultsQuery and CastVoteCommand, the contracts LivePollResultsDTO and CastVoteRequest, LiveCallerRights (:131, :134), IdempotentAttribute, RefuseMachineClientsAttribute, EngagementFeatures, plus Error and Result. Externals: ASP.NET Core MVC and authorization, Asp.Versioning, [FeatureGate].
  • Concept introduced, identity read from claims on every action, not from the request. [Rubric §11, Security] assesses whether ownership travels through a value a caller could tamper with. All three actions resolve currentUserService.UserId first and answer Error.Forbidden("LivePolls.Forbidden", "Access denied.") when it is absent (:56-60, :85-89, :115-119); no action takes a user id as a parameter. GetResultsAsync (:81-98) adds two rights reads for the scope check the handler performs, both delegated to the shared LiveCallerRights: GetCallerSpeakerId() (:131) takes the speaker id from the caller's claims rather than from a caller-supplied argument, and CanManageLiveAsync() (:134) asks the authorization service whether the caller holds the LiveManage capability (ADR-020), not merely the Organizer role (:133). The doc comment on GetResultsAsync (:73-76) states the resulting behavior: a Draft poll, or a poll on an unpublished event, is visible only to the BR-236 rights holders and answers 404 to everyone else, so walking sequential poll ids reveals neither content nor existence. The class also carries [RefuseMachineClients] (:36), so a client-credentials caller never reaches the vote path (ADR-140).
  • Concept, idempotency on an explicit-value write. [Rubric §29, Resilience & Business Continuity]: CastVoteAsync (:110-128) carries [Idempotent] (:106). The doc comment (:102-103) gives the same argument PointsController's participation write relies on: the request names the target option explicitly (set my vote to X, not toggle), so a conference-day retry over flaky wifi replays onto the same state rather than double-toggling.
  • Walkthrough (endpoints in file order)
    • GetOpenPollsAsync (:51), GET open?eventId=&sessionId=: both filters are optional query arguments (:52-53); dispatches GetOpenPollsQuery with the caller's id (:62-64), returning every open poll's tallies plus the caller's own vote for each.
    • GetResultsAsync (:81), GET {id}/results: dispatches GetPollResultsQuery(id, userId.Value, GetCallerSpeakerId(), await CanManageLiveAsync()) (:91-93), the scope-aware read described above.
    • CastVoteAsync (:110), POST {id}/votes: dispatches CastVoteCommand(id, request.OptionId, userId.Value) (:121-123), returning the updated tallies on success.
    • All three follow the same two-line shape once the identity check passes: dispatch the handler, then HandleFailure(result.Errors) or Ok(result.Value).
  • Why it's built this way: keeping every identity read claims-only means there is no argument on any of the three routes that a caller could substitute to see or vote as someone else, the same shape PointsController uses for its own no-ownership-argument endpoints. Routing the speaker and manage-rights reads through LiveCallerRights keeps one definition of "may see a draft" for every live-layer controller, and asking for the LiveManage capability rather than a role name lets the permission grants decide who holds it. The scope logic behind Draft/unpublished visibility stays in the query handler rather than in this controller, so the 404 masking is enforced in one place regardless of caller.
  • Where it's used: mounted at /livepolls by its route attribute and fronted by the YARP Gateway; its clients are the live-poll attendee and speaker surfaces. Covered by LivePollVotingControllerTests, and its constructor width is one of the subjects of ConstructorDependencyCountTests.
  • Caveats / not-in-source: which polls exist and how an organizer opens or closes one is out of scope for this controller; it only reads and votes. Which roles hold the LiveManage capability is decided by the permission grants, and how LiveCallerRights reads the speaker claim is not restated here.

AuditHistoryController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/AuditHistoryController.cs:21 · Level 11 · class (sealed)

  • What it is: the Engagement service's audit-history endpoint: one page of the recorded change history of one CheckIn, PointsEntry or Ticket, newest change first (AuditHistoryController.cs:11-16). The class body is empty; all behavior is inherited.
  • Depends on: AuditHistoryControllerBase and IAuditTrailReader (:21-22), with the three audited aggregates passed as typeof arguments (:22). Externals: ASP.NET Core MVC, Asp.Versioning.
  • Concept: the per-service audit reader (ADR-075). [Rubric §30, Compliance, Privacy & Data Governance]: the three types listed are exactly the Engagement aggregates that carry the audit marker, so a disputed check-in, a points award or a ticket link can be traced. [Rubric §11, Security]: the framework base gates every action on audit:view and refuses an entity this service does not own (:14-15). [Rubric §7, Microservices Readiness]: the reader reads this service's own database, so each service host mounts its own controller under its own prefix, here Admin/Engagement/AuditHistory (:19).
  • Where it's used: the Conference and Identity modules mount the same shape (MMCA.ADC/Source/Modules/Conference/MMCA.ADC.Conference.API/Controllers/AuditHistory/AuditHistoryController.cs, MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.API/Controllers/AuditHistory/AuditHistoryController.cs). It carries no [RefuseMachineClients] and is on the allow-list in MMCA.ADC/Tests/Architecture/MMCA.ADC.Architecture.Tests/Api/MachineClientParticipationTests.cs:72-73 because every action needs audit:view.

BookmarksController

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Controllers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/BookmarksController.cs:37 · Level 11 · class (sealed)

  • What it is: the REST surface for session bookmarks, the attendee's personal schedule (UC-11): create one, list a user's bookmarks paginated, read a user's bookmark changes as a change feed, fetch the bookmarked session ids as a lookup, and delete one. All endpoints require authentication (BR-42, :27-30).
  • Depends on: ApiControllerBase, a create handler over CreateBookmarkRequest (:38), query handlers for GetUserBookmarksQuery (:39) and GetBookmarkedSessionIdsQuery (:40), a delete handler over DeleteEntityCommand<TEntity, TIdentifierType> (:41), IEntityQueryService<TEntity, TEntityDTO, TIdentifierType> for the ownership probe and the change feed (:42), ICurrentUserService (:43), plus UserSessionBookmark, UserSessionBookmarkDTO, PagedCollectionResult<T>, KeysetCollectionResult<T>, EntityChange<TEntityDTO, TIdentifierType>, InlineSpecification<TEntity, TIdentifierType>, Error, RoleNames, OwnerOrAdminFilter, OwnershipHelper, IdempotentAttribute, RefuseMachineClientsAttribute and EngagementFeatures. Externals: ASP.NET Core MVC, Asp.Versioning, [FeatureGate], ClaimTypes and CultureInfo for the Created location.
  • Concept introduced, three ways to enforce one ownership rule. [Rubric §11, Security] assesses row-level authorization, and this controller is the reference example in the module because the same rule ("a non-organizer may only touch their own bookmarks") is enforced three different ways, each matched to where the owner identity actually travels (ADR-033).
    1. On the three GETs the owner arrives as a userId query argument, so the shared [ServiceFilter(typeof(OwnerOrAdminFilter))] (:91, :121, :147) compares it to the caller's user-identifier claim, with Organizer bypassing. The ADC vocabulary for that filter is configured in the Engagement module registration, not here (:87-89).
    2. On POST the owner arrives in the request body, which no query-argument filter can see, so the check is inline (:65-77) and the comment records the consequence of omitting it (:68-69): any authenticated user could create bookmarks owned by another user by supplying a foreign UserId.
    3. On DELETE the owner is not in the request at all, it is a property of the stored row, so the check is a database probe run through the shared OwnershipHelper.ValidateOwnershipAsync (:175-184), with the same owner claim (ClaimTypes.NameIdentifier, :177) and bypass role (RoleNames.Organizer, :178) the filter uses (:173-174). The DELETE also teaches a second decision: per the comment (:171-174) a non-owner gets 404 rather than 403, so the response cannot be used to learn that a given bookmark id exists, while an unresolvable user claim gets 403 without the lookup running. Contrast the whole picture with PointsController, which avoids all three mechanisms by never accepting a user id.
  • Concept, the change feed for offline clients. [Rubric §9, API & Contract Design]: GET changes serves one keyset page of a user's bookmark changes since a point in time, live bookmarks with their DTO and deleted ones as tombstones, oldest change first, so an offline client can bring its copy of the schedule up to date (:109-111, ADR-144). The page is an opaque cursor plus a size clamped to MaxChangesPageSize = 500 (:46, :135), and the feed is scoped to the named user by an InlineSpecification<TEntity, TIdentifierType> on UserId (:136).
  • Walkthrough (members in file order)
    • The class carries [FeatureGate(EngagementFeatures.SessionBookmarks)] (:34), a bare [Authorize] (:35) and [RefuseMachineClients] (:36, ADR-140), and is mounted at /bookmarks ([Route("[controller]")], :32). MaxChangesPageSize (:46) is the framework's default list ceiling.
    • CreateAsync (:61): the one endpoint with [Idempotent] (:57). The doc comment states the safety argument (:52-54): the request names the (user, session) pair explicitly and a duplicate already answers 409, so replaying a retried star is what the attendee meant rather than a second row or a spurious conflict (ADR-017). The action then runs the inline body-vs-claim check for non-organizers, failing with Error.Forbidden("Bookmarks.Forbidden", ...) when the caller id is missing or does not match (:70-77), dispatches (:79), and unwraps the outcome with TryGetValue (:81): a failure goes to HandleFailure, and a success answers 201 with the unwrapped DTO and a relative location built culture-invariantly from its Id (:83), so the action never dereferences a nullable Value.
    • GetUserBookmarksAsync (:93): userId is [FromQuery, Required], eventId is an optional filter, and paging defaults to page 1 of 10 (:94-97); returns a PagedCollectionResult<T>.
    • GetChangesAsync (:125): userId required, since and cursor optional, pageSize defaulting to 100 (:126-129); calls bookmarkQueryService.GetChangesSinceAsync directly rather than a handler (:132-137) and answers a KeysetCollectionResult<T> of EntityChange<TEntityDTO, TIdentifierType> (:139-141).
    • GetBookmarkedSessionIdsAsync (:149): returns an IReadOnlyDictionary<SessionIdentifierType, UserSessionBookmarkIdentifierType> (:148-149), which is the shape a session list needs to render bookmark toggles without one call per row.
    • DeleteAsync (:167): runs OwnershipHelper.ValidateOwnershipAsync with an ExistsAsync probe for a row with this id and this owner (:175-184), tagging a failure with the controller and entity names (:182-183) and returning it through HandleFailure (:185-186). Only then does it dispatch the generic DeleteEntityCommand<TEntity, TIdentifierType> (:188-190), which soft-deletes, and answer 204 (:194).
  • Why it's built this way: the mixed enforcement is deliberate rather than inconsistent. A shared action filter can only read what is on the request line, so the body and the stored-row cases cannot use it, and pushing the DELETE check into the handler would either duplicate it across every future mutation or force the generic delete command to learn about ownership. The stored-row probe now goes through the framework's OwnershipHelper, so the 403-versus-404 split is decided in one shared place rather than re-written inline per controller.
  • Where it's used: mounted at /bookmarks and routed to the Engagement service by the Gateway; consumed by the Conference session-list and personal-schedule surfaces. Note that the writes here are also what trigger UserSessionBookmarkCacheEvictionHandler: the aggregate raises UserSessionBookmarkChanged on every path this controller reaches, so a star or an un-star broadcasts an output-cache eviction to Conference. Covered by BookmarksControllerTests.
  • Caveats / not-in-source: the OwnerOrAdminFilter configuration (the claim name, the userId argument name, and the Organizer bypass role) is set during module registration and is not visible in this file. The exact 403 and 404 errors on DELETE are produced inside OwnershipHelper, not here. The business-rule numbers in the comments (UC-11, BR-42) are the controller's own claim; the authoritative statements live in the ADC specifications guide.

UserEngagementExportServiceGrpcAdapter

MMCA.ADC.Engagement.Contracts · MMCA.ADC.Engagement.Contracts · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/UserEngagementExportServiceGrpcAdapter.cs:20 · Level 12 · class (internal sealed)

  • What it is: the client-side gRPC adapter for the data-subject export, the remote twin of the in-process UserEngagementExportService. It implements IUserEngagementExportService on top of the generated export client and is what Identity resolves.
  • Depends on: IUserEngagementExportService and its DTOs from MMCA.ADC.Engagement.Shared.Exports (including UserEngagementTicketExportDTO), plus CheckInScope, PointsActivityType and TicketLinkMethod from the module's Shared project (:3-6); the generated UserEngagementExportService.UserEngagementExportServiceClient and its messages (:2); the framework's GrpcWireFormat (:7). Externals: System.Globalization (:1), the Grpc.Net client factory.
  • Concept, the same-interface transport swap plus wire rehydration. [Rubric §7, Microservices Readiness], [Rubric §9, API & Contract Design]. This is the export sibling of BookmarkCountServiceGrpcAdapter: the same interface as the in-process implementation, so consumers swap one DI registration (ADR-007). It also owns the inverse of every encoding decision the server made, and each inverse is written next to the decision it undoes.
  • Concept, parsing defensively across a rolling deploy. [Rubric §29, Resilience & Business Continuity]. The five DateTime fields are read with GrpcWireFormat.ParseUtc (:40, :47, :56, :74, :79), which parses with DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/GrpcWireFormat.cs:37, :61-62) so that a peer replica still emitting the marker-less form (new Identity code running against an old Engagement replica during a rolling deploy) does not yield Kind=Unspecified, and AssumeUniversal alone would yield Kind=Local. The comment there (GrpcWireFormat.cs:32-36) also records why RoundtripKind is deliberately absent: DateTime.Parse rejects it alongside either Assume* or AdjustToUniversal with an ArgumentException, and its purpose (preserving a non-UTC kind) is the opposite of what this contract wants. The one parser in this file, ParseRoundtripOffset (:113-117), keeps the offset the server emitted rather than folding it into UTC, with AssumeUniversal covering an offset-less value from an old peer (:110-112). It reads the three DateTimeOffset fields: CheckedInOn (:68) and the ticket's InvitedOn and LinkedOn (:92, :97).
  • Walkthrough
    • The adapter sets no per-call deadline: the call passes only the caller's token (:28-33). The typed client gets the framework default from AddTypedGrpcClient instead, GrpcDefaultDeadlineInterceptor (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:125, :132) applying HttpResilienceDefaults.GrpcCallDeadline, five seconds (MMCA.Common/Source/Core/MMCA.Common.Shared/Resilience/HttpResilienceDefaults.cs:87), so a hung peer still degrades its export section quickly rather than stalling the export request.
    • GetUserEngagementExportAsync(userId, cancellationToken) (:24-108): sends a GetUserEngagementExportRequest { UserId = userId } with the caller's token (:28-33), then rebuilds UserEngagementExportDTO from the seven repeated fields with collection expressions: bookmarks (:37-41), submitted questions (:42-48, including the question Text at :46), points entries (:49-57, casting the numeric ActivityType back to its enum at :53), check-ins (:58-69, casting Scope back at :62, mapping a 0 SessionId/SponsorId back to null at :66-67, and parsing CheckedInOn as a DateTimeOffset at :68), poll votes (:70-75, into UserEngagementPollVoteExportDTO), question upvotes (:76-80, into UserEngagementQuestionUpvoteExportDTO) and tickets (:81-98, into UserEngagementTicketExportDTO). The ticket mapping copies EventId and five string fields (:83-88), maps an empty OrderEmail and an empty InvitedOn back to null (:91-92, comment :90), and casts the numeric LinkMethod back to TicketLinkMethod (:96), lossless because those values are persisted and never renumbered (:94-95). Finally IsOnLeaderboard (:99) and the empty-string-to-null mapping for LeaderboardDisplayName (:104-106), whose comment (:101-103) notes the same mapping also covers an old peer that never sets the field at all.
  • Why it's built this way: the class doc (:11-19) states the resilience posture, transport failures propagate to the caller (Identity's ExportUserDataHandler), which degrades the Engagement section to Available = false rather than failing the whole export. Best-effort cross-service aggregation: a peer outage never sinks an entire data-subject export. [Rubric §30, Compliance, Privacy & Data Governance].
  • Where it's used: registered by DependencyInjection.AddEngagementUserExportClient(), called from MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:288. Covered by MMCA.ADC/Tests/Services/MMCA.ADC.Services.Tests/Exports/UserEngagementExportServiceGrpcAdapterTests.cs.
  • Caveats / not-in-source: proto3 carries no null, so the adapter cannot tell an empty OrderEmail or InvitedOn from an absent one; both rehydrate as null (:90-92), which is correct only because the server never emits an intentionally empty value for either.

DependencyInjection

MMCA.ADC.Engagement.Contracts · MMCA.ADC.Engagement.Contracts · MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:21 · Level 13 · class (public static)

  • What it is: the Engagement *.Contracts DI facade (one of several DependencyInjection classes in this module; this is the extraction-wiring one). Four C# extension(IServiceCollection) members a consuming host calls to swap Engagement's in-process cross-module registrations for their gRPC-backed adapters: bookmark counts and the verified-participant answer for Conference, and the data-subject export and the pending ticket invitation lookup for Identity (class doc :13-20).

  • Depends on: the generated BookmarkCountServiceClient / UserEngagementExportServiceClient / TicketInvitationServiceClient / VerifiedParticipantServiceClient (:3), BookmarkCountServiceGrpcAdapter, UserEngagementExportServiceGrpcAdapter, TicketInvitationServiceGrpcAdapter, VerifiedParticipantServiceGrpcAdapter, IBookmarkCountService, IUserEngagementExportService, IPendingTicketInvitationService, IVerifiedParticipantService (:4-7), AddTypedGrpcClient<TClient> from MMCA.Common.Grpc (:8, defined at MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:115) and WithServiceToken() from MMCA.Common.Grpc.Authentication (:9, defined at MMCA.Common/Source/Presentation/MMCA.Common.Grpc/Authentication/ServiceTokenHttpClientBuilderExtensions.cs:28). Externals: Microsoft.Extensions.DependencyInjection and its ServiceCollectionDescriptorExtensions.Replace (:1-2).

  • Concept, the adapter-swap wiring lives in the contracts package. [Rubric §7, Microservices Readiness], [Rubric §17, DevOps & Deployment], [Rubric §15, Best Practices & Code Quality]. ADR-007 requires each extracted service to publish a *.Contracts project holding the proto definitions and the DI wiring, so a consumer depends on that thin package rather than on the full module. The C# extension(IServiceCollection services) block (:23) adds the methods directly onto the collection (see primer §4).

  • Concept, Replace rather than TryAdd. [Rubric §2, Design Patterns]. Every method does the same two things: register a typed client, then replace one interface binding.

    Method File:Line What it swaps
    AddEngagementBookmarkCountClient(serviceName = "engagement") DependencyInjection.cs:41-49 registers BookmarkCountServiceClient (:43), then services.Replace(ServiceDescriptor.Scoped<IBookmarkCountService, BookmarkCountServiceGrpcAdapter>()) (:46)
    AddEngagementUserExportClient(serviceName = "engagement") DependencyInjection.cs:72-80 registers UserEngagementExportServiceClient (:74), then services.Replace(ServiceDescriptor.Scoped<IUserEngagementExportService, UserEngagementExportServiceGrpcAdapter>()) (:77)
    AddEngagementTicketInvitationClient(serviceName = "engagement") DependencyInjection.cs:100-108 registers TicketInvitationServiceClient with .WithServiceToken() (:102), then services.Replace(ServiceDescriptor.Scoped<IPendingTicketInvitationService, TicketInvitationServiceGrpcAdapter>()) (:105)
    AddEngagementVerifiedParticipantClient(serviceName = "engagement") DependencyInjection.cs:128-136 registers VerifiedParticipantServiceClient (:130), then services.Replace(ServiceDescriptor.Scoped<IVerifiedParticipantService, VerifiedParticipantServiceGrpcAdapter>()) (:133)

    Replace makes the adapter win over any binding made before the call, such as the real in-process implementation when the Engagement module is loaded in that host; TryAdd would silently lose to it. The inline comments state this at :45, :76, :104 and :132. There are no disabled stubs for these interfaces: EngagementModule.Register only calls AddEngagementModule() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/EngagementModule.cs:24-25). For bookmark counts the method's own doc (:33-36) records that in the extracted Conference host the in-process binding does not exist either: that host names only its own module to ModuleLoader, so the Engagement module is never discovered there and this call is the only IBookmarkCountService registration.

  • Concept, which clients present their own identity. [Rubric §11, Security]. Three clients forward the caller's bearer; the ticket-invitation client cannot, because the Identity request it serves is anonymous. Its doc (:87-92) says the server maps the edge under the service-only ServiceCaller policy, so the client opts in to the service token with WithServiceToken(), and the calling host must register AddServiceTokenClient. The verified-participant doc states the opposite case (:115-120): every caller is an authenticated feedback request and the server answers only for the caller's own account, so that client forwards the end user's token and does not opt in to the service token.

  • Walkthrough: AddTypedGrpcClient<T> is what makes each method two lines instead of twenty, it wires the client to Aspire service discovery (http://{serviceName}), the JwtForwardingClientInterceptor and the Polly resilience handler, all from MMCA.Common.Grpc (documented at :28-30 and :54-56). The same call also installs the framework's default per-call deadline (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:85-86, :132). All four methods return IServiceCollection for chaining (:48, :79, :107, :135).

  • Why it's built this way: the default serviceName = "engagement" matches the AppHost resource name, so the common call site is argument-free. [Rubric §33, Developer Experience]. The XML docs on the export, ticket-invitation and verified-participant methods (:64-68, :93-96, :121-124) spell out the ordering requirement: call them after ModuleLoader.DiscoverAndRegister(...), so any in-process registration is already in the container for Replace to find. That is an ordering constraint the compiler cannot enforce, which is why the docs repeat it. The hosts meet it by registering each client in their ConfigurePipeline after .Register(moduleHost.RegisterModules).

  • Where it's used: MMCA.ADC/Source/Services/MMCA.ADC.Conference.Service/Program.cs:361 and :362 register AddEngagementBookmarkCountClient() and AddEngagementVerifiedParticipantClient() (after the module step at :360); MMCA.ADC/Source/Services/MMCA.ADC.Identity.Service/Program.cs:288 and :291 register AddEngagementUserExportClient() and AddEngagementTicketInvitationClient() (after the module step at :287). The AppHost documents the edges of the resulting topology, including why the Conference-to-Engagement reverse edge, which now also carries the verified-participant client, gets no reciprocal WaitFor (MMCA.ADC/Source/Hosting/MMCA.ADC.AppHost/Program.cs:273-277, against the Engagement-to-Conference edge at :267-268), and the Identity-to-Engagement edge at :286-295.

  • Caveats / not-in-source: neither these methods nor the four adapters set a per-call deadline. The 5-second budget is the framework default HttpResilienceDefaults.GrpcCallDeadline (MMCA.Common/Source/Core/MMCA.Common.Shared/Resilience/HttpResilienceDefaults.cs:87), applied by the interceptor AddTypedGrpcClient registers, and a caller-set deadline would win over it (MMCA.Common/Source/Presentation/MMCA.Common.Grpc/DependencyInjection.cs:85-86).


PointsEntry

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/PointsEntry.cs:29 · Level 7 · class (sealed)

  • What it is: the aggregate root recording one points award, and the whole of the points ledger. An attendee's total is never a stored number: it is the sum of their entries.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> (bound to PointsEntryIdentifierType), IAuditedEntity, PointsEntryInvariants, PointsActivityType and PointsSubjectKeys, IdValueGeneratedAttribute, and Result.
  • Concept introduced, the append-only ledger. [Rubric §8, Data Architecture] assesses whether the schema states the intended semantics rather than relying on convention. This type has a factory and no mutators at all: every property has a private set and nothing inside the class ever writes one after construction (PointsEntry.cs:32-44). A total is therefore always derivable and never a number somebody edited (:10-11). [Rubric §4, Domain-Driven Design]: immutability is the model's statement that an award is a historical fact, not a mutable balance.
  • Concept introduced, the value snapshot. Points stores the configured award as it stood at award time (:37-38), resolved by the caller before it reaches the factory (:71). [Rubric §15, Best Practices & Code Quality] and [Rubric §8, Data Architecture]: retuning the economy mid-conference changes what the next award is worth and never rewrites history (:13-14). The alternative (storing only the activity and multiplying by today's configured value at read time) would silently restate every past award every time an operator changed a setting.
  • Concept introduced, idempotency and anti-farming in one index. [Rubric §12, Performance and Scalability] and [Rubric §11, Security] both apply. The unique index on (UserId, ActivityType, SubjectKey) (PointsEntryConfiguration, PointsEntryConfiguration.cs:46-48) is the real rule behind both properties (:17-19): a replayed award collides with the row it already wrote, and N questions asked in one session collapse onto one subject key (session:{id}, PointsSubjectKeys.cs:24-25) so they award exactly once. Neither guarantee is implemented by counting in application code. PointsAwarder adds a pre-check for the ordinary duplicate (PointsAwarder.cs:73-82) and reads the index violation from a concurrent race as already-awarded rather than as a failure (PointsAwarder.cs:93-99, via IUniqueConstraintViolationDetector).
  • Concept, the audit marker on a ledger. [Rubric §13, Observability and Operability] assesses whether operationally load-bearing writes leave a trail. The class implements IAuditedEntity (:29) for a stated reason (:22-25): the ledger decides a prize-bearing leaderboard, so the append-only rule is worth being able to prove rather than merely assert. With the trail (ADR-075), an insert that was never followed by an update is visible in the data, and the one write that does move a total (a soft-delete or erasure of an entry) is recorded with it.
  • Walkthrough
    • [IdValueGenerated] (:28): database-generated id, so the factory writes Id = default (:92).
    • Five private set properties: UserId (:32, a cross-database scalar), ActivityType (:35), Points (:38), SubjectKey (:41, defaulted to string.Empty so the EF constructor never leaves it null), OccurredOnUtc (:44, supplied by the caller's TimeProvider rather than read from a clock here).
    • Two constructors: EF-only parameterless (:47) and the private assigning one (:49-61).
    • Create(userId, activityType, points, subjectKey, occurredOnUtc) (:75-96): Result.Combine over all four invariants (:82-86), failure re-wrapped as Result.Failure<PointsEntry> (:87-88), the entity built with Id = default (:90-93) and returned as Result.Success (:95). There is no Update, no Adjust, and no Delete override: correcting an award means writing the compensating history, not editing the row.
    • No domain event. [Rubric §12, Performance and Scalability]: the factory raises nothing, and the summary states why (:63-68): nothing reacts to an award, and the award rate peaks at every session changeover, so an event would only add an outbox row to each award. The audit trail (above) is what records the write, not an event.
  • Why it's built this way: the contract is deliberately conference-agnostic. Neither this entity nor IPointsAwarder names an event, a session, or a check-in: an award is a user, an activity, an opaque subject key, and a timestamp (IPointsAwarder.cs:10-17). [Rubric §7, Microservices Readiness]: that is what would make lifting the ledger into MMCA.Common a move rather than a rewrite, leaving only the thin award adapters behind in ADC. The scan surfaces that feed it are described in ADR-072.
  • Where it's used: written only by PointsAwarder (PointsAwarder.cs:84, the single write path into the ledger); read by GetMyPointsHandler (GetMyPointsHandler.cs:54), GetPointsOverviewHandler (GetPointsOverviewHandler.cs:39) and GetLeaderboardHandler (GetLeaderboardHandler.cs:54), all projecting to PointsEntryDTO rather than returning the aggregate; exported by UserEngagementExportService; persisted per PointsEntryConfiguration, which adds a UserId-leading index so the "my points" read is a seek (PointsEntryConfiguration.cs:51-52). Unit-tested by PointsEntryTests.

MyPoints

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Points/MyPoints.razor.cs:16 · Level 5 · class (partial)

  • What it is: the code-behind for the attendee's own points page (@page "/points", MyPoints.razor:1, @attribute [Authorize], MyPoints.razor:2). It shows the running total, the ledger entries behind it, the leaderboard opt-in switch, and the public board.
  • Depends on: IPointsUIService (MyPoints.razor.cs:28), ViewerTimeZone (:29), Result (the load method's own return type, :95, and the parameter of SaveErrorMessage, :180), PointsEntryDTO (:48), LeaderboardEntryDTO (:49), MyPointsDTO (read at :97-105) and PointsActivityType (:192). Externals: Blazor ComponentBase, MudBlazor BreadcrumbItem / Icons / MudSwitch, and an injected IStringLocalizer<MyPoints> named L from the markup (MyPoints.razor:6).
  • Concept introduced, making a stateful child control follow the server. [Rubric §19, State Management] assesses who owns a visible piece of state. A MudSwitch keeps its own checked state, and Blazor re-parameterizes a child only when a parameter actually changes, so after a rejected write the control would keep showing what the attendee clicked while the page holds what the server accepted. The page solves it with a render key: _switchGeneration (:55) is bound as @key on the switch (MyPoints.razor:74) and incremented whenever the server's value disagrees with the requested one (:167-170), which re-mounts the control and forces it to drop its internal state. [Rubric §24, Forms, Validation & UX Safety] covers the second decision in the same method: a failed write and a failed read-back are reported differently (:133-136), because conflating them made a refresh blip force the switch back to the pre-write value and show the opposite of the server state. A third decision sits on the failed-write branch: SaveErrorMessage (:180-183) looks for the one refusal the attendee can fix, the error code Points.DisplayNameUnavailable (DisplayNameUnavailableCode, :26, raised for a caller with no display name on their token), and answers it with its own localized advice (Error.DisplayNameUnavailable); every other failure keeps the generic Error.SaveFailed, so the server's diagnostic text is never surfaced (:173-179). [Rubric §27, Internationalization] covers both the L["..."] resource lookups and the culture-aware timestamp rendering (ADR-027).
  • Concept introduced, a page that reads failures instead of catching them. [Rubric §1, SOLID] and [Rubric §15, Best Practices & Code Quality] both show in one detail: LoadAsync returns Result (:95) rather than throwing, and it composes the two service calls by propagating their errors (:98-101, :108-111). The only exception the page catches is OperationCanceledException on disposal (:81-84, :153-156), so the error state is driven by a value the UI service returned, not by an exception type the page has to recognize. SaveErrorMessage follows the same rule: it branches on the Code of the returned errors, not on an exception type.
  • Walkthrough (teaching order)
    • EntryPageSize (:19) fixes the activity feed at 20 entries per read; DisplayNameUnavailableCode (:26) names the one refusal code the page recognizes; the injected IPointsUIService (:28) and ViewerTimeZone (:29), a CancellationTokenSource (:31) and the breadcrumb list (:38) follow. LifetimeToken (:36) wraps _cts.LifetimeToken(): reading Token off a disposed source throws ObjectDisposedException, and Dispose cancels before it disposes, so a load or handler that resumes after the attendee navigated away gets a cancelled token and stops through its OperationCanceledException path (comment :33-35). Every service call below passes LifetimeToken rather than _cts.Token. IsLoading is protected with a private setter (:41) so component tests can observe the first load.
    • The private state (:43-49) is a load error, a save error, an in-flight save latch, the total, the opt-in flag, the entries and the board. _switchGeneration (:55) is the render key described above.
    • OnInitializedAsync (:57) is not async: it builds the two-item breadcrumb trail (:59-63) and returns the task of LoadPageAsync (:65).
    • LoadPageAsync (:69) is the whole load cycle and, per its doc comment (:68), also the Retry action: the markup's error alert binds it as OnRetry (MyPoints.razor:21). It sets IsLoading and clears the previous load error first (:71-72), so a retry starts from the loading state rather than leaving the old error on screen, then awaits LoadAsync and sets the localized load error when it comes back a failure (:76-79), swallows OperationCanceledException as expected on disposal (:81-84), and clears IsLoading in finally (:85-88).
    • LoadAsync (:95) makes two calls: the caller's ledger (:97) and the public board (:107). Each is unwrapped with TryGetValue and short-circuits into Result.Failure carrying the service's own errors (:98-101, :108-111). Both are re-read after an opt-in change, because joining adds a row to the board and leaving removes one (:91-94).
    • OnParticipationChangedAsync (:123) returns early when a save is already in flight (:125-128), latches _isSaving and clears the previous save error (:130-131), then writes through SetLeaderboardParticipationAsync (:139). A failed write sets the message chosen by SaveErrorMessage(write) (:140-143); a successful write followed by a failed refresh sets the refresh-failed message instead and adopts the requested value locally (:144-151) so the key guard below does not re-mount the switch back onto a stale reading.
    • SaveErrorMessage (:180-183) is an expression-bodied method that tests write.Errors.Any(...) for an error whose Code equals DisplayNameUnavailableCode under StringComparison.Ordinal, returning the display-name advice when it matches and the generic save message otherwise.
    • ActivityLabel (:192-202) maps each PointsActivityType member to a resource key by an explicit switch rather than by enum name, so a renamed member breaks the build instead of silently rendering a missing key (:185-191).
    • OnAfterRenderAsync (:209-215) calls ViewerTime.EnsureResolvedAsync(LifetimeToken) on the first render only, once JS is available, and calls StateHasChanged when the zone changed, so award times move from the UTC fallback to the viewer's clock.
    • FormatOccurredOn (:225-226) delegates to ViewerTime.Format. The comment (:217-222) gives the reason: ViewerTimeZone.Format reads an Unspecified value as UTC, so a serializer that drops the UTC marker cannot shift the reading, whereas DateTime.ToLocalTime would use the server's clock on Blazor Server and during prerender.
    • Dispose(bool) / Dispose() (:230-250) are the standard disposable pattern with a _disposed latch, cancelling and disposing _cts so an in-flight load stops when the attendee navigates away.
  • Why it's built this way: the page makes one promise, that the switch shows the server's state and not the click's, and both the key bump and the split error messages exist to keep it. Everything else is orchestration only: all I/O goes through IPointsUIService, which keeps the page testable under bUnit and swappable per host.
  • Where it's used: routed at /points, the value of EngagementRoutePaths.MyPoints (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:26). Component-tested by MyPointsTests.
  • Caveats / not-in-source: the tables, the empty states and every visible string live in MyPoints.razor and the resource files. Whether the page is reachable at all depends on the Engagement.Points feature gate on PointsController, which is configuration. The refusal code is raised by SetLeaderboardParticipationHandler (named in the DisplayNameUnavailableCode comment, :23); the page only recognizes the code string.

AttendeeBadgeInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Badges · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadgeInvariants.cs:9 · Level 6 · class (static)

  • What it is: the one invariant rule for AttendeeBadge: a badge must be bound to a real user.
  • Depends on: CommonInvariants (AttendeeBadgeInvariants.cs:16) and Result.
  • Concept: the static invariant class beside its aggregate is taught in group 02. [Rubric §4, DDD] assesses whether invariants are stated where the model can enforce them: keeping them in a static class that the factory composes means each rule is individually named, individually testable, and reusable by any future mutator on the same aggregate.
  • Walkthrough: one method. EnsureUserIdIsValid(userId, source) (:15-16) delegates to CommonInvariants.EnsureIdIsNotDefault with the stable error code "AttendeeBadge.UserId.Invalid", the message, the calling member name for attribution, and nameof(userId) as the target. The source parameter is passed by its caller as nameof(Create) (AttendeeBadge.cs:42), which is what puts the failing member into the error rather than a stack trace.
  • Why it's built this way: a badge carries almost no state (an owner and an opaque credential, AttendeeBadge.cs:21-24), and the credential is generated internally, so there is exactly one thing a caller can get wrong. The class is still written out rather than inlined into the factory so the badge follows the same shape as every other aggregate in the module, including its much larger sibling CheckInInvariants.
  • Where it's used: AttendeeBadge.Create (AttendeeBadge.cs:42) is the only caller in the module.

CheckInInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/CheckIns/CheckInInvariants.cs:10 · Level 6 · class (static)

  • What it is: the five invariant rules for CheckIn. Four are simple id and enum checks; the fifth encodes the rule that makes one aggregate able to carry three different check-in shapes.
  • Depends on: CommonInvariants (EnsureIdIsNotDefault at CheckInInvariants.cs:17, :24, :31, and EnsureEnumIsDefined at :102), Result and Error (Error.Invariant at :88 and :93), plus CheckInScope (:45) and the UserIdentifierType / EventIdentifierType / SessionIdentifierType / SponsorIdentifierType aliases (solution-wide global using, see primer §2). No externals beyond the BCL.
  • Concept introduced, the discriminated-shape invariant. [Rubric §4, Domain-Driven Design] assesses whether the model can express an illegal state. This aggregate is a polymorphic row: a Session check-in must name a session and must not name a sponsor, a Sponsor visit is the mirror image, and an Event check-in names neither. EnsureTargetMatchesScope states that rule once, in the domain, so no handler and no controller can persist a row that belongs to two shapes at once (:33-38). [Rubric §8, Data Architecture] is the reason it matters beyond tidiness: the storage layer builds three filtered unique indexes on the same table, one per scope (CheckInConfiguration, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:49-63), and a row with two targets set would be visible to two of them. The invariant and the index filters are two statements of one rule, which the doc comment names explicitly (:34-36).
  • Walkthrough (teaching order)
    • EnsureUserIdIsValid (:16-17), EnsureEventIdIsValid (:23-24) and EnsureCheckedInByUserIdIsValid (:30-31) are three CommonInvariants.EnsureIdIsNotDefault delegations with stable codes ("CheckIn.UserId.Invalid", "CheckIn.EventId.Invalid", "CheckIn.CheckedInByUserId.Invalid"). The event id is required for every scope (:19), which is what lets the attendance rollup bucket any row by conference. The recorder is whoever wrote the row: an organizer for a scan or manual check-in, the attendee for a self-recorded visit (:27).
    • EnsureTargetMatchesScope (:44-71) runs the session check first (:50-58) and returns it when it fails (:60-61), otherwise runs the sponsor check (:62-70), so the caller gets the first specific failure rather than a merged pair.
    • EnsureTargetPresence (:75-95) is the private rule stated once. isOwningScope decides the direction: the owning scope requires the id and treats null or default as missing (:85-90), and every other scope forbids it outright (:92-94). The comment above it (:73-74) records why one method serves both targets: both are int aliases, so the parameter is typed int?.
    • EnsureScopeIsDefined (:101-102) delegates to CommonInvariants.EnsureEnumIsDefined with the code "CheckIn.Scope.Invalid", which matters because a scope can arrive from a deserialized request rather than from C# code.
  • Why it's built this way: pushing the shape rule into the domain rather than into each use case means the three write paths (organizer scan, sponsor visit, room check-in) cannot drift apart, and the separate error codes make a failure legible at the API boundary without a message-parse.
  • Where it's used: composed with Result.Combine inside CheckIn.Create (CheckIn.cs:98-103); that factory is the only caller.
  • Caveats / not-in-source: EnsureTargetPresence treats a supplied-but-default id as missing only for the owning scope (:87); a non-owning scope rejects any non-null value, default included (:92).

ErasedUser

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.ErasedUsers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/ErasedUsers/ErasedUser.cs:20 · Level 6 · class (sealed)

  • What it is: the aggregate root that records one erased account in the Engagement database: the erased user's id and when Identity erased it (ErasedUser.cs:23, :26). It holds no personal data, only the fact of erasure, so write handlers can ask "has this account been erased?" without reaching across a service boundary.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> (bound to ErasedUserIdentifierType, :20), UserIdentifierType, CommonInvariants.EnsureIdIsNotDefault (:43-44) and Result. Externals: only System.DateTimeOffset.
  • Concept introduced, a tombstone that closes the erasure gap. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether erasure actually holds. An access token outlives the account it was issued for, and the per-feature erasure handlers only reach rows that exist when they run, so a question, vote, bookmark, badge, room check-in or sponsor visit written afterwards would carry an erased user id that no erasure revisits. The ErasedUser row is the answer: the erasure writes it once (UserDeletedSessionQuestionsHandler.cs:101-108, a no-op when a row for that user already exists) and every Engagement write handler keyed to the caller checks it through ErasedUserGuard (ErasedUserGuard.cs:26-43), which refuses with a Forbidden error coded Engagement.AccountErased (ErasedUserGuard.cs:18). [Rubric §7, Microservices Readiness] is the other half: Identity owns the account, so Engagement keeps its own scalar copy of the id rather than a cross-database reference (ADR-005).
  • Walkthrough
    • UserId (:23) and ErasedOn (:26): private set scalars; ErasedOn is the time Identity erased the account, taken from the UserDeleted event, not the time Engagement processed it (:39).
    • Two constructors, an EF-only parameterless one (:29) and a private assigning one (:31-35). Construction always runs through the factory.
    • Create(userId, erasedOn) (:41-49): validates the id with CommonInvariants.EnsureIdIsNotDefault under the code Engagement.ErasedUser.UserIdInvalid (:43-44), re-wraps a failure as Result.Failure<ErasedUser> (:45-46), and otherwise builds the entity with Id = default (:48) so the database generates the key. No domain event is raised: nothing downstream subscribes to an erasure record being written.
  • Why it's built this way: the persistence side pins uniqueness, one row per erased account, with a unique index on UserId (ErasedUserConfiguration.cs:29-30, ErasedUserConfiguration), so a redelivered UserDeleted event cannot create a second record. The identifier alias follows the module convention (ADR-085).
  • Where it's used: created by UserDeletedSessionQuestionsHandler (UserDeletedSessionQuestionsHandler.cs:108); read by ErasedUserGuard; persisted by ErasedUserConfiguration and the AddErasedUsers migration (20261020142915_AddErasedUsers.cs); mapped into the Engagement database through the shared per-engine SQLServerDbContext, since ErasedUserConfiguration derives from EntityTypeConfigurationSQLServer<ErasedUser, ErasedUserIdentifierType> (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/ErasedUsers/ErasedUserConfiguration.cs:15-16). Unit-tested by ErasedUserTests.
  • Caveats / not-in-source: which handlers run the guard is spread across the write handlers and is not enumerated here; the class comment on ErasedUserGuard (:7-14) lists the write kinds it covers. The L207 marker in those comments is a backlog reference whose text is not in this source.

LeaderboardOptIn

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/LeaderboardOptIn.cs:23 · Level 6 · class (sealed)

  • What it is: the aggregate root recording that one attendee agreed to publish their score on the points leaderboard. Opting out soft-deletes the row, so "the board" is exactly the set of active opt-ins and nothing else (LeaderboardOptIn.cs:9-10). It carries two pieces of state: the attendee's id and the display name they chose to publish.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> (bound to LeaderboardOptInIdentifierType), IAnonymizable, PiiAttribute, LeaderboardOptInInvariants, IdValueGeneratedAttribute, and Result. Externals: only System.StringComparison.
  • Concept introduced, the published-name snapshot. [Rubric §7, Microservices Readiness] assesses whether a read can be served without reaching across a service boundary. DisplayName is not a lookup key into Identity: it is the name the attendee explicitly published at opt-in, stored here verbatim (LeaderboardOptIn.cs:12-14). That single choice is what lets GetLeaderboardHandler project the whole board out of the Engagement database (GetLeaderboardHandler.cs:39-43) with no gRPC call into Identity, and it also bounds the exposure: the board can only ever leak the name the attendee chose to put on it. [Rubric §30, Compliance, Privacy and Data Governance] is the other half, taught below on EraseDisplayName.
  • Concept, opt-in as a row rather than a flag. [Rubric §4, Domain-Driven Design] assesses whether the model states the rule rather than encoding it in a boolean somewhere. Participation is a first-class aggregate with its own lifecycle (join, leave, rejoin), which means leaving is auditable (CreatedOn/By and LastModifiedOn/By come from the auditable base) and rejoining is a state transition on the same row rather than a new record.
  • Walkthrough
    • [IdValueGenerated] (LeaderboardOptIn.cs:22): the id is database-generated, so the factory writes Id = default and SQL Server's IDENTITY fills it (see IdValueGeneratedAttribute).
    • DisplayNameMaxLength = 100 (:26) and ErasedDisplayName = "Deleted Account" (:33): two constants that the rest of the system reads rather than restates. The EF configuration binds the column length to the first (LeaderboardOptInConfiguration, LeaderboardOptInConfiguration.cs:30) and LeaderboardOptInInvariants validates against it (LeaderboardOptInInvariants.cs:26-28). The second matches the placeholder the Identity aggregate anonymizes to, so an erased account reads the same wherever a row survives (:28-32).
    • UserId (:36) and DisplayName (:40): private set scalars. UserId is a cross-database reference, never a navigation (ADR-006). DisplayName carries [Pii] (:39, see PiiAttribute): a self-chosen public name is still a person's name (:16-20).
    • IsDisplayNameErased (:47): a computed bool comparing DisplayName to ErasedDisplayName with StringComparison.Ordinal. It exists so a redelivered erasure can recognise that there is nothing left to write (:42-46).
    • Two constructors, an EF-only parameterless one (:50) and a private assigning one (:52-56). Construction always runs through the factory.
    • Create(userId, displayName) (:65-81): Result.Combine over both invariants (:69-71), errors re-wrapped as Result.Failure<LeaderboardOptIn> on failure (:72-73), the entity built with Id = default (:75-78) and returned as Result.Success (:80). It raises no domain event, and the summary says why (:58-61): nothing reacts to a leaderboard opt-in, so an event would only cost an outbox row per toggle ([Rubric §12, Performance and Scalability]).
    • Reactivate(displayName) (:90-102): validates the name first (:92-94), calls the inherited Undelete() (:96), and only on success overwrites DisplayName (:98-99). Rejoining therefore republishes the attendee's current name, not the one they had the first time (:83-87, BR-135).
    • Leaving the board is the inherited soft-delete: the class declares no Delete() override, so optIn.Delete() at the call sites is the base AuditableAggregateRootEntity behavior and raises nothing of its own. This is "left the board", not "erased".
    • EraseDisplayName() (:115): a one-line, irreversible overwrite of DisplayName with ErasedDisplayName. [Rubric §30, Compliance, Privacy and Data Governance] assesses whether erasure is modelled distinctly from deletion. The remarks (:108-114) state why the two are deliberately separate methods: taking an entry off the board and erasing the name it carried are different promises, and only the second is irreversible. The row itself survives (anonymize in place, ADR-005), so the scalar UserId reference and the audit trail stay intact, and the operation is idempotent because a redelivered erasure rewrites the same placeholder.
    • Anonymize() (:122-126): the IAnonymizable contract the class now implements (:23). It calls EraseDisplayName() and returns Result.Success(), so the interface erasure and the domain-named erasure are one operation and equally idempotent (:117-121). The interface is what the [Pii] marker obliges: the shared fitness rule fails any domain entity with a [Pii] property that does not implement IAnonymizable (MMCA.Common/Source/Hosting/MMCA.Common.Testing.Architecture/Bases/Governance/PiiConventionTestsBase.cs:85, ADR-005).
  • Why it's built this way: the unique index on UserId is filtered on the soft-delete flag (LeaderboardOptInConfiguration, LeaderboardOptInConfiguration.cs:33-35), so an attendee can hold at most one active opt-in while their history survives (ADR-095). That index is precisely what makes Reactivate necessary rather than optional: without it a rejoin would insert a second row and collide, which is the reasoning recorded at the call site (SetLeaderboardParticipationHandler.cs:80-82). The handler also treats an erased row as terminal: when the soft-deleted row it finds has IsDisplayNameErased, it returns Forbidden (Points.AccountErased) instead of reactivating, so a deleted account's still-valid token cannot republish a name (SetLeaderboardParticipationHandler.cs:97-106).
  • Where it's used: reactivated and created by SetLeaderboardParticipationHandler (SetLeaderboardParticipationHandler.cs:108 and :114 respectively, opt-out via the inherited Delete() at :164); read by GetLeaderboardHandler (GetLeaderboardHandler.cs:39-43, ordering tie-break on DisplayName at :69); soft-deleted and erased by UserDeletedPointsHandler (UserDeletedPointsHandler.cs:66-85, Delete() at :70, the IsDisplayNameErased guard and EraseDisplayName() at :80-82); persisted per LeaderboardOptInConfiguration. Unit-tested by LeaderboardOptInTests.
  • Caveats / not-in-source: the erasure comment cites PRIVACY.md section 11 (LeaderboardOptIn.cs:106); that document lives in the ADC repo's own docs, not in this file, so the citation cannot be verified from the source under this type.

LeaderboardOptInInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/LeaderboardOptInInvariants.cs:9 · Level 6 · class (static)

  • What it is: the two-rule invariant helper for LeaderboardOptIn: the opt-in must name a real attendee, and the published name must be present and fit the column.
  • Depends on: CommonInvariants (LeaderboardOptInInvariants.cs:1), Result and Error, the UserIdentifierType alias (solution-wide global using, see primer §2), and the LeaderboardOptIn.DisplayNameMaxLength constant.
  • Concept introduced, the static invariant class. [Rubric §4, Domain-Driven Design] assesses whether business rules live in the model rather than leaking into handlers or the database schema alone. Every aggregate in this module pairs with a static class whose methods each return a Result, so a factory can compose them with Result.Combine and report every violation at once instead of failing on the first. [Rubric §1, SOLID]: one method, one rule, one reason to change. The idiom is the same one the framework value objects use in Group 02; the three siblings in this unit (CheckInInvariants, PointsEntryInvariants and UserSessionBookmarkInvariants) are the same shape with different rules.
  • Walkthrough: two expression-bodied methods, both taking a source string that the caller passes as its own method name so a failure carries its origin without a stack trace.
    • EnsureUserIdIsValid(userId, source) (:15-16): delegates to CommonInvariants.EnsureIdIsNotDefault with code "LeaderboardOptIn.UserId.Invalid" and message "User ID must be provided.". A default id (zero or empty, whichever the alias resolves to) fails.
    • EnsureDisplayNameIsValid(displayName, source) (:22-29): fails when the name is null, empty, whitespace, or longer than LeaderboardOptIn.DisplayNameMaxLength, returning Error.Invariant with code "LeaderboardOptIn.DisplayName.Invalid" and an interpolated message that reads the constant rather than hardcoding 100 (:26).
  • Why it's built this way: the length rule is stated once as a constant on the aggregate and consumed in three places (this check, the EF column at LeaderboardOptInConfiguration.cs:28-30, and the error message), so widening the column cannot silently disagree with the domain rule. Validating the name in the domain rather than only at the API boundary matters because LeaderboardOptIn.Reactivate also writes it (LeaderboardOptIn.cs:92), and that path never passes through a request validator.
  • Where it's used: called by LeaderboardOptIn.Create (LeaderboardOptIn.cs:69-71) and by Reactivate (LeaderboardOptIn.cs:92).

PointsEntryInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/PointsEntryInvariants.cs:10 · Level 6 · class (static)

  • What it is: the four-rule invariant helper for PointsEntry. It is the widest invariant class on the points side of the module, because a ledger row has four things that can be wrong: the attendee, the activity, the amount, and the subject the award is scoped to.
  • Depends on: CommonInvariants, Result and Error, PointsActivityType and PointsSubjectKeys from MMCA.ADC.Engagement.Shared (PointsEntryInvariants.cs:1), and the UserIdentifierType alias. No BCL externals of its own: every rule delegates to a CommonInvariants helper.
  • Concept: the static invariant class is taught on LeaderboardOptInInvariants. What is worth teaching here is the boundary between a rule and a kill switch. [Rubric §4, Domain-Driven Design]: a zero-point award is rejected outright here (:26-27), because turning an earn rule off is the awarder's job, not the ledger's. A rule configured to 0 short-circuits inside PointsAwarder before any entity is built (PointsAwarder.cs:45-50), so a zero reaching this factory can only be a caller bug, which is exactly what the doc comment states (:19-22).
  • Walkthrough: four expression-bodied methods, each a one-call delegation to a shared CommonInvariants helper (MMCA.Common/Source/Core/MMCA.Common.Domain/Invariants/CommonInvariants.cs) with this aggregate's own error code and message.
    • EnsureUserIdIsValid(userId, source) (:16-17): CommonInvariants.EnsureIdIsNotDefault, code "PointsEntry.UserId.Invalid".
    • EnsurePointsArePositive(points, source) (:26-27): CommonInvariants.EnsureIntIsPositive, which fails any value <= 0 with an Error.Invariant (CommonInvariants.cs:94-98), code "PointsEntry.Points.Invalid".
    • EnsureSubjectKeyIsValid(subjectKey, source) (:36-44): CommonInvariants.EnsureStringLengthIsWithin(subjectKey, 1, PointsSubjectKeys.MaxLength, ...), which rejects null, empty, whitespace, or longer than PointsSubjectKeys.MaxLength (64, PointsSubjectKeys.cs:13; helper at CommonInvariants.cs:219-223), with code "PointsEntry.SubjectKey.Invalid" and a message that reads the constant (:42). The comment (:29-32) explains why this is more than cosmetic: the key is part of the unique index, so a truncated or blank key would break idempotency rather than merely look wrong.
    • EnsureActivityTypeIsDefined(activityType, source) (:50-51): CommonInvariants.EnsureEnumIsDefined, an Enum.IsDefined check behind a struct, Enum constraint (CommonInvariants.cs:177-182), code "PointsEntry.ActivityType.Invalid". [Rubric §15, Best Practices and Code Quality]: PointsActivityType deliberately starts at 1 and reserves 0 for "no activity" (PointsActivityType.cs:11-15), so this one check turns a defaulted field or an unset payload into a validation failure instead of a silently mis-attributed award.
  • Why it's built this way: three of the four rules exist to protect the ledger's unique index on (UserId, ActivityType, SubjectKey) (PointsEntryConfiguration, PointsEntryConfiguration.cs:46-48). Idempotency and anti-farming both rest on that index, and an index cannot defend itself against a blank or truncated component, so the domain does.
  • Where it's used: called by PointsEntry.Create (PointsEntry.cs:82-86), combined through Result.Combine. Unit-tested by PointsEntryInvariantsTests.

UserSessionBookmarkInvariants

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.UserSessionBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/UserSessionBookmarks/UserSessionBookmarkInvariants.cs:9 · Level 6 · class (static)

  • What it is: the static invariant helper for UserSessionBookmark. Two rules, both guarding that the aggregate's cross-module foreign keys are actually set before a bookmark can be constructed.
  • Depends on: CommonInvariants (UserSessionBookmarkInvariants.cs:1), Result, and the UserIdentifierType / SessionIdentifierType aliases (solution-wide global using, see primer §2).
  • Concept: the static invariant class is taught on LeaderboardOptInInvariants. This is the minimal instance of it: no lengths, no enums, just the two identifiers. [Rubric §1, SOLID]: each method has exactly one reason to change.
  • Walkthrough: two one-line methods.
    • EnsureUserIdIsValid(userId, source) (:11-12): forwards to CommonInvariants.EnsureIdIsNotDefault with code "UserSessionBookmark.UserId.Invalid" and message "User ID must be provided.".
    • EnsureSessionIdIsValid(sessionId, source) (:14-15): the same shape for SessionId, code "UserSessionBookmark.SessionId.Invalid".
    • Both take the source string the caller fills with its own method name, so a failure carries the originating call site.
  • Why it's built this way: enforcing "a bookmark must reference a real user and a real session" in the domain, not only through a database NOT NULL, means an invalid bookmark can never be materialized. Because SessionId and UserId point at rows in other services' databases (database-per-service, ADR-006), there is no cross-database foreign key to lean on, so the not-default check is the domain's own front line.
  • Where it's used: called by UserSessionBookmark.Create (UserSessionBookmark.cs:44-46), combined through Result.Combine.
  • Caveats / not-in-source: unlike its siblings in this unit, this class carries no XML doc comments on its members (UserSessionBookmarkInvariants.cs:11-15); the intent has to be read off the error codes.

OrganizerPointsOverview

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Points/OrganizerPointsOverview.razor.cs:19 · Level 5 · class (partial)

  • What it is: the code-behind for the organizer rollup of the points game (@page "/organizer/points", OrganizerPointsOverview.razor:1, @attribute [Authorize(Roles = RoleNames.Organizer)], OrganizerPointsOverview.razor:2): how many attendees are playing, what the economy has paid out, which mechanic the room actually used, and the newest awards.
  • Depends on: IPointsUIService (OrganizerPointsOverview.razor.cs:24), ViewerTimeZone (:25), PointsOverviewDTO (:40) and PointsActivityType (:91). Externals as on MyPoints: MudBlazor BreadcrumbItem / Icons, and an injected IStringLocalizer<OrganizerPointsOverview> (OrganizerPointsOverview.razor:7).
  • Concept introduced, distinguishing "no data yet" from "the read failed". There is no write on this surface, so none of the switch-state machinery MyPoints needs appears here, but the load does one thing its sibling does not. [Rubric §24, Forms, Validation & UX Safety] assesses whether the UI tells the truth about what happened: the load unwraps the Result with TryGetValue and, when it is a failure, checks IsNotFound() before deciding (:62-72). A not-found rollup leaves _overview null so the page keeps rendering its empty state, and only a real failure becomes the error state; the comment (:68-70) records that this preserves the behavior the older null-returning service produced. [Rubric §30, Compliance, Privacy & Data Governance] is the other point worth teaching: the class comment (:13-17) states that the recent entries carry NO attendee identity by design, because the overview endpoint reports activity, points and timestamps only. An organizer can watch the game move without seeing who earned what, and the only published identities anywhere in this feature are the leaderboard names attendees opted in to. [Rubric §11, Security] covers the role gate, which is declared on the markup rather than in this file.
  • Walkthrough: RecentEntryCount (:22) fixes the tail at 20 entries. LifetimeToken (:32) is the same _cts.LifetimeToken() guard as on MyPoints (comment :29-31), so a read resuming after disposal gets a cancelled token instead of an ObjectDisposedException. IsLoading (:37) is protected with a private setter for the component tests; _loadError and _overview (:39-40) are the only other state. OnInitializedAsync (:42) is not async: it builds the breadcrumbs (:44-48) and returns the task of LoadAsync (:50). LoadAsync (:54) is, per its doc comment (:53), also the Retry action, bound as OnRetry on the error alert (OrganizerPointsOverview.razor:22): it sets IsLoading and clears the previous load error (:56-57), awaits GetPointsOverviewAsync(RecentEntryCount, LifetimeToken) (:61), applies the found / not-found / failed split described above (:62-72), swallows OperationCanceledException (:74-77) and clears IsLoading in finally (:78-81). ActivityLabel (:91-101), OnAfterRenderAsync (:108-114) and FormatOccurredOn (:124-125) are the MyPoints helpers repeated verbatim: the first-render ViewerTime.EnsureResolvedAsync(LifetimeToken) re-render, and a ViewerTime.Format delegation whose recorded reason (:116-121) is that an Unspecified value is read as UTC and ToLocalTime would be the server's clock. Dispose(bool) / Dispose() (:129-149) are the same disposable pattern over _cts.
  • Why it's built this way: the two helper methods are duplicated across the two points pages rather than shared, the same trade-off the feedback pages make with their nested answer holder: each page stays self-contained and independently editable, and the duplicated code is two small pure functions with no state.
  • Where it's used: routed at /organizer/points, the value of EngagementRoutePaths.OrganizerPointsOverview (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/EngagementRoutePaths.cs:27). Its data comes from PointsController's overview endpoint (PointsController.cs:126) via GetPointsOverviewHandler. Component-tested by OrganizerPointsOverviewTests.
  • Caveats / not-in-source: the stat cards, the per-activity table and the recent-entry table live in OrganizerPointsOverview.razor, not in this code-behind.

AttendeeBadge

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.Badges · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:18 · Level 7 · class (sealed)

  • What it is: the aggregate root holding an attendee's badge credential, the opaque value encoded into their QR badge and the only thing an organizer's scan carries.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> (the base, :18), AttendeeBadgeInvariants (:42), Result, and IdValueGeneratedAttribute (:17), which tells the persistence layer the database assigns the id. Externals: System.Guid.
  • Concept introduced, the opaque bearer credential. [Rubric §11, Security] assesses how a credential is issued, verified and revoked. The design decision is written in the class comment (:7-11): the credential is server-verified on every scan, so it needs no signature and no expiry of its own, and revoking a leaked badge is a Regenerate away. The most instructive line in the file is the private helper comment (:65-67): Guid.NewGuid() is chosen over Guid.CreateVersion7() precisely because a v7 value embeds its creation timestamp and orders monotonically, which is the property a guessable bearer value must not have. That is a case where the newer API is the wrong one, and the file says so rather than leaving the next reader to "modernize" it. [Rubric §4, DDD] covers the aggregate shape: private setters, a private EF constructor, a static factory returning Result<T>, and a named mutator instead of a public property setter.
  • Walkthrough
    • Two properties: UserId (:21), one badge per user, and Credential (:24), the Guid encoded into the QR.
    • The parameterless private constructor (:27) exists for EF Core materialization; the private assigning constructor (:29-33) is what the factory uses.
    • Create(userId) (:40) validates through AttendeeBadgeInvariants (:42), returns the failure unchanged when it fails (:43-44), then builds the badge with a fresh credential and Id = default (:46-49) so the store assigns the key. It raises no domain event, and the class comment (:12-15) explains that too: a badge existing says nothing a downstream module needs to react to, because the interesting fact is the check-in, which CheckIn publishes.
    • Regenerate() (:59-63) replaces the credential in place and returns success, invalidating every previously issued copy: a printout left on a table, a screenshot shared in a chat (:54-57).
    • NewCredential() (:68) is the one place a credential is minted.
  • Why it's built this way: the badge is deliberately the thinnest possible aggregate, because everything expensive (who may scan, whether the event is running, whether this is a duplicate) belongs to the check-in write path rather than to the credential. Keeping the credential opaque and server-verified is the decision recorded in ADR-072, which also fixes the encoded form the scanner reads.
  • Where it's used: minted on first use by GetOrCreateMyBadgeHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:49) behind CheckInsController's my-badge endpoint; read back by CheckInAttendeeHandler, which first extracts the credential from the scanned payload through BadgePayload (.../CheckInAttendee/CheckInAttendeeHandler.cs:43) and then resolves it to an attendee (:50). Persisted by AttendeeBadgeConfiguration (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/AttendeeBadgeConfiguration.cs:15), which puts a unique index on both the owner and the credential (:31, :35), and exposed as a DbSet on the module context (.../Persistence/DbContexts/ModuleApplicationDbContext.cs:30). It gets no INavigationPopulator: the module's application registration registers none (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:33-82), and the entity carries only scalar properties (UserId, Credential; MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:21, :24), so it has no navigation to populate. Covered by AttendeeBadgeTests.
  • Caveats / not-in-source: Regenerate() has no production call site today. The only callers in the repository are the domain tests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Domain.Tests/Badges/AttendeeBadgeTests.cs:54, :67, :77): the revocation path exists on the model but no endpoint or handler invokes it.

UserSessionBookmark

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.UserSessionBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/UserSessionBookmarks/UserSessionBookmark.cs:16 · Level 7 · class (sealed)

  • What it is: the aggregate root of the session-bookmark feature, one row per user's saved session (a personal-schedule entry). It holds two scalar foreign keys, UserId and SessionId, and nothing else: its whole behavior is a create/reactivate/delete lifecycle expressed through a single domain event.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> (bound to UserSessionBookmarkIdentifierType), UserSessionBookmarkInvariants, the UserSessionBookmarkChanged domain event, DomainEntityState, IdValueGeneratedAttribute, and Result.
  • Concept introduced, one domain event with a state enum (BR-60). [Rubric §4, Domain-Driven Design] and [Rubric §6, CQRS and Event-Driven] assess whether aggregates own their invariants and announce state changes as events. This aggregate is the module's clearest example of the deliberate "one event, many states" choice: rather than separate BookmarkCreated and BookmarkDeleted types, every lifecycle transition raises a single UserSessionBookmarkChanged carrying a DomainEntityState discriminator (Added or Deleted), documented in the class remarks (UserSessionBookmark.cs:12-13). Downstream consumers subscribe to one signal and branch on the enum. That is the framework-wide taxonomy decision recorded in ADR-083; LeaderboardOptIn follows the same pattern.
  • Concept, the reactivation lifecycle (BR-135). Re-bookmarking a previously removed session must revive the soft-deleted row rather than insert a second one. The database half of that rule is UserSessionBookmarkConfiguration's soft-delete-filtered unique index (UserSessionBookmarkConfiguration.cs:31-33, the convention behind it taught on SoftDeleteUniqueIndexConvention and decided in ADR-095); the decision half is BookmarkManagementDomainService.
  • Walkthrough
    • [IdValueGenerated] (UserSessionBookmark.cs:15): marks the id as database-generated, so the factory leaves Id = default and SQL Server's IDENTITY fills it.
    • UserId / SessionId (:19, :22): private set scalar FKs. They are not navigations: the referenced rows live in the Identity and Conference databases (database-per-service, ADR-006), so a navigation would cross a service boundary.
    • Two constructors, an EF-only parameterless one (:25) and a private (userId, sessionId) one (:27-31). Neither is callable from outside: construction runs through the factory.
    • Create(userId, sessionId) (:40-60): combines both invariants via Result.Combine (:44-46); on failure re-wraps the errors as Result.Failure<UserSessionBookmark> (:47-48); on success builds the entity with Id = default (:50-53) and raises UserSessionBookmarkChanged(DomainEntityState.Added, ...) (:57). The comment above that call (:55-56) is the one subtle line in the file: the id is still 0 at this point because the IDENTITY value is assigned by the INSERT, and the event captures it by value, so consumers correlate on the user and the session rather than on the bookmark's own id.
    • Reactivate() (:68-76): calls the inherited Undelete() (:70) and, only if that succeeds, re-raises the same Added event (:73). The row keeps its identity and audit trail. Note the contrast with LeaderboardOptIn.Reactivate, which takes a display name and refreshes it: a bookmark carries no snapshot to refresh, so this overload takes no arguments.
    • Delete() (:83-91): overrides the base soft-delete, calls base.Delete() first (:85) and, on success, raises UserSessionBookmarkChanged(DomainEntityState.Deleted, ...) (:88).
  • Why it's built this way: reactivation over delete-then-insert preserves referential continuity and the audit trail, consistent with the soft-delete-everywhere policy (ADR-005). Funnelling create and reactivate through the same Added event means consumers see one uniform "this bookmark is now active" signal regardless of whether the row is new or revived.
  • Where it's used: created and reactivated by BookmarkManagementDomainService; counted by BookmarkCountService; mapped by UserSessionBookmarkDTOMapper; persisted per UserSessionBookmarkConfiguration; the aggregate type parameter for the CRUD surface on BookmarksController. Unit-tested by UserSessionBookmarkTests.

BookmarkManagementDomainService

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.UserSessionBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/UserSessionBookmarks/BookmarkManagementDomainService.cs:11 · Level 8 · class (static)

  • What it is: the create-or-reactivate lifecycle for session bookmarks (BR-135, BookmarkManagementDomainService.cs:5), collapsed to a static class with a single static method rather than an injectable, interface-backed service. Given a possibly null previously soft-deleted bookmark plus the acting user and session, CreateOrReactivate returns the active bookmark: either the reactivated old row or a brand-new one.
  • Depends on: UserSessionBookmark, Result, and the UserIdentifierType / SessionIdentifierType aliases (solution-wide global using, see primer §2). No EF, no repository, no CancellationToken, and, being static, no DI registration.
  • Concept, soft-delete meets a filtered unique index. [Rubric §8, Data Architecture] assesses deliberate schema semantics. UserSessionBookmarkConfiguration declares a unique index on (UserId, SessionId) filtered to the soft-delete flag (UserSessionBookmarkConfiguration.cs:31-33), so a second active row for the same pair is impossible, but a soft-deleted row still occupies that pair's history. That is exactly why you cannot blindly Create on a re-bookmark: you must flip the existing row back to active. This method is the domain half of that dance and the index is the database half, applied automatically by SoftDeleteUniqueIndexConvention (ADR-095). The same pairing appears one aggregate over on LeaderboardOptIn, where the reactivate branch lives in the handler instead.
  • Walkthrough (:76-91): CreateOrReactivate(existingDeletedBookmark?, userId, sessionId) returns Result<UserSessionBookmark> (:76). If existingDeletedBookmark is not null (:81): call existingDeletedBookmark.Reactivate() (:83), which on the aggregate calls the inherited Undelete() and re-raises UserSessionBookmarkChanged(DomainEntityState.Added, ...) (UserSessionBookmark.cs:68-76). If reactivation fails, its errors are propagated as Result.Failure<UserSessionBookmark>(reactivateResult.Errors) (:84-85); otherwise the revived entity is returned via Result.Success(...) (:87). If null: delegate to the factory UserSessionBookmark.Create(userId, sessionId) (:90), which validates invariants and raises the same Added event (UserSessionBookmark.cs:40-60).
  • Why it's built this way: reactivation (not delete-then-insert) preserves the row's identity, its audit trail (CreatedOn/By), and any scalar references that point at it, consistent with the soft-delete-everywhere policy (ADR-005). Both branches funnel through the same Added domain event so downstream consumers see one uniform "bookmark is now active" signal (BR-60, a single UserSessionBookmarkChanged carrying DomainEntityState rather than separate Created/Changed events, ADR-083). The type used to be a sealed class BookmarkManagementDomainService : IBookmarkManagementDomainService with an implicit constructor; the interface has since been removed and the class made static, since a state-free decision needs no instance and nothing else ever implemented the contract.
  • Where it's used: CreateBookmarkHandler calls the static method directly after querying for a soft-deleted match, BookmarkManagementDomainService.CreateOrReactivate(deletedBookmark, command.UserId, command.SessionId) (CreateBookmarkHandler.cs:64), and only adds the returned entity to the repository when there was no prior row to revive (CreateBookmarkHandler.cs:68-71). A concurrent insert that gets past the pre-check surfaces as a unique-index violation the handler catches via uniqueConstraintViolationDetector.IsUniqueConstraintViolation(exception) and translates back into the same UserSessionBookmark.Duplicate conflict error (CreateBookmarkHandler.cs:77-89).

CheckIn

MMCA.ADC.Engagement.Domain · MMCA.ADC.Engagement.Domain.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/CheckIns/CheckIn.cs:28 · Level 10 · class (sealed)

  • What it is: the aggregate root recording that an attendee was checked in, by an organizer scanning their QR badge, through the manual fallback, or by the attendee themselves scanning a printed sponsor or room QR. One aggregate carries all three scopes.
  • Depends on: AuditableAggregateRootEntity<TIdentifierType> and IAuditedEntity (both on :28), CheckInInvariants (:99-103), CheckInScope (:34), CheckInScopeNames (:114), AttendeeCheckedIn (:112), Result and IdValueGeneratedAttribute (:27). Externals: DateTimeOffset.
  • Concept introduced, one aggregate for a family of shapes. [Rubric §4, Domain-Driven Design] assesses aggregate boundaries. The tempting alternative is three aggregates (session check-in, sponsor visit, room check-in), and the class comment (:10-15) argues against it from the behavior: the row, the idempotency rule and the attendance query are the same shape for each, only the required target differs, and self-recorded rows stay distinguishable by CheckedInByUserId. The cost of that choice is that "which target is legal for which scope" becomes an invariant instead of a type, which is exactly what CheckInInvariants.EnsureTargetMatchesScope exists for.
  • Concept, an integration event raised from inside the aggregate. [Rubric §6, CQRS and Event-Driven] assesses where an announcement is produced. AddDomainEvent is called inside the factory (:112-119), not by a handler, and the payload is AttendeeCheckedIn, which derives from BaseIntegrationEvent rather than from a plain domain event. Because the aggregate collects it before SaveChangesAsync runs, the outbox captures the announcement in the same transaction as the row (ADR-003): the check-in and its cross-module event either both land or neither does.
  • Concept, the audit marker on an attendance assertion. [Rubric §30, Compliance, Privacy and Data Governance] covers the IAuditedEntity marker, whose reason is written out (:21-25): a check-in is an attendance assertion about a named person that feeds the points economy, so a disputed or revoked row needs a record of what it looked like before (ADR-075). This is the same marker PointsEntry carries, for the same reason on the other side of the earn path.
  • Walkthrough (teaching order)
    • Seven private-set properties: UserId (:31), Scope (:34), EventId (:37, always set), the nullable SessionId (:40) and SponsorId (:43), CheckedInByUserId (:49) and CheckedInOn (:52). The two nullable targets plus the scope are the polymorphic part; everything else is present on every row.
    • The parameterless private constructor (:55) is EF's; the assigning private constructor (:57-73) is the factory's.
    • Create (:89-122) takes the scope explicitly and the sponsor id last with a default (:96), which the doc comment (:87) justifies: the scan and manual paths can never carry one, so they stay unchanged as sponsor visits were added.
    • Validation is one Result.Combine of five invariants (:98-103), so a caller gets every violated rule at once rather than the first; a failure returns the errors unchanged (:104-105).
    • Construction sets Id = default (:107-110) so the store assigns the key, matching the [IdValueGenerated] attribute on the class.
    • AddDomainEvent(new AttendeeCheckedIn(...)) (:112-119) projects the aggregate onto the wire contract, converting the enum scope to its stable string with CheckInScopeNames.ToName (:114) and passing the nullable session and sponsor ids straight through.
    • There is no mutator: a check-in is a fact, so the aggregate is create-only.
  • Why it's built this way: the factory doc comment (:75-80) states the guarantee the whole points path leans on: because the event is added before the save, a persisted check-in has always published exactly one event, and because the handler's duplicate short-circuit never reaches this method, a repeat scan publishes none. The second scoping fact is in the class comment (:16-20): the conference runs door and arrival check-in through TicketLeap, so the Event scope is not a door process and session check-in is the working path (ADR-072).
  • Where it's used: created through CheckInProcessor on behalf of CheckInAttendeeHandler and ManualCheckInHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:72, after the duplicate short-circuit at :59-68), and directly by RecordSponsorVisitHandler (.../CheckIns/UseCases/RecordSponsorVisit/RecordSponsorVisitHandler.cs:97, scope Sponsor) and RecordRoomCheckInHandler (.../CheckIns/UseCases/RecordRoomCheckIn/RecordRoomCheckInHandler.cs:99, scope Session with the attendee as their own recorder); read by GetAttendanceStatsHandler (.../CheckIns/UseCases/GetAttendanceStats/GetAttendanceStatsHandler.cs:25-35) and exported by UserEngagementExportService (.../Exports/UserEngagementExportService.cs:51-59). Persisted by CheckInConfiguration, which turns the scope rule into three filtered unique indexes (one event check-in per attendee per event, one per session, one per sponsor: MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:49-63) plus two non-unique indexes for the attendance rollup (:64-69). Its event feeds AttendeeCheckedInPointsHandler. Covered by CheckInTests.
  • Caveats / not-in-source: the duplicate-scan short-circuit the factory comment relies on lives in the use-case handlers and in CheckInProcessor, not in this file. The once-per-sponsor cap that makes a shared deep link worth nothing beyond the first scan is stated in the EF configuration comment (CheckInConfiguration.cs:59-60).

TicketRoster

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketRoster.Invites.razor.cs:10 · Level 10 · class (partial, IDisposable)

  • What it is: the organizer's Ticket Roster page (/organizer/tickets, organizer role only, TicketRoster.razor:1-2), split across partial files. The cited part, TicketRoster.Invites.razor.cs, holds the two account actions: sending invite emails to ticket holders (UC-49) and linking tickets to accounts that already exist (UC-55). The main partial (TicketRoster.razor.cs:27) holds the shared state: the injected ITicketUIService and IAppDialogService (:41, :43), the TicketRosterSummaryDTO _summary (:61), _selectedEventId (:63) and _isBusy (:65).
  • Depends on: ITicketUIService, IAppDialogService, TicketRosterSummaryDTO, TicketInvitesResultDTO, TicketAccountLinkResultDTO, the child TicketRosterUpload (TicketRoster.razor:104). Externals: MudBlazor Severity.
  • Concept: confirm what cannot be undone, and only that. [Rubric §24, Forms, Validation and UX Safety] assesses whether irreversible actions are guarded proportionately. SendInvitesAsync asks for confirmation through Dialogs.ConfirmAsync with destructive: false (TicketRoster.Invites.razor.cs:24-29): sending email cannot be undone, but it removes nothing (:23). LinkExistingAccountsAsync asks nothing, because it sends nothing, links only by the BR-272 rules, and a re-run links nothing new (:64-68).
  • Walkthrough
    • SendInvitesAsync (:16-62): returns unless an event is selected and the summary reports pending invites (:18); after confirmation posts SendInvitesAsync(eventId, dryRun: false, ...) (:38), words the sent and tickets-covered counts, appends the remaining count when the server's per-run cap left some for the next run (:45-49), and reloads the summary without the loading state (:52).
    • LinkExistingAccountsAsync (:69-99): posts the link run (:79), words the linked, left-for-barcode and no-account counts (:86-88, BR-277), and reloads the summary (:89).
    • Both set _isBusy for the duration, which also disables the upload child.
  • Where it's used: a routed page; server side SendTicketInvitesHandler and LinkExistingAccountsHandler. Tested by TicketRosterTests and TicketRosterFailureWordingTests (test rollup).
  • Caveats / not-in-source: only the Invites partial and the main partial's fields were read for this section; the roster summary, delete and upload wiring in TicketRoster.razor.cs are not described here. The name is shared with the application-layer TicketRoster record (MMCA.ADC.Engagement.Application/Tickets/Services/TicketRoster.cs:11) that TicketLeapRosterParser produces; the inventory's usage list for this type mixes both.

TicketRosterUpload

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketRosterUpload.razor.cs:26 · Level 6 · class (partial, IDisposable)

  • What it is: the file-upload half of the organizer's Ticket Roster page: a child component that takes a TicketLeap CSV export, dry-runs it so the organizer sees what would change, then commits the same bytes as a background import run and follows that run's progress until it ends (UC-48, TicketRosterUpload.razor.cs:98, :174-178). It writes no status of its own: every outcome is handed back to the host page through a callback.
  • Depends on: ITicketUIService (injected, :48), TicketRosterLimits, TicketRosterImportErrorCodes, TicketRosterImportResultDTO, TicketRosterImportRunDTO and TicketRosterImportStatus, Result and Error, and the EventIdentifierType alias. Externals: Blazor InputFileChangeEventArgs/IBrowserFile, MudBlazor Severity, IStringLocalizer<TicketRosterUpload> (TicketRosterUpload.razor:2).
  • Concept introduced, dry run then commit over one buffered read. [Rubric §24, Forms, Validation and UX Safety] assesses whether a destructive or bulk action can be previewed and is guarded against double submission. A browser file stream cannot be read twice, so the picked file is copied into a byte[] once (:120-126) and held as _pendingContent between the dry run and the commit (:73-77); the dry run posts it through DryRunRosterAsync (:128) and the commit posts the identical bytes through StartRosterImportAsync (:189). The commit button is therefore guaranteed to apply exactly the file the organizer reviewed. IsClosed (:90) closes the picker and the commit while the host is busy, this component is busy, or a run is active.
  • Concept, a server-owned run polled from the client. [Rubric §29, Resilience and Business Continuity] assesses whether long work survives a disconnect. The commit answers a queued run at once and the server applies it in the background (:175-177), so the run's state lives on the server: OnInitializedAsync (:158-172) asks for the event's latest run and, if one is still active, resumes tracking it, so a reloaded page on any replica picks the progress back up (:154-157). TrackImportAsync (:214-243) polls every PollInterval (2 seconds by default, internal so bUnit can shrink it, :85-86). A failed poll keeps the last progress on screen and polls again rather than declaring the run failed (:230-234), and a generation counter (_trackGeneration, :83, bumped at :216, checked at :225) ends a superseded track when a resumed or retried run starts a new one.
  • Concept, refusals worded by error code. [Rubric §27, Internationalization] assesses whether user-facing text follows the selected language. FailureResourceKeys (:35-46) maps nine of the API's machine-readable codes (for example "Ticket.Roster.MissingColumn", the three row refusals "Ticket.Roster.DuplicateBarcode", "Ticket.Roster.DuplicateTicket" and "Ticket.Roster.InvalidRow", and TicketRosterImportErrorCodes.AlreadyRunning) to resource keys, so the wording comes from this component's resources rather than from the server's English message. DescribeKnownFailure (:297-315) adds a detail argument where one exists: the file cap for Error.FileRequired (:300), the server message for Error.MissingColumn (:301), and the CSV line carried in Error.Target for Error.Malformed (:305-307) and for the three row refusals (:311-313). When a line-carrying refusal arrives without a target, the wording switches to its NoLine variant (Error.MalformedNoLine, or the row key plus "NoLine") rather than to the generic refusal. An unmapped code falls back to wording by error type (DescribeByErrorType, :318-333: forbidden, not found, validation or invariant, else generic).
  • Walkthrough
    • Parameters (:50-62): EventId ([EditorRequired]), Disabled, OnStatus (an EventCallback<(string Message, Severity Severity)>) and OnImported. ReportAsync (:280) is the single exit for every message.
    • LifetimeToken (:69): reads the token through the LifetimeToken() extension on the component's CancellationTokenSource, so a handler that resumes after disposal sees a cancelled token rather than an ObjectDisposedException (:66-68).
    • OnFileSelectedAsync (:99-152): discards any previous dry run, refuses a file over TicketRosterLimits.MaxFileBytes before uploading (:110-115, worded in whole megabytes via MaxFileMegabytes, :96), buffers and dry-runs it, and maps an IOException from the browser stream to Error.FileUnreadable (:143-147).
    • CommitImportAsync (:179-207): posts the held bytes, clears _runFailure, and starts tracking the returned run (:196-197). It is also the Retry action of a failed run (:177).
    • FinishImportAsync (:246-270): on TicketRosterImportStatus.Succeeded it drops the held file, reports the added, updated, unchanged, voided and reinstated counts (:252), appends the linked-existing-accounts count when it is above zero (BR-277, :253-257), and raises OnImported so the host reloads its funnel (:260). Otherwise _runFailure is set to the abandoned or the generic failed wording (:264-266).
    • Dispose(bool) (:339-353): cancels before disposing the token source, the idiom shared by every page in this folder.
  • Why it's built this way: the import itself can take longer than a request should, so the server runs it out of band and the client only ever reads its state. Keeping the run on the server (not in this component's memory) is what makes reload-and-resume possible, and keeping the bytes in the component between preview and commit is what makes the preview honest. Checking the size client-side as well as in the API (:110) spares the organizer an upload that would be refused anyway.
  • Where it's used: hosted by TicketRoster (TicketRoster.razor:104, re-keyed through _uploadKey and disabled while the page is busy). The server side of the dry run and the commit is ImportTicketRosterHandler and StartTicketRosterImportHandler behind TicketRosterImportController. Tested by TicketRosterUploadImportRunTests, TicketRosterFailureWordingTests and TicketRosterTests in MMCA.ADC.Engagement.UI.Tests (test rollup).
  • Caveats / not-in-source: which handler serves the dry-run post versus the commit post is inferred from the handler names in the type map, not read from the controller here.

ClaimTicketRequestValidator

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ClaimTicket · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ClaimTicket/ClaimTicketRequestValidator.cs:10 · Level 7 · class (sealed)

  • What it is: the FluentValidation rules for ClaimTicketRequest, the body an attendee posts to link a ticket to their account by typing its barcode. It checks shape only; whether the barcode names a claimable ticket is ClaimTicketHandler's job.
  • Depends on: ClaimTicketRequest, TicketInvariants (for BarcodeMaxLength), and the EventIdentifierType alias. Externals: FluentValidation AbstractValidator<T>.
  • Concept: request validators in this module follow the shape taught with the other request validators in this group (for example CheckInAttendeeRequestValidator); each rule carries its own WithErrorCode, so the UI can word a refusal by code. [Rubric §24, Forms, Validation and UX Safety]: the barcode limit is read from the domain constant (ClaimTicketRequestValidator.cs:23-24) rather than restated, so the request rule and the aggregate rule cannot drift apart.
  • Walkthrough (constructor, :12-26)
    • EventId (:14-17): NotEqual(default(EventIdentifierType)), code "Ticket.Claim.EventIdRequired".
    • Barcode (:19-25): NotEmpty with code "Ticket.Claim.BarcodeRequired" and the attendee-facing message "Enter the barcode printed on your ticket.", then MaximumLength(TicketInvariants.BarcodeMaxLength) with code "Ticket.Claim.BarcodeTooLong".
  • Where it's used: runs ahead of ClaimTicketHandler for POST tickets/claim on TicketsController (TicketsController.cs:133). Unit-tested in TicketValidatorTests (test rollup).

NewestRosterTicketSpecification

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.Specifications · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Specifications/NewestRosterTicketSpecification.cs:12 · Level 7 · class (sealed)

  • What it is: a one-row query over an event's roster that returns the most recently created ticket, or the most recently changed one, depending on a constructor flag.
  • Depends on: QuerySpecification<TEntity, TIdentifierType> bound to Ticket and TicketIdentifierType, and the EventIdentifierType alias. Externals: System.Linq.Expressions.
  • Concept: the specification pattern is taught in Group 03. This one shows the "top 1 by ordering" shape: an ordering plus ApplyPaging(0, 1) (NewestRosterTicketSpecification.cs:31) instead of a Max aggregate, so the caller can project the single row to whichever timestamp it wants.
  • Walkthrough
    • _eventId (:14), captured by the constructor and read by Criteria (:35): ticket.EventId == _eventId.
    • Constructor (eventId, byLastChange) (:19-32): byLastChange orders descending by LastModifiedOn ?? CreatedOn (:24), otherwise descending by CreatedOn (:28); either way the page is one row (:31).
  • Where it's used: twice in GetRosterInsightsHandler (GetRosterInsightsHandler.cs:326-333), once per flag, each projected to a nullable DateTime, to fill the roster-health "last added" and "last changed" timestamps on RosterHealthDTO that TicketInsights renders.

Columns

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Tickets.TicketLeap · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Tickets/TicketLeap/TicketLeapRosterParser.cs:152 · Level 7 · class (private sealed, nested in TicketLeapRosterParser)

  • What it is: the resolved column index of every header TicketLeapRosterParser reads, computed once per file so each row is read by index rather than by header lookup (TicketLeapRosterParser.cs:151).
  • Depends on: CsvTable (FindColumn), Result and Error, and the parser's header constants.
  • Concept: a header whitelist split into required and optional columns. [Rubric §15, Best Practices and Code Quality]: the three columns the import cannot work without are required int (:149-153): the ticket ID (the upsert key), the barcode (the claim key) and the event name (the void scope), as the comment states (:169-170). The other seven are int? (:155-167), so a missing optional column reads as blank rather than failing the file.
  • Walkthrough: Resolve(table) (:171-205) looks up the three required headers (:173-175), collects every one that is missing (:177-182), and fails with one Error.Validation naming all of them under code "Ticket.Roster.MissingColumn" (:184-190), so an organizer who uploads the wrong export learns every missing header at once. On success it builds the instance with the required indexes plus a FindColumn for each optional header (:192-204).
  • Where it's used: only by TicketLeapRosterParser.Parse (:75) and ReadEntry (:118-138). The "Ticket.Roster.MissingColumn" code is the one TicketRosterUpload words with the server's message as a detail argument (TicketRosterUpload.razor.cs:39, :298).
  • Caveats / not-in-source: the name Columns is not unique in the workspace; the usage sites the inventory lists for it (list-page grids in MMCA.Common and Conference) belong to other members named Columns, not to this nested class.

TicketLeapRosterParser

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Tickets.TicketLeap · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Tickets/TicketLeap/TicketLeapRosterParser.cs:28 · Level 7 · class (internal sealed)

  • What it is: the TicketLeap implementation of ITicketRosterParser: it turns the bytes of a TicketLeap attendee-export CSV into the application-layer TicketRoster record (MMCA.ADC.Engagement.Application/Tickets/Services/TicketRoster.cs:11: one source event name plus a list of TicketRosterEntry), or into the first reason the file cannot be imported.
  • Depends on: ITicketRosterParser, CsvReader, CsvTable and CsvRow from MMCA.Common, TicketInvariants, Ticket (NormalizeEmail), TicketRosterEntry, the nested Columns, and Result and Error. Externals: System.Globalization.CultureInfo.
  • Concept introduced, the vendor format behind an application port. [Rubric §3, Clean Architecture] assesses whether the application layer depends on abstractions rather than on a vendor's details. The application side knows only ITicketRosterParser and the neutral roster record; every TicketLeap header name (TicketLeapRosterParser.cs:31-58) and every TicketLeap quirk (buyer-name and buyer-email fallbacks) lives here, in Infrastructure, behind internal. Supporting a second ticketing vendor would be a second parser registration, not a change to the import handlers.
  • Concept, refuse the whole file at the first bad row. [Rubric §8, Data Architecture]: an import that applies part of a file is hard to reason about, so Parse (:73-118) returns a failure for the first invalid, duplicated or inconsistent row instead of skipping it, and each row failure names the CSV line twice (RowFailure, :144-149): in the message, "Line {n}: ...", and as the error's Target, so the upload panel can word the refusal in the reader's language with the line in it instead of parsing the English message (:142-143, see TicketRosterUpload).
  • Walkthrough
    • Header constants (:31-58): ten internal const string names, from "Ticket ID" and "Barcode" to "(Order) Email Address" and its fallback "Buyer Email".
    • ParseAsync(content, cancellationToken) (:61-71): wraps the bytes in a read-only MemoryStream, reads the table through CsvReader.ReadTableAsync (:66), and either parses it or passes the CSV reader's own errors through (:67-69).
    • Parse(table) (:73-118): resolves Columns (:75-77), then per row records the event name, builds the entry, and checks TicketInvariants.EnsureEntryIsValid (:91-93, code "Ticket.Roster.InvalidRow"), a duplicate ticket ID (:95-96, code "Ticket.Roster.DuplicateTicket") and a duplicate barcode (:98-99, code "Ticket.Roster.DuplicateBarcode"). Event names collect in an ordinal HashSet (:79); ticket IDs and barcodes collect in StringComparer.OrdinalIgnoreCase sets (:82-83), so two rows differing only in letter case count as a duplicate. After the loop the file must carry exactly one non-blank event name (:104-111, code "Ticket.Roster.EventName", the message counting the names found), and that name must pass TicketInvariants.EnsureSourceEventNameIsValid (:114).
    • ReadEntry(row, map) (:120-140): trims every cell; uses the buyer's name only when both attendee name cells are blank (:122-124); prefers the order-form email and falls back to the buyer email (:126-127); stores a well-formed address lowercased via Ticket.NormalizeEmail and passes a malformed one through unchanged so the invariant refuses the row by line rather than silently dropping the address (:129-131).
  • Why it's built this way: the event name is the void scope of an import (the comment at :174-175), so a file mixing two events, or rows without one, is refused rather than guessed at. Duplicate ticket IDs and barcodes are caught here, before anything is written, because the ticket ID is the upsert key and the barcode is the claim key. The duplicate check is case-insensitive to match the (EventId, ExternalTicketId) and (EventId, Barcode) unique indexes, which the source comment (:80-81) says sit on a case-insensitive collation: a file that passed an ordinal check with a case-only duplicate would still collide in the database.
  • Where it's used: registered as the singleton ITicketRosterParser (MMCA.ADC.Engagement.Infrastructure/DependencyInjection.cs:31, TryAddSingleton); consumed by the roster import path (ImportTicketRosterHandler and TicketRosterStaging). Unit-tested by TicketLeapRosterParserTests (test rollup).
  • Caveats / not-in-source: the record it returns is also named TicketRoster; this group's ticketroster anchor belongs to the Blazor page TicketRoster, so the record is cited by path, not linked. Which import classes call ParseAsync is taken from the inventory's usage list, not re-read here.

UserDeletedBadgeHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.CheckIns.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandler.cs:22 · Level 8 · class (public sealed partial)

  • What it is: the erasure handler for attendee badges. When Identity deletes an account, this soft-deletes that user's AttendeeBadge rows in the Engagement database. The check-in records themselves are kept; only the badge, which carries a per-user credential, goes (class doc, :10-13).
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserDeleted integration event (:25, imported from MMCA.ADC.Identity.Shared.Users.IntegrationEvents at :4), IUnitOfWork (:34), the IRepository<TEntity, TIdentifierType> it obtains for AttendeeBadge (:35) and that aggregate's Delete() (:46). Externals: IServiceScopeFactory, ILogger<T> and the source-generated [LoggerMessage] (:61-62, which is why the class is partial).
  • Concept, cross-database erasure by event. [Rubric §30, Compliance, Privacy & Data Governance]. Under database-per-service (ADR-006) the Identity-side erasure cannot reach a row in the Engagement database, so the deletion travels as an event and the owning service carries it out (:11-13). It is one of several UserDeleted handlers in this module; the Engagement host registers a single consumer for the type, and that consumer runs every handler for it (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:200-203, MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29). The retained check-in history follows the commitment the class doc cites (PRIVACY.md section 1.2), which lives in ADC's private docs rather than this repo.
  • Walkthrough
    • HandleScopedAsync(integrationEvent, services, cancellationToken) (:28-59) is the override; the base has opened the per-delivery scope and passes its provider. The body takes the user id (:33), resolves the scoped unit of work (:34) and the badge repository (:35).
    • The read (:37-41) filters badge.UserId == userId && !badge.IsDeleted and asks for tracked entities (asTracking: true, :40) because mutations follow. It does not bypass the soft-delete query filter: only active badges are candidates.
    • The loop (:43-50) calls badge.Delete() per row and counts only the successes (:46-49); a failed Delete() result is skipped without a log.
    • When nothing was deleted the method returns without saving (:52-55); otherwise it saves once for the batch (:57) and logs the count at Information through LogErased (:58, :61-62).
  • Why it's built this way: idempotence is a requirement, because at-least-once delivery makes redelivery normal (:15-16). Reading active rows only means a second delivery finds nothing and writes nothing. Exceptions are deliberately not caught (:16-17), so a failed erasure propagates to the base and the broker retries it rather than acking it away. [Rubric §29, Resilience & Business Continuity].
  • Where it's used: registered by the Application convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) and driven by the UserDeleted consumer registered at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29 (passed to AddBrokerMessaging at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:231). Sibling erasure handlers: UserDeletedBookmarksHandler and UserDeletedPointsHandler. Covered by UserDeletedBadgeHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/CheckIns/IntegrationEventHandlers/UserDeletedBadgeHandlerTests.cs).
  • Caveats / not-in-source: the deletion is a soft delete through the aggregate's Delete(), so the row stays in the table flagged deleted; whether anything later purges it is not determinable from this file.

UserDeletedBookmarksHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/IntegrationEventHandlers/UserDeletedBookmarksHandler.cs:22 · Level 8 · class (public sealed partial)

  • What it is: the erasure handler for session bookmarks. When Identity deletes an account, this soft-deletes that user's active UserSessionBookmark rows, the promise the class doc quotes from PRIVACY.md section 5 ("Session bookmarks: deleted along with your account", :10-12).
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserDeleted integration event (:25), IUnitOfWork (:34), the IRepository<TEntity, TIdentifierType> it obtains for UserSessionBookmark (:35) and that aggregate's Delete() (:46). Externals: IServiceScopeFactory, ILogger<T> and the source-generated [LoggerMessage] (:61-62).
  • Concept, cross-database erasure by event. [Rubric §30, Compliance, Privacy & Data Governance]. The same shape as UserDeletedBadgeHandler, line for line: the bookmarks live in the Engagement database, which the Identity-side erasure cannot reach (:12-13), so the owning service performs the delete on receipt of UserDeleted. It runs under the module's single UserDeleted consumer alongside the other erasure handlers (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:200-203, MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29).
  • Walkthrough
    • HandleScopedAsync(integrationEvent, services, cancellationToken) (:28-59): takes the user id (:33), resolves the unit of work and the bookmark repository (:34-35), then reads the user's active bookmarks tracked (:37-41, filter bookmark.UserId == userId && !bookmark.IsDeleted at :39).
    • Each bookmark is passed to Delete() and only successes are counted (:43-50). Zero deletions returns without a save (:52-55); otherwise one SaveChangesAsync for the batch (:57) and an Information log of the count (:58, :61-62).
  • Why it's built this way: active-rows-only reads make a redelivered event a no-op, and uncaught exceptions let the broker retry a failed erasure (:15-17). [Rubric §29, Resilience & Business Continuity]. Soft delete is also how an ordinary un-bookmark ends, so an erased bookmark is indistinguishable in shape from one the attendee removed.
  • Where it's used: registered by the Application convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) and driven by the consumer registered at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29. Covered by UserDeletedBookmarksHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/UserSessionBookmarks/IntegrationEventHandlers/UserDeletedBookmarksHandlerTests.cs).
  • Caveats / not-in-source: the PRIVACY.md wording the class doc quotes lives in ADC's private docs; this file is the only in-repo evidence of it.

UserSessionBookmarkDTOMapper

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.UserSessionBookmarks.DTOs · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/UserSessionBookmarks/DTOs/UserSessionBookmarkDTOMapper.cs:12 · Level 8 · class (sealed partial)

  • What it is: the Mapperly-generated mapper that projects a UserSessionBookmark aggregate to its wire-facing UserSessionBookmarkDTO.
  • Depends on: IEntityDTOMapper<TEntity, TEntityDTO, TIdentifierType> (closed over the bookmark triple, UserSessionBookmarkDTOMapper.cs:13), UserSessionBookmark, UserSessionBookmarkDTO. Externals: Riok.Mapperly.Abstractions (the [Mapper] source generator).
  • Concept, compile-time DTO mapping with Mapperly (ADR-001). [Rubric §2, Design Patterns] and [Rubric §15, Best Practices and Code Quality] assess mapping that is explicit and allocation-cheap rather than reflection based. The [Mapper] attribute (:11) makes Mapperly generate the body of the partial method at compile time, so there is no runtime reflection and a shape mismatch is a build error rather than a silent null (the framework-wide manual-mapping versus Mapperly rationale is taught in Group 12).
  • Walkthrough (:12-24): the class implements the shared IEntityDTOMapper contract. MapToDTO(entity) (:16) is declared partial and Mapperly writes the property-by-property copy. MapToDTOs(collection) (:19-23) is hand-written: it guards null with ArgumentNullException.ThrowIfNull and returns [.. entityCollection.Select(MapToDTO)], a collection-expression materialization.
  • Why it's built this way: a source-generated single-item map plus a tiny hand-written collection wrapper keeps the hot path reflection-free while still satisfying the batch signature the query pipeline expects. sealed partial is mandatory: partial lets the generator supply the method body, sealed keeps the type closed.
  • Where it's used: auto-registered by the module's convention scan and injected directly by CreateBookmarkHandler (CreateBookmarkHandler.cs:22, used at :90) and GetUserBookmarksHandler (GetUserBookmarksHandler.cs:21, used at :72); also resolved by the generic EntityQueryService<TEntity, TEntityDTO, TIdentifierType> registered for bookmarks (DependencyInjection.cs:35) behind BookmarksController. Unit-tested by UserSessionBookmarkDTOMapperTests.

ErasedUserGuard

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.ErasedUsers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/ErasedUsers/ErasedUserGuard.cs:15 · Level 8 · class (internal static)

  • What it is: the one-call refusal of a write from an account that has been erased. Every Engagement write handler that a still-valid token could reach calls EnsureNotErasedAsync first and gets back a Result: success for a live account, an Error.Forbidden for an erased one. A second member, GetErasedUserIdsAsync, is the batch form for a write that acts for many accounts at once.
  • Depends on: IUnitOfWork (parameter, :26-30, :54-57), the ErasedUser tombstone read through the unit of work's read repository (:32, :62, the batch read typed as IEntityQuerier<TEntity, TIdentifierType>), Result and Error. The user key is the module's UserIdentifierType alias.
  • Concept, erasure is checked at write time, not by token revocation. [Rubric §30, Compliance, Privacy & Data Governance]. Erasure (see ADR-005) removes the user's rows, but a deleted account's token can stay valid for a while. Without a gate, a late request could re-create rows for an account that no longer exists. The guard asks the tombstone table whether the user was erased and refuses the write if so.
  • Walkthrough
    • AccountErasedCode (:18): the constant "Engagement.AccountErased", the error code callers and tests can match on.
    • EnsureNotErasedAsync(unitOfWork, userId, source, cancellationToken) (:26-43): obtains the read-side repository for ErasedUser (:32, typed as IEntityReader, so no tracking and no write surface), runs ExistsAsync(erased => erased.UserId == userId) (:33-35), then returns Error.Forbidden with AccountErasedCode, the message "This account has been deleted." and the caller-supplied source for attribution (:37-41), or Result.Success() (:42).
    • GetErasedUserIdsAsync(unitOfWork, userIds, cancellationToken) (:54-69): the batch form (doc :45-53, which names its use: linking an event's roster to existing accounts, BR-277). An empty input returns an empty set without touching the database (:59-60); otherwise one GetProjectedAsync projects UserId from the tombstones whose id is in userIds (:62-66) and returns the erased subset as an IReadOnlySet<UserIdentifierType> (:68). It returns data rather than a Result because the caller decides per account what to skip, rather than refusing the whole write.
  • Why it's built this way: a static helper rather than a decorator or a service, because the check needs the handler's own unit of work (one scope, one connection) and the source string so the error names the handler that refused. Forbidden rather than NotFound tells the client the request was understood and denied. The sibling handler SetLeaderboardParticipationHandler applies the same message and Forbidden type to its own erased-opt-in case under code Points.AccountErased.
  • Where it's used: EnsureNotErasedAsync is called from CreateBookmarkHandler (CreateBookmarkHandler.cs:32), GetOrCreateMyBadgeHandler (GetOrCreateMyBadgeHandler.cs:40), ManualCheckInHandler (ManualCheckInHandler.cs:44), RecordRoomCheckInHandler (RecordRoomCheckInHandler.cs:71), RecordSponsorVisitHandler (RecordSponsorVisitHandler.cs:60), PointsAwarder (PointsAwarder.cs:65), SetLeaderboardParticipationHandler (SetLeaderboardParticipationHandler.cs:71), TicketLinker (TicketLinker.cs:56), ClaimTicketHandler (ClaimTicketHandler.cs:58), plus the CastVoteHandler (:36), SubmitQuestionHandler (:66) and ToggleUpvoteHandler (:33) use cases. GetErasedUserIdsAsync has one caller, ExistingAccountLinker (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/ExistingAccountLinker.cs:75). All sites are under MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/.
  • Caveats / not-in-source: the guard is internal, so it is unreachable from the API or UI projects, and each handler must remember to call it; no fitness test enforcing that is visible in this unit's source.

UserDeletedTicketHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/IntegrationEventHandlers/UserDeletedTicketHandler.cs:28 · Level 8 · class (public sealed partial)

  • What it is: the erasure handler for roster tickets. When Identity deletes an account, every Ticket linked to that account has its holder fields anonymized and its link cleared (class doc, :10-15, BR-274), the same anonymize-then-unlink shape as the speaker erasure.
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserDeleted integration event (:31, imported at :4), IUnitOfWork (:40), the IRepository<TEntity, TIdentifierType> it obtains for Ticket (:41), and that aggregate's Anonymize() and Unlink() (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/Ticket.cs:337, :314). Externals: IServiceScopeFactory, ILogger<T> and the source-generated [LoggerMessage] (:67-68, which is why the class is partial).
  • Concept, erasure that must reach soft-deleted rows too. [Rubric §30, Compliance, Privacy & Data Governance]. Under database-per-service (ADR-006) the ticket rows live in the Engagement database, so the owning service performs the erasure on receipt of the event, as the sibling UserDeletedBadgeHandler does. Unlike that sibling, this read bypasses the soft-delete filter (ignoreQueryFilters: true, :47): deleting a roster after the event only soft-deletes its tickets, and a deleted row must not keep naming the erased person either (:13-15). Anonymization follows ADR-005 (:12).
  • Walkthrough
    • HandleScopedAsync(integrationEvent, services, cancellationToken) (:34-65): takes the user id (:39), resolves the unit of work and the ticket repository (:40-41), then reads every ticket with LinkedUserId == userId, tracked and with query filters ignored (:43-48).
    • The loop (:51-58) calls ticket.Anonymize() first, then ticket.Unlink(), counting a ticket only when Unlink reports it changed something (:55-57). The comment (:53-54) explains the order: the holder fields must not survive a ticket this erasure touched, and Anonymize only assigns placeholders, so its Result is not inspected.
    • Zero unlinks returns without a save (:60-61); otherwise one SaveChangesAsync covers both changes for the batch (:63) and LogErased records the count at Information (:64, :67-68).
  • Why it's built this way: both changes land in one pass and one save because the link is the only way to find the tickets: an unlink committed without the anonymization would hide them from every later delivery (:17-18). Reading linked rows only makes a redelivered event find nothing and write nothing, and exceptions propagate so a failed erasure is retried rather than acked away (:21-23). [Rubric §29, Resilience & Business Continuity].
  • Where it's used: registered by the Application convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) and driven by the single UserDeleted consumer that EngagementBrokerConsumers registers (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:29), which runs every erasure handler for the type (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:200-203). Covered by UserDeletedTicketHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/IntegrationEventHandlers/UserDeletedTicketHandlerTests.cs) and exercised from ProcessTicketRosterImportHandlerTests.
  • Caveats / not-in-source: a ticket whose Unlink reports no change is anonymized in memory but not counted, and if no ticket in the batch unlinks, nothing is saved, so that anonymization is dropped. Whether that combination (a linked ticket that Unlink declines) can occur is not determinable from this file.

ClaimTicketHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.UseCases.ClaimTicket · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/UseCases/ClaimTicket/ClaimTicketHandler.cs:34 · Level 9 · class (sealed partial, primary constructor)

  • What it is: the command handler that links an imported Ticket to the calling attendee when they type the barcode printed on it, answering the linked ticket as a MyTicketDTO.
  • Depends on: ICommandHandler<in TCommand, TResult> over ClaimTicketRequest, IUnitOfWork, ICurrentUserService, ICounterStore, TicketSettings through IOptions<T>, ErasedUserGuard, MyTicketProjection, TicketLinkMethod, Result and Error. Externals: TimeProvider, ILogger<T> with [LoggerMessage] source generation.
  • Concept introduced, one answer for every unclaimable barcode. [Rubric §11, Security] assesses whether an endpoint leaks what it guards. A barcode is a bearer secret, so the handler gives the same 404 (NotClaimableCode = "Ticket.NotFound", ClaimTicketHandler.cs:43, built by NotClaimable() at :110-114) for an unknown barcode (:85-86) and for a ticket that exists but is linked to someone else or is no longer live: LinkTo's Conflict errors are rewritten to the same not-found answer (:94-99), because telling them apart would confirm the barcode exists (:91-92).
  • Concept, a per-user attempt budget counted before the lookup. [Rubric §11, Security] again: guessing barcodes is bounded by a counter keyed per user (tickets:claim-attempts:{userId}, :107-108) and incremented through ICounterStore.IncrementAsync (:63-66). The window is fixed, not sliding: the increment that creates the counter sets its lifetime and later increments leave it alone (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/ICounterStore.cs:26-27), so retrying never extends it (:61). The store is shared across replicas when Redis is registered and falls back to counting in-process on a Redis fault (ICounterStore.cs:16-20). The defaults are 10 attempts per 60 minutes (TicketSettings.cs:24, :27). Every attempt counts, successful or not, so the budget cannot itself be read as a signal (:60-61). Over budget the handler logs a warning and answers Error.TooManyRequests with code "Ticket.ClaimAttemptsExceeded" (:67-75).
  • Walkthrough (HandleAsync, :44-105)
    • Caller from the token: RequireUserId("Ticket.Forbidden") (:50), then ErasedUserGuard.EnsureNotErasedAsync (:56) so an erased account cannot claim (ADR-005).
    • Budget check (:62-75), then a tracked lookup by (EventId, trimmed Barcode) through the write repository (:77-83).
    • Already linked to the caller: answer the ticket again without writing (:88-89), so a repeated claim is idempotent.
    • Otherwise ticket.LinkTo(userId, TicketLinkMethod.Barcode, timeProvider.GetUtcNow()) (:93); non-conflict errors pass through unchanged (:98); on success save, log at information level (:101-102) and project with MyTicketProjection.ToDTO (:104).
  • Why it's built this way: the claim is the fallback path for a ticket the organizer's import could not link by email, so it is reachable by any signed-in attendee and must resist enumeration without a separate lockout table; a fixed-window counter plus a uniform not-found answer is the smallest mechanism that does both.
  • Where it's used: injected into TicketsController (TicketsController.cs:46) behind POST tickets/claim (:129-146, marked [Idempotent], see IdempotentAttribute); called from the UI by MyTicketsPanel. Request shape checked first by ClaimTicketRequestValidator. Unit-tested by ClaimTicketHandlerTests (test rollup).
  • Caveats / not-in-source: that the claim is the fallback for tickets not linked by email is drawn from the sibling types' names and comments (ExistingAccountLinker, the "left for barcode" count on TicketRoster), not from this file.

MyTicketsPanel

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/MyTicketsPanel.razor.cs:17 · Level 10 · class (partial, IDisposable)

  • What it is: the attendee's "my tickets" panel: it lists the tickets linked to the signed-in account and offers a barcode box to claim one more for the current event (UC-50, MyTicketsPanel.razor.cs:99).
  • Depends on: ITicketUIService and ILiveEventUIService (injected, :19-20), MyTicketDTO, Result, and the EventIdentifierType alias. Externals: MudBlazor Severity, IStringLocalizer<MyTicketsPanel> (MyTicketsPanel.razor:3).
  • Concept: feature-flag-aware loading. [Rubric §19, State Management] assesses whether a component distinguishes "empty", "off" and "failed". A 404 from the tickets read means the Engagement.Tickets flag is off and the whole ticket surface answers not found (ADR-031), so the panel sets _featureOff and stops (:52-56) instead of showing an error; any other failure sets _loadError (:58-61). The claim entry is offered only when a current event resolves, and a failed event read shows its own error with Retry rather than silently withdrawing the claim (LoadClaimEventAsync, :75-97).
  • Walkthrough
    • OnInitializedAsync (:43-73): loads the caller's tickets, then the claim event; _loaded is set in finally (:71).
    • ClaimAsync (:100-133): ignores the click with no event or a blank barcode (:102), posts the trimmed barcode (:111), and on success replaces the ticket by id rather than appending, because a repeated claim of one's own ticket answers the same ticket again (:114-116), then clears the box and words the success with the ticket type (:119).
    • DescribeClaimFailure (:139-164): words a refusal by error type: not found (named with the event), too many requests, conflict, forbidden (BR-273), validation, else generic. The not-found wording deliberately covers both an unknown barcode and an unclaimable ticket, mirroring ClaimTicketHandler's single answer (:135-138).
    • HolderName (:172-173) joins the non-blank attendee name parts; Dispose(bool) (:177-191) cancels before disposing the token source.
  • Where it's used: rendered by the MyBadge page (MyBadge.razor:55, route /my-badge). Server side: GET tickets/mine (GetMyTicketsHandler) and POST tickets/claim (ClaimTicketHandler) on TicketsController.

TicketInsights

MMCA.ADC.Engagement.UI · MMCA.ADC.Engagement.UI.Pages.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Tickets/TicketInsights.razor.cs:30 · Level 10 · class (partial, IDisposable)

  • What it is: the organizer's ticket-insights page (/organizer/tickets/insights, organizer role only, TicketInsights.razor:1-2): two independently loaded report groups for one event, the roster-only reports A1 to A6 and the roster-plus-activity reports B1 to B4 (TicketInsights.razor.cs:161, :181).
  • Depends on: ITicketUIService, ILiveEventUIService and ViewerTimeZone (injected, :32-34), InsightLoadState<T>, RosterInsightsDTO, EngagementInsightsDTO, LiveEventContext, EngagementRoutePaths, and Result. Externals: MudBlazor BreadcrumbItem, CultureInfo.
  • Concept introduced, per-group load state with a generation guard. [Rubric §19, State Management] assesses whether concurrent loads can overwrite each other. Each group owns an InsightLoadState<T> (:54-55); LoadReportsAsync starts both with Task.WhenAll so each renders the moment its own answer arrives (:151-153). Begin() returns a generation (:164, :184) and a result is applied only if it is still current (:168, :188), so switching events quickly never lets a slow answer for the previous event land on screen. Each group has its own Retry (:155-159).
  • Concept, unavailable versus failed. Apply<T> (:206-225) separates three outcomes: success, unavailable with a reason (a 404 means the Engagement.Tickets flag is off, ADR-031; a 403 means the permission was revoked), and a retryable failure. [Rubric §24, Forms, Validation and UX Safety]: a reason the organizer cannot fix is not offered a Retry.
  • Walkthrough
    • EventId (:36-38): an optional [SupplyParameterFromQuery(Name = "eventId")], so the Ticket Roster page can deep-link to an event.
    • LoadEventsAsync (:73-122): a failed current-event read shows an error with Retry (:81-85); the published list feeds the picker and degrades to the current event alone when it is empty or unreadable (:90-100); the requested event wins over the current one (:102-109).
    • OnAfterRenderAsync (:129-135): resolves the viewer's time zone once JS is available and re-renders, so roster-health timestamps move from the UTC fallback to local time.
    • OnEventSelectedAsync (:138-149) switches event and reloads both groups. Formatting helpers IsEmptyRoster, Median, N and Percent (:228-236) use the current culture.
  • Where it's used: linked from the Ticket Roster page (TicketRoster); its data comes from GetRosterInsightsHandler and GetEngagementInsightsHandler. Tested by TicketInsightsTests (test rollup).

UserEmailVerifiedTicketLinkHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/IntegrationEventHandlers/UserEmailVerifiedTicketLinkHandler.cs:22 · Level 10 · class (public sealed partial)

  • What it is: the handler that links an account's roster tickets once the account proves control of its email address (BR-272): a confirmed email, an attached external login with a verified address, or a redeemed sign-in link (class doc, :10-12). It is a thin adapter from Identity's event to the shared linking rules in TicketLinker.
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserEmailVerified integration event (:25, imported at :4), TicketLinker.LinkVerifiedEmailAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketLinker.cs:43), and the scoped IUnitOfWork and TimeProvider it passes in (:34-35). Externals: IServiceScopeFactory, ILogger<T> and the source-generated [LoggerMessage] (:48-49, which is why the class is partial).
  • Concept, cross-module linking by event, with the rules in one place. [Rubric §6, CQRS & Event-Driven], [Rubric §7, Microservices Readiness]. Identity owns the account and Engagement owns the roster, so the link is made by the Engagement side on receipt of an event rather than by a call across the module boundary. Both link handlers delegate to the same TicketLinker method, so the matching rules live once and are idempotent: a repeated proof links nothing more (:17).
  • Walkthrough
    • HandleScopedAsync(integrationEvent, services, cancellationToken) (:28-46): calls TicketLinker.LinkVerifiedEmailAsync with the scoped unit of work, TimeProvider, the event's UserId and Email, and firstName: null, lastName: null (:33-40), because this event carries no account name. A positive count is logged at Information through LogLinked (:42-45, :48-49).
  • Why it's built this way: without a name, the BR-272 name match cannot run, so the address's ticket is linked only when it holds exactly one for the event; a multi-ticket order waits for a barcode claim (BR-273) unless UserRegisteredTicketLinkHandler already matched it by name (:14-17). Exceptions are not caught, so the base and the broker retry a failed link.
  • Where it's used: registered by the Application convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) and driven by the UserEmailVerified consumer that EngagementBrokerConsumers registers (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:31; mapping comment at MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:206). Covered by TicketLinkHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/IntegrationEventHandlers/TicketLinkHandlerTests.cs).
  • Caveats / not-in-source: the matching rules themselves (one ticket per address per event, the erased-account refusal) are in TicketLinker, not here; this file only shows that a zero count is silent.

UserRegisteredTicketLinkHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Tickets.IntegrationEventHandlers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/IntegrationEventHandlers/UserRegisteredTicketLinkHandler.cs:25 · Level 10 · class (public sealed partial)

  • What it is: the handler that links a new account's roster tickets when its address is already proven at registration (BR-272): an account an invite created, or one created from an external login whose provider vouched for the address (class doc, :10-12). The sibling of UserEmailVerifiedTicketLinkHandler, and the one that can match by name.
  • Depends on: ScopedIntegrationEventHandlerBase<TIntegrationEvent> closed over Identity's UserRegistered integration event (:28, imported at :4), TicketLinker.LinkVerifiedEmailAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Tickets/Services/TicketLinker.cs:43), and the scoped IUnitOfWork and TimeProvider it passes in (:40-41). Externals: IServiceScopeFactory, ILogger<T> and the source-generated [LoggerMessage] (:54-55).
  • Concept, a typed address proves nothing. [Rubric §11, Security]. The event's EmailVerified flag is the gate (:36-37), exactly as for the Conference speaker auto-link (BR-207): an address typed into a registration form proves nothing, so a local password registration links nothing here until UserEmailVerified arrives and the sibling handler runs (:13-15). Linking on an unproven address would hand someone else's ticket to whoever typed it.
  • Walkthrough
    • HandleScopedAsync(integrationEvent, services, cancellationToken) (:31-52): returns at once when EmailVerified is false (:36-37); otherwise calls TicketLinker.LinkVerifiedEmailAsync with the scoped unit of work, TimeProvider, the event's UserId, Email, FirstName and LastName (:39-46), and logs a positive count at Information (:48-51, :54-55).
  • Why it's built this way: this is the one event that carries the account name, so it is where a multi-ticket order is matched by name (:17-18). An invite-created account raises both events; the shared rules are idempotent, so the second delivery links nothing more (:18-20).
  • Where it's used: registered by the Application convention scan (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:92) and driven by the UserRegistered consumer that EngagementBrokerConsumers registers (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/EngagementBrokerConsumers.cs:30); Conference consumes the same event on its own queue (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Program.cs:204-205). Covered by TicketLinkHandlerTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Application.Tests/Tickets/IntegrationEventHandlers/TicketLinkHandlerTests.cs).
  • Caveats / not-in-source: how the name match resolves ties within an order is TicketLinker's concern and is not visible in this file.

LiveCallerRights

MMCA.ADC.Engagement.API · MMCA.ADC.Engagement.API.Authorization · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Authorization/LiveCallerRights.cs:21 · Level 9 · class (internal static)

  • What it is: a two-member helper that answers the two caller questions every live-layer endpoint needs before it builds a command or query: "which speaker is calling, if any" and "may this caller manage the whole live layer". Both answers come from the token, never from the request body (BR-236, class doc LiveCallerRights.cs:10-12).
  • Depends on: ICurrentUserService (its GetClaimValue<T> member, MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Auth/ICurrentUserService.cs:70), ClaimNames (SpeakerId = "speaker_id", MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Shared/Authorization/ClaimNames.cs:25), EngagementPermissions (LiveManage = "engagement:live:manage", MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Authorization/EngagementPermissions.cs:17) and PermissionPolicy (NameFor, MMCA.Common/Source/Presentation/MMCA.Common.API/Authorization/PermissionPolicy.cs:17). Externals: ASP.NET Core's IAuthorizationService and System.Security.Claims.ClaimsPrincipal.
  • Concept, a capability check instead of a role check. [Rubric §11, Security] assesses whether authorization decisions rest on server-held identity and on explicit capabilities rather than on hard-coded roles or client-supplied values. CanManageLiveAsync (:41-48) does not ask "is this an Organizer"; it evaluates the policy named PermissionPolicy.NameFor(EngagementPermissions.LiveManage) (:45), which is the perm: prefix (PermissionPolicy.cs:12) plus the permission string, the same policy a HasPermissionAttribute endpoint resolves. The class doc (:13-18) states the consequence: role grants, stored grants and permission claims are all honored, so any role granted engagement:live:manage manages polls and moderates questions exactly like an Organizer, who holds it by default (ADR-020). The difference from [HasPermission] is that the answer is a bool handed to the handler, not a gate on the endpoint: a speaker without the capability may still act on their own session, so the endpoint stays open and the handler decides.
  • Walkthrough
    • SpeakerId(currentUserService) (:30-35): null-guards the service (:32), reads the speaker_id claim as a typed SpeakerIdentifierType through GetClaimValue<SpeakerIdentifierType>(ClaimNames.SpeakerId) (:33), and maps default to null (:34). GetClaimValue already returns null for a missing or unparseable claim (ICurrentUserService.cs:69); the extra default check also folds an empty identifier into "not a speaker".
    • CanManageLiveAsync(authorizationService, user) (:41-48): null-guards the authorization service (:43), awaits AuthorizeAsync(user, policyName) with ConfigureAwait(false) (:44-46), and returns outcome.Succeeded (:47).
  • Why it's built this way: three controllers need the identical pair of answers, so the logic lives once and each controller keeps only two one-line private wrappers (for example LivePollsController.cs:196, :199). Binding both facts from the caller's claims, never from a request field, is what stops a client from claiming to be a session's speaker or a live manager. internal static keeps it an API-layer detail with no DI registration.
  • Where it's used: LivePollsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/LivePollsController.cs:196, :199), which passes both answers into its create, open, close, delete and manage-polls requests (:66, :97-100, :127-130, :149, :187); LivePollVotingController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/LivePollVotingController.cs:131, :134); and SessionQuestionsController (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/SessionQuestionsController.cs:254, :257).
  • Caveats / not-in-source: no test targets this class by name; it is exercised through the controller tests, which wire the capability through the LiveManageAuthorization helper (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.API.Tests/Helpers/LiveManageAuthorization.cs). How each handler combines the speaker id and the manage flag is in the handlers, not here.

SetLeaderboardParticipationHandler

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Points.UseCases.SetLeaderboardParticipation · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/SetLeaderboardParticipation/SetLeaderboardParticipationHandler.cs:33 · Level 9 · class (public sealed partial)

  • What it is: the command handler behind "put me on the leaderboard" and "take me off". One boolean in, a Result out, with all the interesting work in how it resolves the published name and how it reconciles with a soft-deleted prior opt-in.
  • Depends on: IUnitOfWork, ICurrentUserService and its CurrentUserServiceExtensions.RequireUserId member (MMCA.Common/Source/Core/MMCA.Common.Application/Extensions/CurrentUserServiceExtensions.cs:35), IUniqueConstraintViolationDetector, IConcurrencyConflictDetector, LeaderboardOptIn, SetLeaderboardParticipationRequest, ErasedUserGuard (using MMCA.ADC.Engagement.Application.ErasedUsers, :3), and the framework contracts ICommandHandler<in TCommand, TResult>, Result and Error. Externals: System.Security.Claims, Microsoft.Extensions.Logging and its [LoggerMessage] source generator (which is why the class is partial, :241-245).
  • Concept, server-side identity for a public surface. [Rubric §11, Security] assesses whether trust decisions read from the token rather than the request body. SetLeaderboardParticipationRequest carries a single bool Participate and nothing else; the display name comes from the caller's claims (:76, :199-230). The class doc (:17-20) states the threat directly: a name in the body would let any caller publish a name they do not own, on a surface whose whole purpose is showing names to other people.
  • Concept, create-or-reactivate against a filtered unique index. [Rubric §8, Data Architecture], [Rubric §4, DDD]. Because the unique index declared in LeaderboardOptInConfiguration is filtered on the soft-delete flag, a soft-deleted opt-in still occupies the UserId slot for a filtered read but not for the constraint. JoinAsync therefore reads through FindIncludingDeletedAsync, which returns the active and the deleted matches as a tuple (:83-86), and the comment (:80-82) states the consequence of not doing so: every rejoin would insert a fresh row and collide with the index. State transitions stay in the aggregate (deleted.Reactivate(displayName) at :108, LeaderboardOptIn.Create(...) at :114), each returning a Result the handler propagates; the create result is unwrapped with TryGetValue(out var optIn) (:115) rather than a null-forgiving .Value!.
  • Concept, an erased account cannot join, two layers deep. [Rubric §30, Compliance, Privacy & Data Governance]. Account erasure leaves a deleted account's token valid for a while, so the join path refuses that caller twice. First, before anything else, JoinAsync calls ErasedUserGuard.EnsureNotErasedAsync(unitOfWork, userId, nameof(SetLeaderboardParticipationHandler), ...) and returns its failure as-is (:71-74); the comment (:68-70) explains why only the join is guarded: leaving is the erasure's own direction. This closes the case of an erased account with no opt-in row at all, which would otherwise insert a fresh one carrying the token's display name. Second, the reactivate path keeps its own check: erasure (UserDeletedPointsHandler) leaves an existing row soft-deleted with an erasure marker in place of the name, so before reactivating, JoinAsync checks deleted.IsDisplayNameErased and returns Error.Forbidden with code Points.AccountErased instead of bringing the row back under a fresh public name (:100-106); the comment (:97-99) draws the line against an ordinary opt-out, which keeps its real name and still rejoins.
  • Concept, classifying both lost join races through injected detectors. [Rubric §1, SOLID], [Rubric §29, Resilience & Business Continuity]. The save is wrapped in a try whose exception filter is when (IsLostJoinRace(exception)) (:125), and IsLostJoinRace (:144-146) is an OR of two injected abstractions. IUniqueConstraintViolationDetector covers the insert path: two first-time joins collide on the unique index on UserId. IConcurrencyConflictDetector covers the reactivate path: a rejoin after an opt-out has both requests updating the same soft-deleted row, and the loser fails the concurrency check rather than the index (comment :127-131). Both are abstractions rather than inline message matches, so the provider-specific knowledge of what each failure looks like lives once in the infrastructure layer (for the duplicate-key case, SqlServerUniqueConstraintViolationDetector) and this handler stays provider-agnostic. PointsAwarder leans on the unique-constraint collaborator too (PointsAwarder.cs:93).
  • Walkthrough
    • HandleAsync(command, cancellationToken) (:41-57): null-guards the command (:45), calls currentUserService.RequireUserId("Points.Forbidden") and returns its failure when there is no caller (:47-49), resolves the typed repository (:52), then dispatches on command.Participate to JoinAsync or LeaveAsync (:54-56).
    • JoinAsync (:63-136): refuse an erased account through ErasedUserGuard (:71-74); resolve the name and bail on failure, unwrapping it with TryGetValue(out var displayName) (:76-78); read both the active and the soft-deleted opt-ins for the user, tracked (:83-86); if any is active, return success without writing (:90-91), because re-publishing the name on every call would let a name change ride in on a no-op request (:88-89); otherwise, for a soft-deleted row, refuse an erased one with Points.AccountErased (:100-106) and reactivate any other (:108-110), or create the first one (:112-119); then save inside the race-filtered try (:121-133), which converts either lost join race (insert or reactivate) into the same success the already-on-board path returns, logging at Debug (:132). The comment (:127-131) frames it as intent satisfaction: being on the board is what was asked for.
    • IsLostJoinRace(exception) (:144-146): a private predicate, IsUniqueConstraintViolation(exception) || IsConcurrencyConflict(exception), so the exception filter on the catch stays one readable call.
    • LeaveAsync (:152-181): note the parameter type, IEntityQuerier<TEntity, TIdentifierType> rather than the full IRepository<TEntity, TIdentifierType> (:153), because this branch only reads and then mutates the aggregate it already holds. A filtered, tracked read (:157-160), success without writing when there is nothing active (:161-162), otherwise active.Delete() (:164) and save inside a try (:168-178) whose filter is concurrencyConflictDetector.IsConcurrencyConflict(exception) only (:172): a concurrent opt-out soft-deleted the same row first, this save lost the rowversion check, and being off the board is what was asked for, so it logs at Debug through LogConcurrentLeave (:177, :244-245) and succeeds. No erasure guard runs here, by design (:68-70). Soft-delete, not erasure, which is what leaves the row available for the next reactivate. Unlike JoinAsync, the filter has no unique-index half, since leaving never inserts.
    • ResolveDisplayName(user) (:199-230): tries ClaimTypes.Name, then the raw name, then unique_name (:201-203), because inbound claim mapping is not uniform across the hosts that serve this module (:187-190). An empty result is an Error.Validation("Points.DisplayNameUnavailable", ...) (:206-213) rather than a placeholder, since "Attendee" or an email fragment would be meaningless or would leak something the attendee never chose to publish (:192-194). Over-long names are cut at LeaderboardOptIn.DisplayNameMaxLength (:215-229), backing off one index when the cut would split a surrogate pair (:223-227); the comment (:220-222) names the visible symptom it prevents, a U+FFFD in the public leaderboard response.
    • FindClaimValue(user, claimType) (:238-239): a null-tolerant one-liner over ClaimsPrincipal.
  • Why it's built this way: every branch that finds the world already in the requested state returns Result.Success() without writing, so the command is idempotent from the client's point of view and safe to retry. [Rubric §6, CQRS & Event-Driven]. Note what the handler does not do: it carries no transactional marker, so the CQRS decorator pipeline opens no transaction around it, which is consistent with each branch performing at most one save. Both branches now absorb their lost race as success, so a retry or a double-tap never surfaces a conflict to the user.
  • Where it's used: injected into PointsController as ICommandHandler<SetLeaderboardParticipationRequest, Result> (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.API/Controllers/PointsController.cs:40, action at :103-104); reached from the UI through PointsService.SetLeaderboardParticipationAsync (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Services/Points/PointsService.cs:40) off the MyPoints page (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.UI/Pages/Points/MyPoints.razor.cs:139). Covered by SetLeaderboardParticipationHandlerTests.
  • Caveats / not-in-source: the display-name cap is applied by truncation, not rejection, so a caller with a very long token name silently publishes a shortened one; nothing surfaces that to the user. Whether the resulting name is unique on the board is not enforced anywhere: the unique index is on UserId, not on DisplayName, so two attendees with the same token name appear identically.

UserEngagementExportService

MMCA.ADC.Engagement.Application · MMCA.ADC.Engagement.Application.Exports · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Exports/UserEngagementExportService.cs:21 · Level 11 · class (internal sealed)

  • What it is: the in-process implementation of IUserEngagementExportService. It gathers everything the Engagement module holds about one user (bookmarks, submitted questions, points ledger, check-in history, poll votes, question upvotes, linked roster tickets, leaderboard participation) into a single UserEngagementExportDTO for the cross-service data-subject export (PRIVACY.md section 12, class doc :12-20).
  • Depends on: IUnitOfWork and the repositories it hands out; the aggregates UserSessionBookmark, SessionQuestion, PointsEntry, CheckIn, LivePollVote, SessionQuestionUpvote, Ticket and LeaderboardOptIn; the contract IUserEngagementExportService plus its DTO family from MMCA.ADC.Engagement.Shared.Exports (UserEngagementExportDTO, UserEngagementBookmarkExportDTO, UserEngagementSubmittedQuestionExportDTO, UserEngagementPointsEntryExportDTO, UserEngagementCheckInExportDTO, UserEngagementPollVoteExportDTO, UserEngagementQuestionUpvoteExportDTO, UserEngagementTicketExportDTO).
  • Concept, the data-subject export as eight server-side projections. [Rubric §30, Compliance, Privacy & Data Governance] assesses whether there is a real, exercised access and portability path for personal data rather than a policy page; this class is the Engagement half of one. [Rubric §12, Performance & Scalability] assesses whether reads are shaped for the database: every collection is fetched with GetProjectedAsync, whose select expression is translated to SQL (MMCA.Common/Source/Core/MMCA.Common.Application/Interfaces/Infrastructure/Persistence/IRepository.cs:105-110), so the server returns only the columns the export publishes and no aggregate is ever materialized. [Rubric §7, Microservices Readiness]: Identity owns the export document but not Engagement's data, so it depends only on the interface, satisfied in-process here and over the wire by UserEngagementExportServiceGrpcAdapter. Same shape as BookmarkCountService.
  • Concept, the soft-delete filter is part of the privacy semantics. [Rubric §8, Data Architecture]. None of the eight reads passes ignoreQueryFilters, so the EF global soft-delete filter stays in force and only active personal data is exported (UserEngagementExportService.cs:18-19). That is a deliberate definition of "your data", not an oversight: it is why an opt-in the user has since left reports as not on the leaderboard rather than as a historical membership, and why a retracted poll vote or a removed question upvote is absent (comment :68-69). A ticket's own status is a different matter: a voided linked ticket is still exported, because its imported fields are data held about the user whatever the status (comment :82-84).
  • Walkthrough (UserEngagementExportService.cs:21-125)
    • The primary constructor injects IUnitOfWork (:21), the only collaborator. Each read then resolves its own typed repository from it (:28, :34, :40, :55, :70, :76, :85, :106) rather than injecting IRepository<TEntity, TIdentifierType> directly, which is the framework rule for staying on one unit of work per request.
    • Bookmarks (:28-32): projects to UserEngagementBookmarkExportDTO { SessionId, CreatedOn } filtered to b.UserId == userId.
    • Submitted questions (:34-38): projects to UserEngagementSubmittedQuestionExportDTO { QuestionId = q.Id, SessionId, Text, CreatedOn }, again filtered by user. Only the questions this user authored are read, so the only text that enters the document is the user's own, as stored: an erased question carries its placeholder (class doc :17-18).
    • Points ledger (:40-50): projects to UserEngagementPointsEntryExportDTO { ActivityType, Points, SubjectKey, CreatedOn }. Points travels as the value awarded at the time (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementPointsEntryExportDTO.cs:14-15), so a later change to the configured points-per-activity does not retroactively rewrite the subject's history.
    • Check-ins (:55-66): projects to UserEngagementCheckInExportDTO { Scope, EventId, SessionId, SponsorId, CheckedInOn }. The inline comment (:52-54) states why this is a separate read rather than something derived from the ledger, and the code it points at backs it up: PointsAwarder writes nothing when a rule's configured value is <= 0 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:49-59) and returns a clean no-op on a repeat (:55-64), so the ledger is no proxy for the attendance record the data subject is entitled to.
    • Poll votes (:70-74): projects LivePollVote rows to UserEngagementPollVoteExportDTO { LivePollId, OptionId, CreatedOn } filtered to v.UserId == userId. The comment (:68-69) notes a retracted vote and a removed upvote are soft-deleted, so the export reports the user's active votes and upvotes.
    • Question upvotes (:76-80): projects SessionQuestionUpvote rows to UserEngagementQuestionUpvoteExportDTO { QuestionId = u.SessionQuestionId, CreatedOn }. Only the upvoted question's id travels, never its text, which keeps another attendee's content out of this subject's document.
    • Roster tickets (:85-101): projects Ticket rows with LinkedUserId == userId (:100) to UserEngagementTicketExportDTO carrying EventId, SourceEventName, ExternalTicketId, TicketTypeName, the attendee first and last name, OrderEmail, InvitedOn, LinkMethod and LinkedOn (:87-99). LinkMethod and LinkedOn are unwrapped with !.Value (:97-98), which the link filter makes safe. The comment (:82-84, BR-274) records the scope: an unlinked ticket is not attributable to an account, so it is never part of anyone's export.
    • Leaderboard participation (:106-110): projects to the bare string DisplayName rather than to a DTO, because the export carries only a boolean plus a name. The comment (:103-105) records the invariant that makes the check safe: a user holds at most one active opt-in, since rejoining reactivates the soft-deleted row (BR-135, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/LeaderboardOptIn.cs:90) instead of inserting a second one.
    • Assembly (:112-123): one UserEngagementExportDTO built with collection expressions ([.. bookmarks] and friends, including PollVotes at :118, QuestionUpvotes at :119 and Tickets at :120), IsOnLeaderboard = leaderboardNames.Count > 0 (:121) and LeaderboardDisplayName = leaderboardNames.FirstOrDefault() (:122), which is null when the collection is empty.
    • The eight reads are sequential awaits on one unit of work, not a Task.WhenAll: a single EF context is not thread-safe for concurrent queries, so this is the correct shape, and the cost is eight round trips on a request that runs once per data-subject request.
  • Why it's built this way: projecting server-side to ids, enums, dates and the few text fields the user owns (their own question text, their ticket's imported fields) keeps the export cheap to build and cheap to ship across a service boundary, and it structurally prevents content authored by other users from leaking into one subject's document (UserEngagementExportDTO states that rule explicitly, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Exports/UserEngagementExportDTO.cs:3-10). Returning a plain Task<T> rather than a Result<T> is what lets the aggregating side degrade: there is no business failure to model here, so an unreachable peer surfaces as an exception the caller turns into a missing section (ADR-007).
  • Where it's used: registered by the Engagement Application DI (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/DependencyInjection.cs:43, TryAddScoped); exposed over the wire by UserEngagementExportGrpcService, which wraps this in-process instance (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Service/Grpc/UserEngagementExportGrpcService.cs:26). The consumer is Identity's EngagementUserDataExportSection (MMCA.ADC/Source/Modules/Identity/MMCA.ADC.Identity.Application/Users/UseCases/ExportUserData/EngagementUserDataExportSection.cs:20), which reaches it through UserEngagementExportServiceGrpcAdapter and re-projects the DTO into the Identity export document, rendering ActivityType and Scope as their readable names (EngagementUserDataExportSection.cs:53, :60), behind ExportUserDataHandler. A host that does not load the module has no disabled stand-in: it resolves the export service through UserEngagementExportServiceGrpcAdapter instead (MMCA.ADC/Source/Services/MMCA.ADC.Engagement.Contracts/DependencyInjection.cs:77).
  • Caveats / not-in-source: erasure is not this class's job and is not visible here, it only reads. Whether the export is additionally rate-limited or audited when it runs in production is not determinable from this file.

AttendeeBadgeConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/AttendeeBadgeConfiguration.cs:15 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for the AttendeeBadge aggregate: two required columns and two unique indexes, one per identity the badge is looked up by (the attendee, and the scannable credential).
  • Depends on: the engine shim base EntityTypeConfigurationSQLServer<TEntity, TIdentifierType> and AttendeeBadge. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, the module entity configuration over the engine shim. [Rubric §8, Data Architecture] assesses whether the schema is designed for the queries and constraints the application actually needs rather than inherited from conventions; [Rubric §3, Clean Architecture] assesses whether persistence concerns stay out of the domain. Every Engagement configuration in this file group follows one shape: extend EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, call base.Configure(builder) first (AttendeeBadgeConfiguration.cs:21), then declare only what is specific to this entity. The base applies the framework conventions once (table and schema resolution, the soft-delete global query filter, audit columns, the concurrency token); the full hierarchy is taught in Group 07. The engine is the choice of base class, so re-pointing an entity at the Cosmos or SQLite shim is a base-class swap with no body edits (ADR-018); every Engagement entity uses the SQL Server shim today. The domain entity itself carries no EF attributes, which is what keeps MMCA.ADC.Engagement.Domain free of a persistence dependency.
  • Concept introduced, unique index as a race backstop. [Rubric §12, Performance & Scalability] and [Rubric §11, Security]. Both indexes here are unique and unfiltered in the source: HasIndex(b => b.UserId).IsUnique() (:31-32) and HasIndex(b => b.Credential).IsUnique() (:35-36). The first is the concurrency guarantee the get-or-create path leans on (the inline comment at :29-30 says so), the second makes a scan a single seek on a Guid column (AttendeeBadge.Credential, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Badges/AttendeeBadge.cs:24) and forbids two badges sharing a credential. Note what is NOT written here: neither index declares HasSoftDeleteFilter(), because SoftDeleteUniqueIndexConvention already stamps IsDeleted = 0 onto every unique index of a soft-deletable entity at model finalizing (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conventions/SoftDeleteUniqueIndexConvention.cs:61-71) and leaves an index that already carries the predicate untouched (:73-76).
  • Walkthrough (AttendeeBadgeConfiguration.cs:19-37): base.Configure(builder) (:21); UserId required (:23-24); Credential required (:26-27); the unique UserId index (:31-32); the unique Credential index (:35-36). That is the whole file: five statements, each with a comment naming the behavior it protects.
  • Why it's built this way: the remarks (:11-14) state the cross-module rule the whole module obeys, UserId is a scalar reference into the Identity database and never a cross-database FK, because Engagement cannot see the Identity model (database-per-service, ADR-006). [Rubric §7, Microservices Readiness].
  • Where it's used: discovered by assembly scanning and applied when the Engagement SQLServerDbContext builds its model; the unique UserId index is what GetOrCreateMyBadgeHandler classifies through IUniqueConstraintViolationDetector when two requests race (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/UseCases/GetOrCreateMyBadge/GetOrCreateMyBadgeHandler.cs:62).

ErasedUserConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.ErasedUsers · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/ErasedUsers/ErasedUserConfiguration.cs:15 · Level 14 · class (internal sealed)

  • What it is: the EF Core mapping for the ErasedUser record, the tombstone that says an account has been erased: two required columns and one unique index on the user.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType> and ErasedUser. Externals: EF Core's EntityTypeBuilder<T>.
  • Walkthrough (ErasedUserConfiguration.cs:15-32): base.Configure(builder) (:21); UserId required (:23-24); ErasedOn required (:26-27); a unique index on UserId (:29-30). It follows the module shape taught in AttendeeBadgeConfiguration, and like that file it states no HasSoftDeleteFilter(): the framework convention stamps the soft-delete predicate on unique indexes of soft-deletable entities.
  • Why it's built this way: the unique UserId index lets an erasure be recorded at most once per user, so a replayed user-deleted event cannot add a second tombstone. UserId is a scalar reference into the Identity database, never a cross-database foreign key (database-per-service, ADR-006). The record exists because erasure differs from soft delete (ADR-005): the table is what ErasedUserGuard consults to refuse later writes for an erased account. [Rubric §11, Security] and [Rubric §8, Data Architecture].
  • Where it's used: applied to the Engagement model by assembly scanning: the framework's entity data-source registry walks the configuration assemblies and picks up every concrete type implementing IEntityTypeConfigurationBase<,> (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/DataSources/EntityDataSourceRegistry.cs:181-198), so no DbSet property names the table. No other code references the class directly.

CheckInConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.CheckIns · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/CheckIns/CheckInConfiguration.cs:20 · Level 11 · class (internal sealed)

  • What it is: the EF Core mapping for CheckIn, the one aggregate that carries all three check-in scopes (event arrival, session attendance, sponsor booth visit). It is the most constraint-dense configuration in the module: three scope-partitioned unique indexes plus two read indexes.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, CheckIn, CheckInScope (by value, not by reference, see below), and IndexBuilderExtensions. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, partitioning one table by a discriminator through filtered indexes. [Rubric §8, Data Architecture], [Rubric §4, DDD]. One aggregate covers every scope because the row shape, the idempotency rule and the attendance query are identical and only the required target differs (CheckInScope documents this, and CheckInInvariants enforces it). The cost is that a single unique index cannot express "one per attendee per event, and separately one per attendee per session": the three uniqueness rules must not collide with each other. Each index therefore carries its own scope predicate through HasSoftDeleteFilter(additionalFilter: ...) (CheckInConfiguration.cs:52, :56, :62), and the extension ANDs that predicate in front of the soft-delete one (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/IndexBuilderExtensions.cs:63-65). The three scope literals are hoisted into private const string fields (:24-26) with a comment explaining why they are literals at all (:22-23): an index filter is SQL, so it cannot read the C# enum. That is also why the enum's numeric values are documented as load-bearing and never renumbered.
  • Concept, the database as the concurrency backstop behind an application-level check. [Rubric §29, Resilience & Business Continuity], [Rubric §6, CQRS & Event-Driven]. The remarks (:11-18) describe the two layers together: CheckInProcessor makes a repeat scan a no-op by looking for the existing row first (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/CheckIns/Services/CheckInProcessor.cs:73-77), and these indexes make a concurrent double scan a DbUpdateException instead of two rows, so the broker retry that follows lands on the no-op path.
  • Walkthrough (CheckInConfiguration.cs:30-71): base.Configure(builder) (:31); five required properties, UserId (:33-34), Scope (:36-37), EventId (:39-40), CheckedInByUserId (:42-43), CheckedInOn (:45-46), note that SessionId and SponsorId are deliberately not required, since each is meaningful only in its own scope; then the three filtered unique indexes, (UserId, EventId) under the event scope (:49-51), (UserId, SessionId) under the session scope (:54-56), and (UserId, SponsorId) under the sponsor scope (:60-62), the last being the once-per-sponsor cap that makes a shared deep link worth nothing beyond the first scan (:58-59); finally two non-unique, soft-delete-filtered read indexes on EventId (:65-66) and SessionId (:68-69), because attendance stats read by event and group by session (:64).
  • Why it's built this way: sponsor visits are self-recorded by the attendee from a printed QR, so the cap has to be structural rather than procedural. Keeping the identifiers scalar (:16-17) is the same database-per-service rule the rest of the module follows (ADR-006).
  • Where it's used: applied to the Engagement model by assembly scanning. Its indexes are the contract every check-in writer is written against: all four handlers route through CheckInProcessor, the organizer paths CheckInAttendeeHandler (CheckInAttendeeHandler.cs:60) and ManualCheckInHandler (ManualCheckInHandler.cs:50) through ExecuteAsync (CheckInProcessor.cs:129), and the self-service paths RecordRoomCheckInHandler (RecordRoomCheckInHandler.cs:118) and RecordSponsorVisitHandler (RecordSponsorVisitHandler.cs:85) through RecordAsync (CheckInProcessor.cs:60). The rows it maps are exported by UserEngagementExportService and travel to Identity through UserEngagementExportGrpcService.

LeaderboardOptInConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Points/LeaderboardOptInConfiguration.cs:17 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for LeaderboardOptIn, the row that says an attendee agreed to appear on the public board and under which name. Same base shape as AttendeeBadgeConfiguration; its distinctive job is "one active opt-in per attendee".
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, LeaderboardOptIn, and IndexBuilderExtensions for HasSoftDeleteFilter(). Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, HasSoftDeleteFilter() instead of a SQL literal. [Rubric §8, Data Architecture] and [Rubric §15, Best Practices & Code Quality]. The unique index is declared .IsUnique().HasSoftDeleteFilter() (LeaderboardOptInConfiguration.cs:33-35). That extension member (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/IndexBuilderExtensions.cs:52-66) builds the predicate from the model rather than from a hand-typed "[IsDeleted] = 0", so the column name follows a rename and the quoting comes from the engine; it takes an engine parameter defaulting to DataSource.SQLServer and an optional additionalFilter that is ANDed in front of the soft-delete predicate (IndexBuilderExtensions.cs:63-65). On a unique index the call is belt-and-braces (the convention would have added the same predicate), and it is idempotent in effect because the convention skips any index that already declares the predicate; on a non-unique index it is the only way to get the filter at all.
  • Walkthrough (LeaderboardOptInConfiguration.cs:21-36): base.Configure(builder) (:23); UserId required (:25-26); DisplayName required with HasMaxLength(LeaderboardOptIn.DisplayNameMaxLength) (:28-30), the cap being the domain constant 100 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Points/LeaderboardOptIn.cs:26), so the column width and the invariant in LeaderboardOptInInvariants can never disagree; then the filtered unique index on UserId (:33-35).
  • Why it's built this way: the remarks (:11-16) give both halves of the design. Filtering the unique index on the soft-delete flag is what makes rejoining reactivate the existing row instead of accumulating one dead row per toggle (the path SetLeaderboardParticipationHandler implements). Storing DisplayName here at all is deliberate denormalization: the name is the snapshot the attendee published, so the leaderboard query never has to reach into Identity, which is a cross-database read this topology does not allow. [Rubric §7, Microservices Readiness].
  • Where it's used: applied to the Engagement model by assembly scanning; the snapshot column is read by GetLeaderboardHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/UseCases/GetLeaderboard/GetLeaderboardHandler.cs:41), and the unique index is the constraint SetLeaderboardParticipationHandler both navigates and catches (SetLeaderboardParticipationHandler.cs:123-129).

LivePollVoteConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.LivePolls · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/LivePolls/LivePollVoteConfiguration.cs:17 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for the LivePollVote aggregate root, whose centerpiece is the filtered unique index guaranteeing one active vote per user per poll (BR-225).
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType> (the shared base that maps audit fields, soft-delete and RowVersion), LivePollVote, and IndexBuilderExtensions for HasSoftDeleteFilter(). Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, the filtered unique index as the backstop for a soft-delete aggregate. [Rubric §8, Data Architecture] assesses whether uniqueness and concurrency are enforced at the storage layer rather than hoped for in application code. Because a vote toggles via soft-delete rather than hard-delete, a naive unique index would permanently block a user from re-voting: the deleted row keeps occupying its unique slot. Scoping the index to active rows is what makes the handler's create-or-reactivate dance race-safe (the remark at LivePollVoteConfiguration.cs:12-16 says exactly that). Note how the scoping is expressed: .HasSoftDeleteFilter() (:37), the framework extension member at MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Configuration/IndexBuilderExtensions.cs:52-66, rather than a hand-typed HasFilter("[IsDeleted] = 0"). The extension builds the predicate from the model, so a renamed soft-delete column or a different engine follows automatically. On a unique index the call is belt and braces: SoftDeleteUniqueIndexConvention already stamps the same predicate onto every unfiltered unique index of a soft-deletable entity at model finalizing (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conventions/SoftDeleteUniqueIndexConvention.cs:57, :60-70) and recognizes the predicate it finds rather than doubling it (:74-75). Writing it explicitly keeps BR-225 legible in the file that owns it. [Rubric §2, Design Patterns] applies in that the database constraint and the domain Reactivate method are two halves of one idempotent-write pattern; the identical shape guards SessionQuestionUpvote through SessionQuestionUpvoteConfiguration.
  • Walkthrough (LivePollVoteConfiguration.cs:21-41): Configure (:21) calls base.Configure (:23), then requires LivePollId (:25-26), OptionId (:28-29) and UserId (:31-32); note there are no navigations, because a vote is a separate aggregate by design and so carries scalar FKs only. The filtered unique index on { LivePollId, UserId } (:35-37) is BR-225, one active vote per poll and user, with the soft-delete predicate applied through HasSoftDeleteFilter() and the rule named in the comment above it (:34). The second, non-unique index on { LivePollId, OptionId } (:40) supports the grouped COUNT per option that the tally issues (:39).
  • Why it's built this way: the filter is what lets soft-delete and uniqueness coexist, routing it through the shared extension keeps every filtered index in the codebase producing byte-identical SQL, and the second index matches the tally query shape exactly, so results are computed from an index rather than by scanning the vote table.
  • Where it's used: applied by the Engagement SQLServerDbContext at model build; CastVoteHandler relies on the unique index as the final arbiter when two concurrent votes race, and LivePollResultsBuilder is the reader the second index serves. Covered by EngagementEntityConfigurationTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure.Tests/Persistence/EngagementEntityConfigurationTests.cs).

PointsEntryConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.Points · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Points/PointsEntryConfiguration.cs:21 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for PointsEntry, one row per awarded activity. Its composite unique index is not an optimization: it is the enforcement point for two separate rules at once.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, PointsEntry, PointsSubjectKeys (for the key length), and IndexBuilderExtensions. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, one index carrying two business rules. [Rubric §8, Data Architecture] and [Rubric §6, CQRS & Event-Driven]. The unique index on (UserId, ActivityType, SubjectKey) (PointsEntryConfiguration.cs:46-48) is simultaneously the idempotency key for an at-least-once award (a replayed integration event collides with the row it already wrote) and the anti-farming rule (N questions or N answers for one session collapse onto one subject key, so they award once). The remarks (:12-20) spell out the two-layer interplay: PointsAwarder pre-checks with an ExistsAsync on exactly those three columns so the ordinary duplicate is a clean no-op (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/Points/Services/PointsAwarder.cs:73-82), and a concurrent race that gets past the pre-check surfaces here as a provider exception the awarder classifies as already-awarded rather than as a failure (PointsAwarder.cs:93). The database is the arbiter of last resort, not the first line.
  • Walkthrough (PointsEntryConfiguration.cs:25-53): base.Configure(builder) (:27); UserId (:29-30), ActivityType (:32-33) and Points (:35-36) required; SubjectKey required with HasMaxLength(PointsSubjectKeys.MaxLength) (:38-40), that is 64 characters (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Points/PointsSubjectKeys.cs:14), a bounded key being what makes it indexable at all; OccurredOnUtc required (:42-43); then the filtered unique triple (:46-48) and a second, non-unique UserId index also carrying HasSoftDeleteFilter() (:51-52) so the "my points" ledger read is a seek. That second index is the case the convention does not cover: it is not unique, so without the explicit call it would carry no filter.
  • Why it's built this way: pushing idempotency into a unique constraint means correctness does not depend on the broker delivering exactly once, which it does not. [Rubric §29, Resilience & Business Continuity]. As everywhere in this module, UserId stays a scalar column, never a cross-database FK (:18-19).
  • Where it's used: applied by assembly scanning; the index is the contract PointsAwarder is written against, and the ledger it protects is read by GetLeaderboardHandler and the my-points queries, and exported by UserEngagementExportService (UserEngagementExportService.cs:40-50).

SessionQuestionConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.SessionQuestions · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/SessionQuestions/SessionQuestionConfiguration.cs:16 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for the SessionQuestion aggregate root (the audience-questions half of the live layer): scalar FK columns, a length constraint, and one query-shaped composite index.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, SessionQuestion, and SessionQuestionInvariants for the shared length constant. Externals: EF Core's EntityTypeBuilder<T>.
  • Walkthrough (SessionQuestionConfiguration.cs:20-39): base.Configure(builder) (:22); SessionId required (:24-25); UserId required (:27-28); Text required with HasMaxLength(SessionQuestionInvariants.TextMaxLength) (:30-32), a constant that itself forwards to the DTO's TextMaxLength (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/SessionQuestions/SessionQuestionInvariants.cs:13), that is 500 characters (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/SessionQuestions/SessionQuestionDTO.cs:18), so the column width, the domain validation and the client-side hint share one source of truth; Status required (:34-35); then HasIndex(p => new { p.SessionId, p.Status }) (:38) because both the attendee list and the moderation queue filter by session and status. This index is deliberately neither unique nor soft-delete-filtered: the question feed has no uniqueness rule to enforce, and the read that uses it is already narrowed by session.
  • Why it's built this way, cross-module FKs stay scalar: the remarks (:10-15) state it plainly. SessionId/EventId point at Conference-owned rows in another database and UserId at an Identity-owned row, so they stay indexed scalar columns; consistency flows through the Conference gRPC validation boundary, never a cross-database constraint. [Rubric §7, Microservices Readiness], [Rubric §8, Data Architecture]. See AttendeeBadgeConfiguration for the shared base-class story.
  • Where it's used: applied to the Engagement model by assembly scanning; the questions it maps are the second section of the data-subject export assembled by UserEngagementExportService (UserEngagementExportService.cs:34-38).

SessionQuestionUpvoteConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.SessionQuestions · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/SessionQuestions/SessionQuestionUpvoteConfiguration.cs:17 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for SessionQuestionUpvote. Same shape as SessionQuestionConfiguration, specialized to enforce one active upvote per question per user.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, SessionQuestionUpvote, IndexBuilderExtensions. Externals: EF Core's EntityTypeBuilder<T>.
  • Walkthrough (SessionQuestionUpvoteConfiguration.cs:21-38): base.Configure(builder) (:23); SessionQuestionId required (:25-26); UserId required (:28-29); the filtered unique index on (SessionQuestionId, UserId) (:32-34), which is BR-235 as a database guarantee (named in the summary at :10 and again at the index, :31), at most one active upvote per (question, user), while soft-deleted history may hold prior toggles; and a second, non-unique SessionQuestionId index (:37) for counting upvotes grouped by question. Note the asymmetry with PointsEntryConfiguration: that second index carries no HasSoftDeleteFilter(), so it indexes deleted rows too.
  • Why it's built this way: the filtered unique index is the database-level backstop behind the handler's create-or-reactivate logic (remarks, :12-16), the same soft-delete-plus-unique-index interplay UserSessionBookmarkConfiguration sets up for bookmarks. [Rubric §8, Data Architecture].
  • Caveats / not-in-source: the remarks (:13-14) note upvotes reference their question by a scalar FK column with no navigations, they are a separate aggregate by design, so the index is the only structural link.

TicketConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Tickets/TicketConfiguration.cs:19 · Level 11 · class (internal sealed)

  • What it is: the EF Core mapping for Ticket, one imported TicketLeap ticket on an event's roster. Same base shape as the siblings in this part; what sets it apart is that it carries two filtered unique indexes at once, plus two non-unique filtered lookup indexes.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, Ticket, TicketInvariants for every column width, and IndexBuilderExtensions for HasSoftDeleteFilter(). Externals: EF Core's EntityTypeBuilder<T>.
  • Concept reinforced, the database as the import's backstop. [Rubric §8, Data Architecture]. The remarks (TicketConfiguration.cs:11-18) name the rules each index enforces: one ticket per TicketLeap ticket ID per event (BR-268) and one ticket per barcode per event, the barcode claim's lookup (BR-273). The import checks for both itself; the indexes are what hold when that check is raced. Both are filtered to active rows, so a deleted roster never blocks a fresh upload for the same event, the same soft-delete-plus-unique interplay UserSessionBookmarkConfiguration uses for bookmarks.
  • Walkthrough (TicketConfiguration.cs:23-74): base.Configure(builder) (:25); EventId required (:27-28); then seven string columns, each width sourced from TicketInvariants: SourceEventName required, 200 (:30-32, MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Domain/Tickets/TicketInvariants.cs:15); ExternalTicketId required, 100 (:34-36, TicketInvariants.cs:18); Barcode required (:38-40), its width forwarding to ClaimTicketRequest.BarcodeMaxLength (TicketInvariants.cs:21), that is 100 (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/ClaimTicketRequest.cs:14), so the claim request and the column cannot disagree; TicketTypeName required, 200 (:42-44, TicketInvariants.cs:24); AttendeeFirstName and AttendeeLastName required, 100 each (:46-52, TicketInvariants.cs:30); OrderEmail bounded but optional (:54-55), its width forwarding to EmailInvariants.MaxLength (TicketInvariants.cs:33). Status required (:57-58). The indexes: unique { EventId, ExternalTicketId } (:60-62) and unique { EventId, Barcode } (:64-66), both with HasSoftDeleteFilter(); non-unique OrderEmail (:68-69) for the account-linking lookup (BR-272, which runs on every verified address per the remarks); non-unique LinkedUserId (:72-73), because "my tickets" and the erasure unlink both read by the linked account (:71). The two non-unique indexes need the explicit filter: the convention stamps only unique ones.
  • Why it's built this way: idempotent re-imports and concurrent claims are guaranteed by constraints rather than by timing, and the two lookup indexes match the hot reads. Cross-module identifiers (EventId, LinkedUserId) stay scalar columns, never cross-database FKs (:16-17). [Rubric §7, Microservices Readiness].
  • Where it's used: applied to the Engagement model by assembly scanning; it is internal. Covered by TicketConfigurationTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure.Tests/Persistence/TicketConfigurationTests.cs:38, :48, :64, :73), which pin the filtered unique index per event key, the order-email index, the string bounds and the optional order email.

TicketImportRunConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.Tickets · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/Tickets/TicketImportRunConfiguration.cs:18 · Level 11 · class (internal sealed)

  • What it is: the EF Core mapping for TicketImportRun, the row that tracks one queued or running roster import and holds its staged data. Its one index is the "one active import per event" rule.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, TicketImportRun, TicketRosterImportStatus (whose numeric values the filter names), and IndexBuilderExtensions. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept introduced, HasSoftDeleteFilter() with an additionalFilter. [Rubric §8, Data Architecture]. Every other unique index in this part filters on soft-delete alone; this one narrows further to active runs: .IsUnique().HasSoftDeleteFilter(additionalFilter: "[Status] IN (0, 1)") with the explicit name IX_TicketImportRun_EventId_Active (TicketImportRunConfiguration.cs:40-43). 0 and 1 are Queued and Running (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Shared/Tickets/Imports/TicketRosterImportStatus.cs:10, :13), so finished and failed runs drop out of the index and any number of them may exist per event, while a second active run cannot. The remarks (:12-17) call it the backstop behind StartTicketRosterImportHandler's own check: two commits racing past that check cannot both start. The trade-off is that the predicate is a SQL literal over enum ordinals, so renumbering the enum would silently change the rule.
  • Walkthrough (TicketImportRunConfiguration.cs:25-44): a private ErrorCodeMaxLength = 100 (:22), since the ticket error codes are short dotted identifiers (:21); base.Configure(builder) (:27); EventId required (:29-30); Status required (:32-33); ErrorCode bounded and optional (:35-36); StagedRoster mapped with no length (:38), unbounded text holding the file's whitelisted fields only while the run is active (remarks :15-16); then the filtered unique index (:40-43).
  • Why it's built this way: the staged holder data lives on the run row so the internal-command payload carries only the run id, and the narrowed index lets the history of completed runs accumulate without loosening the single-active-run guarantee. EventId is a scalar column, never a cross-database FK (:16). [Rubric §7, Microservices Readiness].
  • Where it's used: applied to the Engagement model by assembly scanning; it is internal, and the brief records no reference outside the defining file.

UserSessionBookmarkConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.UserSessionBookmarks · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/UserSessionBookmarks/UserSessionBookmarkConfiguration.cs:16 · Level 8 · class (internal sealed)

  • What it is: the EF Core mapping for UserSessionBookmark, the module's founding aggregate. Same base shape as the siblings above; it enforces BR-21 (one active bookmark per user per session) and adds the index the conference-day count path depends on.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, UserSessionBookmark, IndexBuilderExtensions. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept, indexing for the hot read, not just for the constraint. [Rubric §12, Performance & Scalability]. The second index (UserSessionBookmarkConfiguration.cs:37-38) exists because BookmarkCountService counts by SessionId alone, and a leading-UserId composite cannot seek on that predicate; the comment (:36-37) says exactly this. It is non-unique, so HasSoftDeleteFilter() is required rather than optional: the convention only stamps unique indexes (MMCA.Common/Source/Core/MMCA.Common.Infrastructure/Persistence/Conventions/SoftDeleteUniqueIndexConvention.cs:63-64), and the count query carries the soft-delete predicate, so an unfiltered index would not match it.
  • Walkthrough (UserSessionBookmarkConfiguration.cs:20-39): base.Configure(builder) (:23); UserId required (:25-26); SessionId required (:28-29); the filtered unique index on (UserId, SessionId) (:32-34); the filtered SessionId index (:38-39).
  • Why it's built this way: filtering the unique index on IsDeleted = 0 lets a user remove and re-add the same bookmark any number of times while guaranteeing only one is active, which is precisely why the bookmark write path reactivates rather than inserts. [Rubric §8, Data Architecture].
  • Caveats / not-in-source: the remarks (:12-16) note the FK relationship to Conference.Session is configured at the shared DbContext level (where both entity types are visible) rather than here, to avoid a cross-module Infrastructure-to-Domain dependency that would break module isolation. In the extracted topology those two entities live in different databases anyway, where CrossDataSourceDegradeConvention drops the constraint.

LivePollConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.LivePolls · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/LivePolls/LivePollConfiguration.cs:16 · Level 9 · class (internal sealed)

  • What it is: the EF Core mapping for the LivePoll aggregate root: column requirements, the question length limit, the two query indexes, and the access mode EF uses to materialize the encapsulated options collection.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType> (the shared base that maps audit fields, soft-delete and RowVersion), LivePoll, and LivePollInvariants for QuestionMaxLength. Externals: EF Core's EntityTypeBuilder<T> and PropertyAccessMode.
  • Concept introduced, the no-cross-database foreign key rule. The base class itself is taught in Group 07; what this file makes concrete is the remark at LivePollConfiguration.cs:11-15: EventId and SessionId point at Conference-owned rows in a different database, so they stay plain indexed scalar columns and consistency flows through the Conference gRPC validation boundary, never through an FK constraint. [Rubric §7, Microservices Readiness] assesses schema independence between services, which is exactly what the scalar-reference choice buys. [Rubric §8, Data Architecture] assesses the persistence contract (nullability, lengths, indexes) and the database-per-service discipline (ADR-006); all of it is visible in a dozen lines here, and it is the same rule AttendeeBadgeConfiguration states for UserId.
  • Concept introduced, pinning EF's access mode for an encapsulated collection. [Rubric §4, DDD] assesses whether the aggregate keeps its collections closed to outside mutation. LivePoll exposes Options as a getter over a private List returned through AsReadOnly(), which means EF must read and write the backing field, never the property, or materialization silently produces nothing. EF's convention already infers field access for this shape; :49-50 states it anyway with builder.Navigation(p => p.Options).UsePropertyAccessMode(PropertyAccessMode.Field). The comment at :43-48 gives the reason: stating it makes the mapping independent of that inference, so a later change to the property (a different projection, a computed wrapper) cannot silently turn materialization into a no-op. [Rubric §15, Best Practices & Code Quality] assesses exactly this kind of fail-loudly-later choice. It is an access mode only, no schema change: the relationship itself stays configured from the child side in LivePollOptionConfiguration.
  • Walkthrough (LivePollConfiguration.cs:20-51): Configure (:20) calls base.Configure(builder) first (:22) so the common conventions land before any override; EventId required (:24-25); Question required with HasMaxLength(LivePollInvariants.QuestionMaxLength) (:27-29), sourcing the length from the domain constant so schema and invariant can never disagree; Status required (:31-32). Then HasIndex(p => p.EventId) (:35), non-unique, because the Happening Now page and the organizer manage view both query polls by event (:34); and HasIndex(p => new { p.SessionId, p.Status }) (:41), the composite added for GetOpenPollsHandler. Its comment (:37-40) is the performance record: that query filters on (SessionId, Status), runs once per attendee per session and again on every structural poll event, and only EventId was indexed, so it scanned. It deliberately mirrors SessionQuestionConfiguration, which already indexes the same pair. [Rubric §12, Performance & Scalability] assesses whether indexes match the real query shapes of the hot path. The file closes with the Navigation(...).UsePropertyAccessMode(PropertyAccessMode.Field) call described above (:49-50).
  • Why it's built this way: one length constant sourced from the domain, scalar cross-service references per ADR-006, indexes derived from the two live-layer read shapes rather than guessed, and an explicitly stated access mode so the aggregate's encapsulation and EF's materialization cannot drift apart.
  • Where it's used: discovered and applied at model-build time by the Engagement SQLServerDbContext through EF Core's configuration scanning; it is internal, so nothing else can reach it. Covered by EngagementEntityConfigurationTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure.Tests/Persistence/EngagementEntityConfigurationTests.cs).

LivePollOptionConfiguration

MMCA.ADC.Engagement.Infrastructure · MMCA.ADC.Engagement.Infrastructure.Persistence.EntityConfiguration.LivePolls · MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure/Persistence/EntityConfiguration/LivePolls/LivePollOptionConfiguration.cs:10 · Level 9 · class (internal sealed)

  • What it is: the EF Core mapping for the LivePollOption child entity: its text limit and its real relationship back to LivePoll.
  • Depends on: EntityTypeConfigurationSQLServer<TEntity, TIdentifierType>, LivePollOption, and LivePollInvariants for OptionTextMaxLength. Externals: EF Core's EntityTypeBuilder<T>.
  • Concept reinforced, the in-aggregate child. Read this directly against LivePollConfiguration: there, a cross-service reference stays a bare scalar; here, both ends are Engagement-owned and in the same database, so the option gets a genuine navigation and a genuine foreign key (LivePollOptionConfiguration.cs:22-25). [Rubric §8, Data Architecture]: the contrast is the lesson, an FK is correct precisely when the constraint can be enforced by one database.
  • Walkthrough (LivePollOptionConfiguration.cs:14-26): Configure (:14) calls base.Configure (:16), then makes Text required with HasMaxLength(LivePollInvariants.OptionTextMaxLength) (:18-20); HasOne(o => o.LivePoll).WithMany(p => p.Options).HasForeignKey(o => o.LivePollId).IsRequired() (:22-25) is the required one-poll-to-many-options relationship inside the aggregate boundary, configured from the child side, which is why LivePollConfiguration only has to state the collection's access mode.
  • Why it's built this way: an option has no meaning without its poll, so the database is allowed to say so; the length again comes from the domain constant rather than a repeated literal.
  • Where it's used: applied by the Engagement SQLServerDbContext at model build; the collection it maps is loaded on query paths by passing [nameof(LivePoll.Options)] as the include list to the read repository, for example in GetOpenPollsHandler (MMCA.ADC/Source/Modules/Engagement/MMCA.ADC.Engagement.Application/LivePolls/UseCases/GetOpenPolls/GetOpenPollsHandler.cs:50-54), and eager-loaded on the delete path by DeleteLivePollHandler. Covered by EngagementEntityConfigurationTests (MMCA.ADC/Tests/Modules/Engagement/MMCA.ADC.Engagement.Infrastructure.Tests/Persistence/EngagementEntityConfigurationTests.cs).


⬅ ADC Conference - UI • Index • ADC Engagement Live Layer (Real-Time Polls & Session Q&A) ➡