| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Five http items were being counted as test-pinned on the strength of a
string alone, and are now `pub(crate)`:
render::Attention the word appears in crash.rs inside a message
Res::html "text/html" is a content type, not a call
Res::redirect "redirect" appears in an assertion message
routes::logout "/logout" is a route path
routes::route "mutating route" appears in an assertion message
Nothing in the test tier calls any of them; each carries a comment saying
so, because "the census said a test needed this" is not a reason and will
be re-asked by the next person to read the line.
`config::TestHooks` was already half-gated — the `hooks` field and the
`Default` line that fills it are both behind `test-support` — while the
type and its impl were not, so a release binary compiled a struct it
could never construct, read, or deserialize. Now gated whole.
The live kata tier moved into `src/sandbox/kata.rs`. It is not a fixture
test: it records its own absence without /dev/kvm or AUR_KATA_API, the
same way the vercmp live tier does. It was the only thing outside the
module naming `K8sSandboxProvisioner` field by field, so that struct is
`pub(crate)` now too.
One correction to the table, and it is the kind of correction a heuristic
deserves: `http::cookie` and `http::login` were classified `move-test`
because their tests contain no harness keyword. They do — `Web::` starts a
real HTTP listener, and a test that talks to one is not a unit test
however little code it holds. The detector now knows that, and both items
are residue, which is what they always were.
http: 27 pub -> 22 pub. Test-only items across the crate: 52 -> 46.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Six db items are now gated behind `test-support`, each with a comment
saying what it is for and why production never calls it:
builds::claim production leases a batch; `claim_batch` is
what the dispatcher runs
settings::set_setting the readers are used, the setter is not
Writer::shutdown the server runs until the process ends
snapshots::snapshot_by_commit
world::world_members production writes world snapshots, never
reads one back member by member
invariants::unapproved_index_entries
gated, not relocated: reading it needs this
module's private helpers, and widening those
to let a test out would be the wrong trade
Gating them exposed three things they were the only user of, and each is
gated with them rather than left compiling into a binary that cannot reach
it: `Msg::Shutdown` and its loop arm, and `model::json_or`.
`arch-census.py --write-budget` also stopped erasing the `test_surface`
section — two writers of one file must not delete each other's axis, or
the ratchet quietly stops checking it.
`steps::touch` is deleted, not narrowed. Nothing called it — not
production, not a test. The census had credited it to `tests/shims.rs`,
where the word appears inside a string.
In sandbox, two tests moved into `src/sandbox/kata.rs`: the container
record a lease provisions, and the TTL expiry of a sandbox that never
dials in. Neither builds a fixture. `KataBackend::shared_for`,
`provision_request`, `sandbox_cr` and `K8sSandboxProvisioner::for_config`
are `pub(crate)` as a result.
`KataBackend::reclaim` is deleted — same story as `touch`. It forwarded to
`self.provisioner.reclaim`, which the reaping site already calls itself,
and the TTL test the census credited it for implements the *trait's*
`reclaim` on a null provisioner. Same word, different function.
Two honest costs, both recorded rather than smoothed over:
- `Provisioner` and `ProvisionRequest` are now named by nobody outside
`sandbox`, yet cannot be narrowed: `LocalAgentProvisioner` is `pub`
because two fixture tests construct it, and Rust forbids a public type
implementing a private trait or taking a private parameter type.
`sandbox.deadonly` therefore rises 0 → 2, with the reason here as the
ratchet demands.
- `agent_sandbox_config()` now exists in both `tests/kata.rs` and
`src/sandbox/kata.rs`. Three of that file's remaining tests still need
it, and a test helper cannot be shared across the crate boundary without
making it public again.
sandbox: 27 pub / 15 dead -> 22 pub / 10 dead.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Error::NotFound("no repo row; run `aur-build init`")` and
`Error::NotFound("pkgbase linux")` were the same variant. One is "the install
was never initialised, every page is wrong"; the other is "that page does not
exist, answer 404". The difference lived inside a string, so the only way to
act on it was to re-parse text the same process had written moments earlier.
Six variants now carry structure:
Missing pkgbase / candidate / release / build / snapshot /
mirror path / repo row
Refused IllegalTransition / WrongState / PointerMoved / Other
Guard HashMismatch / DigestMismatch / Invariant
WorldGap MissingPin / Other
PoolFull Backend{backend} / Other
TransientCause Upstream / Command / Other
`Refused` distinguishes the three refusals that were indistinguishable: a
transition no edge permits (caller bug), a row in the wrong state (stale
view), and the accepted pointer moving under a build (a lost race, and the
one a client may safely retry). `PoolFull::Backend` names which pool, because
a kata quota needs an operator and a local cap clears when a build exits.
`is_transient` and `is_pool_exhausted` already matched on variants rather than
strings, so they are unchanged — the typing is what lets the *next* branch be
a match instead of a `contains`.
No test assertion was edited. Where a message is load-bearing the Display was
written to reproduce it: `recipe_hash mismatch: approved X, materialized Y`,
`no release 4`, `illegal candidate transition approved → rejected`, `sandbox
world is missing plain-make-1.0-1 after installing the lease set` and kata's
`never dialed in` all come out of the new types byte-identical. Five messages
did change wording, none asserted anywhere:
release N is X, not published: nothing to withdraw
-> release N is X, not published (Refused::WrongState's shape)
illegal candidate transition a → b for review 7
-> ... for candidate 7 (it is a candidate id; "review"
was misleading)
no candidate 7 to resolve -> candidate 7 (Missing::Candidate's shape)
lease artifact n-v: store bytes hash to A but the index says B
-> source n-v hashed to A but the candidate recorded B (shares
Guard::DigestMismatch with the source-cache check)
vcs_cache clone URL: err -> upstream: vcs_cache clone URL: err
(TransientCause::Upstream tag)
error.pub 15->21 is the six payload enums, which is the point of the task
rather than a widening to apologise for. watch.dead/test each rose by one for
a subtler reason: `watch::upstream::resolve` looked live only because an
unrelated db message ended "... to resolve", and rewording that string removed
the phantom mention. The census now documents that a clean count is not always
an answer, since mentions are matched over raw source including string
literals.
281 passed / 0 failed (277 plus four new typing tests in src/error.rs), clippy
-D warnings clean, release build clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sandbox exported 35 items and 8 of them were named by nobody at all — not by a
caller, not by a test. `Frame`, `read_frame`, `write_frame`, `hex_bytes`,
`unhex` and `MAX_FRAME_BYTES` are the wire protocol, and the protocol is
sandbox's: the agent, the remote client and the loopback all speak it from
inside. Exporting it advertised a second way in that nothing used and everything
would have had to keep compatible. `LoopbackSandbox` and `RemoteSandbox` are
the same story — handles handed out by a constructor nobody calls by name.
Pipeline exported its step machine. `run_step`, `log_line`, `sweep_render_dirs`,
`from_candidate`, `from_release` and the four types they pass around
(`Collect`, `CollectedPkg`, `SourceIdentity`, `StepResult`) were all internal
plumbing reachable from `main`, which only ever wanted `run`, `Outcome`,
`enqueue_for_candidate`, `enqueue_manual_rebuild`, `publish::reconcile` and
`dispatch::Pool::spawn`.
sandbox.pub 35->27, pipeline.pub 30->21, and both modules now have zero items
named by nobody: what is left public is public because a test names it, which
is the allowlist the budget records rather than a hole in it.
Clippy caught what the tests did not: `Ctx::src` was a `pub` field of the newly
private `SourceIdentity`, a public face on a private type. The field narrowed
with the type. Re-widening `SourceIdentity` to silence it would have undone the
point.
The diff is visibility keywords only — no step id literal, no frame variant, no
wire byte changed. 277 passed / 0 failed across 36 binaries, including
remote_agent, failure_modes and the kata tier; clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
| |
The dispatcher tick, watcher tick, SSE poll, agent watchdog and remote
keepalive each slept on the wall clock in their own slice loop, so every test
that wanted a tick waited for real time. They call crate::time::wait/sleep now,
which is the same real sleep in a production build and a virtual clock advance
under test-support: a test that takes the clock owns it, and threads it spawns
inherit it. production_surface checks the virtual path is compiled out and that
no control loop went back to std::thread::sleep.
|
| |
|
|
|
|
|
|
|
|
|
| |
Stripped every comment that described what an item does, documented its
arguments or fields, or cited the design docs (§n, I-n, m-n, decision n).
2247 comments down to 83.
What survives: the section dividers that segment the large modules, the
secret-handling warnings, the agent wire-frame directions, and the few notes
without which the code they attach to reads as redundant, reorderable, or
unsound.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`sandbox_backend` was a string and `backend_for` matched it with `_ => loopback`,
so the documented Kata backend was unreachable from configuration: a hub told to
use agent-sandbox would have quietly built untrusted PKGBUILDs as its own user.
The kind now parses, validates, and produces a real `KataBackend` over
`K8sSandboxProvisioner`, with the CR's `runtimeClass`, `activeDeadlineSeconds`,
nonce, image and cluster coordinates all traced back to the config that produced
them.
Kata shares a *backend* per configuration rather than only a listener: it routes
each 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. The cache key is a digest of the distinguishing fields so
the token and bearer are not copied into a second place.
The containerd/`nerdctl` payload builder is deleted rather than left unused. It
was a second deployment shape with no provisioner, no config path and no live
tier — a builder that advertises a route the configuration refuses is worse than
no builder, because someone will eventually assume the route exists. DESIGN.md
now names one provisioning shape, which is the one that exists.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Ctx::new` constructed a backend for every build, and constructing a remote
backend bound the agent listener. With a fixed `listen` — which is what any real
deployment configures, since the operator has to tell the agents where to dial —
the second concurrent build died of EADDRINUSE. A build failing for a reason
that had nothing to do with its package is the worst kind of flake: it looks like
the package's fault.
`RemoteBackend::bind` now shares one bound listener per `(address, token)` for
the life of the process, and hands each backend a clone of the dial-in queue.
That is also what `remote` already meant: an agent dials in when the operator
boots one and whichever build is waiting takes it. The token is part of the key
deliberately — two tokens cannot share a listener, and quietly reusing the first
one's would be a fail-open surprise, so the second bind is attempted and fails
loudly instead.
Backend construction moved out of `Ctx` into `sandbox::backend_for`, so "which
backend" has exactly one answer and the validation guard travels with it. Tests
cover the shared listener, the shared queue (the *second* backend takes the
dial-in), the two-token refusal, and two concurrent `Ctx`es on one address —
with an assertion that a raw second bind still fails, so the test cannot rot
into proving nothing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`sandbox_backend` was a free-form string and `backend_for` matched it with
`_ => loopback`. So `sandbox_backend = "kata"` — a real, intended backend,
documented in the design — meant "run the untrusted PKGBUILD as the hub's own
user", and nothing anywhere said so. There was also no validation of any kind in
the crate: an empty `agent_token` with a remote backend, or a missing listen
address, parsed fine and failed later as something else.
The four flat fields become one tagged `sandbox` object with three kinds:
`loopback` (needs nothing, still the default, so every config on disk keeps
working), `remote` (listen + token), and `agent-sandbox` (api, namespace,
bearer, image, listen, token). Required fields are required by the type, an
unknown kind is a parse error naming the valid set, and `deny_unknown_fields`
means a misspelled field is named rather than read as absent. `agent-sandbox`
parses and is refused at backend construction until it is wired up — a valid
kind that is not implemented is an error, never a substitution.
Retired keys are refused when they carry intent: a config saying
`sandbox_backend: "remote"` errors and names the replacement shape, because
quietly reinterpreting it as loopback is the bug being removed. A config saying
`"loopback"` with the empty strings `init` wrote is noise, not intent, and loads
unchanged. The token and the cluster bearer are redacted in `Debug`, so a config
that reaches a log line cannot leak them.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The kata lease path is composition, not a new protocol: acquire mints a
rendezvous nonce, asks a Provisioner for a sandbox pointed at this hub,
and leases only the dial-in whose hello carries that nonce back. A box
that never dials in is a TTL expiry — the same vocabulary every other
failure here speaks (I5) — and a stray box that greets with a nonce
nobody ordered is dropped unread, never leased.
Two payload shapes are constructed as pure, unit-tested functions
because both are real targets: an agent-sandbox-style Kubernetes CR
(runtimeClass kata, activeDeadlineSeconds so the orchestrator enforces
the TTL even if the hub dies) and a nerdctl/containerd argv for hosts
without a cluster. The K8s provisioner is real ureq code exercised only
by the gated live tier, which skips with a printed note wherever
/dev/kvm or AUR_KATA_API is absent — the recorded-skip convention, not
a silent pass.
The rendezvous and TTL logic runs for real on any machine via
LocalAgentProvisioner: a real sandbox-agent process, real frames, real
nonce matching, no VM. That is the same honesty as the loopback
backend — the interface is under test, not a mock of it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The seam from the previous commits only had one body. This adds the
other one: a sandbox-agent binary that dials the hub (outbound
rendezvous — the hub never needs a route into an untrusted box), serves
Run/Put/Get frames over length-prefixed JSON, streams the child's
stdout/stderr as they fill, and dies — taking its child with it — when
the connection drops or its TTL expires. The TTL watchdog is the
backstop under every leak: hub crash, partition, a forgotten destroy.
Hub side, RemoteBackend implements the same SandboxBackend: acquire
waits for a dial-in and verifies the shared token and profile before a
lease exists; a vanished sandbox fails the step, which is already the
shape of an expired lease (I5), so the remote path adds no new failure
vocabulary. Run frames carry the hub's child environment, so the §16a
shim protocol reaches remote children exactly as local ones — which is
what makes the end-to-end test honest: a real build, real frames, real
log streaming into the SSE-tailed file, no root and no container.
Workspace sync over the wire is deliberately not here: Run carries a
hub-side cwd, honest for loopback-shaped deployments and this test
tier, and the module says so rather than pretending.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chroot step existed to run mkarchroot/makechrootpkg, whose sudo
requirement was the whole reason a build had to run on the hub under
root-adjacent rules. The sandbox model makes the chroot redundant: the
sandbox boots from a base that already carries the official packages,
and step 2 now provisions it with a lease manifest instead — every
dependency we publish, pinned to the exact version and digest of the
artifact the index serves. The hub re-hashes every blob before staging
it, installs with pacman -U (no -Sy, no live resolution, no mirror at
build time), and the sandbox's own pacman -Q must confirm the pinned
world landed before a build may start. A byte that hashes differently,
or a world that drifted, fails closed.
The build step is now plain makepkg -c -f: no -s (dependencies arrive
installed; resolving at build time is what the pinning model forbids)
and no -si (ingest signs). mkarchroot/makechrootpkg are gone from the
pipeline and the config; their shims stay as stand-ins for the real
devtools so the shim protocol itself remains exercised. The shim pacman
grew a real fake installed-database: -U refuses bytes that do not hash
to the digest their name claims, -Q reports what landed, so the world
check is a test and not a no-op.
|
|
|
The step machine spawned its own subprocesses, which quietly made
"build code runs on this machine, inside a devtools chroot, under §14's
sudo rules" a pipeline fact rather than a deployment fact. Every build
subprocess now goes through SandboxBackend: acquire a lease, run argv
shaped commands (never a shell string), move content-addressed blobs,
destroy. The loopback backend is today's behavior wearing the interface
- same child_env shim protocol, same captured output - which is why the
shim suite passes untouched: a step that cannot tell loopback from a
remote sandbox is the property under test.
|