4.2 KiB
4.2 KiB
WS-H: Phase 5 final-review fixes
| Field | Value |
|---|---|
| Status | Done (awaiting merge) |
| Owner | goose |
| Owned files | src/peers/**, src/telemetry/mod.rs, src/main.rs, tests/**, docs/consolidator.md, config.example.toml, README.md |
Log
2026-10-20 Handoff
The review text (loop/final-review.md) is not present in this worktree; the
six items below were taken from the task statement that quotes it. Nothing in
contracts.md was touched and no contract looked wrong.
All items are done, one commit each, dev-level gate green after every commit
(cargo fmt --check, cargo clippy --all-targets -- -D warnings,
cargo test, cargo tree -i openssl empty). No Nix files changed, so no nix
build or VM test was run.
- One token loader, one set of peer helpers (
H: merge token loaders and peer helpers).src/peers/client.rsno longer has a loader: it callssecrets::load_tokenfor every request. The header-validity rule (no CR, LF or NUL, and the value must be a validBearerheader) lives insecrets.rs.secrets::under_credentialscanonicalises both paths and fails closed, so the client's non-canonicalstarts_withis gone withload_token_in. Deny-CIDR parsing (config::deny_networks), the loopback test (config::url_is_loopback), the plain-http rule (plain_http_allowed,plain_http_off_loopback) and its warning wording (warn_plain_http) exist once inconfig.rsand are used by validation, the transport andregistry::reload. Tests:secrets::tokens_that_cannot_be_a_header_value_are_refused,client::a_refused_token_file_sends_nothing(no request reaches the peer),config::deny_networks_rejects_a_bad_cidr_once_for_every_caller,config::loopback_detection_covers_localhost_and_both_families. Deviation: the merged mode check is the stricter union of the two old ones (0o077, message "group or world accessible" instead of the client's "readable"), so a group/world-writable token file stays refused; wording updated insecrets.rsanddocs/consolidator.md. A doubled trailing newline is nowinvalid(it would end the header line) instead of being forwarded with one newline left. denied()canonicalises (H: canonicalise addresses in the deny check).config::deniedcallsIpAddr::to_canonical; config validation and the transport both use it. Tests:config::ipv4_mapped_ipv6_literals_match_the_v4_deny_list(unit) andclient::an_ipv4_mapped_address_is_matched_against_the_v4_deny_list(::ffff:169.254.169.254refused before any connect); both fail if the canonicalisation is removed.- IPv6 deny defaults (
H: deny IPv6 link-local and metadata addresses by default).types::DEFAULT_DENY_CIDRSaddsfe80::/10,::/128andfd00:ec2::254/128; synced inconfig.example.toml,README.md,docs/consolidator.mdandtests/peers_config.rs(PEERS_DEFAULT). Test:config::the_default_deny_list_covers_metadata_in_both_families_but_allows_lans. peer.requestis a client span (H: mark the peer.request span as an OTel client span).otel.kind = "client"on the span, asserted intelemetry::tests::peer_request_span_names_the_peer.- Gauge gating in the docs (
H: correct the peer gauge gating in the docs).docs/consolidator.mdnow namesotel.enabledwithotel.export_unit_metrics(there is nootel.metrics.enabled) and states thatenabled = falsepeers have no series; behaviour was already covered bymetrics_export::tests::disabled_peer_is_not_reported. - Port-stealing flakiness (
H: make the SIGTERM tests immune to a stolen port).tests/tls.rs::try_start_onandtests/integration.rs::sse_stream_then_sigterm_ononly accept a socket that answers as this server (a TLS handshake against the test pair; a200from/healthz) while the child is still running, and report "retry" otherwise;start/the test then retry on a fresh port, up to three times. The SSE exit bound is 10 s. New teststests/tls.rs::a_probed_port_taken_by_someone_else_is_retriedandtests/integration.rs::a_probed_port_taken_by_someone_else_is_retriedfail if the identity check is weakened back to a bareconnect().