100 Commits
Author SHA1 Message Date
ari 72fccc34f8 docs 2026-10-21 00:12:33 -04:00
ari d8ad1c44c5 faster builds 2026-10-21 00:01:04 -04:00
ari b3b9103f2f Merge branch 'build-stamped-version' 2026-10-20 23:38:12 -04:00
ari 1a30b20ac0 Stamp the version as YYYY.MM.DD-<branch>-<sha>
build.rs builds the string (git, or SLINUXM_* env for builds without .git)
and the lib exposes it as VERSION. --version, /healthz, /api/v1/ping, MCP
server info and OTel service.version use it; OpenAPI info.version stays on
the semver so docs/openapi.json does not change per commit. The flake passes
the commit date and short rev to the package.
2026-10-20 23:27:46 -04:00
ari 020fa4871f added a way to rotate a token 2026-10-20 23:26:10 -04:00
ari 5d78004720 fixing tests 2026-10-20 22:57:34 -04:00
ari b38c66bcc8 added live redoc and slight refactors to tokens 2026-10-20 22:53:09 -04:00
ari 435a54a02d pulled out tests and validated them 2026-10-20 21:58:33 -04:00
ari dc8d62da30 added hooks 2026-10-20 21:29:23 -04:00
ariandClaude Sonnet 5.5 ca5c4b5642 Package: include docs/openapi.json for the drift test
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 16:47:30 -04:00
ariandClaude Sonnet 5.5 32e03d7cb5 Relax markdownlint list spacing for archived logs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 16:36:25 -04:00
ariandClaude Sonnet 5.5 f5e5f752e3 Fold Phase 5 into docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 16:35:11 -04:00
ariandClaude Sonnet 5.5 6be774e98b H: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 16:32:08 -04:00
ari 3d82eefcc7 H: review-1 handoff log 2026-10-20 16:28:35 -04:00
ari 5571b1d3a4 H: assert the exported peer request span kind
Export the span through a capturing exporter and require SpanKind::Client,
so the contract is checked where a backend sees it, not only in the field
that carries it.
2026-10-20 16:27:39 -04:00
ari 5f9f160666 H: keep the token listener open for the whole loop
The 500 ms accept window covered only the first case; a connection made later
went unseen. Accept once after the loop instead.
2026-10-20 16:26:52 -04:00
ari a78303c123 H: never open a token path that is not a regular file
Check is_file before opening and open with O_NONBLOCK, so a FIFO token file
cannot park a blocking-pool thread on every check and proxy call.
2026-10-20 16:26:11 -04:00
ari f9911f6c70 H: warn once about plain http
Validation runs at startup and on every reload, so the transport no longer
repeats the warning per peer on its first request; the helper is named for
the peer it reports.
2026-10-20 16:24:44 -04:00
ari a09c64de9a H: pin the token mode check for every group/world bit
Cover 0620, 0602, 0610 and 0601 in the loader and assert that startup
validation and the per-request load give the same reason for each.
2026-10-20 16:23:54 -04:00
ari 70af820838 H: prove the SSE test server identity
Require the child's own listening line for the probed port before it is
signalled; a 200 from /healthz proves liveness only, since another slinuxm
answers it too. Retry a lost bind race instead of signalling a dead child,
and add a squatter that answers 200.
2026-10-20 16:22:56 -04:00
ari 7252b0c966 H: dedupe integration test block 2026-10-20 16:18:19 -04:00
ari 33a49533a3 H: handoff log for the final-review fixes 2026-10-20 16:16:40 -04:00
ari 5ba6e820ca H: name the token mode check after what it rejects 2026-10-20 16:16:30 -04:00
ari fea6a52bb0 H: make the SIGTERM tests immune to a stolen port Both helpers verify the socket answers as our server and retry on a fresh port when the child lost the bind race; the SSE exit bound is 10 s 2026-10-20 16:16:13 -04:00
ari 3f017725f8 H: correct the peer gauge gating in the docs Name otel.enabled plus otel.export_unit_metrics, and state that disabled peers have no series 2026-10-20 16:14:19 -04:00
ari 9c770b0576 H: mark the peer.request span as an OTel client span otel.kind = client is set on the span and asserted in the span test 2026-10-20 16:14:14 -04:00
ari 97c81f899c H: deny IPv6 link-local and metadata addresses by default Add fe80::/10, ::/128 and fd00:ec2::254/128 to the default deny_cidrs and sync config.example.toml, README and docs/consolidator.md 2026-10-20 16:13:25 -04:00
ari 6e74d3d99b H: canonicalise addresses in the deny check Match IPv4-mapped IPv6 addresses against the IPv4 deny list at connect time, with tests for ::ffff:169.254.169.254 2026-10-20 16:12:07 -04:00
ari 39c1c91695 H: merge token loaders and peer helpers One loader in secrets.rs (header validity, canonicalised credentials dir) is used by the client; the deny-CIDR parser, loopback test and plain-http warning live once in config.rs 2026-10-20 16:10:24 -04:00
ariandClaude Sonnet 5.5 c478bef930 Plan WS-H: final review fixes
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 16:04:52 -04:00
ariandClaude Sonnet 5.5 a6d451f23f G: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 15:59:48 -04:00
ari 0515008572 G: order the schema check list 2026-10-20 15:56:44 -04:00
ari 33c70442a1 G: review-1 handoff and deviation log 2026-10-20 15:54:13 -04:00
ari ae1b6fed28 G: F7 index the generated OpenAPI document 2026-10-20 15:54:13 -04:00
ari 2adfa59027 G: F6 fix health tag and document auth 503 and auth-off notes 2026-10-20 15:54:13 -04:00
ari a1117da01d G: F5 document the MCP stream and session delete 2026-10-20 15:54:13 -04:00
ari abd5b12cd0 G: F4 scan multiline routes and their methods 2026-10-20 15:54:13 -04:00
ari e6a9453c7a G: F3 derive IntoParams for query parameter structs 2026-10-20 15:54:13 -04:00
ari d2917b2483 G: F2 reflect peer status schemas from JsonSchema derives 2026-10-20 15:54:13 -04:00
ari 1506af11fc G: F1 probe documented paths through auth-off router with real methods 2026-10-20 15:54:13 -04:00
ari 55a2401f17 G: dedupe openapi helpers 2026-10-20 15:54:13 -04:00
ari e7f1d1a488 G: handoff for G1-G4 2026-10-20 15:54:13 -04:00
ari 214e074cca G: G4 document every error code and both content types per response 2026-10-20 15:54:13 -04:00
ari 34a1e1644c G: G4 Drift guard and docs commit the spec and fail tests on drift 2026-10-20 15:54:13 -04:00
ari 869b6818e9 G: G3 Serving and CLI serve the spec behind auth and print it offline 2026-10-20 15:54:13 -04:00
ari 7078ed15b1 G: G2 MCP description document POST /mcp and x-mcp-tools from the tool router 2026-10-20 15:54:13 -04:00
ari 3d8e840427 G: G1 REST spec derive the OpenAPI document from the handlers 2026-10-20 15:54:13 -04:00
ariandClaude Sonnet 5.5 5f4a0583f3 F: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 15:54:03 -04:00
ari f894d7da17 F: dedupe the repeated peers test block 2026-10-20 15:31:10 -04:00
ari 2af03308ba F: make the multi-address tcp test independent of /etc/hosts 2026-10-20 15:16:56 -04:00
ari 4f388ccc92 F: dedupe test setup 2026-10-20 15:05:36 -04:00
ari f82b78bad5 F: say what the proxy forwards instead of 'it is stripped'
The caller's /api/v1 prefix is dropped during validation and the peer
path is built with it, so the old sentence described half of it.
2026-10-20 15:04:09 -04:00
ari 2769c6f999 F: record review round 3 in the workstream log
Log entry for the round and the hook-check port noted in the dated
Handoff, so the orchestrator knows why four files outside the F list
changed and what is left for the fold.
2026-10-20 15:04:09 -04:00
ari 2a9339c673 F: handoff for review round 3 2026-10-20 15:04:09 -04:00
ari 1d4b568a7c F: script the remaining fakes on the peer's /api/v1 paths
Follow-up to the proxy path fix: the MCP end-to-end and peers_config
fakes still matched "/systemd/units" and so answered 404. Test
expectations only.
2026-10-20 15:04:09 -04:00
ari 04992e202d F: correct the peers docs against the finished behaviour
docs/consolidator.md: the Testing section described the pre-feature test
(no tests/peers.rs, the old tests.<system>.peers attribute, a note about
assertions failing by design) and is rewritten for both layers, the
module's eval check included. A shutdown subsection backs the README's
promise, the agenix examples say why a consolidator would bind 0.0.0.0
(remote callers; peers need no inbound port), and the VM test asserts
the chained-request status is exactly 400 as documented. README: token
rotation on NixOS also needs a reload for the LoadCredential copy.
2026-10-20 15:04:09 -04:00
ari 0a83386de5 F: one in-process server helper and the shared test TempDir
Peer::spawn and Consolidator::start repeated the bind, pool, migrate,
mint and serve_listener sequence; serve(config, tls, prepare) does it
once and returns the handle, the token and whatever the caller prepared,
so the registry is installed before the router is built. The local
TempDir copy is gone in favour of peers::testing::TempDir, which already
does unique scratch dirs and mode-controlled writes.
2026-10-20 15:04:09 -04:00
ari dab2f1ad4f F: tighten the redirect, cap and oversize assertions
The redirect test waited on a fixed sleep and a status that starts false;
it now waits for the health loop's own http_302 verdict before asserting
the Location target saw no connection. The peer cap asserts the message
rather than the bare number, and a chunked response (no Content-Length to
precheck) proves the byte count refuses an oversize body end to end.
2026-10-20 15:04:09 -04:00
ari a3b3958add F: exercise shutdown and a slow-loris peer for real
The hand-written listener now distinguishes a complete reply, SSE headers
followed by a held socket and headers followed by one body byte every
300 ms. shutdown_ends_a_proxied_follow uses the held socket instead of a
real peer, so only shutdown can end the stream, and a new trickle case
proves the request deadline ends a slow-loris peer (503 timeout) rather
than the peer's goodwill. The silent-peer bound drops from 10 s to 4 s so
a missed 1 s deadline cannot hide inside it.
2026-10-20 15:04:09 -04:00
ari 30ca2010ea F: build checks.<system>.vm-peers from dev-test vm peers
After F2 moved the peers test into checks, vm-steps still resolved peers
to tests.<system>.peers, so the documented command built nothing. Both
VM names now resolve under checks, the peers one renamed to vm-peers,
and a new self-check fails if a vm name stops pointing at .#checks.

