Skip to content

pub(crate) visibility pass

Status: Open — Phase 1, no confirmation needed

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.

Declarationpubpub(crate)
fn38342 (9.9%)
struct1243
enum913
  • src/lib.rs currently exports 22 top-level modules (grew from 21) plus app::run
  • There are zero pub(crate) mod declarations — all 22 modules use bare pub mod
  • RUSTFLAGS='-W unreachable_pub' cargo check reported 10 warnings at the original analysis; the count may have changed — re-verify before starting
FileScopeNotes
src/workspace/planner.rs5 current warningsPlan structs/helpers are only consumed inside the crate today
src/console/manager/agent_allow.rs2 current warningsManager helper fns can likely tighten to pub(super)
src/runtime/launch.rs1 current warninginspect_attach_outcome appears narrower than pub
src/config/roles.rs1 current warningBUILTIN_AGENTS likely does not need full pub
src/config/mounts.rs1 current warningMountEntry may be wider than necessary
  1. Re-run RUSTFLAGS='-W unreachable_pub' cargo check to get the current warning set.
  2. Decide the intended library surface in src/lib.rs first: what truly needs to stay pub for main.rs, jackin-validate, and tests?
  3. Add to Cargo.toml [lints.rust] section:
    [lints.rust]
    unreachable_pub = "warn"
  4. Run cargo check — compiler lists the items that are public but unreachable from the crate root.
  5. Convert each flagged item to the narrowest workable visibility (pub(crate) or pub(super) as appropriate).
  6. If a larger pass is still desired, shrink or reorganize the lib.rs export surface first, then rerun the lint.
  7. Verify cargo nextest run still passes and cargo check is warning-free.
  • pub fn run and 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

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.