From 4304b0f336ddba7b4ec6780795059ff2066d105b Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:33:17 +0000 Subject: comments: keep only what the code cannot show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound. --- src/sandbox/mod.rs | 35 ----------------------------------- 1 file changed, 35 deletions(-) (limited to 'src/sandbox/mod.rs') diff --git a/src/sandbox/mod.rs b/src/sandbox/mod.rs index ea3e126..3bd4b3b 100644 --- a/src/sandbox/mod.rs +++ b/src/sandbox/mod.rs @@ -16,14 +16,6 @@ pub mod loopback; pub mod remote; pub mod wire; -/// A command to run inside a sandbox. Deliberately argv-shaped, never -/// shell-shaped: a remote sandbox must not be handed a shell string. The -/// environment is the backend's business (see `Config::child_env`). -/// -/// An argv element of the form `blob:` names a blob staged with -/// [`Sandbox::put`]; the backend expands it to wherever the blob materializes -/// inside the sandbox. Callers never name sandbox-local paths, which is what -/// keeps a loopback step byte-identical to a remote one. #[derive(Debug, Clone)] pub struct Cmd { pub argv: Vec, @@ -47,7 +39,6 @@ impl Cmd { } } -/// A finished command. `code` is `None` when the child died by signal. #[derive(Debug)] pub struct Exit { pub code: Option, @@ -61,10 +52,6 @@ impl Exit { } } -/// What a caller asks the pool for. `profile` is the only affinity key warm -/// pools need today (§8.3); `ttl` is the guarantee that the sandbox is dead no -/// matter what this process then does; `disk_mb` replaces the hub's local -/// disk-headroom check (§8.2) once builds leave the hub's filesystem. #[derive(Debug, Clone)] pub struct SandboxSpec { pub profile: String, @@ -79,7 +66,6 @@ impl SandboxSpec { } } -/// Pool state for the UI and notices. #[derive(Debug, Clone)] pub struct SandboxInfo { pub id: String, @@ -87,32 +73,19 @@ pub struct SandboxInfo { pub warm: bool, } -/// A leased sandbox. `run` streams output through `on_log` as it arrives and -/// also returns it captured, so a step can parse stdout while the build log -/// stays complete. `put`/`get` move content-addressed blobs and never accept a -/// destination path from a sandbox — the same I9 posture the local staging -/// containment checks enforce. pub trait Sandbox: Send + Sync { fn id(&self) -> &str; fn run(&self, cmd: &Cmd, on_log: &mut dyn FnMut(&[u8])) -> Result; fn put(&self, digest: &str, r: &mut dyn Read) -> Result<()>; fn get(&self, digest: &str) -> Result>; - /// Idempotent, and also happens by itself when the TTL bites. fn destroy(&self) -> Result<()>; } -/// The pool. `acquire` may return a pre-warmed sandbox, cold-start one, or fail -/// when at quota; a failed acquire is a blocked build, not a broken one. pub trait SandboxBackend: Send + Sync { fn acquire(&self, spec: &SandboxSpec) -> Result>; fn status(&self) -> Result>; } -/// Turn a configuration into the backend it names — the only place that does. -/// -/// `Config::validate` runs here as well as at startup: a guard that only exists -/// in the CLI is a guard a test or a future daemon can walk past. An unknown or -/// unwired kind is an error, never a fallthrough. pub fn backend_for(cfg: &Config) -> Result> { cfg.validate()?; match &cfg.sandbox { @@ -127,20 +100,12 @@ pub fn backend_for(cfg: &Config) -> Result> { } } -/// A listener shared by every backend built from the same `(addr, token)`. #[derive(Clone)] pub(crate) struct Bound { pub local: String, pub rx: Receiver, } -/// One bound listener per `(address, token)` per process. -/// -/// The listener belongs to the process, not to a build: binding it per build -/// meant a second concurrent build hit `EADDRINUSE` for a reason unrelated to -/// its package. The token is part of the key because two different tokens -/// cannot share a listener, and silently reusing the first one's listener would -/// be a fail-open surprise. pub(crate) fn bound_listener(addr: &str, token: &str) -> Result { static REGISTRY: OnceLock>> = OnceLock::new(); let registry = REGISTRY.get_or_init(|| Mutex::new(HashMap::new())); -- cgit v1.2.3