diff options
| author | aur-build <aur-build@localhost> | 2026-11-21 13:28:55 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-21 13:28:55 +0000 |
| commit | 48fecfe03be4f214eaf4f9c49cb3c27496bb74ba (patch) | |
| tree | 432f6e32351df60d36a115561c1bf8b8013c5430 /tests/architecture-budget.json | |
| parent | a200edaac2056dd9c85d6bddff3ca181f0cc277e (diff) | |
| download | aur-build-48fecfe03be4f214eaf4f9c49cb3c27496bb74ba.tar.gz aur-build-48fecfe03be4f214eaf4f9c49cb3c27496bb74ba.zip | |
src: narrow what only its own module reads, and delete what nothing reads at all
The census's 35 `deadonly` items were a lead, not a verdict, and the compiler
answered it: 17 of them are read only inside their own module and were declared
`pub` for no reason, so they are `pub(crate)` now — `db::OpenReview` and its two
queries, `ReviewSubject` and its query, `fetch::Body`, `http`'s `form_get`,
`query_get` and `Page::flash`, `ops::EvictPlan`, `usecase`'s `StageB`… — and two
are read by nobody: `ReleaseState::can_transition` and
`SubscriptionState::can_transition`, both already annotated "nothing consults
this table today", which is the definition of dead rather than the argument for
keeping.
Narrowing them is what made the compiler look harder, and it found three more:
`ReviewSubject::pkgbase` was selected out of the database and never read,
`StageB::cached` was written in three places and never read, and
`StageB::version` was never called. All gone, the SELECT column with them.
The other 18 cannot be narrowed and now say so, once at the declaration and once
in the budget file: a row type the `aur-build` binary binds without naming
(`PackageRow`, `Checked`, `GcPlan`, `Prepared`), a type behind a `pub` fn a test
calls (`Unbuilt`, `BulkItem`, `StageA`, `CheckReport`, `PkgInfo`, `Installed`,
`Subscription`, `Manifest`), a trait a public test provisioner implements
(`Provisioner`, `ProvisionRequest`), and three that a release build never even
compiles because their module is `test-support`-gated (`shims::*`, `VirtualClock`).
`deadonly` therefore means *dead and unargued* now: an allowlisted item leaves the
dead columns, which is the only way the number can be held at zero forever.
448 pub, 49 dead, 0 unargued; 284 tests pass, one ignored, none lost.
Diffstat (limited to 'tests/architecture-budget.json')
| -rw-r--r-- | tests/architecture-budget.json | 150 |
1 files changed, 85 insertions, 65 deletions
diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json index f451680..7a95341 100644 --- a/tests/architecture-budget.json +++ b/tests/architecture-budget.json @@ -1,5 +1,25 @@ { "dead_code": { + "allowlist": { + "db.Migration": "the row type of `MIGRATIONS`, which is `pub` only under `test-support`; production walks the table through `db::migrate` without naming it", + "db.PackageRow": "what `index_packages` hands back to `http`, the publish step and the `aur-build` binary, which bind it without naming it", + "db.Subscription": "what `get_subscription` and `list_subscriptions` hand back to `watch`, `usecase`, the binary and tests/detect.rs", + "db.Unbuilt": "the attention row `approved_but_unbuilt` returns to the web UI and to tests/crash.rs", + "pkginfo.Installed": "what `parse_installed` answers with, read line by line by `pipeline` and tests/world.rs", + "pkginfo.PkgInfo": "what `parse_pkginfo` answers with; `pipeline`, `shims` and tests/world.rs read its fields, never its name", + "review.BulkItem": "one outcome of `approve::bulk`, which tests/approve.rs drives directly", + "sandbox.ProvisionRequest": "the argument of `Provisioner::provision`, the trait the public `LocalAgentProvisioner` implements", + "sandbox.Provisioner": "implemented by the test-gated public `LocalAgentProvisioner`; a private trait on a public impl is E0445", + "shims.FakeInstalled": "the whole `shims` module is `test-support`-gated, so a release build never compiles it", + "shims.FakePackage": "the whole `shims` module is `test-support`-gated, so a release build never compiles it", + "shims.Manifest": "returned by `manifest()`, which the shim tests read; the module is `test-support`-gated", + "time.VirtualClock": "lives in the `test-support`-gated clock module, behind the gated `virtualize()` that returns it", + "usecase.Checked": "what `usecase::detect` returns to the `aur-build` binary, which is a separate crate", + "usecase.GcPlan": "what `usecase::plan_gc` returns to the `aur-build` binary, which is a separate crate", + "usecase.Prepared": "what `prepare_review` and `view_review` return to the `aur-build` binary, which is a separate crate", + "watch.CheckReport": "what `detect::check_pkgbase` returns; the test tier drives it and binds the value without naming it", + "watch.StageA": "what `upstream::probe` returns; tests/ops.rs and tests/vcs.rs call `probe` directly" + }, "deadonly": { "bin/gpg": 0, "bin/makechrootpkg": 0, @@ -9,26 +29,26 @@ "bin/repo-add": 0, "bin/sandbox-agent": 0, "config": 0, - "db": 8, + "db": 0, "error": 0, - "fetch": 1, + "fetch": 0, "git": 0, "hash": 0, - "http": 3, + "http": 0, "lib": 0, "main": 0, - "ops": 1, + "ops": 0, "pipeline": 0, - "pkginfo": 2, + "pkginfo": 0, "pkgver": 0, "recipe": 0, - "review": 1, - "sandbox": 2, - "shims": 8, - "time": 2, + "review": 0, + "sandbox": 0, + "shims": 0, + "time": 0, "urlutil": 0, - "usecase": 3, - "watch": 4 + "usecase": 0, + "watch": 0 } }, "modules": { @@ -121,14 +141,14 @@ "test": 2 }, "db": { - "dead": 19, - "deadonly": 8, + "dead": 11, + "deadonly": 0, "glob": 0, "largest": 368, "largest_file": "src/db/mod.rs", - "lines": 3923, - "priv": 12, - "pub": 196, + "lines": 3897, + "priv": 19, + "pub": 189, "test": 11 }, "error": { @@ -143,14 +163,14 @@ "test": 0 }, "fetch": { - "dead": 1, - "deadonly": 1, + "dead": 0, + "deadonly": 0, "glob": 0, "largest": 57, "largest_file": "src/fetch.rs", "lines": 57, - "priv": 1, - "pub": 2, + "priv": 2, + "pub": 1, "test": 0 }, "git": { @@ -176,14 +196,14 @@ "test": 0 }, "http": { - "dead": 8, - "deadonly": 3, + "dead": 5, + "deadonly": 0, "glob": 0, "largest": 565, "largest_file": "src/http/routes/pages.rs", "lines": 2034, - "priv": 78, - "pub": 20, + "priv": 81, + "pub": 17, "test": 5 }, "lib": { @@ -209,14 +229,14 @@ "test": 0 }, "ops": { - "dead": 4, - "deadonly": 1, + "dead": 3, + "deadonly": 0, "glob": 0, "largest": 455, "largest_file": "src/ops.rs", "lines": 455, - "priv": 3, - "pub": 13, + "priv": 5, + "pub": 11, "test": 3 }, "pipeline": { @@ -231,12 +251,12 @@ "test": 6 }, "pkginfo": { - "dead": 2, - "deadonly": 2, + "dead": 0, + "deadonly": 0, "glob": 0, - "largest": 115, + "largest": 117, "largest_file": "src/pkginfo.rs", - "lines": 115, + "lines": 117, "priv": 0, "pub": 6, "test": 0 @@ -264,47 +284,47 @@ "test": 0 }, "review": { - "dead": 5, - "deadonly": 1, + "dead": 4, + "deadonly": 0, "glob": 0, "largest": 301, "largest_file": "src/review/diff.rs", - "lines": 914, + "lines": 915, "priv": 4, "pub": 24, "test": 4 }, "sandbox": { - "dead": 9, - "deadonly": 2, + "dead": 7, + "deadonly": 0, "glob": 0, - "largest": 506, + "largest": 508, "largest_file": "src/sandbox/kata.rs", - "lines": 1411, + "lines": 1413, "priv": 16, "pub": 21, "test": 7 }, "shims": { - "dead": 12, - "deadonly": 8, + "dead": 4, + "deadonly": 0, "glob": 0, - "largest": 652, + "largest": 655, "largest_file": "src/shims/mod.rs", - "lines": 652, - "priv": 8, - "pub": 13, + "lines": 655, + "priv": 13, + "pub": 8, "test": 4 }, "time": { - "dead": 5, - "deadonly": 2, + "dead": 3, + "deadonly": 0, "glob": 0, - "largest": 242, + "largest": 243, "largest_file": "src/time.rs", - "lines": 242, + "lines": 243, "priv": 0, - "pub": 14, + "pub": 13, "test": 3 }, "urlutil": { @@ -319,25 +339,25 @@ "test": 0 }, "usecase": { - "dead": 3, - "deadonly": 3, + "dead": 0, + "deadonly": 0, "glob": 0, - "largest": 123, + "largest": 124, "largest_file": "src/usecase/reviews.rs", - "lines": 402, + "lines": 405, "priv": 0, "pub": 30, "test": 0 }, "watch": { - "dead": 8, - "deadonly": 4, + "dead": 4, + "deadonly": 0, "glob": 0, - "largest": 302, + "largest": 296, "largest_file": "src/watch/upstream.rs", - "lines": 1121, - "priv": 10, - "pub": 24, + "lines": 1115, + "priv": 12, + "pub": 21, "test": 4 } }, @@ -348,15 +368,15 @@ "total": 36 }, "totals": { - "dead": 84, - "deadonly": 35, + "dead": 49, + "deadonly": 0, "edges": 87, "glob": 0, "largest": 701, "largest_file": "src/config.rs", - "lines": 15704, - "priv": 150, - "pub": 470, + "lines": 15684, + "priv": 170, + "pub": 448, "test": 49 } } |
