Repository navigation
fix(cluster): surface a degraded transport boot in /_cluster/health - #1175
Merged
Merged
Conversation
Issue #1171, remaining half. A configured ring whose TCP transport failed to bind — port taken, address unusable — degraded to single-node with one ERROR line and a "Continuing in degraded single-node mode" warning, and then nothing: /_cluster/health answered `status: green, number_of_nodes: 1` for the rest of the process life, indistinguishable from an intentional single node. The same hole existed on the !storage_available path (cluster-state storage unavailable), which disabled the transport with one warn. An operator who configured a ring had no API-visible signal that they were not getting one; only the boot log held the truth, and only until it scrolled away. Root cause: the REST layer could not know. It read the *config* (cluster.enabled — the ask) and had no field for the *outcome* (what the transport boot actually did), and main.rs 8b recorded the outcome nowhere but the log. Fix, in three small pieces: - xerj-api/state.rs: `ClusterTransportStatus { Disabled, Running, Degraded }` on AppState. `AppState::new` cannot see a boot, so it seeds from the config alone (enabled -> Running, else Disabled — the model a direct-construction test of a configured ring assumes) and main.rs overwrites it with the truth before the first router exists, the same default-then-overwrite pattern `--decide-mode` already uses at 9b-iia. A new field, not a constructor argument: AppState::new has ~126 call sites and none of them can know a boot outcome either. - xerj-server/main.rs 8b: the outcome starts Degraded on every enabled path and is upgraded to Running only inside the transport-Ok arm — so the bind-failure arm, the !storage_available arm, and any future early exit all inherit Degraded without each needing to remember to say so. Assigned to state.cluster_transport at new section 9b-i. - xerj-api/es_compat.rs health: Degraded -> status yellow; node count drops to the 1 actually serving (the configured peers are unreachable by construction — the transport that would reach them failed to bind — so counting them would be the fabrication #1169 removed, wearing the degraded state as a topology); and an additive `xerj_cluster_transport: "degraded"` field appears exactly when true, because `status: yellow` alone cannot distinguish "replicas unassigned" from "you are not clustered at all". Extra fields are additive on this wire (ES clients ignore unknowns; the ES-YAML assertions are match-shaped), so Running/Disabled responses stay byte-identical to before. Deliberately NOT changed: the wait_for_status check stays red-only. The full `observed <= requested` comparison would start timing out `wait_for_status=green` on our yellow single-node replica indices, which the ES-YAML suite asks of exactly those — the narrowing comment at the site documents this. Degraded-yellow surfaces via status/nodes/marker instead. Tests (cluster_topology_honesty_tests, +4): degraded health is yellow / 1 node / marked; degraded + wait_for_nodes=2 -> 408 timed_out with the real count (and =1 still passes); the marker is absent on Disabled and Running states; and an unopenable index still outranks the marker — red is the headline, the marker rides beside it. The 6 existing #1169 tests pass unchanged (the enabled->Running constructor seed models a ring that came up, which is what they always assumed). Verification: xerj-api lib tests 335 passed / 0 failed; clippy clean; fmt clean; xerj-server release build clean. ES-YAML on a private port (19501, throwaway dir): cluster 10/0, smoke 29/0, indices 139/0, search 452/0 (one co-tenant flake on the first run that did not reproduce), bulk 21/0, scroll 15/0, aggregations 644/0 — 0 failed everywhere. Addresses the remaining half of #1171 (the config-validation half landed in #1172). Files: - engine/crates/xerj-api/src/state.rs (ClusterTransportStatus, field, seed) - engine/crates/xerj-server/src/main.rs (8b outcome, 9b-i assignment) - engine/crates/xerj-api/src/es_compat.rs (health status/nodes/marker, cluster_topology_honesty_tests)
Ravandevil25
pushed a commit
to Ravandevil25/xerj
that referenced
this pull request
Oct 6, 2026
Version roll 1.0.0-rc.83 → 1.0.0-rc.84. Engine window (all merged to main before this cut): - xerj-org#1172 (fix/cluster-topology-honesty, closes xerj-org#1169): cluster endpoints stopped fabricating topology — health reports real configured membership, wait_for_nodes times out honestly (408 + timed_out), upper bounds enforced, _cat/nodes lists every configured member, _cluster/state reports the actual cluster address; multinode smoke skips with a recorded reason instead of passing vacuously. Also the xerj-org#1171 config half: peer-label≠address and cluster.port collisions refused at load. - xerj-org#1175 (fix/cluster-degraded-health, closes xerj-org#1171 with xerj-org#1172): the transport boot outcome recorded on AppState (ClusterTransportStatus Disabled/Running/Degraded) before the first router exists; degraded boot → health yellow, number_of_nodes 1, additive xerj_cluster_transport:"degraded" marker; unopenable indices (red) still outrank the marker. - xerj-org#1174 (fix/corpus-index-resume, xerj-org#1173 honesty half — throughput half stays open): xerj corpus index stopped reporting a converged corpus as a failed crawl; resume path re-crawls only what's missing. - xerj-org#1167 (docs): hub counts un-staled — llms.txt:51 and the corpus-hub blog note said 75 live / 104 backlog from 2026-10-02; now 100/119. - xerj-org#1163 (thomas-villani, docs): EPUB/notebook answer pages recaptured on the rc.83 build; \x08 man-page fact-check alias fix + self-test. Mechanics of this commit: - engine/Cargo.toml version → 1.0.0-rc.84; cargo update -w rolled 17 Cargo.lock entries. - landing/: 91 V1.0.0-RC.83 footer spans → V1.0.0-RC.84 across 54 files (0 old spans remain); landing/index.html data-latest-tag span → v1.0.0-rc.84. - CHANGELOG: [Unreleased] rolled into [1.0.0-rc.84] - 2026-10-06 with all five window PRs cited under Fixed. - ROADMAP: Last-reviewed line → rc.84; open-defects shortlist re-verified live at cut time — eleven open (xerj-org#1091 xerj-org#1092 xerj-org#1094 xerj-org#1100 xerj-org#1146 xerj-org#1147 xerj-org#1158 xerj-org#1122 carried forward, xerj-org#1168 xerj-org#1170 cluster liveness/leader-wiring, xerj-org#1173 throughput half); xerj-org#1169/xerj-org#1171 moved to the CHANGELOG; GA-window rc.84 paragraph added. ES-YAML gate on the window PRs: 0 failed (452/452 re-run after one non-reproducing co-tenant flake).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Addresses the remaining half of #1171. A configured cluster ring whose TCP transport failed to bind — or whose cluster-state storage was unavailable — degraded to single-node with one ERROR line at boot and then
status: greenforever on/_cluster/health. The operator believed the node was clustered; no API could say otherwise.Root cause
The REST layer read the config (
cluster.enabled— the ask) and had no field for the outcome (what the transport boot actually did).main.rs8b recorded the outcome nowhere but the log.Fix
xerj-api/state.rs—ClusterTransportStatus { Disabled, Running, Degraded }onAppState. The constructor cannot see a boot, so it seeds from the config alone (enabled -> Running, elseDisabled— the model a direct-construction test of a configured ring assumes) andmain.rsoverwrites it with the truth before the first router exists (same default-then-overwrite pattern as--decide-modeat 9b-iia). A new field, not a constructor argument:AppState::newhas ~126 call sites and none of them can know a boot outcome either.xerj-server/main.rs8b — the outcome startsDegradedon every enabled path and is upgraded toRunningonly inside the transport-Okarm, so the bind-failure arm, the!storage_availablearm, and any future early exit all inheritDegradedwithout each remembering to say so. Assigned at new section 9b-i.xerj-api/es_compat.rshealth —Degraded⇒status: yellow; node count drops to the 1 node actually serving (the configured peers are unreachable by construction — the transport that would reach them failed to bind — so counting them would be the fabrication cluster: REST endpoints fabricate multi-node topology — wait_for_nodes is echoed into number_of_nodes, _cat/nodes is a stub, health stays green with no ring #1169 removed, wearing the degraded state as a topology); and an additivexerj_cluster_transport: "degraded"field appears exactly when true, becauseyellowalone cannot distinguish "replicas unassigned" from "you are not clustered at all". Extra fields are additive on this wire (ES clients ignore unknowns; the ES-YAML assertions are match-shaped), soRunning/Disabledresponses stay byte-identical to before.Deliberately not changed
The
wait_for_statuscheck stays red-only. The fullobserved <= requestedcomparison would start timing outwait_for_status=greenon our yellow single-node replica indices — which the ES-YAML suite asks of exactly those. The narrowing comment at the site documents this; degraded-yellow surfaces via status/nodes/marker instead.Tests (+4 in
cluster_topology_honesty_tests)yellow/ 1 node / carries the markerwait_for_nodes=2→ 408timed_outwith the real count (and=1still passes)DisabledandRunningstatesThe 6 existing #1169 tests pass unchanged.
Verification
cargo test -p xerj-api --lib: 335 passed / 0 failed; clippy clean; fmt cleancargo build --release -p xerj-server: clean