feat(hive-c0re): offer this hive's readiness to the swarm
The controller reads per-hive status out of a JetStream KV bucket and nothing was writing one, so every hive rendered `never_reported`. This is the half that makes the read path mean anything. A hive offers; the controller never reaches down to collect. The gateway has gone down in a way where every recovery channel ran through the one broken thing, so a status path that depended on the controller would go dark exactly when it is needed to diagnose the controller's own network. What it publishes is what the hive already says about itself — `warnings::readiness()`, the same value `/health/ready` serves. Nothing here stamps a time: freshness is derived by the reader from when the value landed, so a hive cannot make itself look fresher than it is, and a hive with a wrong clock skews only its own payload. The key is this hive's `hiveName`, which `swarm.nix` already asserts is a key of `swarm.hives` — so a hive that evaluates at all publishes under a name the roster knows, rather than by convention. Publish first, then wait: a hive that has just come up is the one whose status someone is looking at, and sleeping first would make every restart read stale for a full interval. The interval is one decision with the controller's staleness threshold, not two — a ratio of 2 means one lost publish still reads fresh and two consecutive misses read stale. Failures go to the dashboard banner through SweepHealth, debounced, at `warn` and deliberately not `crit`: `crit` is what makes this hive report itself degraded, and a hive that cannot reach the queue is not unhealthy — the swarm's view of it is. Publishing `degraded` because the publish failed would be both false and self-erasing on the next tick.
This commit is contained in:
parent
e23a70e488
commit
dc394b459d
4 changed files with 178 additions and 0 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1664,6 +1664,7 @@ name = "hive-c0re"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-nats",
|
||||
"axum",
|
||||
"base64",
|
||||
"bcrypt",
|
||||
|
|
@ -1695,6 +1696,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.0",
|
||||
"swarm-queue-client",
|
||||
"tempfile",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
|
|
|
|||
Loading…
Reference in a new issue