Skip to content

TOC-83 Multi-location checks with a quorum - #66

Merged
jensenbox merged 9 commits into
mainfrom
TOC-83-quorum
Oct 28, 2026
Merged

jensenbox merged 9 commits into
mainfrom
TOC-83-quorum

Conversation

@jensenbox

Copy link
Copy Markdown
Member

Checks placed on two or more nodes are now quorum checks: each node's run is evidence, and a node whose results all converge (its own and every other node's, through push_to) derives the check's health from the freshest result per node and records it under node_id = '*'.

What changed

  • Config: nodes and quorum on [[check]]. A check on two or more nodes is a quorum check, needing its own quorum or a majority. Validation refuses a quorum check no node can evaluate, and several evaluators without [federation] alert_order.
  • State: state::quorum_health takes each node's latest result inside the freshness window (2 × interval + push_interval + grace). It returns the health a quorum agrees on, or none.
  • Engine: the evaluator records * results and opens and closes * outages, which alert like any other. Per-node runs are evidence only and never alert. A node that runs the check without evaluating it is quiet.
  • Quorum lost: each evaluator keeps a quorum:<check> heartbeat. It is pinged up while the quorum can decide and down while it cannot, so losing the quorum alerts and later resolves. It has no component, so it shows on the internal board only. Serve and reload both add it.
  • alert_order gating: an evaluator behind others alerts only when every node ahead is down. A missing heartbeat for a node ahead counts as not up. An outage opened without an alert stays unalerted.
  • Alerts: titles for * say "on a quorum of nodes".
  • Public surfaces:
    • The uptime bar for a quorum check comes from its * evaluations per day. Days from before the check became a quorum check keep their per-node rollups.
    • Anonymous reads of /api/v1/outages, the timeline and MCP list_outages show only a quorum check's * outages.
    • A status:read token and /internal/ still see every node's outages, so the internal view keeps matching Gatus.

Acceptance tests

  • crates/tocsin-engine/tests/quorum.rs covers four cases:
    • With a quorum of 2 of 3, one node down leaves the check up and pages nobody.
    • Two nodes down open one * outage and one alert.
    • Two stale nodes leave the health unknown and raise one "quorum lost" alert.
    • A node that only runs the check never pages for it.
  • tocsin-core state.rs has a property test: a stale node never changes the derived health.
  • Store and federation tests check that anonymous outage reads show only * outages for a quorum check, and that a reader token sees every node's.
  • liveness_tests checks that watch (used at serve and at reload) adds quorum:<check>.
  • Each of these tests failed when the code it covers was mutated.

Deviations and notes

  • Uptime bar: the bar comes from * evaluation rollups, not from * outages weighted by time as the ticket worded it. The design doc (docs/design/federation.md) was updated on purpose to match what shipped, including the freshness formula. Treat that as a reconciliation, not drift.
  • Behaviour change on upgrade: any check that resolves to two or more nodes, including through [federation] default_nodes, becomes a quorum check. It then stops alerting per node, and the config is refused if no node can evaluate it. The deployed Closient config has no [federation], so nothing changes there today.
  • Test fixtures: the liveness_tests and push_tests fixtures changed. The api-port check in the federation tests now runs on hub and spoke, which makes it a quorum check.
  • Spokes: a spoke serving a public page shows no * state for a quorum check, because it never evaluates one.
  • Clippy: the heartbeat spec is boxed, and Engine::reconcile and Router::new each had a helper split out.
  • Release: this is a minor-version change (new config keys and behaviour). It ships with the next release, which needs a fresh go-ahead.

https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE

…-83)

Anonymous outage reads (the API, the timeline, MCP) drop a quorum check's per-node outages, so one node down while the quorum says up never shows on public surfaces. A status:read token and the internal board still see every node's. The admin timeline names * as a quorum of nodes.

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
…OC-83)

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
…es (TOC-83)

Serve and reload both add the liveness heartbeats through watch, so this
pins the quorum ones there.

Claude-Session: https://claude.ai/code/session_01Ub1Bi7sFncPnpe2Cz4azBE
Signed-off-by: Christian Jensen <christian@closient.com>
@jensenbox jensenbox added the enhancement New feature or request label Oct 28, 2026
@jensenbox
jensenbox merged commit 3d9da95 into main Oct 28, 2026
16 checks passed
@jensenbox
jensenbox deleted the TOC-83-quorum branch October 28, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant