diff options
| author | aur-build <aur-build@localhost> | 2026-11-20 21:22:56 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-20 21:22:56 +0000 |
| commit | 2ed254f5487613e00dae4ee15dc63500c4edcce2 (patch) | |
| tree | fd14c32b9b2b8cba43a3b231b1833c411f2577e6 | |
| parent | b3c326735e4c212afed8c6a25411a1040a67f760 (diff) | |
| download | aur-build-2ed254f5487613e00dae4ee15dc63500c4edcce2.tar.gz aur-build-2ed254f5487613e00dae4ee15dc63500c4edcce2.zip | |
docs: record the test-surface movement in the census report and README
The census report gets a second movement next to the first. The numbers:
pub 505 -> 484, dead 105 -> 84, test-only 72 -> 48, pub(crate) 109 -> 119,
globs still zero.
Two budget increases are recorded rather than smoothed over, because both
are consequences of narrowing and a reader is entitled to know which
numbers moved the wrong way and why:
- sandbox.deadonly 0 -> 2. `Provisioner` and `ProvisionRequest` are named
by nobody outside sandbox but cannot be narrowed: LocalAgentProvisioner
is pub because two fixture tests construct it, and Rust forbids a public
type implementing a private trait or taking a private parameter.
- db.deadonly 8 -> 9. Five state enums each have a `can_transition`. Three
went private with their tests; ReleaseState's and SubscriptionState's
are consulted by nothing at all, so the name slid from test-only to
dead-only instead of disappearing. Both carry a NOTE already.
`largest` went 603 -> 673 because eleven config tests moved into
src/config.rs. It is reported and not budgeted: a line ceiling that counts
a module and its tests together would penalise the exact act this goal was
for.
README's Testing section was stale in a way only a test move exposes — it
named `versions::vercmp_matches_the_system_oracle`, a test that does not
exist under that name in either location — and said nothing about where a
test belongs. Both fixed, with the reason stated: a test outside a module
can only reach what the module exports, so a fixture-free test in tests/
is a door held open by a test.
| -rw-r--r-- | README.md | 20 | ||||
| -rw-r--r-- | tools/arch-census.md | 55 |
2 files changed, 73 insertions, 2 deletions
@@ -171,12 +171,28 @@ fails if any of it leaks into the default build. Some tests are gated on the host and skip themselves with a printed note rather than failing: -* `versions::vercmp_matches_the_system_oracle` needs pacman's `vercmp` on `PATH` - and compares the hand-written comparator against it over ~1100 pairs. +* `pkgver::tests::the_live_vercmp_tier_is_recorded_not_silently_absent` needs + pacman's `vercmp` on `PATH` and compares the hand-written comparator against it + over ~1100 pairs. A second test, `vercmp_matches_the_recorded_oracle`, checks + the same ~1100 pairs against a committed table, so the comparator is pinned on + a machine with no pacman at all. * The live kata tier needs `/dev/kvm` and a cluster (`AUR_KATA_API`); the kata rendezvous and TTL logic itself runs everywhere via a real `sandbox-agent` process with no VM. The old real-chroot tier retired with devtools. +### Where a test lives + +A test goes in the module it tests, unless it needs something a unit test cannot +have — the fixture corpus, a database, a real subprocess, a listening socket. +`tests/` is for those, and `src/` holds the rest as `#[cfg(test)] mod tests`. + +That is a rule with a consequence, and the consequence is the reason it is worth +stating: a test outside a module can only reach what the module exports, so every +test that sat in `tests/` while testing something module-private was quietly +keeping that thing `pub`. Moving the test home is what lets the item go private. +`tools/test-surface.py` finds the ones still outstanding and +`tools/test-surface.md` records what is being done about each. + ## Operations ```sh diff --git a/tools/arch-census.md b/tools/arch-census.md index 9dc52ae..ce0647c 100644 --- a/tools/arch-census.md +++ b/tools/arch-census.md @@ -153,3 +153,58 @@ 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. + +--- + +## Second movement: the test surface + +The first movement closed interfaces by deleting exports nothing reached. The +second closed them by moving tests home, because a test that sits outside a +module can only reach what the module exports — so every fixture-free test in +`tests/` was quietly holding a door open. + +| | pub | dead | dead-only | pub(crate) | glob | largest file | +|---|---|---|---|---|---|---| +| after the first movement | 505 | 105 | 33 | 109 | 0 | 603 src/shims/mod.rs | +| after the second | 484 | 84 | 36 | 119 | 0 | 673 src/config.rs | + +`pub` fell 505 → 484 and test-only items fell 72 → 48. The 48 that remain are +not an oversight: `tools/test-surface.md` gives each one a disposition and a +reason, and 33 of them are `residue` — items production needs inside their own +module *and* a fixture-bound integration test needs from outside, which Rust +cannot express as anything other than `pub` because it has no test-conditional +visibility. + +`dead-only` rose 33 → 36, and both increases are consequences of narrowing +rather than of anything being forgotten: + +- **sandbox 0 → 2.** `Provisioner` and `ProvisionRequest` are now named by + nobody outside `sandbox`, yet cannot be narrowed: `LocalAgentProvisioner` is + `pub` because two fixture tests construct it, and Rust forbids a public type + implementing a private trait or taking a private parameter type. Narrowing + them means narrowing that provisioner, which means those tests stop + constructing it. +- **db 8 → 9.** Five state enums each have a `can_transition`. Three became + private when their tests moved into the module; the other two — + `ReleaseState` and `SubscriptionState` — are consulted by nothing at all, so + the name moved from test-only to dead-only rather than disappearing. Both + carry a NOTE saying they are dead tables for machines nothing enforces. + +`pub(crate)` rose 109 → 119 for the same reason it rose before: closing an +interface raises that count, which is why it is reported and not budgeted. + +The largest file is now `src/config.rs` at 673 lines, up from 603. It grew +because eleven config parsing tests moved into it, not because the module grew +more capable. `largest` is reported and not budgeted for exactly that reason — +counting lines across a module and its tests measures the wrong thing, and a +ceiling on it would discourage moving tests home, which is the whole movement. + +### What the ratchet now also holds + +`tests/architecture.rs` gained `the_test_surface_is_disposed_of`, which runs +`tools/test-surface.py` and fails if any test-only item lacks a hand-written +disposition reason, or if any disposition count exceeds +`tests/architecture-budget.json`. `tools/arch-census.py --write-budget` now +preserves the `test_surface` section instead of erasing it: two tools writing +one file must not delete each other's axis, or the ratchet quietly stops +checking one of them. |
