| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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'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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
Four greps in tests/layers.rs were the entire enforcement. They could say
that db had stopped naming http; they could not say what the architecture
is, could not place a new module, and said nothing about the twenty-odd
modules nobody had tripped over yet.
tests/architecture.rs declares the whole map instead. Every module in src/
gets a rank with the reason it sits there, and a module may name only
modules ranked strictly below it — one rule, every module, cycles
impossible by construction rather than by luck. The census says the graph
already satisfies it, so the map is a description of what is true, not an
aspiration the suite immediately fails on.
The same file holds the interface budgets, because a boundary is only as
strong as what it refuses to let you export: per module, how many pub items
it hands out and how many of them nothing outside the module names. Budgets
live in architecture-budget.json and move one way. A number that grows
fails; a number that got smaller without being written back also fails,
which is what stops a won gain from quietly becoming the new ceiling.
Each rule was probed rather than trusted: naming http from db fails with
`db (rank 3) names http (rank 9)`, tightening db.pub to 200 fails with
`db.pub: 226 > 200`, and leaving a stale budget fails with
`db.deadonly: budget 99, actual 36`.
tests/layers.rs is deleted, not weakened. Three of its four rules are rank
consequences now (db, review, recipe all sit below everything they were
forbidden to name); the fourth, watch -> shims, was already covered by
production_surface.rs, which greps every non-shim file for shims:: and
would catch it in any module, not just watch.
The census definition now lives in two languages, so the test checks them
against each other the way the vercmp oracle checks the hand-written
comparator: without python3 the note prints and the suite moves on.
277 passed / 0 failed (273 + 8 new - 4 subsumed), clippy -D warnings clean.
|