pub(crate) visibility pass
Status: Open — Phase 1, no confirmation needed
Problem
Section titled “Problem”jackin has a real library surface: src/lib.rs publicly exports most top-level modules and src/bin/validate.rs consumes the library. That means a blanket “binary crate ⇒ convert everything to pub(crate)” pass would be wrong. The actual readability problem is narrower: some items are still wider than needed.
Verified numbers (May 2026)
Section titled “Verified numbers (May 2026)”| Declaration | pub | pub(crate) |
|---|---|---|
fn | 383 | 42 (9.9%) |
struct | 124 | 3 |
enum | 91 | 3 |
src/lib.rscurrently exports 22 top-level modules (grew from 21) plusapp::run- There are zero
pub(crate) moddeclarations — all 22 modules use barepub mod RUSTFLAGS='-W unreachable_pub' cargo checkreported 10 warnings at the original analysis; the count may have changed — re-verify before starting
Current low-hanging fruit
Section titled “Current low-hanging fruit”| File | Scope | Notes |
|---|---|---|
src/workspace/planner.rs | 5 current warnings | Plan structs/helpers are only consumed inside the crate today |
src/console/manager/agent_allow.rs | 2 current warnings | Manager helper fns can likely tighten to pub(super) |
src/runtime/launch.rs | 1 current warning | inspect_attach_outcome appears narrower than pub |
src/config/roles.rs | 1 current warning | BUILTIN_AGENTS likely does not need full pub |
src/config/mounts.rs | 1 current warning | MountEntry may be wider than necessary |
- Re-run
RUSTFLAGS='-W unreachable_pub' cargo checkto get the current warning set. - Decide the intended library surface in
src/lib.rsfirst: what truly needs to staypubformain.rs,jackin-validate, and tests? - Add to
Cargo.toml[lints.rust]section:[lints.rust]unreachable_pub = "warn" - Run
cargo check— compiler lists the items that are public but unreachable from the crate root. - Convert each flagged item to the narrowest workable visibility (
pub(crate)orpub(super)as appropriate). - If a larger pass is still desired, shrink or reorganize the
lib.rsexport surface first, then rerun the lint. - Verify
cargo nextest runstill passes andcargo checkis warning-free.
What stays pub
Section titled “What stays pub”pub fn runand other intentionally exported library entrypoints used by sibling binaries- validation helpers consumed by
src/bin/validate.rs - any types that are deliberately part of the internal library boundary exposed from
src/lib.rs
Caveats
Section titled “Caveats”Do not treat unreachable_pub as a turnkey “convert hundreds of bare pub items” script. It is a cleanup aid for the current exported shape, not a substitute for deciding what the library boundary should be.