ADR 0029: node status and listing suppression follow "newer time wins", and a retired node is terminal
Status
Accepted (2026-11-15). Completes ADR 0028 (whose last consequence left these two projections for "a separate change") and follows the precedent of ADR 0022. Amends the consumed-contract reading of ADR 0003 for NodeProfileView and AvailabilityView.
Context
The context documentation (warehouse-docs, delivery-promise domain-events) words the projections of NodeActivated, NodeSuspended, ListingSuppressed and ListingRestored as "newer time wins" and NodeRetired as "RETIRED (terminal)". The code did neither: OnNodeStateChanged and OnListingToggled wrote whatever arrived last.
- A
NodeSuspendedreplayed or delivered late after a newerNodeActivatedtook a healthy node out of the candidate set; an olderNodeActivateddelivered after a newerNodeSuspendedput a suspended node back, so the search quoted promises from a node that had been taken out of service. - Any
NodeActivatedorNodeSuspendeddelivered afterNodeRetiredrevived a retired node. node-topology ADR 0002 makesRETIREDterminal at the producer (ErrNodeRetiredon every command), so such a message can only be an out-of-order delivery, never a real revival. - The same last-delivered-wins hole existed for a suppressed listing that a late older
ListingRestoredbrought back to the candidate set (and the reverse).
The three sources agree (ADR 0022 and 0028 for the rule, warehouse-docs for the wording, node-topology ADR 0002 for the terminal state) and only the code diverged, so the code is fixed, not the text. Covered by features/stale_facts_rules.feature and internal/application/usecases/projections_state_order_test.go.
Decision
readmodel.NodecarriesStateAt, the CloudEventstimeof the newestNodeActivated/NodeSuspendedapplied toState;readmodel.ListingcarriesSuppressedAt, the CloudEventstimeof the newestListingSuppressed/ListingRestoredapplied toSuppressed. Both live in the row'sdatajsonb: no migration.OnNodeStateChanged(NodeActivated,NodeSuspended): dropped whentimeis older thanStateAt; an equal instant is the later delivery of the same fact and applies (the ADR 0022 rule).OnListingToggledfollows the same rule againstSuppressedAt. A zero instant on either side (an older producer, a row written before the stamp existed) carries no ordering: the fact applies, as before. The samestaleFacthelper serves ADR 0028's capacity facts.RETIREDis terminal. A node whose row saysRETIREDtakes no later status fact, whatever its time or type.NodeRetireditself applies whatever itstime(it cannot be older than a real activation; if it arrives late it still retires the node, and a laterNodeActivatedstays dropped). ANodeRetiredthat arrives beforeNodeRegisteredkeeps the row retired: registration never touches the status.ListingAvailabilityChangedkeeps its ownasOfguard (ADR 0003) and, rewriting the row, keepsSuppressedandSuppressedAt.
Consequences
- A late older fact is dropped silently; there is no new metric or error, and the inbox row is still written, so the event is not redelivered (same as ADR 0028).
- Rows written before this change have no stamp and accept the first status or suppression fact unconditionally; they are stamped from then on. A node already revived from
RETIREDby the old code stays active until the producer repeats a status (nothing here rewrites history); a repeatedNodeRetiredretires it. - A retirement cannot be undone from this side. If node-topology ever allows a node to be re-registered after retirement, that is a new node id or a new ADR; this projection will not follow it.
- No contract, REST, MCP or event-envelope change; the CloudEvents
timewas already consumed (Meta.Time). - Docs:
docs/docs/ddd/domain-events.md,eventstorming.md(H2) anddevelopment/testing.mdstate the new rule.