| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
| |
Advancing the clock on every wait made virtual time outrun real work: a build
taking a few hundred ms would burn forty ticks and expire its own lease. Under
a virtual clock a wait now costs a yield and the clock only moves when a test
moves it with time::advance, so a frozen lease stays frozen however fast the
loop runs.
|
| |
|
|
|
|
|
|
|
|
| |
The dispatcher tick, watcher tick, SSE poll, agent watchdog and remote
keepalive each slept on the wall clock in their own slice loop, so every test
that wanted a tick waited for real time. They call crate::time::wait/sleep now,
which is the same real sleep in a production build and a virtual clock advance
under test-support: a test that takes the clock owns it, and threads it spawns
inherit it. production_surface checks the virtual path is compiled out and that
no control loop went back to std::thread::sleep.
|
| |
|
|
|
|
|
|
|
|
|
| |
Stripped every comment that described what an item does, documented its
arguments or fields, or cited the design docs (§n, I-n, m-n, decision n).
2247 comments down to 83.
What survives: the section dividers that segment the large modules, the
secret-handling warnings, the agent wire-frame directions, and the few notes
without which the code they attach to reads as redundant, reorderable, or
unsound.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every module-level `//!` header is gone, and the comments that remained
either re-explained the line below them or had grown into paragraphs.
Density went from one comment line per 6.7 lines of code to one per 10.
827 insertions against 2194 deletions across 86 files.
What survived: the invariants (I1-I12), the design cross-references into
DESIGN.md, and the notes recording a bug that was found and fixed — those
are the comments that carry weight, because they answer a question the
code cannot answer about itself. What did not: restating a function
signature in prose, and narration of the statement underneath.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`now()` returned the pinned instant when a test had pinned one, but
`secs_ago`/`secs_ahead` called `Utc::now()` directly (m-1). Anything built from
them — every lease expiry, every `next_check_at`, every cooldown cutoff — was
therefore computed against the real wall clock and then compared against the
pinned one. A test that pinned 2026-01-01 and took a 90-second lease got an
expiry 90 seconds after *today*, so the reaper comparing `lease_expires_at <
now()` saw a lease that would not expire for a century, or one that had expired
millions of seconds ago, depending on which way the pin pointed. The test still
passed, because nothing asserted on the number.
Both now go through a `base()` that reads the pinned instant, so a pinned test
computes and compares on the same clock. `tests/time.rs` pins the arithmetic
directly and then does the thing the bug actually broke: claim a lease under a
pinned clock, assert the expiry is 90 seconds after the pinned now, assert the
reaper sees nothing yet, advance the pinned clock 91 seconds, and assert it
reaps.
|
|
|
The §11 data model as four migrations, plus the §11a concurrency model:
one writer thread owning the write connection (mutations arrive as
closures over a crossbeam channel, so SQLITE_BUSY is not part of the
design) and thread-local read-only connections under WAL.
Invariants that are database guarantees rather than conventions:
I7 partial unique index -> at most one pending_review per pkgbase
I3 UNIQUE(pkgbase_id, identity_hash) -> no duplicate candidates
I10 audit table rejects UPDATE and DELETE by trigger
§16 current_accepted_release_id moves only by compare-and-swap
Also: vercmp + dependency-string parsing (ALPM algorithm, no libalpm),
hash helpers including recipe_hash over the whole AUR tree, the clock
helper that stamps every write, and the config/root layout.
Part of P0 (DESIGN.md §17).
|