From df5b55ecf9e65da02a015807d10de1507113e1f6 Mon Sep 17 00:00:00 2001 From: ari Date: Mon, 19 Oct 2026 20:51:12 -0400 Subject: [PATCH] B: record the round 1 review responses in the workstream log --- plan/phase-5-consolidator/ws-b-registry.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plan/phase-5-consolidator/ws-b-registry.md b/plan/phase-5-consolidator/ws-b-registry.md index b6ec69a..b410fcb 100644 --- a/plan/phase-5-consolidator/ws-b-registry.md +++ b/plan/phase-5-consolidator/ws-b-registry.md @@ -62,3 +62,20 @@ Integration test starts a second in-process server (fake sources) as a peer and 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. + +## Round 1 review (2026-10-19) + +Responses to `loop/B/review-r.md`; every Blocking and Major item is addressed, Minors where cheap. + +- **Blocking 1 (stream cut off after `request_timeout_secs`) — fixed.** `get` no longer sets reqwest's total request timeout. One `within()` deadline covers preparation (validation, DNS, token and CA reads, a permit, building the client, sending and response headers); a buffered body is read under the same deadline. A stream escapes that deadline and is bounded by an idle timeout instead (`STREAM_IDLE_TIMEOUT`, 120 s): peers send SSE keep-alives and end their own follow streams at `limits.max_follow_secs`, so this only catches a dead connection. Test `a_stream_outlives_the_request_timeout` sends chunks across ~750 ms with a 150 ms timeout and fails on the old code. +- **Blocking 2 (token sent to disabled peers) — fixed.** `PeerRegistry::get` looks the peer up with `enabled` and `config.enabled` applied. A disabled peer (or a disabled feature) returns `NotFound` (`peer : disabled`, or `unknown peer` when the feature is off) and the transport is never called. Test `a_disabled_peer_is_never_proxied` asserts the fake records no call before and after both kinds of reload. +- **Blocking 3 (DNS/token/CA outside the timeout) — fixed.** `tcp_check` and `get` run every phase inside a single `within(deadline, ...)`. Test `one_deadline_covers_every_phase` drives the wrapper with a pending future on a paused clock (plus error and success pass-through). The health claim in `health.rs` now holds for the transport too. +- **Blocking 4 (IPv6 URLs) — fixed.** Targets come from `url::Host` (`Ipv4`/`Ipv6`/`Domain`); only a domain is resolved and pinned, and `url_is_loopback` uses the parsed host. Tests `loopback_hosts_as_the_url_parser_reports_them`, `ipv6_plain_http_to_loopback_needs_no_opt_in` and `ipv6_literal_peers_resolve_and_connect` (skips when the environment has no `::1`). +- **Major 5 (probes compete with proxy permits) — fixed.** `/api/v1/ping` and `/healthz` skip the per-peer and global semaphores; the proxy allowlist excludes both, so no caller can use the exemption for data traffic. Test `probes_bypass_the_concurrency_limits` holds a follow stream with `max_concurrent_per_peer = 1` and still gets a ping through, while a data call is `Saturated`. +- **Major 6 (reload only changes limits on paper) — fixed by rejecting such reloads.** `deny_cidrs`, `max_response_bytes`, `max_concurrent_per_peer` and `max_concurrent_total` cannot change without a restart; a reload that changes them fails and the old registry stays, so `config()` never reports a value that is not enforced. The deny list is now parsed by one shared `deny_networks()` used at startup and on reload, so an invalid CIDR on SIGHUP is rejected instead of accepted and ignored. Tests `reload_rejects_changes_the_transport_cannot_apply`. +- **Major 7 (token loader belongs to WS-A) — recorded disagreement.** The rules are A3's, but `src/peers/secrets.rs` does not exist in this branch and WS-A owns it. `load_token_in` here is private to the transport and documented as the single loader until A3 lands; when it does, `ReqwestTransport` should call `peers::secrets` and this function should be deleted. Likewise `#[path = "client.rs"] pub mod client;` in `registry.rs` is the workaround for not owning `peers/mod.rs`; at merge the module should move to `mod.rs` and `ReqwestTransport` be re-exported from `peers`. +- **Major 8 (test gaps).** Added: `sighup_reloads_peers_when_tls_is_off` (TLS off, peers on; TLS off/peers off is still covered by `tests/tls.rs::sighup_with_tls_disabled_keeps_serving`), `a_rotated_token_recovers_without_a_restart` in `tests/peers_registry.rs` (rejected -> rotate file -> `auth = ok`, no restart or SIGHUP), the threshold test now observes both checks flip down, and `shutdown_waits_for_loops_retired_by_a_reload`. The loop tests that do not need a real socket now run on paused time. +- **Minor 9–14 — fixed.** `request_url` calls `validate_target` instead of repeating its rules; probes share `probe_request`; `map_io` lost the dead DNS string matches; `error_is_tls` matches structured error kinds (rustls downcast, or an `io::Error` whose kind is not a socket failure) instead of text; the Authorization `HeaderValue` is `set_sensitive(true)`; a peer whose URL changes on reload starts from a clean status; loops retired by a reload are kept and awaited by `shutdown`; the `/healthz` fallback reports its own latency and `ApiTracker` keeps the last known `peer_version` while the API stays up. Tests were added for each. +- **Minor 15 (scope).** `src/tls.rs` changes the SIGHUP handler's signature and imports `PeersReloader`; that is the minimum for one handler to reload TLS and peers with independent failures. `main()` changes only the arguments to `serve()`, as logged under B4. The handoff to the C/D/E/F logs still has to be posted by the orchestrator; this worktree does not own those files. + +- 2026-10-19 verification: `cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, `cargo test` and `cargo tree -i openssl` (empty) are clean after the round-1 fixes.