diff options
| author | aur-build <aur-build@localhost> | 2026-11-20 20:47:21 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-20 20:47:21 +0000 |
| commit | 289560d196b65b0b257b59a92c956f088eb29fad (patch) | |
| tree | 01966faf56a44013c805de2ae08d7ad139939462 /src/db/snapshots.rs | |
| parent | 39ae04fcc1e25d6b252a7432dfc8257e41237750 (diff) | |
| download | aur-build-289560d196b65b0b257b59a92c956f088eb29fad.tar.gz aur-build-289560d196b65b0b257b59a92c956f088eb29fad.zip | |
tools: decide the disposition of every test-only pub item
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.
Diffstat (limited to 'src/db/snapshots.rs')
0 files changed, 0 insertions, 0 deletions
