Skip to main content

Domain events

Every event this context publishes and consumes, with the envelope rules of ADR 0004. The summary tables are on the Event catalogue; this page carries the field-level detail.

Envelope​

AttributeValue
specversion1.0
ida UUID minted once when the event is appended to the outbox; a redelivery carries the same id
source/retailnetwork/node-performance
typecom.retailnetwork.partner.node-performance.scorecard.<EventName>
subjectthe aggregate root id, scorecardId = nodeId:window (for example N-0042:30d)
timethe recompute instant (computedAt)
datacontenttypeapplication/json
dataschemaurn:retailnetwork:node-performance:<events|analytics>:<EventName>:v1
Kafka keythe scorecardId, same as subject
Kafka headercontent-type: application/cloudevents+json; charset=UTF-8 (plus traceparent/tracestate when a span was active)

Source: internal/adapters/kafka/cloudevents/cloudevents.go (Type, DataSchema, New), internal/adapters/outbound/kafka/encoder.go (Encoder.Encode).

Published​

NodeScorecardUpdated​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeScorecardUpdated
Topicretailnetwork.node-performance.events (and only that topic)
Produced byRecompute after the scorecard is saved (outbox row in the same transaction)
Raised whenstate, grade or metrics changed; never PROVISIONAL to PROVISIONAL; also GRADED back to PROVISIONAL
Consumersdelivery-promise (scorecard view and handicap), order-sourcing (scorecard view and assignment cost)
FieldTypeMeaning
nodeIdstringThe node, as minted by node-topology.
windowstring7d or 30d.
gradestringA, B, C, D, or PROVISIONAL while the state is.
onTimeHandoverRatenumber in [0,1]On-time handovers over handovers.
lateAckRatenumber in [0,1]Late acknowledgements plus expiries over acknowledged or expired orders.
rejectRatenumber in [0,1]Rejected over acknowledged or expired orders.
expiryRatenumber in [0,1]Expired over acknowledged or expired orders.
promiseKeptRatenumber in [0,1]Kept over kept plus node-attributable broken promises.
feedFreshnessP95Minutesinteger, minutesNearest-rank p95 of the gaps between applied inventory feeds.
observationsintegerObservations counted in the window.
computedAtRFC 3339 instantWhen the recompute ran.

The two inbound metrics are not on this event.

NodeTierEligibilityChanged​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeTierEligibilityChanged
Topicretailnetwork.node-performance.events (integration topic; dataschema stream events)
Subject / keythe scorecardId of the 7d scorecard, nodeId:7d
Produced byRecompute of the 7d scorecard (policy FastTierEligibility, ADR 0013), only when the eligibility flag flips: two events per flip, one per tier, the same changedAt, in the same transaction as the scorecard save. No event for the initial eligible state.
Consumersdelivery-promise (fast-tier eligibility per node)
FieldTypeMeaning
nodeIdstringThe node.
tierstringSAME_DAY or NEXT_DAY.
eligiblebooleanThe state the node moved to: false on suspension, true on reinstatement.
metricstringonTimeHandoverRate.
valuenumberThe 7d rate that caused the change.
thresholdnumber0.90 on suspension, 0.95 on reinstatement.
windowstring7d.
changedAtRFC 3339 instantThe recompute instant.

NodeThresholdBreached​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeThresholdBreached
Topicretailnetwork.node-performance.analytics (analytics only, never the integration topic; dataschema stream analytics)
Produced byRecompute, one event per metric that moved from the healthy to the unhealthy side of its bound between two GRADED states
Consumersnone in the organization
FieldTypeMeaning
nodeIdstringThe node.
metricstringThe metric that crossed: onTimeHandoverRate, lateAckRate, rejectRate, expiryRate, promiseKeptRate or feedFreshnessP95Minutes.
valuenumberThe metric's new value.
thresholdnumberThe bound it crossed.
windowstring7d or 30d.

Consumed​

Every consumer dispatches on the full type string and is idempotent on the CloudEvents id: the processed_events inbox row and the effect commit in one transaction. A duplicate id is acknowledged and skipped; behind it ErrDuplicateObservation stops a second count of the same source event inside a scorecard. Each topic has its own consumer group (Runbook).

ProducerFull typeFields usedWhat this context does
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.vendoraccount.VendorOnboardednoneAcknowledged: inbox row only.
vendor-connectivity...purchaseorder.PurchaseOrderIssuedpoNumber, nodeId, requiredShipBy, ackBy; envelope time as issuedAtUpserts the purchase-order facts; no observation.
vendor-connectivity...purchaseorder.PurchaseOrderAcceptedpoNumber, nodeId, acceptedAtACK_ACCEPTED observation, late in the last tenth of the ack window.
vendor-connectivity...purchaseorder.PurchaseOrderRejectedpoNumber, nodeId, rejectedAtACK_REJECTED observation (an acknowledgement and a rejection).
vendor-connectivity...purchaseorder.PurchaseOrderExpiredpoNumber, nodeId, ackByACK_EXPIRED observation, always late.
vendor-connectivity...purchaseorder.VendorShipmentConfirmedpoNumber, nodeId, requiredShipByFills requiredShipBy of the facts; the vendor's own shippedAt is not used.
vendor-connectivity...submission.SubmissionProcessednoneAcknowledged: inbox row only.
vendor-connectivity...inboundreceipt.InboundReceiptSubmittednodeId, shipmentId, receivedAt, cartons[].statusStores carton counts; informational inbound metrics.
shipping-and-trackingcom.retailnetwork.logistics.shipping-and-tracking.journey.PackageHandedOverpoNumber, nodeId, handedOverAtHANDOVER observation, on time if not after requiredShipBy.
delivery-promisecom.retailnetwork.commerce.delivery-promise.promise.PromiseKeptnodeId, deliveredAtPROMISE_KEPT observation.
delivery-promise...promise.PromiseBrokennodeId, cause, optional deliveredAtPROMISE_BROKEN observation only for LATE, LATE_HANDOVER, VENDOR_REJECT, ACK_EXPIRED; otherwise ignored.
offer-availabilitycom.retailnetwork.commerce.offer-availability.inventoryfeed.InventoryFeedAppliednodeId, appliedAtFEED_APPLIED observation.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeRegisterednoneAcknowledged; a node's scorecards are created by its first observation.
node-topology...node.NodeOperationalProfileDeclarednoneAcknowledged; the declared profile never enters a metric.
seller-inboundcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentShippednodeId, shipmentId, shippedAtStores the shipped instant (first wins).

Source: internal/adapters/inbound/kafka/handlers.go (the type constants, payload structs and handlers), internal/application/usecases/intake.go. Partition order: each producer keys by its own aggregate id, so facts about one node arrive on many partitions in no global order; a scorecard does not depend on arrival order except that acknowledgements and handovers need their purchase-order facts first (retried, then dead-lettered).