Skip to content

TOC-82 Retire nodes, replace rebuilt stores, conflict duplicates - #65

Merged
jensenbox merged 1 commit into
mainfrom
TOC-82-decommission
Oct 28, 2026
Merged

jensenbox merged 1 commit into
mainfrom
TOC-82-decommission

Conversation

@jensenbox

Copy link
Copy Markdown
Member

Retiring a node, a rebuilt node's new store, and two machines pushing as one node now each end in a defined state (TOC-82, step 8 of docs/design/federation.md).

Behaviour

  • One active store per node. If a store pushes for the first time while the node has another active store, it replaces that store. In the same transaction as the new batch, the old store becomes retired with superseded_at set, and its open outages are withdrawn (ending = withdrawn; their alerts end as ended by config). The hub logs a warning.
  • Two machines pushing as one node. The batch is rolled back and every remote store of the node is marked conflicted in a separate transaction. That happens when:
    • a replaced store pushes again, or
    • a store resends an outage change whose end or open differs from what was applied.
      The push gets a 409. The node's node:<id> liveness heartbeat is pinged Down with the conflict text, so it alerts straight away with the reason instead of waiting for the node to go stale.
  • Conflicted is terminal across restarts, until the config retires the node.
  • Retiring a node (retired = true) withdraws the open outages of every store of the node and marks them retired. This happens when the hub starts or reloads with the node retired. Pushes from the node are already refused with 403 before they reach the store. A superseded store of a retired node gets Retired, not a conflict.
  • Pings with the same health are still limited to one per half push interval. A change of health is never held back.

Changes

  • Migration 0022 adds node_store.superseded_at. It joins 0020 and 0021 in the next release, and that release needs Christian's fresh yes.
  • docs/api.md, docs/storage.md, docs/design/federation.md and schema/openapi.json (the 409 description) are updated.
  • tests/cli.rs pinned the schema version at 21; it now pins 22.

Tests

  • Store tests:
    • replacement withdraws the old store's outages;
    • a replaced store pushing again conflicts both stores, and they stay conflicted across a reopen until retired;
    • retire withdraws outages and is idempotent;
    • a differing end or open conflicts the node.
  • HTTP test: a rebuilt store replaces the old one; the old store then gets 409, and so does the new one.
  • End-to-end: two spokes with the same key alert on the hub with "retire one" in the check result. Retiring withdraws the spoke's outage both at start and at reload.
  • Mutation checks: each of these was made and turned the tests red:
    • replacing after apply_outages;
    • ended_seq = opened_seq;
    • dropping mark_conflicted;
    • dropping the retired-node guard;
    • pinging Up instead of Down on a conflict.
  • The new liveness assertions use an hour interval. A 400 ms interval was timing-sensitive under full-workspace load.
  • Local runs pass: cargo fmt, clippy (plain and with grpc), and cargo test --workspace.

https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE

…OC-82)

A retired node's open outages are now withdrawn when the hub starts or
reloads with it retired. A new store for a known node replaces the old
one: the old store is retired with superseded_at set and its open
outages are withdrawn in the same transaction as the new batch. If a
replaced store pushes again, or a store resends a differing outage
change, the batch rolls back, every store of the node is marked
conflicted, and the node's liveness heartbeat goes down with the reason.
A conflicted node stays refused across restarts until it is retired.

Migration 0022 adds node_store.superseded_at.

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
@jensenbox
jensenbox merged commit 217d1d4 into main Oct 28, 2026
16 checks passed
@jensenbox
jensenbox deleted the TOC-82-decommission branch October 28, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant