Skip to main content

EventStorming

Following the ddd-crew EventStorming glossary: domain events in orange, commands in blue, policies in lilac, read models in green, external systems in pink and hotspots marked. The board is reconstructed from the code, not from a workshop.

Timeline​

Source: internal/adapters/inbound/kafka/handlers.go (the facts), internal/application/usecases/intake.go (deduplication and recording), cmd/api/workers.go (runRecompute), internal/domain/scorecard/scorecard.go and grade.go (grading and alert policies), internal/domain/scorecard/eligibility.go (FastTierEligibility, tierEvents), internal/adapters/outbound/kafka/encoder.go (the three events). The FastTierEligibility policy runs inside Recompute only for the 7d scorecard and only on a GRADED result, and raises NodeTierEligibilityChanged only when the flag flips (eligibility.go assess); delivery-promise's reaction is in its own apis/asyncapi.yaml.

Hotspots​

HotspotWhat the code does about it
Facts arrive in no global order across topicsA handover or acknowledgement that beats its purchase order is retried (200 ms doubling to 5 s, 5 attempts) and then dead-lettered; there is no automatic redrive from the DLQ.
PromiseBroken for causes that are not the node's faultOnly LATE, LATE_HANDOVER, VENDOR_REJECT, ACK_EXPIRED count; other causes are acknowledged and ignored.
A quiet new node must not look goodUnder 50 observations a scorecard is PROVISIONAL and publishes nothing.
Observations leave the window with no new factExpiresAt makes a scorecard due when its oldest observation expires, so a grade can fall back to PROVISIONAL.
Declared profile next to measured capabilityNot modelled: NodeOperationalProfileDeclared is consumed with no effect and no read model holds it.
Inbound accuracy mixes node and seller causesInformational only, never graded.
Kafka down while recomputingThe event waits in the outbox; delivery is at-least-once, consumers deduplicate on the id.
A suspended node that stops reportingIt is only recomputed when observations leave its window, so it stays suspended until fresh facts say otherwise (ADR 0013 consequences).

Aggregate and read model​

One aggregate, NodeScorecard (canvas). The two reads (GET /scorecards/{nodeId}, GET /scorecards?grade=) read its table directly; there is no separate read model.

Policies​

PolicyWhenThenOwner
Deduplicatean event arrivesclaim its CloudEvents id in processed_events, or stopNode Performance
Late acknowledgementan acknowledgement is recordedlate if in the last tenth of the ack windowNode Performance
Gradinga recompute has 50 or more observationsgrade A to DNode Performance
Threshold alerta recompute moves a metric across its boundraise NodeThresholdBreachedNode Performance
Fast-tier eligibilitya GRADED 7d recompute is below 0.90 on-time handover (suspend), or at or above 0.95 on three consecutive distinct UTC days (reinstate)raise NodeTierEligibilityChanged, one per tierNode Performance
Scorecard handicapNodeScorecardUpdateddelay the node's ship-bydelivery-promise
Assignment costNodeScorecardUpdatedweigh the grade in the costorder-sourcing
Fast-tier gateNodeTierEligibilityChangeddrop an ineligible node from the SAME_DAY / NEXT_DAY candidates of future quotes and estimates; existing promises are never toucheddelivery-promise