diff options
Diffstat (limited to 'src/sandbox')
| -rw-r--r-- | src/sandbox/kata.rs | 34 | ||||
| -rw-r--r-- | src/sandbox/loopback.rs | 11 | ||||
| -rw-r--r-- | src/sandbox/mod.rs | 11 | ||||
| -rw-r--r-- | src/sandbox/remote.rs | 26 |
4 files changed, 16 insertions, 66 deletions
diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs index e035fd6..2bdc472 100644 --- a/src/sandbox/kata.rs +++ b/src/sandbox/kata.rs @@ -18,7 +18,6 @@ use crate::sandbox::wire::{self, Frame}; use crate::sandbox::{Sandbox, SandboxBackend, SandboxInfo, SandboxSpec}; #[derive(Debug, Clone)] -// ProvisionRequest stays `pub`: the argument of `Provisioner::provision`, the trait the public `LocalAgentProvisioner` implements. pub struct ProvisionRequest { pub sandbox_id: String, pub profile: String, @@ -28,7 +27,6 @@ pub struct ProvisionRequest { pub image: String, } -// Provisioner stays `pub`: implemented by the test-gated public `LocalAgentProvisioner`; a private trait on a public impl is E0445. pub trait Provisioner: Send + Sync { fn provision(&self, req: &ProvisionRequest) -> Result<()>; fn reclaim(&self, sandbox_id: &str) -> Result<()>; @@ -36,10 +34,9 @@ pub trait Provisioner: Send + Sync { } /// The agent-sandbox-style CR: one disposable Sandbox per build, Kata for the -/// VM boundary, `activeDeadlineSeconds` so the *orchestrator* enforces the -/// TTL even if the hub dies. The token rides in args for v1; a production -/// deployment should mount it from a Secret, and this comment is the honest -/// place that says so. +/// VM boundary, `activeDeadlineSeconds` so the orchestrator enforces the TTL +/// even if the hub dies. The token rides in args; a production deployment +/// should mount it from a Secret. fn sandbox_cr(req: &ProvisionRequest) -> serde_json::Value { serde_json::json!({ "apiVersion": "agents.x-k8s.io/v1alpha1", @@ -123,13 +120,8 @@ impl Provisioner for K8sSandboxProvisioner { } } -/// Provisions sandboxes by running the local `sandbox-agent` binary. -/// -/// Test-tier only. Production selects `K8sSandboxProvisioner` when the config -/// names an agent-sandbox backend (kata.rs:193); nothing in the crate ever -/// constructs this type. It exists so tests can drive the real agent protocol -/// against the shim binary without a cluster, which is a more valuable test -/// than the absence of one — so it is gated rather than deleted. +/// Provisions sandboxes by running the local `sandbox-agent` binary, so tests +/// can drive the real agent protocol without a cluster. #[cfg(feature = "test-support")] pub struct LocalAgentProvisioner { pub bin: PathBuf, @@ -176,9 +168,7 @@ impl Provisioner for LocalAgentProvisioner { } } -/// The real definition and its impls. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the only way to -/// reach it, and the alias is what carries the feature-conditional visibility. +/// The real definition and its impls; the alias below carries the visibility. mod kata_backend { use super::{ bounded, route_dial_in, wire, Arc, AtomicU64, Config, Duration, Error, Frame, HashMap, K8sSandboxProvisioner, @@ -252,13 +242,6 @@ mod kata_backend { }) } - // NOTE: `KataBackend::reclaim` used to sit here and called nothing but - // `self.provisioner.reclaim`, which the pool already calls itself at the - // reaping site. Nothing — not a test — ever called the wrapper, so it is - // gone rather than gated. The census had credited it to `tests/kata.rs`, - // where the TTL test implements the *trait's* `reclaim` on a null - // provisioner: same word, different function. - fn nonce(&self) -> String { let n = self.counter.fetch_add(1, Ordering::SeqCst); let nanos = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.as_nanos()); @@ -298,10 +281,7 @@ mod kata_backend { } } -/// Selected by `backend_for`. The kata tests drive it directly and need a -/// fixture, so they cannot move into the module. -/// `pub` only under `test-support`. Production reaches the backend through -/// `backend_for` and never names the type from outside `sandbox`. +/// Selected by `backend_for`; the kata tests drive it directly. #[cfg(feature = "test-support")] pub use kata_backend::KataBackend; diff --git a/src/sandbox/loopback.rs b/src/sandbox/loopback.rs index fb97660..5433ee6 100644 --- a/src/sandbox/loopback.rs +++ b/src/sandbox/loopback.rs @@ -7,10 +7,7 @@ use crate::config::Config; use crate::error::{Error, Result}; use crate::sandbox::{Cmd, Exit, Sandbox, SandboxBackend, SandboxInfo, SandboxSpec}; -/// The real definition. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the -/// only way to reach it, and the alias is what carries the -/// feature-conditional visibility. +/// The real definition; the alias below carries the visibility. mod loopback_backend { use super::Config; // `pub` fields inside a private module are not nameable from @@ -21,11 +18,7 @@ mod loopback_backend { } } -/// The default backend, built by `backend_for`. A failure test builds one to inject a fault. -/// -/// `pub` only under `test-support`. Production reaches the type -/// through its own module and never names it from outside; the -/// outside reader that needs the name is a test. +/// The default backend, built by `backend_for`. #[cfg(feature = "test-support")] pub use loopback_backend::LoopbackBackend; diff --git a/src/sandbox/mod.rs b/src/sandbox/mod.rs index 1c73e40..22bf062 100644 --- a/src/sandbox/mod.rs +++ b/src/sandbox/mod.rs @@ -72,10 +72,7 @@ impl SandboxSpec { } } -/// The real definition. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the -/// only way to reach it, and the alias is what carries the -/// feature-conditional visibility. +/// The real definition; the alias below carries the visibility. mod sandbox_info { #[derive(Debug, Clone)] pub struct SandboxInfo { @@ -84,11 +81,7 @@ mod sandbox_info { } } -/// The return type of `SandboxBackend::status`. No production module outside `sandbox` names it; the backend tests do. -/// -/// `pub` only under `test-support`. Production reaches the type -/// through its own module and never names it from outside; the -/// outside reader that needs the name is a test. +/// The return type of `SandboxBackend::status`. #[cfg(feature = "test-support")] pub use sandbox_info::SandboxInfo; diff --git a/src/sandbox/remote.rs b/src/sandbox/remote.rs index f881eb0..08474d4 100644 --- a/src/sandbox/remote.rs +++ b/src/sandbox/remote.rs @@ -9,14 +9,10 @@ use crate::error::{Error, Result}; use crate::sandbox::wire::{self, Frame}; use crate::sandbox::{Exit, Sandbox, SandboxBackend, SandboxInfo, SandboxSpec}; -/// The real definition. The module is private, so this `pub` -/// is not a nameable path from outside; the alias below is the -/// only way to reach it, and the alias is what carries the -/// feature-conditional visibility. +/// The real definition; the alias below carries the visibility. mod remote_backend { use super::{Config, Receiver}; - // `pub` fields inside a private module are not nameable from - // outside; they stay readable by the impls below. + // `pub` inside a private module is still unreadable from outside it. pub struct RemoteBackend { pub cfg: Config, @@ -26,11 +22,7 @@ mod remote_backend { } } -/// The remote backend, built by `backend_for`. A fixture test builds one to drive the agent protocol. -/// -/// `pub` only under `test-support`. Production reaches the type -/// through its own module and never names it from outside; the -/// outside reader that needs the name is a test. +/// The remote backend, built by `backend_for`. #[cfg(feature = "test-support")] pub use remote_backend::RemoteBackend; @@ -43,16 +35,8 @@ impl RemoteBackend { Ok(Self { cfg: cfg.clone(), token: token.to_string(), addr: bound.local, queue: bound.rx }) } - /// The address the rendezvous listener actually bound to. - /// - /// Test-tier only. Production binds through `bound_listener` and hands the - /// address to the agent itself, so nothing in the crate asks for it back; - /// `tests/remote_agent.rs` needs it to point a real agent at the socket. - /// It is gated rather than left public because the census believed it had - /// production callers at two `listener.local_addr()` calls — std's method - /// on a `TcpListener`, in sibling files, which a name match cannot tell - /// apart from this one. That confusion is what `dotted_only` confirmation - /// in `tools/test-surface.py` now forces a human to resolve. + /// The address the rendezvous listener actually bound to, so a test can + /// point a real agent at the socket. #[cfg(feature = "test-support")] pub fn local_addr(&self) -> &str { &self.addr |
