H: review-1 handoff log

This commit is contained in:
ari committed 2026-10-20 16:28:35 -04:00
1 parent 5571b1d3a4
commit 3d82eefcc7
1 file changed
+63
+63
View File
@@ -69,3 +69,66 @@ build or VM test was run.
`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()`.
### 2026-10-20 Handoff (review-1)
Every finding in `loop/H/review-1.md` is answered, one commit each. The full
gate is green after every commit: `cargo fmt --check`,
`cargo clippy --all-targets -- -D warnings`, `cargo test` (run twice; the
SIGTERM tests pass both times), `cargo tree -i openssl` empty. No Nix files
changed. `devenv shell -- dev-test all` could not be used in this worktree:
devenv aborts before any command with "To use 'git-hooks', run `devenv inputs
add git-hooks …`" (an environment problem, not a repo change), so the same
cargo commands were run directly.
1. **Blocking: the SSE SIGTERM test proves identity, not liveness**
(`H: prove the SSE test server identity`). `tests/integration.rs` spawns the
binary with stderr piped and waits for its own `listening addr=127.0.0.1:<port>`
line (`spawn_listening` / `logs_listening`, ANSI stripped, the address parsed
and compared whole so a neighbouring port cannot match). Only then is the
child signalled; `sigterm_and_wait` now also refuses to signal a child that
has already exited. A port a stranger won makes `spawn_listening` return
`None` and the test retries on a fresh port; the MCP `tail_journal` test
uses the same helper. `healthz_answers` is no longer an identity check.
New test `a_probed_port_held_by_a_lying_squatter_is_retried` starts a
thread that answers `HTTP/1.1 200` (verified by the test itself) and asserts
the helper retries; `only_the_childs_own_listening_line_counts` pins the
parser (other port, other address, non-startup line).
2. **Blocking: mode tests for every group/world bit**
(`H: pin the token mode check for every group/world bit`).
`secrets::group_or_world_write_and_execute_bits_are_rejected_too` covers
0620, 0602, 0610 and 0601, and
`tests/peers_config.rs::a_loose_token_fails_startup_and_per_request_checks_alike`
asserts that `validate_token_readiness` and `peers::load_token` give the
same reason, "group or world accessible", for each mode. Both fail with the
old `0o044` mask (checked by reverting the mask locally).
3. **The plain-HTTP warning no longer appears twice**
(`H: warn once about plain http`). The transport warning and its
`plain_warned` set are gone: every peer set is validated before the registry
uses it (startup and reload both go through `Config::load`), and
`plain_http_off_loopback_requires_the_flag_and_warns_when_set` now asserts
exactly one `cleartext` line. The remaining helper is
`config::warn_plain_http_peer`, named after the peer it reports.
Deviation: the duplicated warning survives only for a `PeersConfig` handed
to `PeerRegistry::reload` directly, bypassing validation; that is test-only
and `validate_target` still refuses a plain-http peer without the opt-in.
4. **A FIFO token file cannot block a thread**
(`H: never open a token path that is not a regular file`).
`load_token_at` calls `std::fs::metadata` and refuses non-files before
opening, then opens with `O_NONBLOCK` to close the window before the open,
and reads the mode and length from the open descriptor.
`a_fifo_is_refused_without_waiting_for_a_writer` (mkfifo, load on a thread,
5 s timeout) fails on the previous code with "must not wait on a fifo".
5. **`a_refused_token_file_sends_nothing` covers the whole loop**
(`H: keep the token listener open for the whole loop`). The listener is no
longer consumed by a 500 ms accept inside a task: it stays open for the
four cases and one bounded `accept()` after the loop must time out. Making a
case reachable (a 0600 token) fails the test.
6. **The span kind is checked where a backend sees it**
(`H: assert the exported peer request span kind`). A capturing
`SpanExporter` plus `SimpleSpanProcessor` exports the span;
`peer_request_span_is_exported_as_a_client_span` requires
`SpanKind::Client`, the name `peer.request`, and no exported `otel.kind`
attribute. It fails if the field is changed to `server`.
No contract looked wrong and `contracts.md` was not touched.