Files
2026-10-20 16:35:11 -04:00

31 KiB

WS-F: NixOS, docs, end-to-end tests

Part of Phase 5: Consolidator. Contracts: contracts.md sections 5 to 10.

Field Value
Status Merged
Owner
Depends on C, D, E (original plan). F1 (module) and F4 (docs drafts) can begin once A1 settles the config keys, since they depend only on contracts sections 6 and 9; F2/F3 need the other streams
Blocks phase exit
Can start when F1 and doc drafts: after A0/A1 land. F2: after C, D, E and WS-T are green. F3: after B and C
Owned files nix/module.nix, nix/tests/module-peers.nix (eval tests for the module, new in F1), nix/tests/vm.nix, systemd/skyg-linux-tracker.service, README.md (peers section), docs/consolidator.md (new; except the ## Testing section owned by WS-T), tests/peers.rs, tests/common/mod.rs (shared helpers, append-only with B), config.example.toml (merge with A1: comments and example peers, not the keys), flake.nix (only the move of tests.<system>.peers into checks.vm-peers plus checks.module-peers, in F2), AGENTS.md (MCP tool count note)
Do not touch src/** (all code streams; report bugs to the owning stream's Log), nix/tests/peers.nix except to adapt it to the first-class options in F2 (coordinate with WS-T, update contracts section 10), dev/test.nu, devenv.nix (T), docs/api.md (C), src/config.rs (A)

Shared-file seams:

  • flake.nix: WS-T owns it until F2; F2 then moves exactly one attribute into checks.
  • README.md / AGENTS.md: WS-T owns the command lists; F4 owns the peers section and the MCP tool count note (tool count becomes "8, or 10 with peers enabled").
  • config.example.toml: A1 owns the keys and defaults; F reviews that it is in sync with docs/consolidator.md and adds only commentary/examples.
  • tests/common/mod.rs: append-only; B may have added helpers already.

Goal

Shippable, documented, verified.

Tasks

  • F1 module: peers.enable; peers.peers.<name> = { url; tokenFile; caFile ? null; enable ? true; allowPlainHttp ? false; }; peers.settings for intervals/caps. The module renders [[peers.peer]] entries into the TOML with the paths only and adds one LoadCredential=peer-<name>:<tokenFile> per peer, pointing each token_file at /run/credentials/skyg-linux-tracker.service/peer-<name> so the service user needs no read access to /run/agenix/* (same mechanism as TLS, DEC-12). tokenFile is typed as a string (config.age.secrets.<x>.path), never a path literal, so secrets cannot enter the Nix store; an eval assertion rejects a store path. Config change reloads via ExecReload (SIGHUP) with reloadIfChanged, else restarts (implemented with reloadTriggers plus a restart trigger derived from the settings SIGHUP cannot apply; see the Log). Assertions: at least one enabled peer when peers.enable; names valid and unique. Also add RefreshOnReload=credentials as nix/tests/peers.nix does (contracts section 10) if the systemd version supports it.
  • F2 promote WS-T to checks, switched to the first-class module options (peers.peers.<name>.tokenFile); add nix/tests/module-peers.nix as checks.module-peers so nix flake check and dev-test ci run the eval cases (it is eval-only, no VM); plus a three-machine variant (consolidator, peer1, peer2) for fan-in. Mint tokens on peers, write them to root-owned 0400 files on the consolidator (stand-ins for agenix paths) and declare the peers through the module, assert status via REST and MCP, stop peer2's service and assert server/api flip, assert proxied units match a direct call, then rotate a token file and revoke the token on the peer: auth flips to rejected, then back after rewriting the file, with no restart. Remove a peer from the config, SIGHUP, assert the series is gone.
  • F3 tests/peers.rs end-to-end (plain, TLS with an rcgen CA via --ca-file, wrong CA rejected, redirect not followed, oversize body, slow-loris peer, 64-peer cap, cancel on shutdown).
  • F4 README section, docs/consolidator.md (threat model, token handling, firewall note: peers must allow the consolidator), a worked agenix example (secrets.nix entry, age.secrets.peer-minipc1.file, peers.peers.minipc1.tokenFile = config.age.secrets.peer-minipc1.path), AGENTS.md MCP tool count note.

Inputs

  • Contracts section 9 (Nix options), 6 (TOML), 10 (test contract), 5 and 7 (what the tests assert). Fakes: none for F2 (real binary); F3 uses in-process servers, not the fake transport.
  • Constraint: nix builds only when the nix gate is free (AGENTS.md).

Done when

nix flake check passes including the new VM test; docs and example config in sync.

Handoff

  • Phase exit evidence: nix flake check output, docs, example config, the Verification plan results in the README.
  • To the orchestrator: ARCHITECTURE.md decision rows (DEC-13 and the DEC-11 clarification), TODO.md checklists, and moving plan/phase-5-consolidator/ to docs/workstreams/.

Log

  • 2026-10-19: Split from the single phase plan 2026-10-19. tests/peers.rs ownership moved here from WS-T; docs/consolidator.md shares one ## Testing section with WS-T.
  • 2026-10-19: F1 done (commit F: F1 NixOS peers options with LoadCredential token delivery).
    • Options under services.skyg-linux-tracker.peers: enable (off by default), settings (freeform [peers] tuning, snake_case, no secrets) and peers.<name> = { url; tokenFile; caFile ? null; enable ? true; allowPlainHttp ? false; }.
    • Rendering: one [[peers.peer]] per peer with enable = true, with name, url, allow_plain_http, ca_file (only when set) and token_file = /run/credentials/skyg-linux-tracker.service/peer-<name>. Peers with enable = false are left out of both the TOML and LoadCredential. A peer-less config gains no [peers] section, so existing deployments keep the same generated file.
    • Credentials: LoadCredential=peer-<name>:<tokenFile> per enabled peer, merged with the TLS cert/key entries; RefreshOnReload=credentials now applies when TLS or peers are on; ExecReload stays SIGHUP.
    • Reload vs restart: the unit always sets reloadTriggers = [ configFile ] and restartTriggers = [ restartTrigger ], where restartTrigger is the JSON of settings with [peers] reduced to the keys SIGHUP cannot apply (enabled, deny_cidrs, max_response_bytes, max_concurrent_per_peer, max_concurrent_total). switch-to-configuration reloads only when the reload trigger is the sole difference in the unit file and restarts otherwise, so a peer entry or interval edit reloads (and the credential copy is refreshed) while a port, bind, auth, sources, otel or limit edit restarts. That keeps peers from turning unrelated config edits into silent no-ops. This is deliberate instead of reloadIfChanged: that flag would also reload on unrelated unit changes such as a package upgrade, keeping the old binary running. The trigger is a plain string (the JSON), so evaluating the unit needs no build.
    • Assertions: declaring peers.<name> requires peers.enable; peers.enable requires at least one enabled peer (or the legacy freeform list); names match ^[a-z0-9][a-z0-9_-]{0,31}$ (uniqueness is by attribute name); at most 64 peers; tokenFile is absolute, outside the store, and free of :/whitespace (it would corrupt the LoadCredential line; a store path here has already been copied into the local store, so the assertion blocks the deployment, not the copy, and the secret must be rotated); caFile is absolute when set; enabled and peer may not be set in peers.settings or settings.peers while the first-class options are in use. peersSection puts the freeform keys first and the first-class enabled/peer last, and settings re-applies that section, so a stale freeform value cannot switch off a feature the module believes is on. The pre-F1 freeform style stays valid, so nix/tests/peers.nix evaluates unchanged (verified: alpha keeps its two peers, gamma none).
    • Tests: nix/tests/module-peers.nix (new file, eval only, no builds) renders the config and the unit and checks 40 cases: peer-less default, TLS-only unchanged, TLS+peers credential list, rendering of enabled/disabled peers, token path never in the config, the reload/restart split (peer url and interval changes leave the restart trigger alone and move the reload trigger; port, auth, deny_cidrs and max_concurrent_total changes move the restart trigger), freeform compatibility and every assertion. Not wired into flake.nix (F2 owns that file and adds checks.module-peers); run it with: nix eval --impure --json --expr 'let f = builtins.getFlake (toString ./.); in import ./nix/tests/module-peers.nix { pkgs = f.inputs.nixpkgs.legacyPackages.x86_64-linux; module = f.nixosModules.default; }'
    • Not run (no nix builds in this worktree): nix build .#checks.x86_64-linux.vm -L, nix build .#tests.x86_64-linux.peers -L, nix flake check. These must pass before F1 is merged (the nix gate was busy for this round): vm covers the unchanged peer-less/TLS path, peers is the only place the mkMerge of LoadCredential is proven together with the test's own LoadCredential/RefreshOnReload override on the legacy freeform path. The eval test above was run: 40/40 pass, and the legacy nix/tests/peers.nix still evaluates to the same TOML, credentials and trigger shape.
    • Handoff: F1 is complete pending the VM runs above; F2 can switch nix/tests/peers.nix to peers.enable/peers.peers.<name>.tokenFile (the TOML it produced is identical), move the test into checks.vm-peers, add checks.module-peers and the three-machine variant. F4 still owes the README peers section, docs/consolidator.md and the DEC-14 note (a consolidator token reaches every peer's data). systemd/skyg-linux-tracker.service is unchanged: the example is a manual install without peers.
  • 2026-10-19: F1 review round 1 (loop/F/review-n4.md) addressed.
    • Blocking: with peers on, the config file no longer moves wholesale to reloadTriggers. reloadTriggers = [ configFile ] stays and restartTriggers = [ restartTrigger ], where the trigger is the JSON of settings with [peers] reduced to enabled, deny_cidrs, max_response_bytes, max_concurrent_per_peer and max_concurrent_total (the keys PeerRegistry::reload refuses). A peer entry, an interval or a timeout change now reloads; a port, bind, allowed hosts, auth, otel/metrics or sources change restarts, so switch never leaves the service on stale settings. enabled is in the restart set because the router mounts the peer routes once, at startup.
    • Precedence: peersSection is freeform keys first and the first-class enabled/peer last, and settings re-applies it after recursiveUpdate, so peers.settings.enabled and settings.peers.enabled/peer can no longer override or bypass the first-class options; an assertion rejects that mix while the first-class options are in use.
    • Assertions added: peers.enable now requires at least one enabled peer; at most 64 peers (the binary's MAX_PEERS); tokenFile may not contain :, a space or a tab (it would corrupt LoadCredential=peer-<name>:<path>). The store-path comment and the tokenFile description no longer claim the secret never enters the store: the assertion blocks deployment, after the interpolation has already copied the file into the local store, so such a secret must be rotated. The caFile description now says the service user reads it directly, unlike the token, so a root-only file fails at startup.
    • Eval cases: 40, the new ones proving a peer url change and an api_interval_secs change move only reloadTriggers while port, auth, deny_cidrs and max_concurrent_total changes move restartTriggers, plus the new assertions and both enabled-conflict directions.
    • Recorded for F2: nix/tests/module-peers.nix is now in the Owned files row, and F2 must add it as checks.module-peers so nix flake check and dev-test ci run it.
    • Still open: the two VM tests, see the "Not run" note above.
  • 2026-10-20: rebased ws/F onto main (9e4fb38, D merged). D's MCP peer tools (list_peers, the peer argument) were not on the branch, so the test's MCP subtest could not pass; the rebase is mechanical, F1's commits are unchanged.
  • 2026-10-20: F2 done (commit F: F2 promote the peers VM test and the module eval test into checks).
    • Root cause of the known failure (the first peers subtest timing out while /api/v1/peers/beta answered 200): not the JSON shape. contracts.md section 3 and the real binary agree (server.up, api.up, and api.auth = "rejected" with a 401). It was address selection: the test network writes both an IPv4 and an IPv6 address for every node into /etc/hosts (nixos/lib/testing/network.nix), name resolution returns the IPv6 one first, and the nodes bound 0.0.0.0. ReqwestTransport::resolve_target takes addrs.first() (the IPv6 address), so both probes failed with unreachable (server.up false, api.up false, api.auth "unknown") while curl reached the IPv4 address. Reproduced locally with url = "http://localhost:1985" against a peer bound to 127.0.0.1: /api/v1/peers/beta reported server.up: false, api.up: false, api.last_error: "unreachable". With the peer bound to :: the same setup reports up: true, up: true, auth: "rejected".
    • Test fix (the binary is unchanged): every node binds :: (dual stack; Linux accepts IPv4-mapped connections, verified against the release binary on both 127.0.0.1 and ::1) and the peer URLs keep their hostnames, so the TLS peer still verifies its DNS:gamma SAN. Reported to WS-B in the Handoff: a peer that listens on IPv4 only is reported as unreachable when its name also resolves to IPv6, because the transport connects to the first resolved address only. A candidate fix (WS-B, src/peers/client.rs) is to try the resolved addresses in order, or to prefer the family the peer actually answers on.
    • poll() now raises with the last observed value: wait_status hands it the status JSON of every attempt, so a timeout prints e.g. last observed: {"api": {"auth": "unknown", ...}} instead of (last error: None). New wait_gone for the removal case.
    • Switched to the first-class options: peers.enable, peers.settings (intervals/timeouts only), peers.peers.<name> = { url; tokenFile; caFile; allowPlainHttp }. The test's hand-written LoadCredential and RefreshOnReload override are gone; the module renders token_file = /run/credentials/skyg-linux-tracker.service/peer-<name>, one LoadCredential=peer-<name>:/var/lib/peer-tokens/<name> per enabled peer and RefreshOnReload=credentials. Token stand-ins stay root-only 0400 files under /var/lib/peer-tokens (agenix stand-ins). gamma keeps peers off (a peer-less node), since peers.enable requires a peer.
    • New assertions: fan-in (alpha's GET /api/v1/peers lists exactly beta and gamma, both with server.up, api.up, auth == "ok" and a peer_version; gamma's display URL is https://); proxied unit names equal a direct call to the peer's own API (and differ from alpha's own); placeholder-token rejection also covers the TLS peer; token install, revoke and rotation leave MainPID unchanged; removing a peer (the rendered /etc/skyg-linux-tracker.toml symlink is replaced by an edited copy with gamma's [[peers.peer]] block dropped, then SIGHUP) makes gamma 404 on GET /api/v1/peers/gamma, drop out of GET /api/v1/peers, leaves beta healthy, leaves gamma's token file at 0400 and leaves MainPID unchanged. The outage subtests run last, because gamma is no longer configured after the removal.
    • flake.nix: tests.${system}.peers is gone; checks.${system} now has package, vm, vm-peers (the same VM test) and module-peers. module-peers wraps the eval test in pkgs.runCommand whose interpolation forces the returned list, so a failing case throws during evaluation of the derivation and nix flake check fails without a VM (a bare list is not a derivation and nix flake check rejects it).
    • contracts.md section 10 updated (first-class options, dual-stack bind and the address note, the removal scenario). That file is outside the Owned files row but the F2 task text assigns section 10 to F2; no other section changed.
    • Verified here (no nix builds in this worktree, per AGENTS.md): nix eval of nix/tests/module-peers.nix after the rebase, 40/40 cases; nix eval of checks.x86_64-linux.{module-peers,vm-peers}.drvPath (both instantiate, so the test nodes, the module assertions and the first-class rendering are all evaluated); nix-instantiate --parse on flake.nix, nix/tests/peers.nix; python3 -m py_compile on the assembled testScript.
    • For the orchestrator to run (the nix gate): nix flake check -L (now includes checks.vm-peers and checks.module-peers), or nix build .#checks.x86_64-linux.vm-peers -L on its own.
    • Seam, blocking for dev-test vm peers (WS-T owns dev/dev-test.nu): vm-steps builds .#($attr).($system).($name) with "peers" => "tests", so after the move it must build .#checks.($system).vm-peers. Suggested change: keep let attr = "checks" and map the build name ("peers" => "vm-peers", _ => $name). dev-test ci is unaffected (it runs vm), as is nix flake check.
  • 2026-10-20: F3 done (commit F: F3 end-to-end peer tests).
    • New tests/peers.rs, one integration binary: a consolidator served by the real router (server::build_router + server::serve_listener) with the real PeerRegistry/ReqwestTransport, against peers that are either another in-process slinuxm (fake sources, real auth with a minted token) or a hand-written listener for the cases a real peer cannot produce. Token files are 0600 temporaries in $TMPDIR; tests/common/mod.rs is reused for request/parse_response and not modified (its items would be dead code in the other test binaries).
    • Cases: plain peer (status server.up/api.up/auth ok, peer_version, list shape, 401 without a caller token, 404 for an unknown peer, 405 on POST, both checks flipping when the peer dies, proxy 503 naming the peer while the caller's token keeps working); TLS peer with an rcgen CA and a leaf for 127.0.0.1 via ca_file (api.up needs a verified handshake and our token); a peer signed by a different CA (server.up true, api.up false, last_error = tls_error, proxy 503 tls_error); a 302 (503 http_302, and the Location target sees zero connections); an oversize body (503 oversize with max_response_bytes = 64); a silent peer (503 timeout, bounded); the 64-peer cap (Config::validate, the path serve uses: 64 accepted, 65 refused); and shutdown ending a proxied follow.
    • Blocking finding, reported to WS-C's Log (2026-10-20): the proxy hands the transport the stripped route (/systemd/units) while peers serve /api/v1/systemd/units, so every proxied call to a healthy peer answers peer <name>: not found on peer. Health checks are fine (/api/v1/ping). Two tests (a_plain_peer_serves_its_own_data_through_the_proxy, shutdown_ends_a_proxied_follow) are #[ignore]d with that reason and state the contract; removing the attribute is the acceptance check once C (or B) prefixes the path. The same defect will fail the proxy subtest of checks.vm-peers.
    • Verified: cargo test --test peers → 7 passed, 2 ignored.
  • 2026-10-20: F4 done (commit F: F4 peers docs, agenix example and tool-count note).
    • README.md: new ## Peers (consolidator) section between TLS and NixOS — TOML example, why token_file is a path (DEC-13) and why each consolidator needs its own token, the two checks with a server/api/auth table, REST/peer list/peer check examples, the pass-through rules, MCP 8-to-10 and OTel metric names, a NixOS snippet, and pointers to docs/consolidator.md and the test runner. The MCP section now says "eight tools (ten with a consolidator)"; the peers section names the underlying nix build .#checks.x86_64-linux.vm-peers -L next to dev-test integration peers / dev-test vm peers.
    • docs/consolidator.md: every section except ## Testing, which is byte-identical (checked). Title and intro; ## Model (checks, thresholds, last_error classes, the server/api/auth reading table); ## Configuration (all keys, SKYG_PEERS__*, validation rules, deny_cidrs against the resolved address); ## REST and MCP (status shape, allowlist, hop header, error mapping table, the 405-has-no-peer-header exception); ## OpenTelemetry; ## Credentials and threat model (DEC-13, per-consolidator tokens, what it does not protect, the D14 note that a consolidator token reaches every peer's data); ## NixOS with agenix (options, mint-on-the-peer, secrets.nix, age.secrets, the module block, tokenFile/caFile consequences, reload-vs-restart including the review-n5 note that adding or removing a peer or changing its tokenFile restarts on switch); ## Firewall and networking plus ### Address families; ## Limits and non-goals (no aggregation, no chaining, GET-only, no history, declarative only).
    • AGENTS.md: the tool-count line is now "8 without peers and 10 with peers.enabled (list_peers, get_peer, an optional peer argument on the other eight); the snapshot test guards both tables". Command lists untouched.
    • config.example.toml: commentary only — one token per consolidator, the module's tokenFile option and a pointer to docs/consolidator.md. Keys and defaults unchanged and checked against docs/consolidator.md and PeersConfig::default.
    • Corrected F1's caFile description in nix/module.nix: nothing opens the CA at startup, so "fails at startup" was wrong; a root-only file makes every check and proxied request to that peer fail as tls_error.
    • Not an Owned file, so left for the fold: docs/README.md's Reference table does not list docs/consolidator.md yet.
  • 2026-10-20: Review round 3 (loop/F/review-n6.md, findings 1 to 8) addressed, one commit per finding; the dated Handoff is at the end of this file. The two VM-test findings were product bugs and are fixed here: the proxy forwards /api/v1/<route> (both formerly ignored tests are the acceptance check and pass) and the transport now uses every resolved address (resolve_to_addrs, tcp_check tries each, ClientKey keys on the set). flake.nix imports nix/checks.nix again, so the hook checks are back; because this branch predates main's 8c0f996, the four files that commit fixed (.markdownlint.yaml, dev/hooks/run.sh, nix/checks.nix, the D8 table cell in decisions.md) were ported so the restored checks pass. dev-test vm peers builds checks.<system>.vm-peers, with a self-check guarding the attribute. Test and docs findings 5 to 8 done. Local gate: fmt, clippy, cargo test on every target and nu dev/dev-test.nu self-check green; no nix build run.

Handoff 2026-10-20 (WS-F -> orchestrator)

State. ws/F is rebased onto main (9e4fb38, so D's MCP peer tools are present; F1's five commits were replayed unchanged). Four commits follow this entry's parent: F2 (36ac4f1), F3 (92d1318), F4 (db3a981) and this one. Local gate green: cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (all targets, 2 pre-existing ignored journal tests plus the 2 blocked proxy tests described below), cargo tree -i openssl empty, nix eval of nix/tests/module-peers.nix (40/40), nix flake check --no-build (package, vm, vm-peers, module-peers all evaluate).

Run, in the nix gate (nothing here was built, per AGENTS.md):

  • nix flake check -L — now covers checks.vm-peers (three-machine peers VM test) and checks.module-peers (eval-only, a runCommand whose interpolation forces the 40 cases, so a wrong rendering fails evaluation without a VM).
  • Individually: nix build .#checks.x86_64-linux.vm-peers -L and nix build .#checks.x86_64-linux.module-peers -L. checks.vm (TLS/plain) is unchanged.

Blocking, belongs to WS-C (reported in its Log, 2026-10-20). Every proxied call to a healthy peer answers peer <name>: not found on peer: proxy::get gives the transport the stripped route (/systemd/units) and the peer only serves /api/v1/systemd/units. Health checks are unaffected. Consequence: checks.vm-peers will still fail at its proxy subtest ("each side returns the other's data") until C (one line: prefix /api/v1 in proxy::get) is fixed, and the two #[ignore]d tests in tests/peers.rs (a_plain_peer_serves_its_own_data_through_the_proxy, shutdown_ends_a_proxied_follow) stay ignored; removing those attributes is the acceptance check. F2 also found and fixed an unrelated cause of the reported first-subtest timeout (see the F2 entry: node names resolve IPv6-first in NixOS test networks, so the nodes now bind ::).

To WS-B (client, src/peers/client.rs). resolve_target connects to addrs.first() only, so a peer that listens on IPv4 while its name also resolves to an IPv6 address reads as unreachable. Candidate fix: try the resolved addresses in order. Worked around in the VM test by binding ::; documented for operators in docs/consolidator.md.

To WS-T (dev/dev-test.nu, not an Owned file here). vm-steps maps "peers" => "tests" and builds .#($attr).($system).($name). After F2 the test lives at checks.<system>.vm-peers, so dev-test vm peers needs "peers" => "checks" and the build name vm-peers. dev-test ci (which runs vm) and nix flake check are unaffected.

Not an Owned file. docs/README.md's Reference table should list docs/consolidator.md; left for the fold.

For the phase exit (orchestrator). ARCHITECTURE.md: DEC-13 plus the DEC-11 clarification, and the F4 doc facts worth keeping (two checks and the auth states, LoadCredential token delivery, reload-vs-restart split, GET-only allowlisted proxy, per-consolidator tokens). TODO.md: F1 to F4 boxes and Backlog entries for D8 (aggregation), scoped tokens, peer health history, runtime peer management, and the B address-selection issue if the fix is deferred. plan/phase-5-consolidator/ moves to docs/workstreams/ per plan/README.md.

Handoff 2026-10-20 (WS-F -> orchestrator, review round 3)

loop/F/review-n6.md had eight findings; all are addressed, one commit each on ws/F. No rebase, no edits to main.

Product fixes (both were VM-test findings, now with regression cover).

  • Proxy forwarded the stripped route. proxy::validate still works the allowlist on the bare route but hands the transport /api/v1/<route>, which is what a peer serves. The two acceptance tests are un-ignored and pass (a_plain_peer_serves_its_own_data_through_the_proxy compares the proxied body with a direct call; shutdown_ends_a_proxied_follow uses a listener that holds the socket). The WS-C fix is no longer needed: checks.vm-peers gets a working proxy from this branch. Fakes in src/api/behaviour_tests.rs, src/mcp/mod.rs, tests/mcp_peers.rs and tests/peers_config.rs were re-scripted on the peer's real paths (test expectations only).
  • Only the first resolved address was tried. resolve_target returns every address and still refuses the name if any is denied; ReqwestTransport pins the set with resolve_to_addrs (the connector falls through), ClientKey keys on the set and tcp_check tries each address with a per-attempt share of the remaining deadline. Cover: two client unit tests, a tests/peers.rs case declaring the peer as http://localhost:<port> against a peer bound to 127.0.0.1, and the VM test's TLS peer gamma now binds 0.0.0.0 (IPv4 only) while alpha/beta stay dual stack. docs/consolidator.md (Address families, deny_cidrs) and contracts section 10 are rewritten; the "reported as unreachable" limitation is gone.

Findings 1, 4 to 8.

  • flake.nix imports nix/checks.nix again, merged with the F2 additions (package, vm, vm-peers, module-peers), so hooks-lint, hooks-selection, rust-fmt, rust-clippy and rust-no-openssl are back in nix flake check. bash dev/hooks/run.sh lint-all and dev/hooks/test-select.sh pass locally.
    • Because this branch predates main's 8c0f996 ("Fix hook flake checks, relax markdownlint style rules"), the restored hooks-lint would fail on files main already fixed. That commit's four functional files were ported verbatim, no rebase: .markdownlint.yaml (MD012/MD026/MD040/MD049 off), dev/hooks/run.sh (return "$bad" plus the shellcheck disable), nix/checks.nix (found= as on main) and the unescaped | in decisions.md D8. The two doc-pointer additions from that commit (AGENTS.md, README.md hooks.md links) were left out as unrelated to the finding; the orchestrator may want them with the fold.
  • dev/dev-test.nu: vm peers builds .#checks.<system>.vm-peers; a new check-vm-attribute self-check fails if a vm name stops pointing at .#checks. nu dev/dev-test.nu self-check prints ok.
  • Shutdown and slow loris: the test listener distinguishes a complete reply, headers plus a held socket, and headers plus one body byte per 300 ms. Shutdown now ends a held stream (no real peer involved), a slow-loris peer is a 503 timeout inside 4 s, and the silent-peer bound dropped from 10 s to 4 s.
  • Redirect test waits for the health loop's http_302 verdict before asserting the Location target saw zero connections; the peer cap asserts "at most 64 peers"; a chunked oversize body is refused end to end.
  • Duplication: one serve(config, tls, prepare) helper replaces the repeated bind/pool/migrate/mint/serve_listener blocks in Peer::spawn and Consolidator::start; the local TempDir is gone in favour of peers::testing::TempDir.
  • Docs: docs/consolidator.md Testing rewritten (both layers, checks.module-peers, the dev-test integration peers command, no "written ahead of the feature" note), a new ### Shutdown subsection backs the README's promise, the agenix examples explain bind = "0.0.0.0" (remote callers only), the VM hop assertion is == 400, and the README says rotation on NixOS also needs systemctl reload for the LoadCredential copy.

Local gate. cargo fmt --check clean; cargo clippy --all-targets -- -D warnings clean; cargo test green on every target (262 lib, 20 peers_config, 12 peers, 9 mcp_peers, 13 integration, 12 tls, 5 peers_registry, 3 plain, 1 binary_smoke; 2 pre-existing ignored journal tests); cargo tree -i openssl empty (covered by dev-test lint); nu dev/dev-test.nu self-check ok; nix-instantiate --parse on flake.nix and nix/tests/peers.nix.

Run in the nix gate (nothing was built here). nix flake check -L, now hooks-lint, hooks-selection, rust-fmt, rust-clippy, rust-no-openssl, package, vm, vm-peers, module-peers. vm-peers should pass its proxy subtests with this branch alone; its TLS peer is IPv4-only on purpose.

Still open. docs/README.md does not list docs/consolidator.md (not an Owned file; left for the fold). The phase-exit items in the previous Handoff stand, minus the WS-C proxy fix and the WS-B address-selection backlog entry, which are done here.