nu dev/dev-test.nu self-check: ok.
2026-10-20 15:04:09 -04:00
ari 1c2f6f32d3 F: restore the nix/checks.nix import in flake.nix
The rebase dropped it, so the five hook/lint rust and shell checks that
main builds were silently missing from nix flake check. Merge them back
under the F2 additions (package, vm, vm-peers, module-peers).
2026-10-20 15:04:09 -04:00
ari dde6a12ce4 F: try every resolved peer address instead of the first
A peer whose name resolves to both families but which listens on only one
of them was reported unreachable, which the documented 0.0.0.0 binding
produces on a dual-stack LAN and in the NixOS test network.

resolve_target now returns the whole address set (still refusing the name
if any address is denied), the HTTP client pins it with
resolve_to_addrs so the connector falls through to the next address, and
tcp_check tries each address in order with a per-attempt share of the
remaining deadline. ClientKey keys on the set.

Regression cover: a client test that resolves localhost against a
single-family listener, a tests/peers.rs case declaring the peer as
http://localhost:<port>, and the VM test's TLS peer gamma now binds
0.0.0.0 (IPv4 only) while alpha and beta stay dual stack. Docs and the
contracts section 10 address note describe the new behaviour.
2026-10-20 15:04:09 -04:00
ari 3ae8e74a1d F: forward the peer's /api/v1 path and un-ignore the proxied tests
The proxy validated the route without its API prefix and handed the
transport "/systemd/units", which a peer answered with 404. Validation
still works on the bare route; the transport now gets
"/api/v1/systemd/units". Un-ignoring the two acceptance tests
(a_plain_peer_serves_its_own_data_through_the_proxy and
shutdown_ends_a_proxied_follow) is the check for that fix; the unit
tests in api/, mcp/ and the registry script their fakes on the peer's
real paths again.
2026-10-20 15:04:09 -04:00
ari 2455486205 F: handoff for F2 to F4
Status, the nix commands to run, the blocking proxy defect reported to WS-C,
and the dev-test/doc seams.
2026-10-20 15:04:09 -04:00
ari 4d83c2eff5 F: F4 peers docs, agenix example and tool-count note
README peers section, docs/consolidator.md (threat model, tokens, firewall,
worked agenix example, reload/restart), the MCP tool count in both tables,
and config.example.toml commentary.
2026-10-20 15:04:09 -04:00
ari 66ee41a672 F: F3 end-to-end peer tests
Real registry and transport against in-process peers and hand-written
listeners: plain, TLS with an rcgen CA, a wrong CA, redirects, oversize
bodies, a silent peer, the 64-peer cap and shutdown mid-follow. Two proxy
cases are ignored: the proxied path is missing its /api/v1 prefix.
2026-10-20 15:04:09 -04:00
ari ca000d973f F: F2 promote the peers VM test and the module eval test into checks
The test nodes declare peers through the first-class module options, so
LoadCredential and RefreshOnReload come from the module. Every node binds
:: because the test network resolves node names to IPv6 first. poll()
raises with the last observed status JSON.
2026-10-20 15:04:09 -04:00
ari 4f5fa589ac F: F1 record review round 1 in the workstream log 2026-10-20 15:04:09 -04:00
ari d056f9df3a F: F1 eval cases for the restart/reload split and the new assertions 2026-10-20 15:04:09 -04:00
ari 7128321692 F: F1 restart on what SIGHUP cannot apply and settle the peers precedence
The config file now always stays a reload trigger, and the restart trigger
is the settings reduced to the keys the service cannot apply on SIGHUP, so
a peer edit reloads while a port, auth or limit change still restarts. The
first-class peers options win over the freeform bags, and the assertions
cover enabled peers, the 64-peer cap and LoadCredential-safe token paths.
2026-10-20 15:04:09 -04:00
ari 95e3533e83 F: F1 record module options, tests and handoff in the workstream log 2026-10-20 15:04:09 -04:00
ari e6cb4c0b3e F: F1 NixOS peers options with LoadCredential token delivery 2026-10-20 15:04:09 -04:00
ariandClaude Sonnet 5.5 38f1bf99fc Plan WS-G: generated OpenAPI doc
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:22:34 -04:00
ariandClaude Sonnet 5.5 8c0f996262 Fix hook flake checks, relax markdownlint style rules, add hook pointers
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:21:52 -04:00
ariandClaude Sonnet 5.5 9e4fb38993 Document hooks; drop review tag from a comment
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:19:46 -04:00
ariandClaude Sonnet 5.5 0bddfbb063 Wire hooks into devenv and flake checks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:19:46 -04:00
ariandClaude Sonnet 5.5 46c644ff2b Add hook path mapping, runner and fixture tests
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dpKwZWtahQU4V2NhpVmLt
2026-10-20 10:19:46 -04:00
ariandClaude Sonnet 5.5 3798e330af D: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 23:14:04 -04:00
ari db345fb0f8 D: fix test names in the round-1 log 2026-10-19 23:10:15 -04:00
ari c0e76607f6 D: reuse the shared proxy bounds and status table in MCP peers
The peer follow stream had no byte cap and kept a whole unterminated
frame in memory, and the MCP surface carried its own peer status table
that already disagreed with REST for peer 400.

