From e757979f1a2afdbe7146066345bb9acd19d3b151 Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:09:59 +0000 Subject: comments: say why, not what MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath. --- src/sandbox/kata.rs | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'src/sandbox/kata.rs') diff --git a/src/sandbox/kata.rs b/src/sandbox/kata.rs index c7d717f..9169f9f 100644 --- a/src/sandbox/kata.rs +++ b/src/sandbox/kata.rs @@ -1,25 +1,3 @@ -//! The kata backend: ad-hoc, TTL-bounded sandboxes provisioned by an -//! orchestrator, leased over the same agent protocol as everything else. -//! -//! This is composition, not a new protocol: a kata sandbox is a small VM that -//! boots the `sandbox-agent` image pointed at this hub, and `acquire` is -//! "ask the provisioner for a box, then wait for *that specific box* to dial -//! in". The nonce each lease generates is handed to the provisioner and comes -//! back as the agent's `agent_id`, so a stray sandbox can never be leased to -//! the wrong build, and a sandbox that never dials in is a TTL expiry — the -//! same vocabulary every other failure in this system speaks (I5). -//! -//! The payload is an agent-sandbox-style Kubernetes CR (`runtimeClass: kata`, -//! `activeDeadlineSeconds` as the TTL the orchestrator enforces). It is a pure -//! function, unit-tested; the network call that sends it is exercised only by -//! the gated live tier, which skips — with a printed note, never a silent -//! pass — wherever a cluster is absent. -//! -//! The `LocalAgentProvisioner` is the shape this tier is tested with: a real -//! `sandbox-agent` process, real rendezvous, no VM. It is to kata what the -//! loopback backend is to a clean machine — the honest stand-in that keeps -//! the interface itself under test. - use std::collections::HashMap; use std::io::BufReader; use std::net::{TcpListener, TcpStream}; @@ -218,16 +196,12 @@ impl KataBackend { /// /// A Kata backend cannot share only its listener the way the plain remote /// backend does: it routes every dial-in by the nonce in its `Hello` into a - /// map that belongs to it, so two backends on one address would each see - /// half the dial-ins and neither could complete a rendezvous. So the whole - /// backend is shared, not just the socket — which is also what makes - /// "one listener per process" true here, since binding happens exactly once - /// per distinct configuration. + /// map that belongs to it, so two backends on one address would each see half + /// the dial-ins. The whole backend is therefore shared, and binding happens + /// exactly once per distinct configuration. /// /// The key is a digest of everything that distinguishes one backend from - /// another, so the rendezvous token and the cluster bearer are not sitting - /// around in a second place, and two configurations that differ only in - /// unrelated hub settings still get their own backend. + /// another, so the tokens are not sitting around in a second place. pub fn shared_for(cfg: &Config) -> Result> { let crate::config::Sandbox::AgentSandbox { api, namespace, bearer, image, listen, token, .. } = &cfg.sandbox -- cgit v1.2.3