From a97e5dc40069b0dc13c28fa9ab3202c8e5012038 Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 20 Nov 2026 18:04:59 +0000 Subject: sandbox, pipeline: close what only your own module was ever meant to name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sandbox exported 35 items and 8 of them were named by nobody at all — not by a caller, not by a test. `Frame`, `read_frame`, `write_frame`, `hex_bytes`, `unhex` and `MAX_FRAME_BYTES` are the wire protocol, and the protocol is sandbox's: the agent, the remote client and the loopback all speak it from inside. Exporting it advertised a second way in that nothing used and everything would have had to keep compatible. `LoopbackSandbox` and `RemoteSandbox` are the same story — handles handed out by a constructor nobody calls by name. Pipeline exported its step machine. `run_step`, `log_line`, `sweep_render_dirs`, `from_candidate`, `from_release` and the four types they pass around (`Collect`, `CollectedPkg`, `SourceIdentity`, `StepResult`) were all internal plumbing reachable from `main`, which only ever wanted `run`, `Outcome`, `enqueue_for_candidate`, `enqueue_manual_rebuild`, `publish::reconcile` and `dispatch::Pool::spawn`. sandbox.pub 35->27, pipeline.pub 30->21, and both modules now have zero items named by nobody: what is left public is public because a test names it, which is the allowlist the budget records rather than a hole in it. Clippy caught what the tests did not: `Ctx::src` was a `pub` field of the newly private `SourceIdentity`, a public face on a private type. The field narrowed with the type. Re-widening `SourceIdentity` to silence it would have undone the point. The diff is visibility keywords only — no step id literal, no frame variant, no wire byte changed. 277 passed / 0 failed across 36 binaries, including remote_agent, failure_modes and the kata tier; clippy -D warnings clean. --- src/pipeline/mod.rs | 16 ++++++++-------- src/pipeline/publish.rs | 2 +- src/pipeline/steps.rs | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/pipeline') diff --git a/src/pipeline/mod.rs b/src/pipeline/mod.rs index 0bd8f92..e7ee34e 100644 --- a/src/pipeline/mod.rs +++ b/src/pipeline/mod.rs @@ -14,7 +14,7 @@ use crate::error::{Error, Result}; use crate::sandbox::{Sandbox, SandboxBackend}; #[derive(Debug, Clone)] -pub struct SourceIdentity { +pub(crate) struct SourceIdentity { pub aur_commit: String, pub recipe_hash: String, pub upstream_pins_json: String, @@ -25,7 +25,7 @@ pub struct SourceIdentity { } impl SourceIdentity { - pub fn from_candidate(c: &CandidateRow, snapshot: &SnapshotRow) -> Self { + pub(crate) fn from_candidate(c: &CandidateRow, snapshot: &SnapshotRow) -> Self { Self { aur_commit: snapshot.aur_commit.clone(), recipe_hash: snapshot.recipe_hash.clone(), @@ -36,7 +36,7 @@ impl SourceIdentity { pkgrel: c.pkgrel.clone(), } } - pub fn from_release(r: &ReleaseRow) -> Self { + pub(crate) fn from_release(r: &ReleaseRow) -> Self { Self { aur_commit: r.aur_commit.clone(), recipe_hash: r.recipe_hash.clone(), @@ -53,7 +53,7 @@ impl SourceIdentity { } #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] -pub struct CollectedPkg { +pub(crate) struct CollectedPkg { pub name: String, pub version: String, pub arch: String, @@ -69,7 +69,7 @@ pub struct CollectedPkg { } #[derive(Debug, Clone, Default, serde::Serialize, serde::Deserialize)] -pub struct Collect { +pub(crate) struct Collect { pub packages: Vec, } @@ -91,7 +91,7 @@ pub struct Ctx { pub db: Db, pub build: builds::BuildRow, pub pb: Pkgbase, - pub src: SourceIdentity, + pub(crate) src: SourceIdentity, pub staging: PathBuf, pub srcdir: PathBuf, pub collect_path: PathBuf, @@ -155,7 +155,7 @@ impl Ctx { self.backend.acquire(&spec) } - pub fn log_line(&self, line: &str) { + pub(crate) fn log_line(&self, line: &str) { use std::io::Write; if let Some(parent) = self.log.parent() { let _ = std::fs::create_dir_all(parent); @@ -286,7 +286,7 @@ pub fn enqueue_manual_rebuild(cfg: &Config, db: &Db, pkgbase: &str) -> Result), Skipped(String), Blocked(Vec), diff --git a/src/pipeline/publish.rs b/src/pipeline/publish.rs index 190fb65..4e72d35 100644 --- a/src/pipeline/publish.rs +++ b/src/pipeline/publish.rs @@ -218,7 +218,7 @@ fn commit_release(ctx: &Ctx, collect: &Collect) -> Result { }) } -pub fn sweep_render_dirs(arch_dir: &Path) { +pub(crate) fn sweep_render_dirs(arch_dir: &Path) { let Ok(entries) = std::fs::read_dir(arch_dir) else { return; }; diff --git a/src/pipeline/steps.rs b/src/pipeline/steps.rs index ba3a08e..be4ebf3 100644 --- a/src/pipeline/steps.rs +++ b/src/pipeline/steps.rs @@ -7,7 +7,7 @@ use crate::pipeline::{Collect, CollectedPkg, Ctx, StepResult}; use crate::sandbox::Cmd; use crate::watch::sources; -pub fn run_step(ctx: &Ctx, step: &str) -> Result { +pub(crate) fn run_step(ctx: &Ctx, step: &str) -> Result { match step { "materialize" => materialize(ctx), "plan" => plan(ctx), -- cgit v1.2.3