Durable writes, past-tense facts, staff projections, and versioned live/on-demand media streams
Guided views
Explore this system
Step through curated paths without changing the source diagram.
Beat
Next
ReadyChapter 01 / 01
Guided chapter
Diagram guideExplore this system
Inspecting compiled semantics
E ExportT ThemeS Style0 Reset+ Zoom in- Zoom outEsc Close
Find a node
⌕/
No matching nodes
Semantic passport
Verified source
Authored reach
Route probeChoose a start node
Pick two semantic nodes on the diagram
Choose the source, then the destination. Direction matters.
Semantic lensCompare system roles
Choose up to two semantic kinds. One reveals its real traffic; two compare only direct authored relationships.
Choose a kind to inspect its nodes and touching relationships.
Semantic radar
Building overview
Click nodeDrag to pan
Secure communications
• Chat HTTP sends lock the conversation, check current membership, deduplicate the client key, persist encrypted content and durable sequence, then publish chat.message.sent and metadata-only chat.realtime.committed invalidations.
• Redis Pub/Sub fans metadata out across API replicas. Every connected staff identity is reauthorized periodically and disconnected at token expiry or within a one-minute session bound. Reconnect refetches authorized HTTP history; portal recovery uses HTTP polling.
• Muted participants retain history and unread state but do not receive future chat notification projections. No plaintext content, attachments, storage keys or signed URLs enter chat facts, transport logs or notification text.
Domain event contract
• Events describe completed facts and use past-tense names
• Source state is durable before publication
• on_demand.video.available follows the stored AddPipe projection and carries the provider's original availableAt
• Ordinary notification listeners are non-blocking; Quitter monitoring awaits promisified post-commit inbox dispatch before one-shot shutdown. MVP delivery stays in process.
• In-process delivery is best effort across termination; durable recovery requires a future outbox
• VIP/CRM reconcileWithParticipation holds the per-VIP transaction lock across current quitter/inactive/deleted validation, the Delivery public read callback and monitor persistence; older evaluation cutoffs cannot undo newer state. Typed vip.quitter.participation.identified/resolved facts use emitAsync after commit. Promisified listeners and awaited post-commit publication drain inbox work before the one-shot worker closes.
Projection + disclosure
• Consumers are idempotent and recoverable
• VIP note facts contain identifiers and revision only
• Clinical note activity requires its explicit read grant
• Quitter participation projects only to eligible active administrators with the effective identity.vip_quitter.participation_detected preference enabled. Stable per-target/VIP/episode creation preserves read state. withSourceProjectionLock serializes identified/resolved cleanup and fan-out; getCurrentEpisodeId is checked before/after projection and expireBySourceEntityPrefix removes all superseded episodes independently of preference while preserving current intent. Later reentry creates a new episode.
Durable async paths
• Per-staff inbox state is distinct from the provider-delivery outbox
• Role eligibility, mandatory rules, and per-staff overrides gate notification materialization; staff-access changes are always enabled
• Identity, Delivery, Engagement, Sales, Integrations, and scheduled due facts are projected asynchronously by Notifications; vip.renewal.weekly_digest.identified carries matched 90-day renewals and creates one subscribed financials-authorized inbox summary per staff/UTC week, with retry dedupe and no Slack output
• Disabled and ineligible targets are skipped independently; source writes remain committed and existing inbox items are unchanged
• notification.projection.committed is emitted only after create, refresh, read, read-all, or explicit expiration persists
• An asynchronous bridge turns committed inbox facts into local and Redis-backed notification.projection.changed signals
• Only staff:{staffUserId} receives inbox and unread-count invalidation events
• Zoom finalization and AddPipe storage use independent schema-versioned Redis Stream consumer groups
• AddPipe requests carry identifiers and an allowlisted HTTPS source; stored/failed results carry metadata and media bytes stay out of Redis
• Repeated invalid AddPipe results move to a bounded dead-letter stream; retryable work remains reclaimable and idempotent
• Failed work is retried without duplicating domain facts
• Notifications VipQuitterParticipationRuleService reacts to committed presence/profile facts and the existing generic worker reconciles the last 30 days through Delivery and VIP/CRM public contracts with four concurrent VIP evaluations. Monitor replay recovers lost projection; source-prefix cleanup recovers any missed expiration without resetting read state. Both per-VIP locks have a 15-second limit and contain bounded local database work only; no provider, Stripe or payment processing is added.
• Integrations opens and closes Zoom capture lifecycles independently of desired revisions. Finalization v3 atomically claims a participant and publishes one request only after the last shard stops; late capture facts are retained without closing an active cycle.
• The finalizer fences current closed lifecycle and participant-attempt metadata before media work and atomic result publication. Distinct attempt output names preserve old playable media; source epochs remain available. Stale request/result/failure projections cannot replace a newer capture, and progress distinguishes processing, failed and unknown states.
Evidence precedes projection
• Cataloged P0 and P1 critical changes commit owner state and Audit together; Audit is not a VIP Activity listener
• Owner events publish after commit. Nested transaction failure rolls back state, evidence and deferred publication
• Protected reads await a sanitized access entry. Denials append through a separate non-recursive path
• Integrations MediaDeletionJob persists intent before an event; recovery scans pending and abandoned work, uses bounded retries and fenced completion, and exposes authorized repair. Final owner state and evidence commit together without an audit-only outbox (ADR 0068)
• P1 VIP and assignment histories publish only after commit; assignment capacity and replacement decisions serialize in Identity. Previously audited video decisions are not recorded a second time
Per-feature rollout — ADR 0087
• Server-side flags gate requested staff Journey review reads, commands and private playback on the existing hosts. Identity roles and participation scope remain required; per-user targeting and percentage rollout cannot grant authorization.
• A disabled feature pauses its protected capability without deleting durable progress, submitted recordings or decisions. Existing owner state commits, past-tense in-process facts and authorized realtime recovery remain unchanged.
• Evaluation metrics are operational counts, not users or exposures. Future VIP A/B must record actual served/rendered experience and attributed outcomes without clinical or personal content; live provider setup and experiment instrumentation are not active.
Manual VIP email — ADR 0088
• Notifications owns EmailDelivery with the frozen active MessageTemplate revision, rendered content and reviewed sender/recipient. NotificationEvent carries emailDeliveryId only; EmailDeliveryFeedback and EmailSuppression retain normalized results and permanent-bounce/complaint blocks.
• Saved VIP email HTTP requires active StaffUser, vip_management.view and independent vip_email:send/read. Identity VipEmailRecipientsService resolves the exact internal profile and operational VIP id through its public facade; the worker rechecks deletion and unchanged recipient without importing Identity tables.
• The generic Notifications worker remains a channel-isolated durable fallback for Slack and leased/fenced email work. Amazon SESv2 sends one recipient with maxAttempts 1 and tfd_email_delivery_id correlation. An unresolved started send becomes uncertain rather than automatically resending; only definitive throttling uses bounded retries.
• After durable enqueue commits, an individual reviewed VIP email immediately attempts only its own delivery through the existing fenced EmailDispatcherService and returns the stored status. An identical request keeps the same delivery and cannot bypass scheduled retry time, duplicate a provider attempt, or drain unrelated mail.
• The existing Backoffice API owns an email-only composition-root pass in email-delivery-runtime.service.ts, registered only in AppModule. With EMAIL_DELIVERY_ENABLED=true it starts at bootstrap and checks every five seconds, without overlapping local passes, for approved due cycle schedules and queued email dispatch. Campaigns become visible only after their transaction commits; future due times, 60/120-second retry waits, expired-claim recovery and uncertain-send protections remain authoritative. The pass uses existing Notifications public services, stops with the API, and logs only sanitized failure codes. Slack, digests and the generic worker schedule are unchanged; no separate process, context, broker or email cron is created.
• Amazon SNS feedback must match the configured topic and verified signature using bounded allowlisted HTTPS certificates without redirects. Durable normalized feedback is correlated to provider message plus delivery id; permanent bounce/complaint suppresses current and future queued sends. Server delivery is not inbox/read proof. No CommunicationLog, Engagement fact or new runtime is created; real sender/DNS/AWS setup and deployment remain prerequisites.
• Notifications also owns revisioned EmailSignature profiles. A template may select one active profile or none; each profile supplies its own optional header and footer. A bounded declarative schema permits approved logos, plain text and HTTPS links.
• One composer builds template/VIP previews and HTML/text delivery. Reviewed signature id/name/revision and composed content freeze in EmailDelivery; enqueue locks and rechecks the active signature. Only the configured public asset origin may load images in the sandboxed preview.
• Signature authoring also exposes POST /email-signatures/:id/send-test, requiring an active administrator (StaffUser.userType=admin). A confirmation names the current StaffUser email; the server alone selects that recipient and checks the confirmed address and saved non-archived signature revision. A staff-scoped idempotency key and serialized one-minute limit atomically create EmailDelivery and a minimal email.signature_test.requested outbox fact. Test deliveries have recipientStaffUserId equal to the requesting actor, null vipProfileId/templateId, frozen sample content and signature, and no campaign. The existing fenced dispatcher immediately claims only that delivery, revalidates the active administrator address through Identity public contracts, and preserves SES/SNS feedback, suppression and uncertain-send protections. The API email-only pass and generic worker recover remaining queued work; no VIP record or separately deployed runtime is created. Administrator self-tests bypass the exact-recipient list through their separately authorized policy. The endpoint and dispatcher recheck administrator status; the global enabled flag, sender/SES/SNS configuration, recipient validity and suppression remain required. Other delivery uses its configured recipient policy, including the development-only current registered-VIP option.
Phase team communications — ADR 0090
• Identity publicly supplies bounded stable-VIP contact, status, membership, active-break and normalized shared-mailbox facts. Delivery publicly supplies current run/session audiences, cycle timelines and reviewed group/completion evidence; placement age is never completion.
• Delivery owns CommunicationRosterReview, PhaseTeachingPlanItem and PhaseResourceHandoff. Classification corrections preserve reason, actor/time, revision and append-only history. Teaching plans reuse ProgramAsset VIP document links; VIT guidance and temporary access URLs are not email resources.
• Notifications owns EmailCampaign, CycleEmailSchedule and StaffCommunicationTask. A reviewed campaign revalidates bounded bulk owner projections and atomically freezes private per-VIP EmailDelivery plus minimal NotificationEvent work under stable idempotency and template/signature locks. Cancellation affects queued work only.
• The existing notification worker activates no drafts automatically. Explicitly approved future cycle schedules use run timezone/calendar offsets, reevaluate due recipients and move changed or overdue intent to needs_review. Late joiners are considered at due time; historical catch-up requires a manual review.
• Calendar reads authorized staff tasks; due inbox notifications deduplicate by task/revision and never imply completion. Accepted frozen resource email reconciles idempotent Delivery handoff evidence. No new runtime, media path, VIP portal contract or graduation authority is introduced; existing Director progression governance remains authoritative.
• The false-default phase-team-communications flag gates staff navigation, Calendar reminders and all campaign/team HTTP routes without granting RBAC. Notifications rechecks each stored authorizing actor before due work; disabled schedules/reminders retain intent and revisions. Already queued email dispatch and accepted handoff reconciliation continue.
• Staff navigation exposes separate Communications, Session groups, Teaching plans and Team tasks modules. The session_leader role grants only dashboard.view plus dedicated phase_communications/phase_roster/phase_teaching/phase_tasks read-write capabilities. Each adapter and scheduled command enforces its own capability; the same feature flag gates all four. No dashboard shortcuts or indicators are added.
Prescription render commands and completed facts
• Prescription commands are versioned explicit requests on dedicated Redis Streams, not in-process imperative events. Durable immutable job state precedes dispatch. Worker progress/completed/failed/cancelled facts carry the job and attempt identities; the core verifies namespace and private object metadata and commits state before the authorized polling snapshot reveals completion. Cancelled or superseded attempts cannot attach their output.
Portal user invitations — ADR 0103
• Identity owns PortalInvitation and append-only PortalInvitationEvent, with per-email/actor transaction locks, request idempotency, immutable recipient and a hashed 256-bit bearer token. Staff use /settings/portal-invitations with portal_invitations:manage. Existing local/provider accounts block sends. Default validity is seven days (168 hours), configurable via PORTAL_INVITATION_TTL_HOURS; expiration is authoritative without a cron and reissue supersedes the old token. No VIP or enrollment is inferred.
• Public POST /portal/auth/user-invitation/inspect, /verification and /accept require exact portal Origin plus shared Redis traffic limits. A fixed-email OTP, hashed HttpOnly browser proof, bounded lifetime/resends/guesses and an atomic provisioning claim precede Cognito creation. Native verified subject/email must match before UserProfile invited-to-active and invitation consumption commit. Lost commit results are reconciled before compensating only a proven newly created unbound subject; uncertain creation/cleanup stays needs_review. The portal strips URL fragments and never persists secrets in browser storage.
• Notifications exposes a leaf auth-public invitation mail facade: a manually selected active MessageTemplate revision and optional signature render transient secret-bearing SES messages, without a regular EmailDelivery snapshot/outbox or a new runtime. VIP Users Email configuration binds Portal account invitation separately from legacy Cognito auth settings. Staff-issued invitations and their fixed-recipient proof codes bypass recipient allowlists, retaining enabled sending, valid sender/tracking configuration, address validation and suppression checks. Other email recipient policies remain unchanged. SES acceptance, failure and uncertainty are durable operational facts; no inbox receipt is inferred. StaffAuditLog adds an explicitly validated recipient email snapshot, fixed reason and correlation for completed sends only. Secrets and bodies never enter logs, audit or history. See docs/operations/portal-user-invitations.md.
• The November 4 amendment adds POST /portal/auth/user-invitation/confirm under the existing Origin and shared traffic guards. Identity validates the token, code and HttpOnly cookie under the invitation lock and shared expiry/attempt budget before VIP Platform reveals name/password fields. Confirmation never provisions, consumes or extends proof, creates a session or issues another credential. Final acceptance revalidates and atomically claims the same proof. The November 5 visual correction reuses the VIP Portal split photo/purple glass layout, white fields, shared visibility checkbox and dark actions; responsive invitation forms scroll without shrinking text; password policy remains twelve characters with uppercase, lowercase, number and symbol. No migration, environment variable or Notifications transport change is introduced.
• The verification-code email has a separate revisioned template binding in the existing Notifications PortalInvitationEmailSettings row portal-user-invitation-verification. Identity exposes GET/PATCH /portal-invitations/verification-template under message_templates:manage, recording existing sanitized configuration audit with resource verification-template and version only. Notifications requires visible verification_code, optional verification_validity_minutes, current template/signature revisions and no enabled buttons or markers. Identity passes the newly persisted proof deadline; rounded-up display minutes never extend expiry. Only an absent binding uses the original built-in copy. Rendered code/body remain transient; the fixed recipient, proof, resend, suppression and activation policies are unchanged. No migration, new runtime or env is introduced; publish API before Backoffice frontend.
• ADR 0105 adds native portal password recovery using the existing Cognito one-hour reset link and Password reset template binding, optional auth_validity_minutes=60, shared Redis IP/account limits and exact verified subject/email checks. A per-profile reset fence plus durable UserProfile authorization revision closes old BFF sessions; verified native password login heals uncertain provider outcomes. Reset never provisions, activates or signs in. Notifications uses its existing auth-public facade and settings table for a separate static portal-password-changed template. Dispatch and notice are best-effort without a new worker/outbox. VIP Portal strips fragments, respects Retry-After and offers normal sign-in. No new migration or env; live provider/inbox/CDN checks remain separate. See docs/operations/portal-password-recovery.md.
• ADR 0108 supersedes mandatory OTP with server-owned link-only policy; dormant verification endpoints reject requests while disabled. Identity records invitation_link_verified and retains fixed recipient, expiry, claim, conflict and compensation controls. Activation uses an application transaction with a Notifications auth-public enqueue callback; Notifications owns the unique PortalWelcomeDelivery intent, recipient/name and delivery leases. Existing API/worker processes poll it; aborted preparation retries, unknown sends remain uncertain, definitive rejection retries are bounded. The manual portal-welcome template requires a normal portal_url button, never a credential. Backoffice shows Account access and Password recovery, hides dormant code/provider-purpose controls and preserves legacy first access collapsed. A dedicated permission-protected retry for failed delivery records secret-free completed audit. Migration 20261109120000 precedes coordinated API/worker/frontend release. See docs/operations/portal-invitation-welcome.md.
Optional email action buttons — ADR 0104
• Notifications reserves button_enabled, button_label and button_url for email-only action controls. Variable definitions may persist default_value only for these controls; fictional examples never become live defaults. The existing template DTO/JSON and revisioned editor expose these saved values without a migration or new runtime. Explicit generic send values can override declared controls.
• Absent/false buttons return the existing body unchanged, preserving exact no-button HTML, signature layout and spacing. Enabled buttons require bounded plain text and a literal HTTPS URL or one declared non-button destination variable. The shared renderer appends trusted purple (#7D06D0) anchor/table markup after sanitized content, before optional signature composition, without allowing arbitrary body CSS. Preview, text fallback and delivery use the same result; reviewed delivery snapshots remain immutable.
• Portal invitations require button_url to reference the server-owned invitation_url; existing first-access/password-reset email binds to auth_url and preserves Cognito placeholders. No personal URL is persisted in a signature/default and no token enters audit. Default-off compatibility, unsafe destinations, variable aliases, provider placeholders and editor persistence are tested; real email-client appearance remains an operational verification. See docs/operations/email-action-buttons.md.
• The November 4 amendment adds up to five content.action_buttons entries (id, enabled, label, url), each positioned by exactly one standalone {{action_button:<id>}} paragraph. The generic {{action_button}} positions the legacy action; absent markers preserve its append behavior. Disabled paragraphs disappear. DTO/editor validation rejects duplicate, unknown, inline and subject markers. A per-render sentinel protects configured placement from variable-value injection before trusted HTML rendering. Invitation/auth require the expected personal link and allow supplemental named HTTPS actions. No new table, runtime or event is introduced; deploy API/worker before frontend and rebind revised templates.
Workflow diagram • Built with Archify • Create yours ↗ • Hover to trace • R route • Click to focus • +/− zoom • M radar • [/] views • P play story • T theme • E export