summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/DECISIONS.md59
1 files changed, 59 insertions, 0 deletions
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 58d694a..32daa8c 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -450,3 +450,62 @@ tree — you move the directory and point `--root` at it, which is how the CLI
already worked. And an existing tree that was already split by the doubling keeps
its two databases until someone notices and moves the rows; the fix stops the
bleeding rather than reconstructing what went into the wrong tree.
+
+## The sandbox backend is a tagged enum, and an unwired kind is an error
+
+`sandbox_backend` was a string, and `backend_for` matched it with `_ => loopback`.
+The design documents a Kata backend, so `sandbox_backend = "kata"` was a
+configuration an operator could write in good faith — and it meant "run the
+untrusted PKGBUILD as the hub's own user", silently. There was no validation of
+any kind in the crate: an empty `agent_token`, a missing listen address, a
+half-filled cluster coordinate set, all parsed and failed later as something
+else.
+
+**Choice.** One `sandbox` object, three kinds — `loopback`, `remote`,
+`agent-sandbox` — internally tagged, `deny_unknown_fields`, required fields
+required by the type rather than by a validation pass someone must remember.
+An unknown kind is a parse error naming the value and the valid set; a misspelled
+field is named rather than read as absent. `Config::validate` catches what a type
+cannot see (a field present but empty) and runs both at startup and wherever a
+backend is constructed, so nothing that builds one can skip it. Retired flat keys
+are refused when they carry intent — a config saying `"remote"` errors and names
+the replacement — while the `"loopback"` plus empty strings that `init` used to
+write is noise, not intent, and keeps loading. `agent-sandbox` parses, validates,
+and builds a real `KataBackend` over `K8sSandboxProvisioner`; the
+containerd/`nerdctl` payload builder is deleted rather than left as a route the
+configuration refuses.
+
+Two consequences of "actually reachable from config" needed fixing on the way.
+The agent listener was bound per build, because `Ctx::new` constructed a backend
+per build, so a second concurrent build on a fixed `listen` died of `EADDRINUSE`
+— the listener is now shared per `(address, token)` for the life of the process,
+with the token in the key so two tokens cannot quietly share one. And a Kata
+backend cannot share only a listener: it routes dial-ins by nonce into a map of
+its own, so two on one address would each see half of them; the whole backend is
+shared per configuration instead, keyed by a digest so the token and bearer are
+not copied into a second place.
+
+**Cost.** Existing configs that named a non-loopback backend must be rewritten —
+deliberately, because silently reinterpreting them is the bug. And a kind that is
+valid but not yet implemented is now a hard error at the first build instead of a
+silent downgrade, which is correct but will bite someone mid-rollout.
+
+## A remote sandbox must be told the workspace is shared
+
+The workspace is not shipped to a remote sandbox: `Run` frames carry a hub-side
+cwd and `build` runs `makepkg` in `ctx.srcdir`. On a hub that shares that path
+with the sandbox — the test tier, and any same-host deployment — this works. On
+one that does not, it fails obscurely inside `makepkg`. Worse, a misconfiguration
+could make a "remote" build succeed on the hub, which is the exact substitution
+the whole enum exists to prevent, one layer down.
+
+**Choice.** Both remote kinds require `"shared_workspace": true`, and the refusal
+explains the gap rather than just naming the field. The field defaults to false
+rather than being required by the type precisely so the error can say why.
+`loopback` needs no assertion because it shares the filesystem by construction.
+
+**Cost.** This is a guard, not a fix. The real fix is the workspace manifest and
+tar sync the design sketches, which touches the wire protocol, `collect`, and the
+I9 containment checks; until then a genuinely networked remote deployment is not
+possible, and the config now says so at startup instead of letting `makepkg`
+discover it.