ADR-0006 — Event Sourcing as the persistence strategy
Forces / Drivers
- Requirement / Constraint:
../context/requirements.md#fr-2-event-store— FR-2 Event store: durable, append-only, versioned, stream-based, immutable.../context/requirements.md#fr-7-auditing-and-replayability— FR-7 Auditing + replay: complete history per aggregate, replayable to any point in time, per-user / per-entity / per-customer query.../context/requirements.md#nfr-2-reliability— NFR-2 Reliability: SLO 99.9 %, RTO 1 h, RPO 0 (no data loss).../context/constraints.md#tc-4-eventual-consistency— TC-4 Eventual consistency across systems is accepted; strong consistency required per-aggregate.../context/constraints.md#bc-3-compliance-and-regulatory— BC-3 Compliance (GDPR / HIPAA / PCI DSS): auditable trail; per-customer deletion on off-boarding.../context/capacity-model.md#derived-processing-load— At the 1,000-customer reference envelope: approximately 208M domain events/month (D9: 20 events/incident × approximately 10.4M incidents/month); six months hot plus one year cold retention.
- Principle(s) embodied:
§ 8 Event Sourcing,§ 7 ECST,§ 6 Choreography,§ 3 DDD modelling. - WAF pillar optimized:
reliability(primary);operational-excellence,performance-efficiency,security(secondary).
Context
V2 used a traditional operational store per bounded context: an aggregate’s current state was the row (or document), mutated in place; history — where kept at all — lived in a bolted-on audit log or in the source system (Sentinel, ServiceNow). Three forces made this untenable for V3:
-
Auditability as a hard requirement, not a feature. As an MXDR provider, every state transition on a security incident, ticket, or investigation is a compliance artefact. “Who changed the status of incident X to
AutoClosedat 03:12 UTC, on the strength of which enrichments, in reaction to which upstream Sentinel event?” must be answerable years after the fact — not “usually” answerable from log queries. V2’s audit-log-as-side-effect could not guarantee this without heroic effort per query. -
Replay as a routine operation. The V3 platform runs many downstream projections — operational stores, reporting/dashboard stores, external integrations (ServiceNow, Sentinel writeback), automation triggers (Cogs), notifications (Pigeon), AI investigator inputs (ION IQ). Any of these can be added later, changed later, or need to backfill. In a state-store world, every backfill is a bespoke migration script against the source system’s API — expensive, fragile, rate-limited (see TC-2 external API ceilings). If the log is the source of truth, backfill is replay the log into the new projection.
-
Choreography (ADR-0003) needs a source of truth for events. ADR-0003 makes events the coordination substrate; ADR-0004 makes events carry state; ADR-0005 makes the event schema a first-class contract. If events are the currency of the platform, the natural persistence primitive is not “the current state” but “the append-only sequence of events that produced it”. Anything else creates a dual-write problem (write to state store + publish to broker) that has to be solved with outbox patterns and CDC anyway (see
patterns/handling-dual-writes.md). Event Sourcing dissolves the dual-write problem: the event is the state change.
At the same time, the pattern is not universally applicable. Every service adopting event sourcing pays a real cost: aggregate design becomes load-bearing; projections need to be authored and maintained; read-your-writes semantics do not come for free; event schema evolution has to be disciplined (ADR-0005 is a prerequisite, not an afterthought). The decision is not “everything is event-sourced everywhere” — it is “event sourcing is the default persistence strategy for domain aggregates whose history matters, and V3 identifies which aggregates those are”.
Decision
V3 adopts Event Sourcing as the persistence strategy for domain aggregates whose history is a first-class product concern. Concretely:
- The event log is the system of record. For each in-scope aggregate, every meaningful state transition is captured as an immutable, versioned, timestamped domain event appended to that aggregate’s stream in an event store. The event store is authoritative; any other representation of state is a projection.
- Streams are per-aggregate. Stream ID =
<AggregateType>-<AggregateId>(e.g.SecurityIncident-{incidentId}). Streams are the unit of write consistency: atomic append + optimistic-concurrency check per stream. - In-scope aggregates for V3:
- Incident (owned by Watchtower) —
../references/ION v3- Incidents Event Store.md - Ticket (owned by Watchtower’s ServiceNow integration boundary) —
../references/ION v3- Tickets Event Store.md - Investigation (owned by the Investigation domain) —
../references/ION v3- Investigation Event Store.md - Additional aggregates (customer collaboration, assets, vulnerabilities) evaluated per the adoption test below.
- Incident (owned by Watchtower) —
- CQRS is the read model. The event log is the write model; projections into query-optimised stores (operational DBs, reporting store, cache) are the read models. Projections are recomputable from the log by replay. See
../references/ION v3- Reporting Data Store.md. - Events are notified downstream via broker subscriptions, not dual writes. Change Feed / CDC-style projection from the event store into a message broker eliminates the dual-write problem (
patterns/handling-dual-writes.md). - Consistency posture: strong within a stream (per-aggregate optimistic concurrency, atomic append); eventual across streams and projections — this is the TC-4 acceptance, not an accident.
- Retention: hot 6 months (queryable at write-store latency), cold 1 year (archived; replay-capable but higher-latency). Beyond 1 year: subject to per-customer archival / deletion policy (BC-3).
- Schema discipline is ADR-0005. Events use CloudEvents envelope + AsyncAPI-described payloads; every event carries
typewith.vNversioning; backward-compat evolution rules apply.
Adoption test — an aggregate is event-sourced when at least two of the following hold: (a) its history is a compliance or product requirement (audit, timeline, replay); (b) multiple downstream projections consume its state; (c) it is coordinated cross-system via events already (ADR-0004); (d) rebuild-from-scratch of downstream stores must be possible without upstream re-fetch. Aggregates failing this test — configuration data, key-asset store, ephemeral operational state — use conventional persistence.
Explicitly out of scope for event sourcing: the Key Asset Store (Veritas), configuration/customer registry, cache tiers, and the reporting projection itself. Event sourcing is the source-of-truth pattern for domain aggregates; it is not a database category.
Technology choice deliberately deferred to a separate ADR — see ADR-0007 (planned: Cosmos DB as event store technology). This ADR is about the pattern; the technology decision must survive on its own merits.
Alternatives considered
-
Option A — Traditional CRUD state store + audit log as a side effect. The V2 posture. Rejected because: (i) audit log is a best-effort side effect, not a system-of-record — reconstructing history requires trust in log completeness, which cannot be guaranteed without transactional coupling; (ii) creates the dual-write problem (state store + broker) that has to be solved with outbox or CDC patterns anyway; (iii) backfilling a new downstream projection means bespoke migration against upstream APIs, hitting TC-2 rate limits and losing history that upstream systems do not preserve.
-
Option B — Change Data Capture (CDC) on the operational database as the “event stream”. Rejected because: (i) CDC events are database-row change records, not domain events — they leak schema and lose intent (a status change from
Open→AutoClosedlooks the same as a manualOpen→Closedat the row level, but they are different domain events with different downstream consequences); (ii) CDC couples every consumer to the write-model schema, defeating volatility-based decomposition (ADR-0002); (iii) evolving the write-model schema breaks every CDC consumer, which is precisely the coupling ADR-0005 eliminates. -
Option C — Event sourcing on a distributed log broker (Kafka / Event Hubs) as the store itself. The “log as database” approach. Rejected as the persistence primitive because: (i) Event Hubs retention is capped (max 90 days on Premium, ≤ 7 days on Standard) — insufficient for the 6-month hot / 1-year cold retention (D10); (ii) point-read latency on a log broker is not competitive with a document store for stream reconstruction on the command path; (iii) log brokers are optimised for throughput and sequential read, not for the aggregate read pattern (read all events for stream X, in order, in one transaction) that Event Sourcing requires. Event Hubs is also not part of the V3 internal event backbone (see ADR-0008).
-
Option D — Hybrid: event source only some aggregates, CRUD the rest, connect via outbox. Rejected as the platform default rule — but adopted as the outcome of the adoption test. The pattern-level decision is that event sourcing is the default for aggregates passing the adoption test; the adoption test itself acknowledges that not everything qualifies. Making hybrid the default would fragment discipline: engineers would default to CRUD (the more familiar option) and every event-sourced aggregate would need to be justified individually. The adoption test flips the burden of proof.
-
Option E — Adopt an off-the-shelf event-sourcing framework (EventStoreDB, Marten). Rejected on two independent grounds. First, § 21 Azure-native managed services first — EventStoreDB has no Azure PaaS offering; adopting it as the pattern’s substrate would commit ION to a second self-hosted stateful cluster forever (the tech-choice consequences of this are formally discharged in ADR-0007). Second, at the pattern level: (i) ION services live in multiple language stacks (TypeScript, Python, C#) and framework maturity varies wildly across them; (ii) the pattern is well-understood and the primitives (append, optimistic concurrency, read stream, project change feed) are small — a shared library across services beats a per-language framework; (iii) frameworks tend to bring their own storage assumptions, defeating the ADR-0007 deferral.
Rationale
Event Sourcing wins on the four requirements that the V2 posture could not meet without heroic effort:
- Auditability by construction. FR-7 becomes a query, not a project. The log is the audit trail; any question of the form “what was the state of aggregate X at time T?” or “what caused the transition Y → Z?” is answerable by reading a stream — no separate audit-log system to keep in sync, no gaps.
- Replay by construction. Adding a new projection (a new dashboard view, a new external integration, a new AI investigator input) is “subscribe to the change feed from timestamp T and project forward”. Rebuilding a corrupted projection is “truncate the projection, replay the log”. Neither operation requires touching upstream systems or hitting their rate limits.
- Choreography’s natural persistence primitive. ADR-0003 makes events the coordination substrate. Event Sourcing makes events the persistence substrate. The two align: a service that changes state emits an event, and emitting the event is the state change. No dual-write. No outbox pattern needed at the aggregate boundary (still needed at broker-fan-out — see
patterns/handling-dual-writes.md). - RPO 0 becomes tractable. Append-only writes to a durably-replicated store, with the change feed as the fan-out mechanism, gives a clear DR story per store (see planned ADR: Event Store DR): if the store survives, no committed event is lost; if the store is lost, replay from the last snapshot + change-feed catch-up restores every downstream projection.
The trade-offs are real (see Consequences) — projection maintenance, aggregate design as a load-bearing decision, eventual consistency across projections, storage growth — but they are the right trade-offs for aggregates whose history is a product concern. The adoption test keeps event sourcing from being over-applied.
Consequences
Positive
- Full auditability. Every state transition is a first-class, immutable, timestamped, attributed record. Compliance queries (GDPR right-to-erasure, incident-history discovery) reduce to stream reads.
- Full replayability. New projections, corrupted projections, and downstream-consumer re-processing all reduce to change-feed subscription from a chosen offset. Backfill against upstream Sentinel / ServiceNow is no longer needed once the event is captured.
- CQRS unlocks read-side scaling. Reporting store (V3-new —
../references/ION v3- Reporting Data Store.md) is a projection tuned for dashboard freshness; operational store is tuned for command-path reads; each scales independently on its own axis. - Temporal queries by default. “What did we know about this incident at 04:00 UTC?” is a stream read at that offset. This directly supports incident-response forensics — a real product feature.
- Dual-write problem dissolves at the aggregate boundary. The event log is the single write; broker fan-out is a downstream projection, not a co-committed side effect.
- Vendor-lock-in mitigation (§ 20). The event log is portable data; migrating a downstream projection (or the whole downstream stack) is easier than migrating a CRUD state store.
- AI investigator (ION IQ) input surface is natural. The event log is literally what happened, in the order it happened, with intent captured. No feature-engineering pipeline needed on the write side.
Negative
- Aggregate design becomes load-bearing. Getting the aggregate boundary wrong (too coarse → contention on the stream; too fine → cross-stream transactions needed) is much more expensive to fix than in CRUD. Requires up-front DDD discipline (§ 3).
- Projection maintenance is real work. Every read model is a separately-authored, separately-deployed, separately-monitored component. Bug in a projection = rebuild the projection.
- Read-your-writes on projections is not free. A command that appends to the log completes before the projection catches up. UIs must be designed for this (optimistic UI, projection versioning header, or session-consistent read-your-writes on the write store) — see
../references/Event Sourcing- MFE UI Interaction Design Pattern.md. - Storage growth is monotonic. At 1000-cust plan: ~208M domain events/month × ~2 KB = ~416 GB/month of event storage growth (before compression). Hot 6 mo alone is ~2.5 TB. Archival + tiering (hot → cold → deletion) becomes a hard operational requirement, not a nice-to-have. See
../context/capacity-model.md#data-volume-and-lifecycle. - Schema evolution is unforgiving. An event written today must deserialise a year from now. ADR-0005’s schema-evolution rules are a hard prerequisite; there is no “just migrate the row” escape hatch.
- Debugging shifts. “What is the state of X?” is not a single row lookup — it is a stream reconstruction (or a projection query with a caveat about staleness). New engineers need to learn to read the log.
- Eventual consistency across streams. Cross-aggregate invariants cannot be enforced transactionally — they become sagas or process managers (which V3 keeps out via ADR-0003 choreography). Requires explicit domain design to keep invariants inside single aggregates.
Neutral / follow-ups
- ADR-0007 — Event store technology choice (Cosmos DB — pending). The pattern here is technology-agnostic; the tech decision has to survive its own analysis.
- Snapshotting policy. V3 references note snapshots are unnecessary while streams stay under ~100 events per aggregate (typical for security incidents). Codified as a per-aggregate operational decision; reconstruction capacity is documented in Capacity, sizing, and scaling.
- Archival policy. Hot (queryable) → cold (blob, replay-capable) → deletion (per-customer off-boarding). Documented in
well-architected/reliability/dr/implementation/cosmos-db.mdxandwell-architected/security/data-protection/. - Projection catalog. Projection ownership, freshness, and rebuild behavior are documented in the canonical V3 data and events design.
- Idempotent-write pattern (
patterns/idempotent-write.md) — every command handler must produce the same event on replay. Enforced at code-review and by unit tests. - Change-feed transport binding — how the event store’s change feed maps onto shared Service Bus topics + subscriptions. Documented under ADR-0008.
WAF Pillar Impact
- Primary pillar:
reliability— RPO 0, replayable recovery of projections, no data loss on the source-of-truth path, single write per state change (no dual-write to reconcile). - Secondary pillars:
operational-excellence— auditability by construction, debugging via replay, projection rebuild without upstream re-fetch. Turns runtime forensics into log reads.performance-efficiency— CQRS enables per-read-model scaling; write path is append-only (best-case Cosmos performance profile); freshness targets tuned per projection independently.security— immutable event log provides tamper-evident audit trail; per-customer partition scheme (stream ID prefix) enables clean off-boarding and data-residency scoping.
- Trade-offs:
- Sacrifices simplicity of “one row = current state” for the durability and replayability of the log.
- Sacrifices storage cost (monotonic growth) for auditability and replay — tiering + archival policy is a hard operational requirement.
- Sacrifices cross-aggregate transactional consistency for per-aggregate append-only guarantees and independent scaling.
- Sacrifices projection freshness (eventual consistency) for read-model scaling and rebuild-ability.
- Increases design cost per aggregate (DDD discipline is a prerequisite, not a nice-to-have).
Previous approach (V2)
V2 used per-bounded-context operational databases as the source of truth, with history captured — where captured at all — via bolted-on audit-log tables, Log Analytics workspace queries, or the source-system’s own history (Sentinel incident history, ServiceNow audit records). Three concrete pain points drove the change:
- Audit coverage was inconsistent. Whether a given state change was auditable depended on which service made it and whether the developer remembered to write an audit-log row. Compliance queries required stitching across systems and could not guarantee completeness.
- Adding a new consumer meant fetching from upstream. New dashboards, new reporting features, new external integrations all required re-fetching from Sentinel / ServiceNow — hitting rate limits (TC-2) and losing history the upstream systems did not preserve.
- The dual-write problem was pervasive. Every service that changed state and published an event had to solve write-then-publish reliability separately. Some used outbox, some used at-least-once + idempotent consumers, some just accepted lost publishes. Inconsistency was the norm.
V3 dissolves all three by making the event log the source of truth: audit is free, replay is free, dual-write is gone at the aggregate boundary.
The V2 posture is not fully deprecated — the adoption test explicitly keeps CRUD as the right choice for aggregates that fail the test. What changed is the default, and the identification of which aggregates in ION belong on which side of the line.
Amendments
- 2026-10-15 — Reliability objectives pointer. The RTO 1 h and RPO 0 cited in this ADR are design objectives for the planned warm spare, not current guarantees. Current objectives are stated per scenario in the ADR-0017 amendment “Reliability objectives clarified”.
References
../references/Architecture- Event Sourcing.md— the V3 event-sourcing requirements + rationale foundation (business + FR + NFR).../references/Event Sourcing- Design.md— the end-to-end command-to-projection design flow.../references/Event Sourcing- Event Store.md— event-store feature requirements + tech-comparison (feeds ADR-0007).../references/Event Sourcing- Event Model.md— the event-type inventory.../references/Event Sourcing- Security Incidents.md— Incident aggregate design + phased rollout plan.../references/Event Sourcing- Event Store Disaster Recovery.md— DR posture that this ADR enables (RPO 0).../references/Event Sourcing- UI Interaction Design Pattern.md,../references/Event Sourcing- MFE UI Interaction Design Pattern.md— read-your-writes on projections at the UI boundary.../references/ION v3- Incidents Event Store.md,../references/ION v3- Tickets Event Store.md,../references/ION v3- Investigation Event Store.md— the three in-scope aggregates for V3.../references/ION v3- Reporting Data Store.md— the reporting projection.../references/Incident Bounded Context- Design.md— capacity envelope for the Incident event store.../references/Design Pattern- Idempotent Write.md,../references/Design Pattern- Handling Dual Writes.md,../references/Design Pattern- Audit Logs.md— supporting patterns.- External: Martin Fowler — Event Sourcing, Martin Fowler — Domain Event.
Related ADRs
- Depends on:
- Enables:
- ADR-0007 (pending) — Cosmos DB as event store technology.
- ADR-0008 — Event backbone (shared Service Bus): change-feed → broker binding.
- Pending: Event Store DR posture, Reporting data store choice, MFE UI interaction pattern.
- Related: