| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`--all-targets` pulls `test-support` in through the dev-dependency, so
every check so far compiled `ReleaseState`, `Writer` and `json_or` as
`pub`. Without that feature they are crate-internal, and the tree was
not clean there: a wildcard import had been expanded into names the
release build never compiles, and `ReleaseState::as_str` took a
reference to a one-byte Copy value that clippy only complains about
once the type is not exported.
Both imports are gated with the code that needs them, and the README
now lists the three commands that hold the shape — including the
release-mode clippy run that found this.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The architecture test's own essays were the largest block of prose left
in the tree, and the test-file headers were notes about which tests moved
into `src/` — history the file no longer needs.
Removing those mentions moved two measured numbers, and the ratchet was
right to complain. `db.Writer` now sits in the allowlist with the
compiler fact that keeps it `pub` — narrowing it makes every call site
say `type db::Writer is private` — and the counts that got smaller are
written back at the smaller value, as the ratchet demands.
|
| |
|
|
|
|
|
|
|
|
| |
A workflow's doc now says what it guarantees and stops defending its
existence: `subscribe` resolves the repo row, `approve` queues what the
approval buys, a per-item failure comes back as a value instead of a
panic. The history of which front end used to open-code it is gone.
The last census-war notes go with it — three places that explained why a
name in a test string was not a caller.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
A gated item used to carry its own defence: why it is `pub` only under
`test-support`, which census once mistook a filename for a caller, why a
wrapper is compiled out rather than deleted. The budget file already
holds those claims and the ratchet already checks them, so the source
keeps the one line that says what the item is.
The module headers stop narrating the refactor that produced them. What
survives is the wire protocol, the git pipe, the poisoned lock that must
be recovered rather than unwedged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The repeated explanations go: sixteen copies of why a `pub` under
`test-support` has two declarations, six notes about where a test moved
from, forty-three banner comments naming the section they sit above.
The prose that stays is the prose the code cannot say — a hand-written
Debug that keeps a token out of a log line, a git pipe that would
deadlock if the write came first, an end-of-string check that has to
precede the separator skip. Enum docs in error.rs collapse to the line
that names what the type is; the argument for why it is shaped that way
is in the variants.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rustfmt.toml fixes the shape the tree is written in (120 columns, small
items kept on one line) and one canonical pass makes it the truth.
[lints.clippy] names the idiom lints worth enforcing and leaves out the
two that would add doc-comment boilerplate rather than remove it. The
tree pays them off here: write!/writeln! instead of push_str(&format!()),
let-else instead of match-on-Option, borrows where a thread entry point
only reads what it owns, no `&self` on a Copy state and no `self` nobody
reads.
ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and
value are now emitted by the same call instead of three.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The constraints section already told the truth about `pub` — an item with no
outside reader is a hole, allowed only by name and only with a reason — and
said nothing about the step below it, which is the one this pass just walked.
Added beside it: what over-wide means, that it is budgeted the same way, the
three compiler facts that actually force a `pub(crate)` to stay (a field cannot
out-reach its type, privacy does not reach up to a parent or across to a
sibling, and `pub(super)` is not a form this crate admits), and the warning
that the count is a grep while the verdict is the compiler's, asked under both
profiles.
The ratchet was checked rather than assumed. Re-widening `ops::sweep_staging`
from private back to `pub(crate)` — a change that compiles clean under both
profiles and breaks nothing at all — makes `arch-census --budget` exit 1 with
`ops.overwide: 1 > 0 accepted` and `ops.sweep_staging is over-wide and
unargued`, and makes `cargo test --test architecture` fail 3 tests including
`interfaces_stay_within_budget` and `the_over_visibility_budget_matches_the_code`.
Reverting it returns the suite to green. A ratchet that only fails on paper is
not a ratchet.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The whole `shims` module is behind `test-support`, so its thirteen `pub(crate)`
items were invisible to a release build already — but `pub(crate)` still made
each of them part of the crate's interface to every other module, and none of
them had a reader outside the file that declares it. `manifest`, `record`,
`split_version`, `valid_db_arg`, `DB_SUFFIXES` and the nine tool entry points
are now private to `src/shims/mod.rs`, which is where the shim binaries reach
them through the module's own `pub` surface.
`pipeline` went 16 -> 4 and `sandbox` 16 -> 9. Two refusals are worth the
sentence: `SourceIdentity` is the type of the `pub(crate)` field `Ctx::src`, and
a field may not be more reachable than its type, so making it private is the
`private_interfaces` warning rather than a legal narrowing. `provision_request`
is declared inside the private `kata_backend` module and called from the
sibling `#[cfg(test)] mod tests`, and privacy does not cross to a sibling —
E0624. Both are argued in `over_visibility.allowlist` now instead of sitting
unexplained.
`LOW` in `review` is the same sibling case one level up: it lives in the
`pub mod level` nested in risk.rs and the scorer in the parent module reads
`level::LOW`, so `pub(crate)` is the narrowest thing that reaches, given that
this crate does not admit `pub(super)`.
priv 149 -> 117, overwide 21 -> 0 unargued. `cargo check` clean under both
profiles with no new warnings; tests/pipeline.rs, remote_agent.rs, kata.rs,
approve.rs, shims.rs and world.rs pass (62 tests), and `cargo test --test
architecture` is 16 passed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`http` declares 81 `pub(crate)` items, the densest cluster in the tree, and the
census called every one of them the good state. Ten of them are not
crate-internal at all: `State`, `Req`, `Res`, `logout`, and the five accessors
on `Req` and constructors on `Res` are named only from `http/mod.rs`, the file
that declares them. The router dispatches through them in the same file; the
`pub(crate)` was describing an outside caller that does not exist.
`cookie` is the one worth naming: it is the auth-cookie helper, it looked used
from `http/routes/mod.rs`, and what is used there is a *field* named `cookie`
on `Req`. A word-match census cannot tell those apart, which is the whole
reason this pass was done by stripping markers and compiling rather than by
reading the census output.
priv 159 -> 149 (http 81 -> 71), overwide 22 -> 21. `cargo check` clean under
both profiles, no new warnings; tests/http.rs, surfaces.rs, notices.rs and
invariants.rs all pass (43 tests).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
reaches
Every one of these was found by taking the marker off and asking the compiler,
under both profiles, not by reading a grep. `cargo check --all-targets` builds
with `test-support` on, so it never compiles the `cfg(not(test-support))` half
of a feature-conditional declaration; the release check is the one that says
whether that half can go private, and it refused several of them that the dev
check appeared to accept.
Narrowed to private: config `shared_workspace` and `store_dir` (both are the
`cfg(not(test-support))` twin of a `pub` that only tests reach), db
`state_col`, `start`, `call`, `send`, fetch `Body` and `open`, ops
`build_success_rate`, `STAGING_GRACE_SECS` and `sweep_staging`.
Refused, and now argued in the budget file rather than left unexplained:
`EvictPlan`, because `plan_retention` is `pub(crate)` and returns
`Vec<EvictPlan>`, so a private row type is `error: type EvictPlan is private`
at `usecase/maintenance.rs:23` where the Vec is bound. `Readers`,
`OpenReview` and `ReviewSubject` are the same story in `db`.
priv 170 -> 159, overwide 27 -> 22. `cargo check` clean under both profiles
with no new warnings, including no new dead_code; `cargo test --test
architecture` 16 passed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`pub(crate)` was the good state in the census by decree: `priv` was reported
and deliberately left out of the budget, on the grounds that a rising count of
crate-internal items is progress. That is true of `pub` -> `pub(crate)` and
false of the next step. A `pub(crate)` item that no file except the one that
declares it ever names is offering the whole crate a thing nothing reaches, and
nothing in the suite said so.
`overwide` counts them. Same shape as `deadonly`, on purpose: a per-module
number that may only shrink, an item allowed to stay only by name in
`over_visibility.allowlist`, and the compiler fact that forces it written
beside the name. `--list-overwide` names every one with its file:line, and
`tests/architecture.rs` mirrors the definition so the two implementations are
cross-checked against each other, the way the census already is.
Baseline, before any item is narrowed: 35 of 170 `pub(crate)` declarations are
over-wide. Eight of them are already argued — a `pub(crate)` field cannot carry
a private type, privacy does not reach up to a parent module or across to a
sibling one, and `pub(super)` is not a form this crate admits — which leaves 27
unargued, and 27 is what the budget now holds.
The count is a grep and a grep is a lead, not a verdict: the verdict is the
compiler's, and it has to be asked under both profiles, because the
`cfg(not(feature = "test-support"))` half of a feature-conditional declaration
is never compiled by `cargo check --all-targets`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
nothing read
`Missing::Snapshot` was declared, rendered by the `Display` arm, and constructed
by nothing: `From<&str> for Missing` routes a bare sentence to `Missing::Other`,
and the test that mentions a snapshot asserts `Other(_)`. The variant and its
formatting arm are gone. A variant scan that counted *mentions* could not see it,
because the formatting arm is a mention; the scan now ignores a line that only
renders the variant, and what it reports afterwards is `Error::Json` and
`Error::Sqlite`, both of which the compiler proves live — deleting either breaks
the hundred-odd `?` sites that reach them through `#[from]`.
Three survivors in `tools/`, none of them caught by the audit that claimed the
axis was empty, because that audit looked at module-level constants and function
parameters and never at local bindings:
- `test-surface.py` opened `render()` with `out = [...] if False else []`, a
literal dead branch whose binding was then never read. Both gone.
- `test-surface.py` computed a `collisions` set that nothing consulted; the rule
it narrated had moved into `mentioned` as `sole_owner`. The set is deleted and
the explanation now sits in the docstring of the function that applies it.
- `release-surface-probe.py` built `decl_line` and used `decl_no` instead.
`a, b = item.split(" as ", 1)` became `_, b = ..` for the same reason. The scans
now cover locals and constant conditions as well, and report nothing: no unread
binding, no `if False`, no unreachable statement after a terminator, no unused
import, constant, parameter, or unread argparse option across the five tools.
|
| |
|
|
|
|
|
|
| |
`Web::server` carried its own `#[allow(dead_code)]` from before the crate-level
one existed, and it is not even true: `tests/live.rs` reads `web.server.addr`.
Every suppression left in the tree is now either a `cfg_attr` on a
test-support-only item, with its reason beside it, or the one crate-level
allowance in `tests/common`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A field scan that printed its first thirty lines missed the rest. Three `pub`
fields were written and never read: `SandboxSpec::disk_mb`, copied off
`cfg.min_free_disk_mb` into a spec no backend consulted — the dispatcher already
checks the disk itself, so the knob stayed live and the plumbing around it was
dead; `SandboxInfo::warm`, computed three ways by three backends and read by
nobody; and `Server::handle`, a `JoinHandle` stored and never joined, which is
what detaching a thread means and so was never load-bearing. All three are gone,
their construction sites with them.
Four more are written-but-never-read on purpose and now say so where they are
declared: `Identity::upstream_pins` and `source_digests` reach the identity
digest through `canonical_json`, not through a name; `VirtualClock::_owner` is
the lease, and holding it unread is the whole mechanism; the `Ab`/`Ba` pair in
`hash`'s canonical-json test exist to be serialized.
`the_test_helpers_are_used` only looked at `pub` items, which left the blanket
`allow(dead_code)` in `tests/common` exactly as able to hide a private helper as
a public one — the objection was fair, and planting
`fn planted_private_helper_never_used()` proved it passed while a dead private
helper sat in the file. It now scans private declarations too, and fails on both
the planted function and a planted struct.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`dead_code.deadonly` is 0 for all 28 modules and the allowlist names the 18
items that stay `pub` by decision, so the remaining question is whether the
ratchet can be broken quietly. Three tests close that.
`the_dead_code_budget_matches_the_code` refuses a budget that contradicts itself:
`modules.<m>.deadonly` is what `interfaces_stay_within_budget` reads and
`dead_code.deadonly.<m>` is what `tools/arch-census.py --budget` reads, and both
must equal the census — an edit to one alone is how a widening enters unnoticed.
`the_dead_code_allowlist_names_real_items` refuses an entry whose item the module
no longer declares, which is the permission that lets a deleted item return.
`the_budget_writers_preserve_each_other` runs both writers against a copy of the
file and fails if either erases the section it does not own, or rewrites the
hand-written allowlist — the failure mode two tools sharing one file were always
going to have.
Each was checked by breaking it on purpose: a raised budget, a stale allowlist
key, and a writer that drops the allowlist all fail loudly and pass again when
reverted. README now says `--list-dead` exists and that a kept item is allowed by
name in the budget file, because a ratchet nobody can inspect is not a ratchet.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Five axes were asked of `tools/*.py` — unreachable statements, unused imports,
module-level functions no tool calls, constants nothing reads, parameters nothing
passes, and argparse options nothing reads — and all five came back empty, which
is worth recording because the alternative is to assume a script directory rots.
The one real finding was staleness rather than dead code: `tools/test-surface.md`
still cited line numbers from before the narrowing, and `tools/arch-census.md`
last recorded a census of 470 `pub` / 84 dead / 35 unargued. Both were
regenerated by the tools that own them, so the committed reports now say
448 / 49 / 0. `gen-vercmp-oracle.py` was run and reproduces the committed oracle
byte for byte.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`tests/common/mod.rs` opened with `#![allow(dead_code)]` and nothing else, which
means it could have been hiding helpers no test called. It was not hiding many —
`upstream2_commit` and nothing else at file scope — but "not many" is not a
check, and the file cannot simply drop the allowance: it is compiled into every
test binary, so a helper one binary uses is dead code in the other twenty and
the lint fires everywhere and means nothing.
So the allowance stays and the check moves up a level. `the_test_helpers_are_used`
reads the file and fails on any `pub` item no test writes, counting a type as
used when a field or method of it is — `Web::raw_request` hands back a `Raw` no
test ever names. `every_fixture_is_referenced` does the same for `testcorpus/`,
which had one entry, `git-submodules`, that no test had ever driven; it is gone.
Both were checked by planting a dead helper and a dead fixture and watching the
suite refuse them.
`tests/dispatch.rs` also carried a function whose entire body was an
`#[allow(dead_code)]` on `fn unused(_: AtomicBool, _: Config) {}` — the deadest
code in the repository, with its two imports behind it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The census only sees `pub` items, so the constructs below it stayed invisible
until narrowing made the compiler look: rustc reported `ReviewSubject::pkgbase`,
`StageB::cached` and `StageB::version` as dead the moment their structs stopped
being exported, and the same question asked of every struct field, enum variant
and SQL literal in the crate found six more.
`BuildRow::lease_owner` and `BuildRow::priority` were selected out of the
database into a row nobody read; the *columns* are live — the dispatcher leases
through one and orders by the other — so the SELECT list and the row mapper lost
them and the schema did not. `Pkgbase::unpinable` and `SnapshotRow::files_json`
are the same shape, and `Config::git_bin` and `Config::build_user` are worse:
they are knobs an operator can set, defaulted, serialized, and consulted by
nothing. A setting that changes nothing is not an unimplemented feature, it is a
lie in a config file, so both are gone; `a_config_init_wrote_before_the_enum_
still_loads` now proves a config that still names them loads anyway.
Two axes came back empty, and both were checked rather than assumed: every string
literal containing SQL is passed to a call, and the two `Error` variants that
name matches never mention — `Json` and `Sqlite` — are constructed by `?` in
about a hundred places, which is why they were left alone. Every template and
every static asset is reachable from a route or an `extends`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`[lints.cargo] unused_dependencies = "allow"` was justified by a roadmap: the
warning was silenced because the dependencies it named would be needed by
targets further down the line. One of them never arrived. `similar` is referenced
by nothing in `src`, `tests` or `tools` — the diff is rendered by `similar`'s
namesake in `review::diff` only if something calls it, and nothing does — and the
mask is what kept that invisible.
Both are gone, and neither profile now warns: `cargo check --all-targets
--features test-support` and `cargo check --release --all-targets` are silent
without the override, so the next dependency that goes unused is a warning
rather than a fact nobody can see.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A count cannot be acted on. `db: 8 dead-only` tells a module is wide and sends
the reader back to grep for which eight, so the census now records where every
dead item is declared and `--list-dead` prints them: 35 named by nobody, 49
named only by tests.
What is *accepted* moves into the one file the ratchet already reads, under a
`dead_code` section — the accepted `deadonly` count per module, and an allowlist
of `module.item` to a one-line reason. `--budget` now fails three ways: a module
over its accepted count, a dead item no one argued for, and an allowlist entry
that no longer names a dead item. The third is the one that matters, because a
stale permission is how a deleted item comes back: the excuse is still on the
books, so nobody notices the new one. `--write-budget` writes the counts and
preserves the allowlist, the same way it already preserves the section
tools/test-surface.py owns — two writers of one file may not erase each other.
All 35 are unargued today, which is the point: the check is the worklist.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`release-surface-probe.py` used to take its candidate list from
`tools/test-surface.py`. That made it strictly downstream of the inference it
existed to audit: an item the detector dropped could never be probed, and the
tool reported "0 leaked" about a table that was missing the leak. The auditor was
right that "proven by compiling, not inferring" did not hold.
It now enumerates on its own — every `pub` declaration in `src/`, found by
scanning the files — and applies its own deliberately simpler production-use
rule (comments, strings and `use` lines do not count). Two independent rules that
must agree is a check; one rule consulted twice is not.
Three control experiments were run against it, and the first two failed before
the tool was correct:
- un-gating `review::approve::withdraw` initially reported nothing, because the
probe built paths from the census module (`aur_build::review::withdraw`)
instead of the real one (`aur_build::review::approve::withdraw`). A path that
cannot compile even with the feature was silently filed as "not nameable".
Paths are now derived from the declaring file, with the module-door and
intermediate re-export paths tried too.
- with that fixed, un-gating `withdraw` is caught by name and location.
- restoring `open_reviews_for` together with the test that used it is caught too.
Restoring only the function is correctly not caught: with no test naming it,
it is dead code, not a test-only leak.
That last distinction is a separate category now. A public item that nothing in
`src` or `tests` reaches — `reopen_rejected`'s shape — is reported and fails the
run, counted over the declaring file too so a helper used only by its own module
is not falsely called unreachable.
`db::Writer` stays reachable on purpose and is now probed for that claim: an item
listed in `test-surface-interface.json` must actually resolve, or the file is
stale and the probe says so.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auditor's `open_reviews_for` was invisible for one reason: the cross-module
mention index counted `pub use` lines as production use, so the item was
discarded before it could become a row. The tool's own docstring already said
"a re-export is not a call" — the rule was simply applied to the in-module loop
and never to the cross-module one. Two implementations of one idea, one of them
ignored.
Fixing that exposed the next layer, because once re-exports stop counting, the
calls that remain are mostly made through a name the declaring module did not
choose:
- `ap::approve(..)` from `use crate::review::{approve as ap, ..}`
- `sources::recipe_hash(..)` from `use crate::watch::sources;`
- `crate::db::model::BUILD_STEPS` — a path is not just its last token
- `candidates::mark_viewed(..)` — an item declared in `db`, re-exported by
`review`, and called through `review`
So the mention resolver now resolves import prefixes, walks the whole qualified
path, and follows re-export edges (collected from the entire `use` statement,
not just its first line — the names live on the continuation lines, which is how
`mark_viewed` hid too).
It also learned the opposite lesson. `Vec::new()`, `v.parse::<u64>()` and
`stop.load(..)` are not mentions of `db::new`, `pkgver::parse` or
`pipeline::load`. Treating every unresolvable receiver as ambiguous buried the
real rows, so a qualified mention must now name a crate module or an imported
prefix to count as anything, and a method name declared in exactly one module is
credited on a value receiver — `cfg.validate()` is `config::validate`, because
nothing else in the crate could mean it. With that, the ambiguous column is empty
instead of full of noise.
`use_block_lines`, `gated_declarations`, `line_context` and `use_prefixes` each
re-read their file on every call — 15,280 reads of the same dozen files, two and
a half minutes per run. Memoised: 20.7s, same output.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
`open_reviews_for` and `reopen_rejected` were both declared in `db`, both
re-exported by `review::candidates`, and both reached by nobody in `src`. The
auditor found them; the reason they stayed invisible is in the next commit.
`reopen_rejected` is simply gone: no caller, no test, nothing to lose.
`open_reviews_for` was a test convenience — `tests/detect.rs` used it to fetch
"the pending candidate for this pkgbase". The production query `pending` already
returns pending candidates and `CandidateRow` carries `pkgbase_id`, so the test
now filters that instead. Same assertion, same rows, one fewer public function
that existed only because a test wanted it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auditor's two counterexamples were both detector bugs, and they were the
same class of bug as the ones before: the instrument was reading the source in a
way that flattered the number.
- Rows are keyed by `(module, name)`. Keyed by bare name,
`pipeline::dispatch::Pool::shutdown` merged into the `db::Writer::shutdown`
row, which is gated, so an ungated item was reported `already-gated`.
- The production-mention index is built from lines with comments and string
literals removed. Searching raw text made `review::approve::withdraw` look
production-used because the *string* "withdraw" appears in an HTTP route
pattern and an audit action; every real caller named `withdraw_package` or
`withdraw_release_in`, which are different items.
- A `pub` declaration inside a private module is not a public declaration.
Without that, the inner-module narrowing made the detector report an
`http::new` nobody could name.
- For a name declared in several modules — `new`, `open`, `record`, `parse` — a
bare mention elsewhere cannot be resolved, so the row is kept and flagged
`ambiguous` rather than silently dropped, and
`tools/test-surface-ambiguous.json` holds the human verdict. An ambiguous row
with no verdict fails the architecture test; "the tool could not tell" is not a
disposition.
- The count rule was duplicated between `--json` and `--write-budget` and the
two drifted the moment a rule was added to one. `tally()` is now the one place.
`tools/release-surface-probe.py` replaces inference with compilation for the
final claim. It writes a throwaway crate depending on `aur-build` twice, with and
without `test-support`, and tries to name every dispositioned item from outside.
A path that compiles with the feature proves the path is real; every such path
must fail without it. Current result: 28 real external paths, 27 closed in a
release build, and the one that stays open is `db::Writer`, which is public
because `Db` has a `pub writer: Writer` field and Rust will not type a public
field with a private type. That is recorded as `interface` in
`tools/test-surface-interface.json` — a disposition that admits reachability and
names the signature that forces it — and the probe fails if the file claims an
item that is not in fact reachable, so it cannot quietly rot.
The tool's own docstring and the generated table claimed "Rust has no
test-conditional visibility". That was false and is gone, replaced with the two
shapes that do it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auditor's two counterexamples were real, and fixing the detector exposed
seventeen more items it had never listed. Each was checked individually rather
than dispositioned in bulk, and the check changed what the right answer was:
- `review::approve::withdraw` — gated. The CLI and the web UI both go through
`usecase::withdraw_package`; nothing invokes this. tests/pipeline.rs pins its
invariants, so it is gated rather than deleted: the test is the cover for an
operation production has not grown yet.
- `pipeline::dispatch::Pool::shutdown` — gated. Production runs the pool until
the process exits; a test needs the join to assert on effects after the
threads stop. Its two fields now carry a matching `cfg_attr(allow(dead_code))`
because in a release build they are stored and never read.
- `shims::{mkarchroot,makechrootpkg,makepkg,gpg,pacman,record}` — plain
`pub(crate)`. `run` dispatches to them by tool name; no module outside `shims`
names them and no test calls them. The tool names appear in test *strings*,
which is not a caller.
- `db::Writer::start`, `fetch::open`, `http::Req::form`, `http::Page::new`,
`http::Panel::new`, `http::render::BuildRow` — plain `pub(crate)`, same
reason: used only from inside their own module.
- `db::AuditEntry::system` — deleted. `audit_system` builds the row through the
free `audit()`; nothing ever called the constructor, production or otherwise.
- `pkgver::Version::display` — deleted, a wrapper around `to_string` with no
callers.
- `http::Server`, `watch::Stale`, `pkgver::Version` — private inner module with a
gated alias. `Server` is what `spawn` hands back and `main` holds without
naming; `Stale` is what `stale_rows` returns to `http` and `ops`; `Version` is
what `parse` returns. All three must stay nameable to those callers in shape
but not in name, which is exactly what the inner-module alias gives.
Measured on the release build's public surface: 466 reachable public names at the
start of this goal, 402 now, newly-public set empty.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`aliased_behind_private_module` reports an item as not release-exposed only when
both halves of the pattern hold: a `pub use ..::NAME;` whose attribute block
carries the test-support gate, and every `pub` declaration of the name sitting
inside a module that is itself private. Either half alone is not enough — a
gated alias to a genuinely public type says nothing, and a `pub` type in a
public module is reachable whatever the alias says.
The census still counts the inner `pub` as a public declaration, which is the
honest reading of the text and the reason this needed a second check rather than
a change to the first.
New `narrowed` disposition, distinct from `already-gated`: production *does* use
these items, just never from outside their module. `residue` and `ungated` are
now 0 and the ratchet records it.
Every one of the 46 items carries a hand-written reason naming its production
caller or explaining why it has none.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auditor was right and my "Rust has no test-conditional visibility" defence
was wrong. Two shapes do it, and both are now used wherever the item allows.
For free functions, methods, consts and statics: one body behind two visibility
declarations.
#[cfg(feature = "test-support")] pub fn probe(..) -> .. { probe_impl(..) }
#[cfg(not(feature = "test-support"))] pub(crate) fn probe(..) -> .. { probe_impl(..) }
fn probe_impl(..) -> .. { .. }
The value lives once in a private `*_impl` / `*_VALUE`, so the aliases cannot
drift apart.
For types: a private inner module holding the real definition, re-exported under
a feature gate.
mod kata_backend { pub struct KataBackend { .. } }
#[cfg(feature = "test-support")] pub use kata_backend::KataBackend;
#[cfg(not(feature = "test-support"))] pub(crate) use kata_backend::KataBackend;
A `pub` item inside a private module has no nameable path from outside, but it is
visible enough to appear in a public trait signature — which is why `Exit`, the
return type of `Sandbox::run`, narrows this way and would not as a plain
`pub(crate) struct`. `ReleaseState` earns its keep the same route: `ReleaseRow`
is public and its `state` field is typed here.
Verified with an external crate against the built library: naming `Exit`,
`SandboxInfo`, `KataBackend`, `LoopbackBackend`, `RemoteBackend`, `ReleaseState`,
`BulkRefusal` or `LogTail` from a release build is `error[E0603]: .. is private`;
with `test-support` the same program compiles.
Where narrowing needed a re-export split by feature (`db::MIGRATIONS`,
`model::ReleaseState`) the alias is split; where nothing in the crate used the
alias (`watch::sync_mirror`) it is gone rather than gated.
|
| | |
|
| |
|
|
| |
build
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Exit` is the result of running a command in a sandbox. `pipeline` consumes it
through `Sandbox::run` — `.success()`, `.stderr` — without ever writing the name,
which is why the census called it dead outside `sandbox`.
The type now lives in a private `mod exit` and reaches the world through an
alias that is `pub` only under `test-support` and `pub(crate)` otherwise. A
`pub` definition inside a private module is not a nameable path from outside,
but it is visible enough to appear in a public trait signature, which is what
makes this possible where a plain `pub(crate) struct` is not.
Verified with an external crate: naming `aur_build::sandbox::Exit` in a release
build is `error[E0603]: struct Exit is private`; with `test-support` it compiles.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An audit found that `internal` — the check deciding whether a test-only item
has a real production caller — was crediting non-calls. Four items were
sorted into `residue` on false evidence, and each false credit was a
different mistake:
db::cas_accepted_release a `pub use` continuation line at db/mod.rs:55.
Production does this CAS through
`cas_accepted_release_in` inside a transaction;
the two names differ by three characters.
shims::invocations the string "invocations.jsonl", plus a call from
`called_with`, which is itself test-support
gated. A test-only function cannot be evidence
that another function is production-used.
sandbox::LocalAgentProvisioner its own struct and impl headers.
Production selects `K8sSandboxProvisioner`.
sandbox::local_addr `listener.local_addr()` — std's method on a
TcpListener, in sibling files. The census treats
all of src/sandbox as one module, and a name
match cannot tell a receiver's type.
All four are gated now. `KataBackend::local_addr` had zero callers in src and
zero in tests — `tests/remote_agent.rs` calls `RemoteBackend::local_addr`, a
different type — so it is deleted rather than gated.
The detector now strips string literals and comments, skips `use` statements
including the continuation lines of a brace-delimited block, skips an item's
own impl headers, and refuses to count a call made inside a `#[cfg(test)]`
module or a `test-support`-gated item.
The case a regex cannot resolve is `self.store_dir()` versus
`listener.local_addr()`: identical to a name match. Rows whose only evidence
is a call in method position are flagged `⚑`, listed in
`tools/test-surface-confirmed.json` only after a human read the cited line,
and `the_test_surface_is_disposed_of` fails on any unconfirmed one. Four rows
are confirmed that way — `config.store_dir`, `http.cookie`,
`ops.build_success_rate`, `watch.needs_stage_b`.
The table now prints each item's in-module call sites as its own column,
because the residue count is the one number this work cannot eliminate and the
claim underneath it has to be checkable rather than asserted.
Suite: 284 passed, 0 failed. Clippy clean. Release build clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`review::diff::render_and_store` is the alarming row in the table: zero
callers in `src/`, seventeen test files. Intake renders through
`review::intake::record` — the single entry point the pipeline and both
front ends use — and this is the older uncomposed form. It is gated, not
relocated to `tests/common`, because it needs this module's private
`panels`/`render_text` and `candidates::set_diff_digest`; widening those
to let a test out would undo the narrowing the last dozen commits did.
`shims::called_with` is gated: the shim *writes* its invocation log in
production, which is how a fake tool leaves evidence, but nothing in the
crate reads it back. Only tests ask what a build actually did.
`time::pin` and `time::unpin` are gated together. Gating half of a
two-function capability would leave a release binary able to freeze the
clock and unable to release it. `pin` is worth naming because the census
never reported it as test-only at all: its name match also fires inside
`upstream_pins`, so a genuinely test-only function hid in plain sight
until its counterpart was examined. The only callers in the crate are
tests, and the unit test that uses them is gated with them.
Nothing was relocated to `tests/common`. The table chose no `relocate`
disposition — every item either needed module-private internals or moved
into its own module instead — and no API was widened to accommodate a
test, which was the condition on relocating anything.
Test-only items across the crate: 61 at the start of this work, 46 now,
of which 33 are residue and 13 already gated. `gate_pending` is zero.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Five http items were being counted as test-pinned on the strength of a
string alone, and are now `pub(crate)`:
render::Attention the word appears in crash.rs inside a message
Res::html "text/html" is a content type, not a call
Res::redirect "redirect" appears in an assertion message
routes::logout "/logout" is a route path
routes::route "mutating route" appears in an assertion message
Nothing in the test tier calls any of them; each carries a comment saying
so, because "the census said a test needed this" is not a reason and will
be re-asked by the next person to read the line.
`config::TestHooks` was already half-gated — the `hooks` field and the
`Default` line that fills it are both behind `test-support` — while the
type and its impl were not, so a release binary compiled a struct it
could never construct, read, or deserialize. Now gated whole.
The live kata tier moved into `src/sandbox/kata.rs`. It is not a fixture
test: it records its own absence without /dev/kvm or AUR_KATA_API, the
same way the vercmp live tier does. It was the only thing outside the
module naming `K8sSandboxProvisioner` field by field, so that struct is
`pub(crate)` now too.
One correction to the table, and it is the kind of correction a heuristic
deserves: `http::cookie` and `http::login` were classified `move-test`
because their tests contain no harness keyword. They do — `Web::` starts a
real HTTP listener, and a test that talks to one is not a unit test
however little code it holds. The detector now knows that, and both items
are residue, which is what they always were.
http: 27 pub -> 22 pub. Test-only items across the crate: 52 -> 46.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Six db items are now gated behind `test-support`, each with a comment
saying what it is for and why production never calls it:
builds::claim production leases a batch; `claim_batch` is
what the dispatcher runs
settings::set_setting the readers are used, the setter is not
Writer::shutdown the server runs until the process ends
snapshots::snapshot_by_commit
world::world_members production writes world snapshots, never
reads one back member by member
invariants::unapproved_index_entries
gated, not relocated: reading it needs this
module's private helpers, and widening those
to let a test out would be the wrong trade
Gating them exposed three things they were the only user of, and each is
gated with them rather than left compiling into a binary that cannot reach
it: `Msg::Shutdown` and its loop arm, and `model::json_or`.
`arch-census.py --write-budget` also stopped erasing the `test_surface`
section — two writers of one file must not delete each other's axis, or
the ratchet quietly stops checking it.
`steps::touch` is deleted, not narrowed. Nothing called it — not
production, not a test. The census had credited it to `tests/shims.rs`,
where the word appears inside a string.
In sandbox, two tests moved into `src/sandbox/kata.rs`: the container
record a lease provisions, and the TTL expiry of a sandbox that never
dials in. Neither builds a fixture. `KataBackend::shared_for`,
`provision_request`, `sandbox_cr` and `K8sSandboxProvisioner::for_config`
are `pub(crate)` as a result.
`KataBackend::reclaim` is deleted — same story as `touch`. It forwarded to
`self.provisioner.reclaim`, which the reaping site already calls itself,
and the TTL test the census credited it for implements the *trait's*
`reclaim` on a null provisioner. Same word, different function.
Two honest costs, both recorded rather than smoothed over:
- `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.
`sandbox.deadonly` therefore rises 0 → 2, with the reason here as the
ratchet demands.
- `agent_sandbox_config()` now exists in both `tests/kata.rs` and
`src/sandbox/kata.rs`. Three of that file's remaining tests still need
it, and a test helper cannot be shared across the crate boundary without
making it public again.
sandbox: 27 pub / 15 dead -> 22 pub / 10 dead.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The census could say which `pub` items nothing outside their module
names, and which of those a test names. It could not say what to do about
them, because the two questions that actually decide it are ones a
raw-source name match cannot answer:
Does a test *call* it, or merely mention it inside a string?
Does production code *inside* the declaring module call it?
`tools/test-surface.py` asks both, and `tools/test-surface.md` records the
answer for all 61 items. Four dispositions, each with a hand-written
reason kept in `tools/test-surface-reasons.json`:
gate (9) production never calls it; a test does
move-test (9) the test that names it builds no fixture, so it is a
unit test in the wrong file
narrow (6) no test calls it at all — census false positives, the
name appears only inside a string literal
residue (34) stays pub, and the honest column
`residue` needs saying out loud. Rust has no test-conditional visibility:
no attribute makes an item `pub` under one feature and `pub(crate)` under
another, and `pub use` cannot re-export a `pub(crate)` item. An item that
production needs *inside* its own module and a fixture-bound integration
test needs from outside cannot be narrowed without breaking one side or
the other. That is not a gap in this analysis; it is a gap in the language,
and the way to close those 34 rows is to change the tests — move them into
the module, or exercise the behaviour through the module's real entry
point — not to invent a visibility that does not exist.
So the column is ratcheted rather than wished away.
`the_test_surface_is_disposed_of` fails if any row lacks a hand-written
reason, and if any count — including `gate_pending`, items decided to be
gated but not yet gated — exceeds its budget. It can only shrink.
Two census limitations surfaced and are now written down rather than
silently trusted: "module" means the top-level directory, so an item used
only from a sibling file in the same module reads as dead; and mentions
are matched over raw source, so a string counts as a reference. Six items
were being counted as test-pinned on the strength of a string alone.
No source file is edited here. This is the decision record the next
commits apply.
Suite: 284 passed, 0 failed. Release build: zero warnings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tests/state_machine.rs was built around a database, so two tests that
asserted nothing about a database still sat there: the column-text round
trip, and the enumeration of the transition table. Both moved into
src/db/model/build_state.rs, where `BuildState` and its table are
declared.
Making them in-module tests is what let the table stop being public.
`ALL` and `can_transition` had no reader outside db/model at all —
production enforces transitions by asking `predecessors(to)` and putting
the answer in a SQL `WHERE state IN (...)` guard — so both are now
private, and the five state enums' `ALL` consts with them.
One assertion moved rather than being dropped.
`a_terminal_build_is_history_and_does_not_move` made two claims per
state: a table claim (`!Succeeded.can_transition(to)`) and a database
claim (`set_state(...).is_err()`). The table claim now lives with the
table; the database claim stayed where the database is. Neither was
weakened.
Two findings, recorded rather than quietly acted on:
`ReleaseState::can_transition` and `SubscriptionState::can_transition`
are consulted by nothing — not by `predecessors`, not by a test. They are
dead tables for machines nothing enforces. Left `pub` with a NOTE and
handed to the disposition table, because deleting a stated invariant and
wiring up an unwired one are both decisions above this commit.
Added two round-trip tests (StepState, and the three enums declared in
state.rs) so the newly private `ALL` consts are still exercised.
db: 202 pub / 13 test-only -> 201 pub / 11 test-only.
Suite: 283 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tests/hash.rs held three tests and none of them belonged there. Two were
about `canonical_json` and moved into src/hash.rs. The third asserted
that the identity digest is a pure function of an identity's own fields
— a property of `db::model::Identity`, not of the hashing helper it
happens to call — so it moved to db::model, where the thing it tests
lives. The file is now empty and is deleted; the tests are moves, not
losses, and each is named in its new module.
tests/time.rs held three tests, two of which were clock arithmetic with
no dependencies at all. They moved into src/time.rs. The third pins a
build lease against a pinned clock and needs a database, so it stayed
where a database is available.
No visibility changed in this commit: `canonical_json` is used in
production and stays public, and `time::pin`/`unpin` are ungated test
escapes that the disposition table will decide on rather than being
quietly narrowed here as a side effect.
Suite: 281 passed, 0 failed, 0 ignored. Release build: zero warnings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eleven tests in tests/config.rs exercised how a config parses, what it
refuses, and what it refuses to print. They reached those behaviours
through the crate's public API only because that was the only way in, and
that had been keeping two items public that nothing outside config names:
DEFAULT_SANDBOX_IMAGE resolved at config.rs:187 and :374, nowhere else
Sandbox::KINDS never read by production at all — serde builds
the unknown-kind message itself
KINDS is now `#[cfg(test)]` rather than merely private, and
`cargo check --release` without the test-support feature compiles with
zero warnings, which is the proof that nothing production needed was
gated away by mistake.
One honest caveat, recorded in the file: these tests still create a
tempdir, because `Config::load` takes a directory and so even a pure
parse needs a file on disk. That is plumbing for the signature, not the
subject of the test — none of them touches the database, the fixture
corpus, or a subprocess. What remains in tests/config.rs genuinely does:
root resolution against real paths under target/, and two tests that run
the built binary.
config: 31 pub / 5 test-only -> 29 pub / 3 test-only.
Suite: 281 passed, 0 failed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ten tests in tests/versions.rs were unit tests of pkgver wearing an
integration test's clothing: the comparison vectors, the chunk rule, the
epoch rules, the dependency grammar, the constraint checks, the recorded
oracle. None of them touched a database or a fixture. They were written
against the crate's public API because that was the only way to reach
them from outside, and that single fact — that a test had to import a
name to exercise it — is what had been keeping five items public:
vercmp_string, Dep, DepOp, Dep::satisfied_by, split_full_version
All five are private now. `vercmp_string` is called by `vercmp` and by
nothing else; `Dep` and `DepOp` are the internals of `dep_names`, which
*is* used in production; `satisfied_by` and `Dep::name` are used only by
this module's tests, so they are gated rather than merely private, and
`cargo check --release` without the test-support feature compiles clean,
which is the proof that nothing production needs them was left behind.
The oracle test now resolves testcorpus/ through CARGO_MANIFEST_DIR
rather than the harness helper, so it no longer depends on the working
directory. The live pacman differential came with it and stays gated on
AUR_LIVE_VERCMP, recording its absence the same way.
What remains in tests/versions.rs is two tests that genuinely need the
harness: they build a package, publish it, and move its upstream.
pkgver: 14 pub / 5 test-only -> 8 pub / 0 test-only.
Suite: 281 passed, 0 failed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The leaf modules were the widest liars. `git` exported 19 names of which 5 were
named by nobody; `hash` exported a constant `EMPTY` that no code had ever
referenced; `time` exported a virtual clock, an `advance` and a `wrap` whose
only caller was a test that turned out not to exist. A leaf's interface is the
whole contract the rest of the crate can rely on, and these interfaces were
mostly decoration.
Nine items were genuinely dead and are gone: `hash::EMPTY`,
`git::{clone_source, count_commits, log_oneline, ls_remote_heads}`,
`recipe::is_diffable`, `pkginfo::values_of`, `time::virtual_now`, and a free
`time::advance` that had been shadowed by the `VirtualClock` method tests
actually call. Eighteen more were used only inside their own module and are now
private — `fetch`'s `Body` aside, which is the return type of a public parser
and so is part of the interface whether or not anyone writes its name.
http went 68 exported names to 27, and its last two glob re-exports
(`pub(crate) use mutations::*; use pages::*;`) are explicit lists now. That
makes the crate's glob count zero, so the allowlist in the architecture test is
empty and can stay that way.
Narrowing surfaced dead code that `pub` had been hiding, because a public item
is presumed used and never questioned: `Req::query` and `Req::body` were parsed
and stored and never read, `Res::found` had no callers, and `sse::FileBody` was
a reader nobody constructed. All four are deleted rather than re-published to
keep the warning quiet.
git 19→14, hash 8→7, recipe 11→7, urlutil 2→1, config 35→31, pkgver 18→14,
time 16→14, pkginfo 7→6, http 68→27. Crate totals: 585→516 pub, 219→115 dead,
4→0 globs.
281 passed / 0 failed, clippy -D warnings clean, release build clean,
architecture 8/8.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`main` opened the repository inline before its command match. `serve` opened it
again, four calls in an order that matters. The web routes wrote subscriptions,
toggles, notices and build retries straight through `db::`, so the CLI and the
UI were two independent guesses at the same product, and the guesses had already
drifted: `sub_add` fell back to repo id 1 where the CLI reported the repository
as uninitialised, and `build_retry` remembered to write the audit row while
nothing else did.
`src/usecase/` is the workflow layer now — bootstrap, detect, reviews,
subscriptions, builds, maintenance. A function earns a place here by having more
than one step in an order that matters: `approve` records the decision *and*
queues the build it authorises, because an approval that silently fails to queue
is the exact failure the review queue exists to prevent, and both front ends had
to remember to pair them.
Nothing in the layer formats output or knows a status code exists. Where the two
front ends genuinely disagree, the result carries the disagreement instead of
resolving it: `Approved::queued` is a `Result` because a failed enqueue is fatal
in the CLI — an approved candidate with no build is a stall nobody notices — and
a soft failure in the UI, which has already committed the decision and can retry
from the package page.
`src/http/routes/mutations.rs` now contains no `db::` call at all, and
`main.rs` is 314 lines with no multi-step sequence and nothing exported.
Rank map: usecase 9, http 10, composition roots 11. The layer test enforces
that usecase cannot name http, which is why `serve` starts the scheduler and the
build pool but leaves the HTTP server to `main`.
One user-visible message moves: `aur-build reject <missing>` now says
`not found: candidate N` (the review layer's wording) instead of
`no candidate #N` (main's). Both exit 1; the check moved with the workflow.
280 passed / 0 failed, clippy -D warnings clean, architecture 8/8.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Error::NotFound("no repo row; run `aur-build init`")` and
`Error::NotFound("pkgbase linux")` were the same variant. One is "the install
was never initialised, every page is wrong"; the other is "that page does not
exist, answer 404". The difference lived inside a string, so the only way to
act on it was to re-parse text the same process had written moments earlier.
Six variants now carry structure:
Missing pkgbase / candidate / release / build / snapshot /
mirror path / repo row
Refused IllegalTransition / WrongState / PointerMoved / Other
Guard HashMismatch / DigestMismatch / Invariant
WorldGap MissingPin / Other
PoolFull Backend{backend} / Other
TransientCause Upstream / Command / Other
`Refused` distinguishes the three refusals that were indistinguishable: a
transition no edge permits (caller bug), a row in the wrong state (stale
view), and the accepted pointer moving under a build (a lost race, and the
one a client may safely retry). `PoolFull::Backend` names which pool, because
a kata quota needs an operator and a local cap clears when a build exits.
`is_transient` and `is_pool_exhausted` already matched on variants rather than
strings, so they are unchanged — the typing is what lets the *next* branch be
a match instead of a `contains`.
No test assertion was edited. Where a message is load-bearing the Display was
written to reproduce it: `recipe_hash mismatch: approved X, materialized Y`,
`no release 4`, `illegal candidate transition approved → rejected`, `sandbox
world is missing plain-make-1.0-1 after installing the lease set` and kata's
`never dialed in` all come out of the new types byte-identical. Five messages
did change wording, none asserted anywhere:
release N is X, not published: nothing to withdraw
-> release N is X, not published (Refused::WrongState's shape)
illegal candidate transition a → b for review 7
-> ... for candidate 7 (it is a candidate id; "review"
was misleading)
no candidate 7 to resolve -> candidate 7 (Missing::Candidate's shape)
lease artifact n-v: store bytes hash to A but the index says B
-> source n-v hashed to A but the candidate recorded B (shares
Guard::DigestMismatch with the source-cache check)
vcs_cache clone URL: err -> upstream: vcs_cache clone URL: err
(TransientCause::Upstream tag)
error.pub 15->21 is the six payload enums, which is the point of the task
rather than a widening to apologise for. watch.dead/test each rose by one for
a subtler reason: `watch::upstream::resolve` looked live only because an
unrelated db message ended "... to resolve", and rewording that string removed
the phantom mention. The census now documents that a clean count is not always
an answer, since mentions are matched over raw source including string
literals.
281 passed / 0 failed (277 plus four new typing tests in src/error.rs), clippy
-D warnings clean, release build clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sandbox exported 35 items and 8 of them were named by nobody at all — not by a
caller, not by a test. `Frame`, `read_frame`, `write_frame`, `hex_bytes`,
`unhex` and `MAX_FRAME_BYTES` are the wire protocol, and the protocol is
sandbox's: the agent, the remote client and the loopback all speak it from
inside. Exporting it advertised a second way in that nothing used and everything
would have had to keep compatible. `LoopbackSandbox` and `RemoteSandbox` are
the same story — handles handed out by a constructor nobody calls by name.
Pipeline exported its step machine. `run_step`, `log_line`, `sweep_render_dirs`,
`from_candidate`, `from_release` and the four types they pass around
(`Collect`, `CollectedPkg`, `SourceIdentity`, `StepResult`) were all internal
plumbing reachable from `main`, which only ever wanted `run`, `Outcome`,
`enqueue_for_candidate`, `enqueue_manual_rebuild`, `publish::reconcile` and
`dispatch::Pool::spawn`.
sandbox.pub 35->27, pipeline.pub 30->21, and both modules now have zero items
named by nobody: what is left public is public because a test names it, which
is the allowlist the budget records rather than a hole in it.
Clippy caught what the tests did not: `Ctx::src` was a `pub` field of the newly
private `SourceIdentity`, a public face on a private type. The field narrowed
with the type. Re-widening `SourceIdentity` to silence it would have undone the
point.
The diff is visibility keywords only — no step id literal, no frame variant, no
wire byte changed. 277 passed / 0 failed across 36 binaries, including
remote_agent, failure_modes and the kata tier; clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The step machine reached into two of watch's internals and reassembled the
rules itself: `mirror::read_tree` then `Tree::recipe_hash` to re-derive the
hash a reviewer approved, and `digests::cached_path` then
`digests::download_and_cache` then its own comparison to check a payload.
The comparison is the part that must never be skipped, and it was sitting in
whichever step happened to want a file — a step could have forgotten it and
nothing would have noticed.
`watch::sources` is the interface now: what a tree hashes to, and a guarantee
that a cached source is the bytes its name claims. `verify_cached` owns the
fail-closed test and its message verbatim. `download_and_cache` and
`cached_path` are `pub(crate)` again, so the cache layout is watch's business
again; `watch/mod.rs` no longer re-exports them.
`src/pipeline` now names exactly one watch path.
Detection is untouched by construction — no git-invoking function changed —
and the census agrees: 264 successful git execs on the detect binary before
and after. (An initial reading of 1320 vs 264 was PATH-probe ENOENTs from a
differing shell PATH, not git work; counted with suite-cost.py's own rule of
successful execve only, the two runs are identical.)
watch.pub 31->30. `read_tree` moved into the test-only column: the pipeline
stopped naming it, and what remains are watch's own calls plus the two tests
that exercise its one-batch-read contract directly.
277 passed / 0 failed, clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`watch::detect` was performing review's write protocol by hand: look up the
accepted release, upsert the candidate, assess the risk, store the risk, work
out the missing dependencies, store those. Six calls that only make sense in
that order, issued from a module whose job is noticing that an upstream moved.
Get the order wrong and nothing complains — the candidate just quietly has no
risk score, and the reviewer approves it without one.
`review::intake::record` is the protocol now. The watcher hands over what it
observed and review decides what it means. `missing_deps` moved with it: it
computes a risk signal, which is a review question that happened to be living
in the watcher.
`accepted_for` was not a review question either. It reads a pointer column off
the pkgbase row, so it is now `db::accepted_release_for` — the watcher asks
persistence what is currently accepted, rather than asking review as a favour.
With intake owning the write path, three things became internal and closed:
`upsert_candidate`, `risk::assess`, and the risk/missing-deps column setters.
`approve::approval_for` was a pass-through to db that only the pipeline called;
it is gone, and the pipeline now asks `review::reads::{candidate, approval}` —
two named facts instead of a re-export of review's storage layout.
The budget rose in two places and both are moves, not growth: db.pub 201->202
is `accepted_release_for` arriving from review, and review.test 4->5 is
`set_risk_for_tests`, the one place a fixture still needs to force a score.
review.pub itself is unchanged at 29 — four names added, four removed.
`priv` was also dropped from the budget keys. Counting `pub(crate)` items
against a ceiling was backwards: closing an interface raises that number, so a
budget that punishes it punishes the work. The Rust test never checked it.
277 passed / 0 failed, clippy -D warnings clean, and every detect, approve and
staleness assertion intact.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
db handed out 226 items and 36 of them were named by nobody at all — not by
the crate, not by the tests. Making them private is the whole of this commit,
but the interesting part is what the compiler said afterwards.
Twenty-five closed cleanly. Eleven did not, and they are the ones worth
writing down: AuditRow, NoticeRow, PackageRow, Subscription, StepRow,
Unbuilt, OpenReview, ReviewSubject, Migration, Writer, predecessors. None is
named outside db, yet none can be made private, because a public query
returns them and callers bind them with `let` and call methods on them.
They are load-bearing and invisible to a name search. So the census's `dead`
count means "the name is never written outside the module", which is a lead
rather than a verdict, and the census now says so: the way to find out which
flagged items are real is to privatize them and let rustc answer. Those
eleven are budgeted with that reason, not zeroed to make a number look good.
Nineteen items turned out to be dead code rather than merely unexported —
set_release, set_candidate, set_pkgbase, set_profile, set_kind,
current_state, index_pkgbase_drift, wal_stats, call_for_tests, put_notice,
is_ours, list_pkgbases, set_unpinable, artifact_id_by_digest_in,
subscription_poll_interval, the four never-emitted notice kinds, and
StateEnum::as_str, which the impl_state_enum macro was required to define
for all five enums while nothing called it through the trait. Privatizing
is what proved they were unused; leaving them private-but-present would have
just hidden dead code behind a narrower address.
Ten items became pub(crate): the Writer actor's call/tx/send surface,
Readers, the StateEnum trait, json_or, predecessors, DEFAULT_SETTINGS.
`Db.readers` was named nowhere outside db, so the field closed with the type.
db: 226 pub / 36 dead-only -> 201 pub / 11 dead-only. 277 passed / 0 failed,
clippy -D warnings clean, schema_ownership and architecture green.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
queries.rs was 1,501 lines holding 83 queries across seventeen aggregates,
separated by comment banners that said "settings", "release", "notices" and
then kept them in one file. The banners were the design; they just never got
files. Each one has one now, verbatim — the split is provably content-only,
the moved text being identical to the original as a sorted set of lines.
model.rs and builds.rs were each two concerns deep, so they became
directories. model.rs held what a row looks like and, separately, the state
machines that say which moves are legal; builds.rs held the build machine and,
below its own `step rows` banner, the step machine. The impl_state_enum!
macro implements StateEnum for all five enums from one place, so it moved
with its invocations rather than being exported across a boundary to chase
them.
They are directories rather than new sibling modules on purpose:
`db::model::CandidateState` and `db::builds::steps` are used across the crate
and by the integration tests, and renaming them would be a bigger change than
the one being made. No call site and no test changed.
db/mod.rs now lists its interface instead of spraying one. `pub use model::*`
and `pub use queries::*` are gone, replaced by seventeen explicit exports, and
the query modules are private — so a query that was not chosen for export is
not reachable, and the width of the module is visible from its own text
rather than only from a grep.
The ratchet caught the win immediately: db.glob went 2 -> 0, which failed
a_shrunk_interface_is_written_back until the budget was written back at the
new value. db is off the glob allowlist now rather than holding a stale zero.
277 passed / 0 failed, clippy -D warnings clean, largest file in src/db 363
lines (candidates.rs, unchanged from before this work).
|