diff options
Diffstat (limited to 'DESIGN.md')
| -rw-r--r-- | DESIGN.md | 66 |
1 files changed, 55 insertions, 11 deletions
@@ -521,14 +521,17 @@ individually confirmed. Bulk approve is per-candidate, never "approve everything 0 materialize git worktree add --detach <builddir> <aur_commit> (local mirror only, no net) recompute recipe_hash; assert == candidate.recipe_hash → fail closed 1 plan resolve deps against current accepted index; compute WorldSnapshot -2 chroot acquire/refresh chroot overlay; install makedepends + depends from our repo +2 provision lease the sandbox; install the pinned lease set (our deps by exact + version+digest) with pacman -U; assert the sandbox's pacman -Q + confirms the approved world landed → fail closed on mismatch 3 sources seed from source_cache, fetch what is missing, then verify against candidate.source_digests (not only the PKGBUILD's declared sums) + PGP 4 pkgver (VCS only) resolve pkgver(); assert == approved pkgver/pkgrel -5 build makechrootpkg -c -r <chroot> -- -si <key> -f +5 build makepkg -c -f in the provisioned sandbox (no -s: deps are installed; + no -si: the sandbox never holds the signing key) 6 collect parse .PKGINFO/.BUILDINFO, extract artifacts + build log -7 verify signature valid, deps satisfiable in target repo, no downgrade -8 ingest move artifacts to content-addressed store, record rows +7 verify deps satisfiable in target repo, no downgrade +8 ingest move artifacts to content-addressed store, sign hub-side, record rows 9 publish repo-add + repo-remove, sign, atomic swap 8 ingest move artifacts to content-addressed store, record rows 9 publish repo-add + repo-remove, sign, atomic swap @@ -596,13 +599,20 @@ reaper (in the dispatcher loop): `UPDATE … WHERE state='queued'` in a `BEGIN IMMEDIATE` transaction is still atomic across processes, so the design survives that split unchanged. -### 8.3 Clean chroot specifics - -* devtools: `mkarchroot` per profile (`extra-x86_64`), one warm root per profile, - per-build CoW snapshot (`makechrootpkg -c`), never mutate the seed. -* The chroot's pacman is configured to trust **only** our repo key + the arch keyring; - `SigLevel = Required DatabaseOptional` inside the chroot so a poisoned mirror can't inject - a build dep. +### 8.3 Clean build environment specifics + +* The sandbox boots from a **base image** we build per profile (`extra-x86_64`), + content-addressed by the world it contains, carrying `base` + `base-devel`, the + arch keyring and our signing key in pacman's keyring, and a pacman.conf with + `SigLevel = Required` and no `Server=` lines: dependencies enter only as + digest-pinned blobs through the lease (§8a), never from a live mirror. +* The provisioning step installs the **lease manifest** — every dependency we + publish, pinned to the exact version and digest the index serves — with + `pacman -U`, and the sandbox's own `pacman -Q` must confirm the pinned world + landed. A byte that hashes differently, or a world that drifted, fails the + build closed (`WorldMismatch`). The devtools chroot (`mkarchroot`, + `makechrootpkg`, nspawn) is gone: the sandbox *is* the isolation boundary, and + the machine boundary makes I9 stronger than a chroot did (DECISIONS.md). * Network: **available during `build()`**, no controls in v1 (decided). Many AUR packages fetch at build time (cargo, npm, go, `pip install` during `build()`), so blocking egress would break a large share of the set. Consequence stated plainly: a `PKGBUILD` can fetch @@ -629,6 +639,40 @@ reaper (in the dispatcher loop): * Flaky test suites: `checkdepends` failures produce a distinct "build ok, check() failed" state with a "retry with --nocheck" action that is itself an explicit, audited decision. +### 8a. Sandbox backends (remote builder) + +Where build code *runs* is a deployment fact, so it is an interface +(`crate::sandbox::SandboxBackend`), not a pipeline fact. The step machine leases +a sandbox (`acquire`), runs argv-shaped commands on it (`run`, streaming output +into the same build log the SSE tail reads), moves content-addressed blobs in +and out (`put`/`get` — there is no "path on the sandbox" concept in the +interface), and destroys it. Three bodies: + +* **loopback** — commands run as subprocesses of the hub, with the §16a shim + protocol applied. This is `cargo test` and the single-machine deployment; the + shim suite passing through it unchanged is what keeps the seam honest. +* **remote** — an ephemeral `sandbox-agent` dials the hub (outbound rendezvous: + the hub never needs a route into an untrusted box), serves `Run`/`Put`/`Get` + frames over length-prefixed JSON, and dies — taking its child with it — when + the connection drops or its TTL expires. A vanished sandbox fails the step, + which is already the shape of an expired lease (I5): the remote path adds no + new failure vocabulary. +* **kata** — ad-hoc, TTL-bounded sandboxes provisioned by an orchestrator + (agent-sandbox-style CR with `runtimeClass: kata` and `activeDeadlineSeconds`, + or `nerdctl` + containerd's kata runtime). `acquire` mints a rendezvous nonce, + provisions, and leases only the dial-in whose hello carries the nonce back; a + box that never dials in is a TTL expiry. A pool that cannot fit a lease is + `PoolExhausted`: the build blocks on `sandbox-pool` using the same blocked + machinery as missing deps (§10.4) — capacity is a fact to wait on, not a + failure to retry. + +The TTL is the guarantee under every leak: hub crash, partition, a forgotten +destroy. Every sandbox is garbage-collected by its deadline, and the hub itself +never needs root — the privileged surface shrank to "nothing on this machine +runs build code at all." Workspace sync over the wire is deliberately not +implemented: `Run` carries a hub-side cwd, honest for loopback-shaped +deployments and the test tier, and the code says so. + --- ## 9. Publishing & serving the index |
