From 734a6ed541b0cb25e0a03717ae5b1fdee1391c23 Mon Sep 17 00:00:00 2001 From: ari Date: Mon, 19 Oct 2026 20:24:34 -0400 Subject: [PATCH] B: record B2-B5 outcomes and handoff in the workstream log --- plan/phase-5-consolidator/ws-b-registry.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plan/phase-5-consolidator/ws-b-registry.md b/plan/phase-5-consolidator/ws-b-registry.md index 3975cd5..a9f1bc7 100644 --- a/plan/phase-5-consolidator/ws-b-registry.md +++ b/plan/phase-5-consolidator/ws-b-registry.md @@ -4,8 +4,8 @@ Part of [Phase 5: Consolidator](README.md). Contracts: [contracts.md](contracts. | Field | Value | |---|---| -| Status | Not started | -| Owner | | +| Status | Complete | +| Owner | goose | | Depends on | A0 (stubs and seams) and A1 to A3 for real config/secrets; can start on B1 as soon as A0 lands | | Blocks | integration of C, D, E (they are developed against the fake registry and finish for real once B lands); F | | Can start when | A0 is merged (design and client code can begin earlier in a branch against contracts.md) | @@ -51,3 +51,14 @@ Integration test starts a second in-process server (fake sources) as a peer and - 2026-10-19: Split from the single phase plan 2026-10-19. The trait and fake moved to A0 so C/D/E are not blocked on this stream; B keeps the implementations. - 2026-10-19 B1 (D15): chose reqwest (option a). Direct dependency `reqwest` 0.13.5 with `default-features = false` and `rustls-no-provider` only (no `native-tls`, no `stream` — that feature cannot resolve `wasm-streams` — and no `rustls` feature that selects aws-lc). Response bodies are capped by polling `chunk()`. Each client is a rustls `ClientConfig` built with `builder_with_provider(ring)` and webpki roots, plus an optional per-peer CA; `install_default` is not called. `cargo tree -i openssl` is empty. `aws-lc-rs` remains in the tree only through `opentelemetry-otlp`'s own reqwest and is not used by this client. `src/peers/mod.rs` is not owned here, so `client.rs` is mounted as `peers::registry::client` (`ReqwestTransport` is re-exported from `peers::registry`). + +- 2026-10-19 B2: one task per peer (both probes in one `tokio::select!`) with a deterministic name-hash jitter capped at a quarter of the shorter interval. Probes are `health::probe_server` / `health::probe_api`; `check_once` joins them for A4. A 401/403 is `api.up = true, auth = rejected`; a 404 falls back to public `/healthz` with `auth = unknown` (older peers, D4). The loop reuses `FakeTransport` for the classification/threshold tests and a second in-process `slinuxm` (fake sources) for up/down/recovery, api-down-but-server-up (listener accepts, never answers) and rejected-token cases in `tests/peers_registry.rs`. +- 2026-10-19 B3: `ServerTracker`/`ApiTracker` keep `since` and consecutive failures in loop-local state, so a surviving peer keeps its timestamps across a reload and a restart resets them. `fail_threshold` consecutive failures flip a check down; a success recovers in one check. `last_error` is always the fixed class string (never peer text or a URL). The first check records `since` whether it is up or down. +- 2026-10-19 B4: `PeerRegistry::start` builds the real transport and loops; `src/main.rs::serve()` assigns `state.peers`. SIGHUP now reloads TLS (when enabled) and peers from one handler (`tls::spawn_sighup_reload`); a config error is logged and the old registry stays. `reload` keeps statuses of surviving peers, cancels removed/disabled/changed loops and starts new ones. Token files are read on every API check, so agenix rotation needs no restart. `peers` concurrency and size caps are fixed for the process lifetime; only the peer set, intervals, timeouts and threshold follow a reload. `PeerRegistry::shutdown` cancels and joins loops with a 5 s bound. +- 2026-10-19 B5: connect-time SSRF guard resolves the peer host, rejects any address in `deny_cidrs` (parsed with `ipnet` at `ReqwestTransport::new`), and pins the allowed address into the HTTP client; plain HTTP to a non-loopback host requires `allow_plain_http`. `tcp_check` uses the same resolution and guard. DNS failures map to `dns`, all-denied to `unreachable`. + +## Handoff (2026-10-19) + +Complete; B1 to B5 and the authenticated `GET /api/v1/ping` route are in. D15 outcome is recorded above (reqwest, rustls-no-provider with ring passed explicitly, body cap enforced while streaming; `cargo tree -i openssl` is empty). The registry API matches contracts section 3 and is already used by the A0 seams (`snapshot`, `status`, `get`, `reload`, `shutdown`); C/D/E can now switch their fake registries to `PeerRegistry::start`. + +Verification run: `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test` (unit plus the in-process two-server cases in `tests/peers_registry.rs`), `cargo tree -i openssl` (empty). No Nix files were touched, so no VM test is involved; when the Nix gate is free, WS-T covers the module/VM path. Nothing in this workstream mints tokens or writes outside the state dir.