- mcp::peers::fetch now returns proxy::PreparedResponse, so the status
  comes from proxy::classify_status and the body from
  proxy::prepare_response (peer byte cap, deadline, shutdown), the same
  two steps REST uses. status_error, body_bytes and the local 2xx check
  are gone.
- tail_journal consumes that prepared stream; a Frames cursor keeps a
  partial frame from being rescanned from byte 0 on every chunk, the
  entry cap truncates the result, and the end of the stream maps to the
  note (entry cap, shutdown, byte cap, deadline or close).
- Prompts resolve the peer argument against the registry (unknown or
  disabled peer is refused); list_peers returns the error registry()
  produced; one wording for an unknown peer name.
- Tests: byte cap on an unterminated frame, entry cap, buffered body,
  follow 404/500, deadline with an open stream, shutdown, frame cursor,
  REST/MCP parity for peer 400/404/401/5xx, and a full golden snapshot of
  the peers-off tool table. Peer scripts use the stripped path form C2
  forwards.
2026-10-19 23:09:45 -04:00
ari e2c553dbe4 D: share tool-name fixture and dedupe MCP peer tests 2026-10-19 22:59:49 -04:00
ari d1bec4a3d8 D: handoff for D1-D3 2026-10-19 22:59:49 -04:00
ari 5237e772d4 D: D3 peer wording, peers://status and peer-aware prompts
Server instructions and the eight tool descriptions mention peers and the
untrusted-data rule only while a registry is configured. peers://status
returns the list_peers JSON and is advertised only then. diagnose_unit and
container_health_report take an optional validated peer argument.
2026-10-19 22:59:49 -04:00
ari ae09f0530c D: D2 list_peers and get_peer behind peers.enabled
The two status tools and the optional peer argument exist only when a
registry is configured. rmcp's disable_route hides the tools; the eight
shared schemas lose the optional peer property, and the two list tools also
lose the derived $schema key, so the peers-off list and schemas match a
build without the feature byte for byte. Both snapshot variants and the
wire-level tool list are asserted.
2026-10-19 22:59:49 -04:00
ari d3285a994b D: D1 optional peer argument on the eight tools
Peers resolve through PeerRegistry::get, the same entry point REST uses,
so the hop marker, allowlist and error mapping stay in one place. Log
tools keep the local {entries, truncated, note} shape; tail_journal
consumes the peer SSE stream. Tests cover every tool, path encoding,
error mapping and the integration path through the assembled router.
2026-10-19 22:59:49 -04:00
ariandClaude Sonnet 5.5 95fac95389 T: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 22:57:56 -04:00
ari 4d7d7defe6 T: a dispatch error raises, so a module-mode session survives a typo 2026-10-19 22:37:08 -04:00
ari e736c12a0e T: log review round 2 (module-mode exit, filter-cache root, handoffs) 2026-10-19 22:37:08 -04:00
ari 5edbd388d1 T: docs: interactive dev-test lives inside devenv shell; module-mode notes
AGENTS.md said the same command works in an interactive shell, which only
holds inside devenv shell or direnv (the script is on PATH there).
docs/consolidator.md now says the filter cache sits at the repo root and that
a failing check raises a catchable error instead of closing the session.
2026-10-19 22:37:08 -04:00
ari b01a409d35 T: anchor the filter cache and its mtime key on the repo root
source-mtime-key globbed src/**/*.rs from the cwd and the cache path was
relative, so completion started in a subdirectory (src/) failed the globs,
keyed the entry "unknown" and wrote <subdir>/target/... under a key that
never goes stale.

