diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 12:00:46 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 12:00:46 +0000 |
| commit | fa921c26bade47634506b57b32713421f976ae22 (patch) | |
| tree | 77738f67fdf641c8a51dc070a3c628c5922be46e /src/error.rs | |
| parent | 2eb4500f089154b982f7c5dbbc7f1efbfd702ed5 (diff) | |
| download | aur-build-fa921c26bade47634506b57b32713421f976ae22.tar.gz aur-build-fa921c26bade47634506b57b32713421f976ae22.zip | |
sandbox: failure-mode tier — a FakeBackend that breaks on purpose
The recovery paths a remote pool makes newly reachable are now executed,
not described. A decorator over the loopback backend injects the four
faults that matter: a sandbox that vanishes mid-run (the step fails, the
lease expires, the reaper requeues, a healthy pool finishes from the
checkpoints — I5 across the sandbox boundary); a TTL that bites mid-build
(a failed step, not a retry-burned one); a pool at quota (the build
blocks on sandbox-pool using the same blocked machinery as missing deps,
rather than failing on an infrastructure fact); and a sandbox whose
pacman -Q lies about the installed world (provisioning refuses with a
dedicated world-mismatch class, so 'the sandbox lied' never reads as
'the sandbox broke').
Two error classes carry that vocabulary: PoolExhausted — capacity, so
wait, never retry — and WorldMismatch — fail-closed, never retried. The
remote and kata acquire timeouts now speak the first, which is what
makes a full pool a queue fact instead of a build failure.
Diffstat (limited to 'src/error.rs')
| -rw-r--r-- | src/error.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index cf6e567..342c628 100644 --- a/src/error.rs +++ b/src/error.rs @@ -30,6 +30,17 @@ pub enum Error { Invalid(String), #[error("blocked: {0}")] Blocked(String), + /// The sandbox pool could not fit a lease right now. Not a failure and not + /// a retry: the build waits, the same way it waits for a dependency it + /// publishes (§10.4). A quota is a fact about capacity, not a bug. + #[error("sandbox pool exhausted: {0}")] + PoolExhausted(String), + /// The world inside the sandbox is not the world the plan approved: + /// a pinned dependency did not land, or the closure was incomplete. + /// Fail-closed with its own class so a test (and an operator) can tell + /// "the sandbox lied" apart from "the sandbox broke". + #[error("world mismatch: {0}")] + WorldMismatch(String), /// A failure the outside world caused and a retry may clear: an unreachable /// upstream, a half-written mirror. Distinct from a deterministic failure, /// which must never be retried into a different answer (§8.4). @@ -67,6 +78,19 @@ impl Error { pub fn transient(s: impl fmt::Display) -> Self { Error::Transient(s.to_string()) } + pub fn pool_exhausted(s: impl fmt::Display) -> Self { + Error::PoolExhausted(s.to_string()) + } + pub fn world_mismatch(s: impl fmt::Display) -> Self { + Error::WorldMismatch(s.to_string()) + } + + /// True when the sandbox pool, not the build, is the problem: the build + /// should block and wait, not fail and not be retried into a different + /// answer. + pub fn is_pool_exhausted(&self) -> bool { + matches!(self, Error::PoolExhausted(_)) + } /// True when a retry could plausibly help (§8.4): an unreachable upstream, a /// mirror that 5xx'd, a connection that reset. @@ -79,6 +103,9 @@ impl Error { pub fn is_transient(&self) -> bool { match self { Error::Http(_) | Error::Transient(_) => true, + // A quota is capacity, not a hiccup: retrying a build that has no + // sandbox just burns attempts. It blocks instead. + Error::PoolExhausted(_) | Error::WorldMismatch(_) => false, Error::Io(e) => matches!( e.kind(), std::io::ErrorKind::WouldBlock @@ -119,5 +146,9 @@ mod tests { assert!(Error::Http("connection reset".into()).is_transient()); assert!(!Error::invalid("recipe has no pkgbase").is_transient()); assert!(!Error::fail_closed("identity hash moved").is_transient()); + // A full pool waits; it does not retry. A lying world fails closed. + assert!(!Error::pool_exhausted("at quota").is_transient()); + assert!(!Error::world_mismatch("missing pinned dep").is_transient()); + assert!(Error::pool_exhausted("at quota").is_pool_exhausted()); } } |
