H: handoff log for the final-review fixes

This commit is contained in:
ari committed 2026-10-20 16:16:40 -04:00
1 parent 5ba6e820ca
commit 33a49533a3
1 file changed
+63 -1
+63 -1
View File
@@ -2,8 +2,70 @@
| Field | Value |
|---|---|
| Status | Not started |
| 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.
1. **One token loader, one set of peer helpers** (`H: merge token loaders and
peer helpers`). `src/peers/client.rs` no longer has a loader: it calls
`secrets::load_token` for every request. The header-validity rule (no CR,
LF or NUL, and the value must be a valid `Bearer` header) lives in
`secrets.rs`. `secrets::under_credentials` canonicalises both paths and
fails closed, so the client's non-canonical `starts_with` is gone with
`load_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 in `config.rs` and are used by validation, the transport and
`registry::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 in `secrets.rs` and `docs/consolidator.md`. A doubled trailing
newline is now `invalid` (it would end the header line) instead of being
forwarded with one newline left.
2. **`denied()` canonicalises** (`H: canonicalise addresses in the deny check`).
`config::denied` calls `IpAddr::to_canonical`; config validation and the
transport both use it. Tests:
`config::ipv4_mapped_ipv6_literals_match_the_v4_deny_list` (unit) and
`client::an_ipv4_mapped_address_is_matched_against_the_v4_deny_list`
(`::ffff:169.254.169.254` refused before any connect); both fail if the
canonicalisation is removed.
3. **IPv6 deny defaults** (`H: deny IPv6 link-local and metadata addresses by
default`). `types::DEFAULT_DENY_CIDRS` adds `fe80::/10`, `::/128` and
`fd00:ec2::254/128`; synced in `config.example.toml`, `README.md`,
`docs/consolidator.md` and `tests/peers_config.rs` (`PEERS_DEFAULT`). Test:
`config::the_default_deny_list_covers_metadata_in_both_families_but_allows_lans`.
4. **`peer.request` is a client span** (`H: mark the peer.request span as an
OTel client span`). `otel.kind = "client"` on the span, asserted in
`telemetry::tests::peer_request_span_names_the_peer`.
5. **Gauge gating in the docs** (`H: correct the peer gauge gating in the
docs`). `docs/consolidator.md` now names `otel.enabled` with
`otel.export_unit_metrics` (there is no `otel.metrics.enabled`) and states
that `enabled = false` peers have no series; behaviour was already covered
by `metrics_export::tests::disabled_peer_is_not_reported`.
6. **Port-stealing flakiness** (`H: make the SIGTERM tests immune to a stolen
port`). `tests/tls.rs::try_start_on` and
`tests/integration.rs::sse_stream_then_sigterm_on` only accept a socket that
answers as this server (a TLS handshake against the test pair; a `200` from
`/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 tests
`tests/tls.rs::a_probed_port_taken_by_someone_else_is_retried` and
`tests/integration.rs::a_probed_port_taken_by_someone_else_is_retried` fail
if the identity check is weakened back to a bare `connect()`.