diff options
| author | dev <dev@localhost> | 2026-11-20 16:49:20 +0000 |
|---|---|---|
| committer | dev <dev@localhost> | 2026-11-20 16:49:20 +0000 |
| commit | 28387a3b920d2ecff62d2ef267af6b875be9d28d (patch) | |
| tree | 247860f1d8019a32677c5cdcc43adb833bc2ea5d /tools/arch-census.md | |
| parent | a0ebd201713ae5a5a871b46aa526ffc40770f4bc (diff) | |
| download | aur-build-28387a3b920d2ecff62d2ef267af6b875be9d28d.tar.gz aur-build-28387a3b920d2ecff62d2ef267af6b875be9d28d.zip | |
tools: census how wide each module's interface actually is
An interface is only as narrow as the items a module hands out, and nobody
had counted them: 585 pub items across 27 modules, 146 of which nothing
outside their own module ever names. That is not an interface, it is a hole
in the module boundary, and every one of them is a thing a later refactor
cannot change without a grep across the crate.
The census counts pub items per module, how many of them are dead, how many
of those a test does name (the integration tests are separate crates, so a
name only they use is genuinely pub and the honest thing is to count it
rather than pretend it is private), the glob re-exports that flatten a
namespace, and the crate:: edge set between modules.
The edge set is already acyclic, which is the useful surprise: a layer map
can be declared over the graph as it stands rather than after breaking
something. It also says where the width is — db hands out 226 items, http 68
of which 54 are dead — so the work has an order.
Baseline for all of it: 273 tests passing, clippy -D warnings clean, release
build clean.
Diffstat (limited to 'tools/arch-census.md')
| -rw-r--r-- | tools/arch-census.md | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/arch-census.md b/tools/arch-census.md new file mode 100644 index 0000000..aedf952 --- /dev/null +++ b/tools/arch-census.md @@ -0,0 +1,67 @@ +# Architecture census + +The numbers below are what the module tree costs, measured by +`tools/arch-census.py`. `tests/architecture.rs` enforces them against +`tests/architecture-budget.json`, which may only shrink. + +Baseline verification, before any of this work: `cargo test --all-targets +--features test-support` 273 passed / 0 failed across 36 test binaries; +`cargo clippy --all-targets --features test-support -- -D warnings` clean; +`cargo build --release` clean. + +## 2026-11-20 16:48 + +totals: 585 pub, 219 dead (73 test-only, 146 named by nobody), 42 pub(crate), 4 glob re-exports, 80 edges, largest file 1501 (src/db/queries.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 | 35 | 9 | 5 | 4 | 0 | 0 | 427 | 427 src/config.rs | +| db | 226 | 49 | 13 | 36 | 5 | 2 | 3687 | 1501 src/db/queries.rs | +| error | 15 | 0 | 0 | 0 | 0 | 0 | 124 | 124 src/error.rs | +| fetch | 3 | 1 | 0 | 1 | 0 | 0 | 56 | 56 src/fetch.rs | +| git | 19 | 5 | 0 | 5 | 0 | 0 | 280 | 280 src/git.rs | +| hash | 8 | 1 | 0 | 1 | 0 | 0 | 61 | 61 src/hash.rs | +| http | 68 | 54 | 11 | 43 | 32 | 2 | 1951 | 565 src/http/routes/pages.rs | +| lib | 0 | 0 | 0 | 0 | 0 | 0 | 22 | 22 src/lib.rs | +| main | 0 | 0 | 0 | 0 | 0 | 0 | 361 | 361 src/main.rs | +| ops | 13 | 5 | 3 | 2 | 0 | 0 | 415 | 415 src/ops.rs | +| pipeline | 30 | 15 | 6 | 9 | 2 | 0 | 1339 | 481 src/pipeline/steps.rs | +| pkginfo | 7 | 3 | 0 | 3 | 0 | 0 | 122 | 122 src/pkginfo.rs | +| pkgver | 18 | 9 | 5 | 4 | 0 | 0 | 347 | 347 src/pkgver/mod.rs | +| recipe | 11 | 4 | 0 | 4 | 0 | 0 | 467 | 467 src/recipe.rs | +| review | 29 | 10 | 4 | 6 | 0 | 0 | 792 | 295 src/review/diff.rs | +| sandbox | 35 | 23 | 15 | 8 | 3 | 0 | 1175 | 347 src/sandbox/kata.rs | +| shims | 19 | 12 | 4 | 8 | 0 | 0 | 603 | 603 src/shims/mod.rs | +| time | 16 | 7 | 3 | 4 | 0 | 0 | 221 | 221 src/time.rs | +| urlutil | 2 | 1 | 0 | 1 | 0 | 0 | 56 | 56 src/urlutil.rs | +| watch | 31 | 11 | 4 | 7 | 0 | 0 | 969 | 317 src/watch/detect.rs | + +``` +bin/gpg -> shims +bin/makechrootpkg -> shims +bin/makepkg -> shims +bin/mkarchroot -> shims +bin/pacman -> shims +bin/repo-add -> shims +bin/sandbox-agent -> sandbox +config -> error hash +db -> config error hash pkgver time +fetch -> error hash +git -> error +http -> config db hash ops pipeline pkgver review time watch +main -> config db http ops pipeline pkgver review watch +ops -> config db error time watch +pipeline -> config db error git hash pkginfo pkgver recipe review sandbox time watch +recipe -> db error +review -> config db error git hash pkgver recipe time urlutil +sandbox -> config error hash time +shims -> hash pkginfo pkgver recipe +watch -> config db error fetch git hash pkgver recipe review time +``` |
