From e6c3a02229994a9e007d8e6618add778e1ec021c Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 20 Nov 2026 19:03:01 +0000 Subject: docs: record the census, and make the README describe the tree that exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The census report gets its after-table, and the README's Layout gets rewritten — it had drifted into fiction, listing `db/queries.rs`'s successors as "queries" and omitting `usecase`, `error`, `hash`, `time`, `urlutil`, `git`, `fetch` and `recipe` entirely. It now states the ranks and says plainly that they are enforced by `tests/architecture.rs`, not kept in hope, and names the two commands that keep it true. This commit also carries the last of the narrowing that fell out of writing the report, because writing it meant actually reading the numbers: - `watch::upstream::resolve` looked test-only and was not — the tests contain an unrelated local function of the same name, which the census matches as a word. It is crate-internal and now says so. - `read_tree` closed with it. Its two integration tests were testing the module's own batching behaviour from outside, so they moved inside as unit tests with a throwaway git repo, which is where a test about one `ls-tree` and one `cat-file --batch` belongs. They lost nothing: the empty-blob and NUL-byte assertions came across verbatim, plus one the old test never made — binary blobs are still listed, just not read. - `Assessment::is_high`, `Tree::get`, `approve::current_accepted` and `diff::full_recipe_text` were dead once their callers closed, and are gone. - `set_risk_for_tests` is gone too. The bulk-refusal test needed a candidate marked high-risk, and the honest way to get one was for the fixture to write the row — `Env::execute` — rather than the library growing a public setter that exists only so a test can pass. That was the last budget above baseline apart from `error.pub`. `error.pub` stays at 21 against a baseline of 15, and the report says why: the six payload enums are constructed in four modules and matched in `error`, so they are interface. `error.dead` is 0. Final: 281 passed / 0 failed across 36 binaries (baseline 273), clippy -D warnings clean, release clean, census within budget. --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 20 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 8e9e20b..f802959 100644 --- a/README.md +++ b/README.md @@ -71,28 +71,55 @@ directory is visible at the same path on both sides. Asserting it is what stops ## Layout +Each layer may name only the layers beneath it. `tests/architecture.rs` encodes +the ranks and fails the build on an upward edge, so the order below is enforced +rather than documented in hope. + ``` src/ - main.rs CLI: init, subscribe, detect, reviews, show, approve, reject, - build, rebuild, run, builds, status, packages, serve, audit, - metrics, gc, backup - config.rs one config file at /config.json - db/ SQLite: migrations, model rows, queries, build state machine - mod.rs single writer actor + thread-local read-only readers - watch/ detection: scheduler, cheap/expensive polls, upstream probes, - source digests, staleness derivation - review/ candidates, diff panels, risk scoring, approval - pipeline/ the step machine, the dispatcher + worker pool, publishing - sandbox/ where build code runs: the backend seam, loopback, remote - agent protocol + agent binary, kata adapter, failure fakes - pkgver/ vercmp and the dependency-string grammar - pkginfo.rs .PKGINFO / .BUILDINFO parsing (no libalpm) - http/ tiny_http server: routes, render, auth, SSE log tail - ops.rs retention, metrics, VACUUM INTO backups - shims/ the fake toolchain that makes the pipeline testable (test-support only) -testcorpus/ the fixture packages the tests build for real -templates/ askama templates, server-rendered -static/ app.css and one vendored htmx + main.rs CLI: init, subscribe, detect, reviews, show, approve, reject, + build, rebuild, run, builds, status, packages, serve, audit, + metrics, gc, backup — argument parsing, one use-case call, + and printing; no workflow of its own + usecase/ rank 9 — the workflows both front ends run: bootstrap + (open/init/serve), detect, reviews (approve/reject/bulk), + subscriptions, builds, maintenance (gc/backup/notices) + http/ rank 10 — tiny_http server: routes, render, auth, SSE log + tail; renders use-case results, holds no workflow itself + ops.rs retention, metrics, VACUUM INTO backups + pipeline/ rank 7 — the step machine, the dispatcher + worker pool, + publishing + watch/ rank 6 — detection: scheduler, cheap/expensive polls, + upstream probes, source digests, staleness; `sources` is + the one interface the pipeline builds against + review/ rank 5 — candidates, diff panels, risk scoring, approval; + `intake::record` is the single way a candidate is recorded + shims/ the fake toolchain that makes the pipeline testable + (test-support only) + sandbox/ rank 3 — where build code runs: the backend seam, loopback, + remote agent protocol + agent binary, kata adapter + db/ rank 3 — SQLite: migrations, model rows, per-aggregate + query modules, build state machine; `mod.rs` lists its + exports explicitly, and a single writer actor owns writes + recipe.rs rank 4 — PKGBUILD and .SRCINFO parsing + config.rs rank 2 — one config file at /config.json + fetch.rs, git.rs rank 2 — the two seams over the outside world + pkgver/, pkginfo.rs, hash.rs, time.rs, urlutil.rs + rank 1 — pure: vercmp and the dependency grammar, .PKGINFO + and .BUILDINFO parsing (no libalpm), sha256 and canonical + json, the clock seam, url and name shapes + error.rs rank 0 — the crate's error type; the six variants behavior + branches on carry typed payloads, not prose +testcorpus/ the fixture packages the tests build for real +templates/ askama templates, server-rendered +static/ app.css and one vendored htmx +``` + +Two tools keep this honest, and both are meant to be run, not read once: + +``` +cargo test --test architecture # ranks, no cycles, no globs, interface budgets +python3 tools/arch-census.py # the numbers, and --budget to check the ratchet ``` ## Testing without root, network, or a real chroot -- cgit v1.2.3