diff options
| author | dev <dev@example.com> | 2026-11-21 19:33:47 +0000 |
|---|---|---|
| committer | dev <dev@example.com> | 2026-11-21 19:33:47 +0000 |
| commit | 9dc9087d89891c6e5ef7e5dc084dd13c8611843e (patch) | |
| tree | 3bf6ebbccbf29f965df2fc6a1c0f5751185f19ce /README.md | |
| parent | bb1d533515c8f63faacb00b3ef59232cf2d4a1c5 (diff) | |
| download | aur-build-9dc9087d89891c6e5ef7e5dc084dd13c8611843e.tar.gz aur-build-9dc9087d89891c6e5ef7e5dc084dd13c8611843e.zip | |
readme: say that pub(crate) is not automatically the narrow state
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.
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -120,6 +120,7 @@ Two tools keep this honest, and both are meant to be run, not read once: ``` cargo test --test architecture # ranks, no cycles, no globs, interface budgets python3 tools/arch-census.py # the numbers; --list-dead names them, --budget checks the ratchet +python3 tools/arch-census.py --list-overwide # pub(crate) items wider than anything reaches ``` ## Testing without root, network, or a real chroot @@ -260,3 +261,17 @@ These are not suggestions: `--list-dead` names every item behind them. A `pub` item that stays `pub` without an outside reader is allowed only by name, in the same budget file, with the reason beside it. +* `pub(crate)` is not the narrow state just because it is not `pub`. A + `pub(crate)` item nothing outside its own file names is **over-wide**: it + offers the whole crate a thing only its own file reaches, and it is one + keystroke from being a hole. `overwide` counts them per module and is held to + a budget exactly the way `deadonly` is — it may only shrink, and an item that + stays `pub(crate)` is allowed only by name in `over_visibility.allowlist`, + with the compiler fact that forces it beside it: a `pub(crate)` field cannot + carry a private type, privacy does not reach up to a parent or across to a + sibling module, and `pub(super)` is not a form this crate admits. + `--list-overwide` names them. The count is a grep, so it is a lead and the + compiler gives the verdict — and the verdict is 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` and only a release + build ever says whether it can go private. |
