summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordev <dev@localhost>2026-11-20 19:03:01 +0000
committerdev <dev@localhost>2026-11-20 19:03:01 +0000
commite6c3a02229994a9e007d8e6618add778e1ec021c (patch)
tree275b4a025af0738bf33b613741c7e7ecc7b708db /tools
parent6c4b4394bd8ddf28d130e87e0100349f13f6e912 (diff)
downloadaur-build-e6c3a02229994a9e007d8e6618add778e1ec021c.tar.gz
aur-build-e6c3a02229994a9e007d8e6618add778e1ec021c.zip
docs: record the census, and make the README describe the tree that exists
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/arch-census.md88
1 files changed, 88 insertions, 0 deletions
diff --git a/tools/arch-census.md b/tools/arch-census.md
index aedf952..9dc52ae 100644
--- a/tools/arch-census.md
+++ b/tools/arch-census.md
@@ -65,3 +65,91 @@ sandbox -> config error hash time
shims -> hash pkginfo pkgver recipe
watch -> config db error fetch git hash pkgver recipe review time
```
+
+---
+
+## 2026-11-20 18:57 — after
+
+totals: 505 pub, 105 dead (72 test-only, 33 named by nobody), 109 pub(crate), 0 glob re-exports, 87 edges, largest file 603 (src/shims/mod.rs)
+
+| module | pub | dead | test-only | dead-only | pub(crate) | glob | lines | largest file |
+|---|---|---|---|---|---|---|---|---|
+| bin/gpg | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/gpg.rs |
+| bin/makechrootpkg | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/makechrootpkg.rs |
+| bin/makepkg | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/makepkg.rs |
+| bin/mkarchroot | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/mkarchroot.rs |
+| bin/pacman | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/pacman.rs |
+| bin/repo-add | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 4 src/bin/repo-add.rs |
+| bin/sandbox-agent | 0 | 0 | 0 | 0 | 0 | 0 | 50 | 50 src/bin/sandbox-agent.rs |
+| config | 31 | 5 | 5 | 0 | 0 | 0 | 427 | 427 src/config.rs |
+| db | 202 | 21 | 13 | 8 | 10 | 0 | 3742 | 364 src/db/candidates.rs |
+| error | 21 | 0 | 0 | 0 | 0 | 0 | 430 | 430 src/error.rs |
+| fetch | 3 | 1 | 0 | 1 | 0 | 0 | 56 | 56 src/fetch.rs |
+| git | 14 | 0 | 0 | 0 | 0 | 0 | 240 | 240 src/git.rs |
+| hash | 7 | 0 | 0 | 0 | 0 | 0 | 59 | 59 src/hash.rs |
+| http | 27 | 13 | 10 | 3 | 67 | 0 | 1922 | 565 src/http/routes/pages.rs |
+| lib | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 23 src/lib.rs |
+| main | 0 | 0 | 0 | 0 | 0 | 0 | 314 | 314 src/main.rs |
+| ops | 13 | 4 | 3 | 1 | 0 | 0 | 415 | 415 src/ops.rs |
+| pipeline | 21 | 6 | 6 | 0 | 11 | 0 | 1330 | 472 src/pipeline/steps.rs |
+| pkginfo | 6 | 2 | 0 | 2 | 0 | 0 | 115 | 115 src/pkginfo.rs |
+| pkgver | 14 | 5 | 5 | 0 | 0 | 0 | 343 | 343 src/pkgver/mod.rs |
+| recipe | 7 | 0 | 0 | 0 | 0 | 0 | 459 | 459 src/recipe.rs |
+| review | 24 | 5 | 4 | 1 | 3 | 0 | 859 | 288 src/review/diff.rs |
+| sandbox | 27 | 15 | 15 | 0 | 11 | 0 | 1178 | 350 src/sandbox/kata.rs |
+| shims | 19 | 12 | 4 | 8 | 0 | 0 | 603 | 603 src/shims/mod.rs |
+| time | 14 | 5 | 3 | 2 | 0 | 0 | 206 | 206 src/time.rs |
+| urlutil | 1 | 0 | 0 | 0 | 0 | 0 | 56 | 56 src/urlutil.rs |
+| usecase | 30 | 3 | 0 | 3 | 0 | 0 | 402 | 123 src/usecase/reviews.rs |
+| watch | 24 | 8 | 4 | 4 | 7 | 0 | 1038 | 270 src/watch/detect.rs |
+
+### Before / after
+
+| | pub | dead | dead-only (named by nobody) | pub(crate) | globs | largest file |
+|---|---|---|---|---|---|---|
+| before | 585 | 219 | 146 | 42 | 4 | 1501 src/db/queries.rs |
+| after | 505 | 105 | 33 | 109 | 0 | 603 src/shims/mod.rs |
+
+The headline is not the pub count, though it fell 585 → 505. It is the
+**146 items whose name no other module ever wrote, down to 33** —
+and of those 33, every one is a type returned by a public function,
+so it is part of an interface without anyone having to spell it. None is an
+export nobody can reach.
+
+The other three numbers are the ones that keep it true:
+
+- **globs 4 → 0.** `db/mod.rs` and `http/routes/mod.rs` list what they hand out.
+ The architecture test's glob allowlist is empty and any new glob fails.
+- **pub(crate) 42 → 109.** This is the count that went *up*, and it is
+ the point. `priv` was removed from the budgeted keys for the same reason it
+ would have been absurd to keep: closing an interface raises it, so a ceiling
+ on it would have been a ceiling on the work.
+- **largest file 1501 → 603,** and the largest file is now
+ `src/shims/mod.rs` — a test fixture, not production logic.
+
+### Where the layer map ended up
+
+```
+error 0 → hash/time/urlutil/pkgver/pkginfo 1 → config/fetch/git 2
+ → db/sandbox 3 → recipe 4 → review/shims 5 → watch 6
+ → pipeline 7 → ops 8 → usecase 9 → http 10 → main/lib/bin 11
+```
+
+`usecase` is the one module added. It sits above everything it orchestrates and
+below both front ends, which is what lets the CLI and the web UI run the same
+workflow instead of each guessing at it.
+
+### The one budget above its baseline
+
+`error.pub` is 21 against a baseline of 15. The six added names are the payload
+types `Missing`, `Refused`, `Guard`, `WorldGap`, `PoolFull` and `TransientCause`,
+which the typed-error task required and which must be `pub` because they are
+constructed in `db`, `pipeline`, `watch` and `sandbox` and matched in `error`.
+They are interface, not leakage: `error.dead` is 0.
+
+`usecase` has no baseline because it did not exist at the start. Its 30 exports
+are the workflows, and its 3 dead-only items (`Checked`, `GcPlan`, `Prepared`)
+are again return types, not orphans.
+
+Every other budget in `tests/architecture-budget.json` is at or below its
+task-1 value, and the ratchet test fails on any increase.