| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`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.
|