diff options
| -rw-r--r-- | src/config.rs | 4 | ||||
| -rw-r--r-- | src/db/mod.rs | 8 | ||||
| -rw-r--r-- | src/fetch.rs | 4 | ||||
| -rw-r--r-- | src/ops.rs | 6 | ||||
| -rw-r--r-- | tests/architecture-budget.json | 28 | ||||
| -rw-r--r-- | tools/test-surface.md | 18 |
6 files changed, 34 insertions, 34 deletions
diff --git a/src/config.rs b/src/config.rs index 958fb0f..7818e4b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -100,7 +100,7 @@ impl Sandbox { } #[cfg(not(feature = "test-support"))] - pub(crate) fn shared_workspace(&self) -> bool { + fn shared_workspace(&self) -> bool { Self::shared_workspace_impl(self) } @@ -376,7 +376,7 @@ impl Config { } #[cfg(not(feature = "test-support"))] - pub(crate) fn store_dir(&self) -> PathBuf { + fn store_dir(&self) -> PathBuf { Self::store_dir_impl(self) } diff --git a/src/db/mod.rs b/src/db/mod.rs index bf54be1..4379a5f 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -99,7 +99,7 @@ pub use world::put_world_snapshot; #[cfg(feature = "test-support")] pub use world::world_members; -pub(crate) fn state_col<T: StateEnum>(col: usize, text: &str) -> rusqlite::Result<T> { +fn state_col<T: StateEnum>(col: usize, text: &str) -> rusqlite::Result<T> { T::parse(text).ok_or_else(|| { rusqlite::Error::FromSqlConversionFailure( col, @@ -196,7 +196,7 @@ pub struct Writer { impl Writer { /// Only `Writer::open` in this module starts a writer. - pub(crate) fn start(path: &Path) -> Result<Self> { + fn start(path: &Path) -> Result<Self> { let conn = open(path, false)?; let (tx, rx) = unbounded::<Msg>(); let alive = Arc::new(AtomicBool::new(true)); @@ -229,7 +229,7 @@ impl Writer { self.alive.load(Ordering::SeqCst) } - pub(crate) fn call<T>(&self, f: impl FnOnce(&mut Connection) -> Result<T> + Send + 'static) -> Result<T> + fn call<T>(&self, f: impl FnOnce(&mut Connection) -> Result<T> + Send + 'static) -> Result<T> where T: Send + 'static, { @@ -259,7 +259,7 @@ impl Writer { }) } - pub(crate) fn send(&self, f: BoxedCall) -> Result<()> { + fn send(&self, f: BoxedCall) -> Result<()> { if !self.is_alive() { return Err(Error::db("writer actor gone")); } diff --git a/src/fetch.rs b/src/fetch.rs index fd9a661..98876bc 100644 --- a/src/fetch.rs +++ b/src/fetch.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use crate::error::{Error, Result}; -pub(crate) enum Body { +enum Body { File(std::fs::File), Http(Box<dyn Read + Send>), } @@ -18,7 +18,7 @@ impl Read for Body { } /// Only `get` in this file opens a fetch result; the bare word `open` elsewhere is a variable, not this function. -pub(crate) fn open(url: &str) -> Result<(Body, Option<u64>)> { +fn open(url: &str) -> Result<(Body, Option<u64>)> { if let Some(path) = url.strip_prefix("file://") { let p = path.trim_start_matches('/'); let p = PathBuf::from(format!("/{p}")); @@ -53,7 +53,7 @@ impl Metrics { } #[cfg(not(feature = "test-support"))] - pub(crate) fn build_success_rate(&self) -> f64 { + fn build_success_rate(&self) -> f64 { Self::build_success_rate_impl(self) } @@ -333,7 +333,7 @@ const STAGING_GRACE_SECS_VALUE: i64 = 3600; pub const STAGING_GRACE_SECS: i64 = STAGING_GRACE_SECS_VALUE; #[cfg(not(feature = "test-support"))] -pub(crate) const STAGING_GRACE_SECS: i64 = STAGING_GRACE_SECS_VALUE; +const STAGING_GRACE_SECS: i64 = STAGING_GRACE_SECS_VALUE; pub fn release_files(cfg: &Config, db: &Db, release_id: i64) -> Result<Vec<PathBuf>> { let mut out = Vec::new(); @@ -365,7 +365,7 @@ pub fn sweep_staging(cfg: &Config, db: &Db, grace_secs: i64) -> Result<(usize, u } #[cfg(not(feature = "test-support"))] -pub(crate) fn sweep_staging(cfg: &Config, db: &Db, grace_secs: i64) -> Result<(usize, u64)> { +fn sweep_staging(cfg: &Config, db: &Db, grace_secs: i64) -> Result<(usize, u64)> { sweep_staging_impl(cfg, db, grace_secs) } diff --git a/tests/architecture-budget.json b/tests/architecture-budget.json index 4ac33de..18e33c5 100644 --- a/tests/architecture-budget.json +++ b/tests/architecture-budget.json @@ -143,8 +143,8 @@ "largest": 699, "largest_file": "src/config.rs", "lines": 699, - "overwide": 1, - "priv": 2, + "overwide": 0, + "priv": 0, "pub": 29, "test": 2 }, @@ -156,7 +156,7 @@ "largest_file": "src/db/mod.rs", "lines": 3890, "overwide": 0, - "priv": 19, + "priv": 15, "pub": 189, "test": 11 }, @@ -179,8 +179,8 @@ "largest": 57, "largest_file": "src/fetch.rs", "lines": 57, - "overwide": 1, - "priv": 2, + "overwide": 0, + "priv": 0, "pub": 1, "test": 0 }, @@ -251,8 +251,8 @@ "largest": 455, "largest_file": "src/ops.rs", "lines": 455, - "overwide": 3, - "priv": 5, + "overwide": 0, + "priv": 2, "pub": 11, "test": 3 }, @@ -408,16 +408,16 @@ "bin/pacman": 0, "bin/repo-add": 0, "bin/sandbox-agent": 0, - "config": 1, + "config": 0, "db": 0, "error": 0, - "fetch": 1, + "fetch": 0, "git": 0, "hash": 0, "http": 1, "lib": 0, "main": 0, - "ops": 3, + "ops": 0, "pipeline": 8, "pkginfo": 0, "pkgver": 0, @@ -432,9 +432,9 @@ } }, "test_surface": { - "already-gated": 16, + "already-gated": 21, "interface": 1, - "narrowed": 19, + "narrowed": 14, "total": 36 }, "totals": { @@ -445,8 +445,8 @@ "largest": 699, "largest_file": "src/config.rs", "lines": 15671, - "overwide": 27, - "priv": 170, + "overwide": 22, + "priv": 159, "pub": 448, "test": 49 } diff --git a/tools/test-surface.md b/tools/test-surface.md index 4535104..16f931f 100644 --- a/tools/test-surface.md +++ b/tools/test-surface.md @@ -70,18 +70,13 @@ reaches the test tier also reaches a release build. |---|---|---|---|---|---| | `db` | `Writer` | `src/db/mod.rs:191` | `architecture.rs` | `src/db/audit.rs:10`, `src/db/audit.rs:74`, `src/db/mod.rs:329` +15 | `Db` has a `pub writer: Writer` field and pipeline, ops, review, watch and usecase all call `db.writer.tx(..)`. A field cannot be `pub` with a `pub(crate)` type — the compiler rejects it — so `Writer` is public because the public interface of `Db` requires it, not because a test asked. `tools/release-surface-probe.py` confirms it is reachable in a release build; that reachability is load-bearing, not residue. | -## Feature-conditional visibility — production uses it, only from inside its module — 19 items +## Feature-conditional visibility — production uses it, only from inside its module — 14 items | module | item | declared at | test files | in-module call sites | why | |---|---|---|---|---|---| -| `config` | `shared_workspace` | `src/config.rs:98` | `config.rs`, `kata.rs`, `remote_agent.rs` | `src/config.rs:19`, `src/config.rs:30`, `src/config.rs:40` +8 | `Config::validate` calls it at config.rs:226; tests/kata.rs and tests/remote_agent.rs call it too and both need a fixture. | -| `config` | `store_dir` | `src/config.rs:374` | `architecture.rs`, `invariants.rs` | `src/config.rs:331`, `src/config.rs:387` ⚑ | the content-addressed store layout is resolved by this module for the cache and blob paths; tests/invariants.rs pins where a blob lands and needs a fixture. | | `db` | `MIGRATIONS` | `src/db/migrations.rs:344` | `db.rs` | `src/db/mod.rs:157` | `db::migrate` iterates it to apply pending migrations; tests/db.rs asserts the list is ordered and complete. | | `http` | `cookie` | `src/http/mod.rs:42` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:224`, `src/http/routes/mod.rs:38`, `src/http/routes/mod.rs:64` +2 ⚑ | the auth cookie helper; the tests that use it build no fixture, so they move into the module and it narrows. | | `http` | `login` | `src/http/routes/mod.rs:51` | `common/mod.rs`, `http.rs` | `src/http/mod.rs:218` | the login route handler; same — its tests are harness-free and move with it. | -| `ops` | `STAGING_GRACE_SECS` | `src/ops.rs:333` | `ops.rs` | `src/ops.rs:300` | the grace period the staging sweep applies at ops.rs:286; tests/ops.rs pins the value it must be. | -| `ops` | `build_success_rate` | `src/ops.rs:51` | `ops.rs` | `src/ops.rs:101` ⚑ | computed inside the maintenance report at ops.rs:87; tests/ops.rs checks the arithmetic. | -| `ops` | `sweep_staging` | `src/ops.rs:363` | `ops.rs` | `src/ops.rs:300` | called by the maintenance pass at ops.rs:286; tests/ops.rs exercises it directly. | | `pipeline` | `admissible` | `src/pipeline/dispatch.rs:130` | `dispatch.rs` | `src/pipeline/dispatch.rs:111` | the dispatch filter, called at dispatch.rs:86; tests/dispatch.rs pins which builds it admits. | | `pipeline` | `dispatch_once` | `src/pipeline/dispatch.rs:87` | `dispatch.rs` | `src/pipeline/dispatch.rs:71` | one tick of the dispatcher, called by the scheduler loop at dispatch.rs:60; tests/dispatch.rs drives single ticks. | | `pipeline` | `free_disk_mb` | `src/pipeline/dispatch.rs:157` | `dispatch.rs` | `src/pipeline/dispatch.rs:145` | the disk probe the dispatcher consults at dispatch.rs:106. | @@ -94,11 +89,13 @@ reaches the test tier also reaches a release build. | `watch` | `probe` | `src/watch/upstream.rs:45` | `architecture.rs`, `ops.rs`, `vcs.rs` | `src/watch/detect.rs:96` | the upstream probe, called by detect.rs:95; tests/ops.rs and tests/vcs.rs both need a fixture. | | `watch` | `sync_mirror` | `src/watch/mirror.rs:22` | `detect.rs` | `src/watch/detect.rs:41` | the mirror sync, called by detect.rs:40; tests/detect.rs drives a real sync. | -## Already gated — 16 items +## Already gated — 21 items | module | item | declared at | test files | in-module call sites | why | |---|---|---|---|---|---| | `config` | `TestHooks` | `src/config.rs:155` | `common/mod.rs`, `production_surface.rs` | `src/config.rs:140`, `src/config.rs:195` | the `hooks` field is already gated; the type and its impl are not, so they compile into a release build that can never read them. | +| `config` | `shared_workspace` | `src/config.rs:98` | `config.rs`, `kata.rs`, `remote_agent.rs` | `src/config.rs:19`, `src/config.rs:30`, `src/config.rs:40` +8 | `Config::validate` calls it at config.rs:226; tests/kata.rs and tests/remote_agent.rs call it too and both need a fixture. | +| `config` | `store_dir` | `src/config.rs:374` | `architecture.rs`, `invariants.rs` | `src/config.rs:331`, `src/config.rs:387` ⚑ | the content-addressed store layout is resolved by this module for the cache and blob paths; tests/invariants.rs pins where a blob lands and needs a fixture. | | `db` | `cas_accepted_release` | `src/db/pkgbases.rs:92` | `db.rs` | — | production performs this CAS inside a transaction via `cas_accepted_release_in` (publish.rs:208); the standalone form has no caller in the crate. The census credited it with a production caller at the `pub use` continuation line in db/mod.rs — a re-export is not a call. | | `db` | `claim` | `src/db/builds/mod.rs:134` | `common/mod.rs`, `state_machine.rs`, `time.rs` | — | production leases with `claim_batch`; `claim` is called only by tests, so the release build need not compile it. | | `db` | `set_setting` | `src/db/settings.rs:44` | `db.rs` | — | a settings writer with no production caller; `setting`/`setting_i64` readers are used, the setter is not. | @@ -106,6 +103,9 @@ reaches the test tier also reaches a release build. | `db` | `tx_for_tests` | `src/db/mod.rs:284` | `approve.rs`, `common/mod.rs`, `db.rs`, `invariants.rs` … | — | already gated behind test-support — the pattern the rest of this table asks for. | | `db` | `unapproved_index_entries` | `src/db/invariants.rs:15` | `db.rs`, `detect.rs`, `notices.rs`, `shims.rs` | — | an invariant query nothing runs; it needs `pub(crate)` diff internals to be useful, so it is gated rather than relocated. | | `db` | `world_members` | `src/db/world.rs:32` | `db.rs` | — | a world-snapshot reader nothing calls; `put_world_snapshot` is the half production uses. | +| `ops` | `STAGING_GRACE_SECS` | `src/ops.rs:333` | `ops.rs` | `src/ops.rs:300` | the grace period the staging sweep applies at ops.rs:286; tests/ops.rs pins the value it must be. | +| `ops` | `build_success_rate` | `src/ops.rs:51` | `ops.rs` | `src/ops.rs:101` ⚑ | computed inside the maintenance report at ops.rs:87; tests/ops.rs checks the arithmetic. | +| `ops` | `sweep_staging` | `src/ops.rs:363` | `ops.rs` | `src/ops.rs:300` | called by the maintenance pass at ops.rs:286; tests/ops.rs exercises it directly. | | `review` | `render_and_store` | `src/review/diff.rs:282` | `approve.rs`, `common/mod.rs`, `crash.rs`, `dispatch.rs` … | — | intake renders through `review::intake::record`; this wrapper has zero callers in src and 17 in tests. Gated, not relocated: it needs the module-private diff renderer. | | `review` | `withdraw` | `src/review/approve.rs:235` | `architecture.rs`, `pipeline.rs`, `production_surface.rs` | — | Single-release withdraw. The CLI and the web UI both go through `usecase::withdraw_package` -> `pipeline::publish::withdraw_package`; nothing invokes this. tests/pipeline.rs pins its invariants (a second withdraw is refused, an unknown release is refused), so it is gated rather than deleted: the test is the cover for the operation production has not grown yet. | | `sandbox` | `LocalAgentProvisioner` | `src/sandbox/kata.rs:136` | `kata.rs` | — | production selects `K8sSandboxProvisioner` (kata.rs:193); nothing in the crate constructs this type. It exists so tests can drive the real agent protocol against the shim binary without a cluster, so it is gated rather than deleted. The census credited its own `impl` headers as callers. | @@ -120,8 +120,8 @@ reaches the test tier also reaches a release build. | disposition | count | |---|---| | `interface` | 1 | -| `narrowed` | 19 | -| `already-gated` | 16 | +| `narrowed` | 14 | +| `already-gated` | 21 | | **total** | **36** | Of these, 1 are ungated today. Gating the `gate` rows and narrowing the |
