Incident domain implementation
This page describes how the Incident domain model is realized at runtime: event-sourcing/CQRS mechanics, storage topology, projections, APIs, integrations, and the current-vs-target status. The generic V3 event-sourcing pattern it builds on is documented in Data and events; this page covers only the incident-specific specifics.
Runtime topology
The incident bounded context is an event-sourced write model with state-based CQRS read models. A provider update enters as a command, the aggregate reconstructs from its Cosmos stream, invariants are checked, and events are appended against the loaded stream version. The Change Feed publishes committed events, and projectors rebuild the Azure SQL operational model.
Current implementation vs target model
| Area | Current implementation | Target or reference status |
|---|---|---|
| Incident consistency boundary | Event-sourced IncidentAggregate | Current |
| Entity enrichment boundary | Separate event-sourced EntityAggregate | Current |
| Incident context | Blob-backed Sentinel context plus events and SQL projections | Current |
| Merge and de-merge | No commands, events, handlers, or aggregate behavior | Reference-only target |
| Incident deletion | No incident delete or soft-delete lifecycle | Reference-only target |
| Purging | Can purge one matching latest event; not an incident or comment purge model | Current, narrowly scoped |
The older Incident domain reference describes proposed merge/de-merge and deletion capabilities. Those capabilities must not be presented as implemented V3 behavior.
Persistence and projections
| Store or transport | Role |
|---|---|
Cosmos DB event_store / incidents | Authoritative append-only streams, partitioned by partition_id |
| Blob storage | Full Sentinel context payloads; streams retain blob names and alert-ID deltas |
| Cosmos change feed | Publishes committed events to the incident-events Service Bus topic |
| Azure SQL | Operational incident, alert, entity, relationship, comment, rating, tag, and scheduler views |
| HTTP API | Reads the Azure SQL operational model; it is not an alternate write authority |
The SQL projection includes both unstable incident-scoped entities and deterministic entities, plus alert/entity relationship projections. See event store, event sourcing, and reporting for the shared patterns, and replay for rebuilding consumers.
Integrations
| Integration | Implemented interaction |
|---|---|
| Sentinel/Defender | Supplies incident metadata and alert/entity context |
| Ticket boundary | Consumes incident changes, patches external tickets, and returns ticket state, severity, closure, archival, and customer-reference changes |
| Escalation | Projects active-escalation state and affects waiting-for-customer scheduling |
| Response actions | Ticket closure may query unresolved response actions and add an incident comment |
| Automation and filtering | Produces scoped, filtered, learning, non-AAA, label, comment, and auto-close outcomes |
| Reporting and APIs | Consume the SQL operational projection and published events |
Implementation evidence
The primary implementation is boundedctx-incidents.