Repository navigation
Commit eb56310
authored
docs(r10): the capstone fleet — example 41 + chapter 41 (the finale) (#10)
* docs(r10): scope the capstone fleet (example 41 + chapter 41)
Working plan for the book's finale: pmon supervising chatterd + sysagent
+ fwatch as a capability-dropped, Landlock-sandboxed, OTLP-observed fleet
across two lab VMs. Records the full subcommand contract, the vm-peer
topology, the reuse map (the capstone assembles pieces already ported in
ex 33/34/36/38/40), the C++/Rust dependency status (C++ ready via the
ex38 conan set; Rust deps still stubbed and offline-availability of
landlock/inotify crates unverified), the reference-passing approach
(verify.lua against Go first, then port by subsystem), the phased steps
S1-S6, and the risks. Internal plan (published: false).
* demo(demo-41): real verify.lua for the capstone fleet
Replaces the hello-syscall template check with a full local-loopback
assertion of the fleet's observable contract (following ex23's vm-peer
convention: the verify runs on 127.0.0.1, the real two-host run is the
chapter's demo). 31 assertions across:
- usage/error shapes (exit 2), incl. sysagent saturate's own usage;
- sysagent one-shot metrics line + otel-disabled;
- fwatch snapshot, watch create/modify/delete events, and the Landlock
ruleset (landlock ABI=N enforced -- kernel-level, not self-reported);
- chatterd single-node delivery, then the cross-node BRIDGE (a message
sent on node A is delivered to a listener on node B as
received from=NICK@A -- the @A tag proving it crossed);
- the pmon fleet: capability-bounding-set drop + no_new_privs, all three
services reaching health=up, clean SIGTERM shutdown, exit 0;
- OTLP telemetry: sysagent's cpu_pct gauge reaching Prometheus through
Grafana's proxy (SKIPs if LGTM down).
Verified against the Go reference through the runner: PASS 31 / FAIL 0.
S1 (contract) and S2 (go gate) done; C++/Rust ports next.
* docs(r10): confirm Rust capstone deps are cached offline (S4 de-risk)
landlock 0.4 (ex33), inotify via nix (ex09), opentelemetry-otlp 0.32
(ex38), libc/anyhow — all in the cargo cache. No offline-availability
risk remains for the Rust port.
* demo(demo-41): C++ port of the capstone fleet
Ports the ~1300-line Go fleet to C++23 across pmon/chatterd/sysagent/
fwatch/proto/caps/telemetry/util, reusing the proven C++ from ex33
(Landlock raw syscalls), ex34 (fork/exec signal-mask unblock before
execv), ex36 (/proc math), ex38 (opentelemetry-cpp OTLP + NoopLogHandler
+ the --start-group link-cycle fix), and ex40 (RAII fd, poll shutdown).
Verified on systems-target via the runner: PASS 31 / FAIL 0.
pmon is a sigwait()-thread supervisor; chatterd is an RAII-socket TCP hub
with the cross-node bridge (received from=NICK@node); sysagent reads
/proc and pushes three OTel observable gauges (with RemoveCallback before
scope exit); fwatch drives raw Landlock + inotify. Fixed a real bug in
the telemetry scaffold (fields were std::shared_ptr but GetTracer/Meter
return nostd::shared_ptr — would not have compiled) and the CMake otlp
target names. Builds fully offline from the conan cache.
* demo(demo-41): Rust port of the capstone fleet
Ports the ~1300-line Go fleet to Rust (edition 2024), same file split as
the C++ port, reusing ex33 (landlock crate + raw-syscall ABI probe), ex09
(nix inotify), ex36 (/proc math), ex38 (opentelemetry-otlp 0.32, base
OTEL_EXPORTER_OTLP_ENDPOINT so the SDK appends /v1/*, no tracing-subscriber
to keep the output contract), and ex40 (raw-fd TCP, OwnedFd, signals).
Verified on systems-target via the runner: PASS 31 / FAIL 0.
pmon forks/execs via nix; chatterd is a raw-fd TCP hub with the cross-node
bridge (received from=NICK@node); sysagent pushes three OTel gauges with a
node attribute; fwatch drives nix inotify + the landlock crate. Deps all
cached offline (nix 0.31, landlock 0.4, opentelemetry-otlp 0.32, libc,
anyhow). Documented divergence: opentelemetry-rust 0.32 surfaces export
errors only via tracing events, so the export_errors counter stays 0
(verify asserts the other telemetry lines, not that value).
* docs(r10): example 41 fully gated across cpp/go/rust (S5 done)
test-all-examples.py --only 41-capstone-fleet --mode vm prints PASS PASS
PASS (verify.lua PASS 31/0 per language). Only chapter 41 (S6) remains.
* docs(r10): author chapter 41 — the capstone fleet (S6, capstone complete)
Writes _docs/41-capstone-fleet.md, the book's finale (part "Performance
and Low Latency"): pmon supervising chatterd + sysagent + fwatch as a
capability-dropped, Landlock-sandboxed, OTLP-observed fleet across two
hosts. Ties the six-program arc together — the supervisor (ch11-14),
the chat daemon (ch21-27), the /proc agent (ch36), the file watcher
(ch07-09/33), the two-VM lab (ch02), the sandbox layers (ch32-34), and
OTLP to the LGTM stack (ch03/38).
Three verbatim codetabs (capability-bounding-set drop, pmon's
supervise-and-restart loop, chatterd's cross-host bridge worker) across
cpp/go/rust. Adds Figures 41.1 (two-VM fleet topology) and 41.2 (pmon
supervise lifecycle) + catalogue entries.
Verified footer cites both the loopback gate (test-all-examples PASS PASS
PASS; verify.lua PASS 31/0 per language) and a real two-VM run this
session: cross-host chat received from=dave@target, both guests reaching
health=up, Landlock ABI=7 on the guest vs 9 on the host, and
sysagent_cpu_pct{node=peer}=1.75 reaching the host's Prometheus over the
libvirt gateway. Marks S6 done; the capstone (example 41 + chapter 41) is
complete. validate.py OK.1 parent 86d050c commit eb56310
32 files changed
Lines changed: 8582 additions & 95 deletions
File tree
- _docs
- _plans
- assets/diagrams
- examples/41-capstone-fleet
- cpp
- src
- rust
- src
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
0 commit comments