summaryrefslogtreecommitdiffstats
path: root/tools/arch-census.md
Commit message (Collapse)AuthorAgeFilesLines
* docs: record the test-surface movement in the census report and READMEaur-build11 days1-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* docs: record the census, and make the README describe the tree that existsdev11 days1-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tools: census how wide each module's interface actually isdev11 days1-0/+67
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.