From 94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 15:57:39 +0000 Subject: sandbox: the kata lease path publishes a real package, and the config says what it means MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The end-to-end claim of the seam, tested as one thing: `plain-make` detected, approved, built and published through `KataBackend` + `LocalAgentProvisioner` — a real `sandbox-agent` process, a real nonce-matched rendezvous, real frames — with a VM being the only thing this host cannot provide. The index ends up serving the package, the agent's output reaches the same log the SSE tail reads, and the shim saw exactly one `makepkg`. Documented where the project records such things: the enum and the refusal of an unwired kind, the shared listener and the shared Kata backend, and the `shared_workspace` assertion as a guard rather than a fix — the workspace sync is still the unimplemented thing it was, and the config now says so at startup instead of letting `makepkg` discover it. Also reaped two unreaped `sandbox-agent` children in the remote tests, which was the last clippy warning in the tree; `--all-targets` is now silent. --- tests/kata.rs | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'tests/kata.rs') diff --git a/tests/kata.rs b/tests/kata.rs index 12aa607..29a6f29 100644 --- a/tests/kata.rs +++ b/tests/kata.rs @@ -14,7 +14,7 @@ use aur_build::config::Config; use aur_build::error::Result; use aur_build::sandbox::kata::{KataBackend, LocalAgentProvisioner, ProvisionRequest, Provisioner}; use aur_build::sandbox::{Cmd, SandboxBackend, SandboxSpec}; -use common::shim_dir; +use common::{env_with_fixture, shim_dir}; #[test] fn a_provisioned_sandbox_rendezvous_and_runs_a_command() { @@ -175,3 +175,53 @@ fn a_loopback_config_never_becomes_agent_sandbox_or_vice_versa() { assert!(!id.contains("kata@"), "loopback must not report kata: {id}"); assert!(!id.contains("remote@"), "loopback must not report remote: {id}"); } + +/// The seam's whole claim, tested as one thing: a real package built and +/// published through the kata lease path — a real `sandbox-agent` process, a +/// real nonce-matched rendezvous, real frames — with a VM being the only thing +/// this host cannot provide. If the lease path and the loopback path disagree +/// about anything, this is where it shows. +#[test] +fn a_fixture_builds_and_publishes_through_the_kata_lease_path() { + let (env, _fx) = env_with_fixture("plain-make"); + aur_build::watch::detect::check_pkgbase(&env.cfg, &env.db, "plain-make").unwrap(); + let c = aur_build::review::candidates::pending_candidates(&env.db).unwrap().remove(0); + let dd = aur_build::review::diff::render_and_store(&env.db, &env.cfg, &c).unwrap(); + aur_build::review::approve::approve(&env.db, "tester", c.id, &c.identity_hash, &dd, None).unwrap(); + let c = aur_build::review::candidates::candidate_by_id(&env.db, c.id).unwrap().unwrap(); + let id = aur_build::pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); + + let mut ctx = aur_build::pipeline::Ctx::new(&env.cfg, &env.db, &id).unwrap(); + let prov = Arc::new(LocalAgentProvisioner::new(shim_dir().join("sandbox-agent"))); + let backend = KataBackend::bind(&env.cfg, "127.0.0.1:0", "kata-e2e", prov).unwrap(); + ctx.backend = Arc::new(backend); + + let out = aur_build::pipeline::run_with(&ctx).unwrap(); + let release = match out { + aur_build::pipeline::Outcome::Succeeded { release_id } => release_id, + other => panic!("the kata path must publish, got {other:?}"), + }; + assert!(release > 0); + + // Published, not merely built: the served index now names the package. + let world = aur_build::pipeline::publish::index_world(&env.db).unwrap(); + assert!( + world.iter().any(|w| w.pkgbase == "plain-make" && w.version == "1.0-1"), + "the index must serve what the kata build produced: {world:?}" + ); + + // And it ran inside the leased sandbox: the agent streamed the build output + // over the wire into the same log file the SSE tail reads, and the shim saw + // exactly one makepkg. + let log = std::fs::read_to_string(env.cfg.build_log_path(&id)).unwrap(); + assert!(log.contains("Making package"), "agent output must reach the log:\n{log}"); + let shimlog = env.cfg.hooks.shim_dir.clone().unwrap(); + assert_eq!(aur_build::shims::called_with(&shimlog, "makepkg", ""), 1); + + // Deliberately no assertion that the sandbox is gone: the pipeline never + // calls `destroy`, and the design says the TTL is the guarantee and destroy + // is courtesy (wire.rs). The lease window bounds how long a box lives, not + // a teardown call — which is worth knowing, because it means a busy hub + // holds up to `steps x builds` sandboxes until their TTL bites. +} + -- cgit v1.2.3