The globs (via glob, since ls only expands literal patterns) and the cache
path are anchored on the script's repo root, and an unusable key (unknown or
none) is neither read nor written. check-filter-cache now proves the key and
path are the same from src/ as from the root, and that an unknown key leaves
no file behind.
2026-10-19 22:37:08 -04:00
ari b2a4059080 T: failing checks raise instead of exiting, so module mode keeps the session
run-steps and self-check ended with exit 1. With use dev/dev-test.nu * in a
Nushell config, exit ends the caller's session and cannot be caught, so any
red dev-test unit|all|ci closed the terminal right after the summary.

run-steps and self-check now raise a catchable error; only the script-mode
entry point (main) exits, after printing the reason. check-module-mode guards
that: it rejects exit outside main, rejects (exit ...) interpolated into a
message (a subexpression that ends the process; the cargo-tree message had
one), catches a real failing step in module mode and requires script mode to
still exit non-zero.
2026-10-19 22:37:08 -04:00
ari b476ac2b0c T: rename runner to dev-test 2026-10-19 22:37:08 -04:00
ari 6dade6239d T: review round 1 fix runner argv, filter cache, and the test builtin 2026-10-19 22:37:08 -04:00
ari 40cf1073f4 T: T7 nushell test runner, devenv test script, command lists, docs testing section 2026-10-19 22:37:08 -04:00
ariandClaude Sonnet 5.5 396c382046 C: mark merged
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 22:37:03 -04:00
ari 8b7569363c C: review round 2 proxy query unit rule and shared status classifier
Proxied journal/unit values now use the local unit-name helper instead of a
second, stricter check, so escaped units pass through as text, %5C or %5c.
The peer status table is one function shared with the transport, and the
segment/encoding cases left untested get allowlist and rejection cases.
2026-10-19 22:35:51 -04:00
ari da2e8d7be2 C: record review round 1 responses and handoff for WS-D 2026-10-19 22:35:51 -04:00
ari cfb3a400df C: document proxied unit names, status mapping and peer header rules 2026-10-19 22:35:51 -04:00
ari 7a4d64c051 C: review round 1 proxy fixes
Unit names go through the local route's validation, so escaped and
dash-rooted units work through the proxy; backslashes stay legal only
there. Response preparation (status classification, content-type check,
size/stream bounds) moves into proxy.rs for REST and MCP to share.
x-slinuxm-peer is only set for configured peers, proxied SSE is no-cache,
and the unreachable handler fallbacks are gone.
2026-10-19 22:35:51 -04:00
ari 9be74b9dd8 C: record C1-C4 completion and handoff in the workstream log 2026-10-19 22:35:51 -04:00