summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* error: give the six variants behavior carries a shape, not a sentencedev11 days15-71/+387
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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, pipeline: close what only your own module was ever meant to namedev11 days7-24/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* watch: one source interface, and the fail-closed check lives with the sourcedev11 days5-19/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The step machine reached into two of watch's internals and reassembled the rules itself: `mirror::read_tree` then `Tree::recipe_hash` to re-derive the hash a reviewer approved, and `digests::cached_path` then `digests::download_and_cache` then its own comparison to check a payload. The comparison is the part that must never be skipped, and it was sitting in whichever step happened to want a file — a step could have forgotten it and nothing would have noticed. `watch::sources` is the interface now: what a tree hashes to, and a guarantee that a cached source is the bytes its name claims. `verify_cached` owns the fail-closed test and its message verbatim. `download_and_cache` and `cached_path` are `pub(crate)` again, so the cache layout is watch's business again; `watch/mod.rs` no longer re-exports them. `src/pipeline` now names exactly one watch path. Detection is untouched by construction — no git-invoking function changed — and the census agrees: 264 successful git execs on the detect binary before and after. (An initial reading of 1320 vs 264 was PATH-probe ENOENTs from a differing shell PATH, not git work; counted with suite-cost.py's own rule of successful execve only, the two runs are identical.) watch.pub 31->30. `read_tree` moved into the test-only column: the pipeline stopped naming it, and what remains are watch's own calls plus the two tests that exercise its one-batch-read contract directly. 277 passed / 0 failed, clippy -D warnings clean.
* review: one call to record a candidate, and one way to read onedev11 days14-76/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `watch::detect` was performing review's write protocol by hand: look up the accepted release, upsert the candidate, assess the risk, store the risk, work out the missing dependencies, store those. Six calls that only make sense in that order, issued from a module whose job is noticing that an upstream moved. Get the order wrong and nothing complains — the candidate just quietly has no risk score, and the reviewer approves it without one. `review::intake::record` is the protocol now. The watcher hands over what it observed and review decides what it means. `missing_deps` moved with it: it computes a risk signal, which is a review question that happened to be living in the watcher. `accepted_for` was not a review question either. It reads a pointer column off the pkgbase row, so it is now `db::accepted_release_for` — the watcher asks persistence what is currently accepted, rather than asking review as a favour. With intake owning the write path, three things became internal and closed: `upsert_candidate`, `risk::assess`, and the risk/missing-deps column setters. `approve::approval_for` was a pass-through to db that only the pipeline called; it is gone, and the pipeline now asks `review::reads::{candidate, approval}` — two named facts instead of a re-export of review's storage layout. The budget rose in two places and both are moves, not growth: db.pub 201->202 is `accepted_release_for` arriving from review, and review.test 4->5 is `set_risk_for_tests`, the one place a fixture still needs to force a score. review.pub itself is unchanged at 29 — four names added, four removed. `priv` was also dropped from the budget keys. Counting `pub(crate)` items against a ceiling was backwards: closing an interface raises that number, so a budget that punishes it punishes the work. The Rust test never checked it. 277 passed / 0 failed, clippy -D warnings clean, and every detect, approve and staleness assertion intact.
* db: close what nothing reaches, and say what cannot be closeddev11 days15-237/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | db handed out 226 items and 36 of them were named by nobody at all — not by the crate, not by the tests. Making them private is the whole of this commit, but the interesting part is what the compiler said afterwards. Twenty-five closed cleanly. Eleven did not, and they are the ones worth writing down: AuditRow, NoticeRow, PackageRow, Subscription, StepRow, Unbuilt, OpenReview, ReviewSubject, Migration, Writer, predecessors. None is named outside db, yet none can be made private, because a public query returns them and callers bind them with `let` and call methods on them. They are load-bearing and invisible to a name search. So the census's `dead` count means "the name is never written outside the module", which is a lead rather than a verdict, and the census now says so: the way to find out which flagged items are real is to privatize them and let rustc answer. Those eleven are budgeted with that reason, not zeroed to make a number look good. Nineteen items turned out to be dead code rather than merely unexported — set_release, set_candidate, set_pkgbase, set_profile, set_kind, current_state, index_pkgbase_drift, wal_stats, call_for_tests, put_notice, is_ours, list_pkgbases, set_unpinable, artifact_id_by_digest_in, subscription_poll_interval, the four never-emitted notice kinds, and StateEnum::as_str, which the impl_state_enum macro was required to define for all five enums while nothing called it through the trait. Privatizing is what proved they were unused; leaving them private-but-present would have just hidden dead code behind a narrower address. Ten items became pub(crate): the Writer actor's call/tx/send surface, Readers, the StateEnum trait, json_or, predecessors, DEFAULT_SETTINGS. `Db.readers` was named nowhere outside db, so the field closed with the type. db: 226 pub / 36 dead-only -> 201 pub / 11 dead-only. 277 passed / 0 failed, clippy -D warnings clean, schema_ownership and architecture green.
* db: one module per aggregate, and an interface you can readdev11 days26-2358/+2568
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | queries.rs was 1,501 lines holding 83 queries across seventeen aggregates, separated by comment banners that said "settings", "release", "notices" and then kept them in one file. The banners were the design; they just never got files. Each one has one now, verbatim — the split is provably content-only, the moved text being identical to the original as a sorted set of lines. model.rs and builds.rs were each two concerns deep, so they became directories. model.rs held what a row looks like and, separately, the state machines that say which moves are legal; builds.rs held the build machine and, below its own `step rows` banner, the step machine. The impl_state_enum! macro implements StateEnum for all five enums from one place, so it moved with its invocations rather than being exported across a boundary to chase them. They are directories rather than new sibling modules on purpose: `db::model::CandidateState` and `db::builds::steps` are used across the crate and by the integration tests, and renaming them would be a bigger change than the one being made. No call site and no test changed. db/mod.rs now lists its interface instead of spraying one. `pub use model::*` and `pub use queries::*` are gone, replaced by seventeen explicit exports, and the query modules are private — so a query that was not chosen for export is not reachable, and the width of the module is visible from its own text rather than only from a grep. The ratchet caught the win immediately: db.glob went 2 -> 0, which failed a_shrunk_interface_is_written_back until the budget was written back at the new value. db is off the glob allowlist now rather than holding a stale zero. 277 passed / 0 failed, clippy -D warnings clean, largest file in src/db 363 lines (candidates.rs, unchanged from before this work).
* tests: declare the layer map, and ratchet every interface widthdev11 days5-78/+909
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Four greps in tests/layers.rs were the entire enforcement. They could say that db had stopped naming http; they could not say what the architecture is, could not place a new module, and said nothing about the twenty-odd modules nobody had tripped over yet. tests/architecture.rs declares the whole map instead. Every module in src/ gets a rank with the reason it sits there, and a module may name only modules ranked strictly below it — one rule, every module, cycles impossible by construction rather than by luck. The census says the graph already satisfies it, so the map is a description of what is true, not an aspiration the suite immediately fails on. The same file holds the interface budgets, because a boundary is only as strong as what it refuses to let you export: per module, how many pub items it hands out and how many of them nothing outside the module names. Budgets live in architecture-budget.json and move one way. A number that grows fails; a number that got smaller without being written back also fails, which is what stops a won gain from quietly becoming the new ceiling. Each rule was probed rather than trusted: naming http from db fails with `db (rank 3) names http (rank 9)`, tightening db.pub to 200 fails with `db.pub: 226 > 200`, and leaving a stale budget fails with `db.deadonly: budget 99, actual 36`. tests/layers.rs is deleted, not weakened. Three of its four rules are rank consequences now (db, review, recipe all sit below everything they were forbidden to name); the fourth, watch -> shims, was already covered by production_surface.rs, which greps every non-shim file for shims:: and would catch it in any module, not just watch. The census definition now lives in two languages, so the test checks them against each other the way the vercmp oracle checks the hand-written comparator: without python3 the note prints and the suite moves on. 277 passed / 0 failed (273 + 8 new - 4 subsumed), clippy -D warnings clean.
* tools: census how wide each module's interface actually isdev11 days2-0/+363
| | | | | | | | | | | | | | | | | | | | | | An interface is only as narrow as the items a module hands out, and nobody had counted them: 585 pub items across 27 modules, 146 of which nothing outside their own module ever names. That is not an interface, it is a hole in the module boundary, and every one of them is a thing a later refactor cannot change without a grep across the crate. The census counts pub items per module, how many of them are dead, how many of those a test does name (the integration tests are separate crates, so a name only they use is genuinely pub and the honest thing is to count it rather than pretend it is private), the glob re-exports that flatten a namespace, and the crate:: edge set between modules. The edge set is already acyclic, which is the useful surprise: a layer map can be declared over the graph as it stands rather than after breaking something. It also says where the width is — db hands out 226 items, http 68 of which 54 are dead — so the work has an order. Baseline for all of it: 273 tests passing, clippy -D warnings clean, release build clean.
* tools: census the final treeaur-build11 days1-0/+1
|
* tools: record the final wall measurementaur-build11 days1-0/+1
|
* tests: stop copying git's locks, and stop git making themaur-build12 days1-1/+12
| | | | | | | | | | | | | copy_tree walked a live repo and tried to copy .git/objects/maintenance.lock after git's detached maintenance had already removed it - a claim, not content, and a copied index.lock would have made the copy refuse to run anyway. Locks are skipped now, and the test git helper runs with maintenance.auto and gc.auto off, so nothing repacks a repo behind a test that is still copying it. Background maintenance spawns in a sampled pair of binaries went 72 to 21; the rest come from the library's own clone and fetch, in directories nobody copies from. Five consecutive full-suite runs clean, against roughly two in three failing before.
* tests: prove the per-append delivery directly on the tailaur-build12 days2-1/+36
| | | | | | | | | | | The HTTP test cannot show delivery per append: the stream response is buffered until it ends, so every line lands in one read no matter what the tail is doing, and the sleeps that used to stage the appends proved nothing. The property moves to where it is observable - drive LogTail, append between reads, and each append has to arrive as its own event. The socket test keeps proving the wiring, the headers and the end event. copy_tree now names the file it failed on, which it did not do before.
* tools: record the suite's cost before and afteraur-build12 days1-0/+2
| | | | | | | 137.9s and 7,017 execs became 121.3s and 4,616, with the 1,090 vercmp spawns gone entirely. Short of the 105s and 3,500 target: what is left is fsync on the scratch filesystem and the mirror clone/fetch cluster, neither of which these four changes were allowed to touch.
* time: the production clock module needs nothing from its parentaur-build12 days1-2/+0
|
* fix: what clippy -D warnings was holdingaur-build12 days3-9/+6
| | | | | Sandbox::default was a hand-written derivable_impl, and copy_tree borrowed an owned PathBuf.
* tests: build each fixture's repos once per binary and copy themaur-build12 days1-34/+160
| | | | | | | | | | | | | Every env_with_fixture call built an AUR stand-in and up to two upstreams from scratch - six git processes a repo, and most fixtures build three of them. The trees are built once per test binary under a cache and copied into the tempdir now, so each test still owns a mutable copy and fx.bump still commits into it. A recipe that names its own directories is the one thing the copy cannot get right, so those few rewrite their work tree and amend instead. Also stopped paying two git config calls and a rev-parse per repo: identity goes in the environment of every test git call, and a repo this file made has one branch and one commit, so the ref file is the tip.
* tests: wait on the condition instead of on the clockaur-build12 days4-24/+38
| | | | | | | | | | | | | | The dispatch and crash waits polled every 50ms and 25ms against a dispatcher that ticks every two seconds; live.rs staged its log appends with 400ms sleeps; vcs.rs waited 80ms to conclude that a blocked racer had not entered. The pool tests take the virtual clock and poll a 2ms condition wait, live.rs appends without sleeping at all, and the Stage B test queues every racer on the slot before releasing it, so the window a broken cap would slip through is set up rather than hoped for. live.rs no longer proves delivery mid-stream, because it never could: the stream response is buffered until it ends, so the sleeps were not observable. Worth fixing on the serving side, but that is a behaviour change, not a test one.
* time: the virtual clock freezes, it does not raceaur-build12 days2-10/+22
| | | | | | | | Advancing the clock on every wait made virtual time outrun real work: a build taking a few hundred ms would burn forty ticks and expire its own lease. Under a virtual clock a wait now costs a yield and the clock only moves when a test moves it with time::advance, so a frozen lease stays frozen however fast the loop runs.
* tools: fix the record path in suite-costaur-build12 days2-6/+4
|
* time: a wait seam the control loops call throughaur-build12 days8-23/+224
| | | | | | | | | | 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.
* tests: record the vercmp oracle instead of spawning it 1,089 timesaur-build12 days3-9/+1184
| | | | | | | | | The differential against pacman's vercmp is the suite's second biggest process cost, and its verdicts are a function of two strings plus the pacman that produced them. They are recorded in testcorpus/vercmp-oracle.tsv now and compared in process on every run, antisymmetry of the table included. The live differential is still there - AUR_LIVE_VERCMP=1 runs it and says so when it is not run.
* fix: drop the doubled semicolons the comment strip left behindaur-build12 days2-2/+2
|
* git: read a tree with one cat-file --batch instead of one process per fileaur-build12 days3-12/+142
| | | | | | | | read_tree cost a cat-file -e, an ls-tree and a cat-file blob per file, so the number of processes a detection paid for scaled with how many files a recipe ships. One ls-tree plus one batch read is now constant, and a commit that is gone from the mirror surfaces from ls-tree itself - still fail closed, still the same message.
* tools: record the plain baseline row alongside the census rowaur-build12 days2-5/+11
|
* tools: measure the suite's wall, cpu and process churnaur-build12 days2-0/+123
| | | | | | | The suite spends most of its time waiting, so wall time alone hides what actually changes when the harness improves. This records wall, descendant cpu, and a successful-execve census (PATH probes excluded) in one run, and appends a row to tools/suite-cost.md.
* docs: drop the citations the deleted docs left behindaur-build12 days22-60/+60
| | | | | | | | The §n, I-n, M-n and m-n references survived in string literals the comment strip never touched: migration SQL comments, assertion messages, runtime error text, Cargo.toml, a CSS and template note, and one corpus manifest. They named sections of files that no longer exist, so the prose stays and the citation goes.
* docs: remove the design and architecture docsaur-build12 days7-2317/+9
| | | | | | | | | DESIGN.md, ARCH_REVIEW.md, docs/DECISIONS.md and docs/INVARIANTS.md are gone, along with the references that pointed at them: the README links and layout entry, the §/I-n citations README carried from the design doc, the Cargo.toml shim comment, and the DESIGN.md citation in the first migration's SQL. Nothing read these files at build or test time; 267 tests pass unchanged.
* comments: keep only what the code cannot showaur-build12 days77-2177/+8
| | | | | | | | | | | 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.
* comments: say why, not whataur-build12 days86-2194/+827
| | | | | | | | | | | | | | 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: the kata lease path publishes a real package, and the config says ↵aur-build12 days4-1/+147
| | | | | | | | | | | | | | | | | | | | what it means 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.
* sandbox: agent-sandbox is a backend now, and nerdctl is goneaur-build12 days5-118/+229
| | | | | | | | | | | | | | | | | | | | | | `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.
* sandbox: the agent listener belongs to the process, not to a buildaur-build12 days4-43/+190
| | | | | | | | | | | | | | | | | | | | | | | | `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.
* config: refuse a sandbox configuration that cannot work, at startupaur-build12 days4-0/+179
| | | | | | | | | | | | | | | | | | | | | The enum makes the impossible unrepresentable, but two things survive any type: a field that is present and empty, and an assertion the type leaves defaulted on purpose. `Config::validate` catches both, and it runs at startup — before the watcher, the dispatcher or the UI are up and looking healthy — and again where a backend is constructed, so nothing that builds one can skip it. The one that matters is the workspace. `Run` frames carry a hub-side working directory and the srcdir is never shipped to the sandbox, so a `remote` backend on a machine that does not share the hub's filesystem would fail in `makepkg` with a missing directory — and, worse, would *succeed* in the case nobody wants: quietly building untrusted code on the hub. So a remote or agent-sandbox config must say `"shared_workspace": true`, and the refusal says why rather than just naming the field. Loopback needs no assertion because it shares the filesystem by construction, which is also why it stays the zero-config default. Empty `listen`, `token`, `api`, `namespace`, `bearer` and `image` are each refused by name. Two tests drive the compiled binary rather than the library, because a guard that only exists as a callable function is a guard the CLI can walk past.
* config: the sandbox backend is an enum, not a string with a fallthroughaur-build12 days4-27/+427
| | | | | | | | | | | | | | | | | | | | | | | | | `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.
* config: the root is the directory config.json lives inaur-build12 days4-12/+195
| | | | | | | | | | | | | | | | | `--root` names a directory and `init` writes config.json inside it, so the root was already named by where the config lived. The `root` field in the file was treated as a second source of truth instead: a relative one was re-joined onto the config's own directory, and `init` saved whatever it had been handed. So `--root runtime` wrote `"root": "runtime"`, and every command after `init` resolved it to `runtime/runtime/` — a second tree with its own empty database, while `init` had created and migrated the first one. The user-visible half was a path like `runtime/runtime/repo/aur-build/os/x86_64/…` in an error message. Compounding it, the CLI fell back to a default config whenever loading failed, so a typo'd `--root` produced a fresh empty server that answered every command as though it were the one you meant. `load` now sets the root to the directory it found the config in, absolutized, and a missing config is an error for every command except `init` — the only one that runs before one exists.
* publish: repo-add decides the database filenameaur-build12 days5-36/+323
| | | | | | | | | | | | | | | | | | | | | | | | Publishing renders the index before the DB commits and renames it into place after, so a crash between the two leaves the old index serving (I4). The way that was written did it at `<db>.tar.gz.tmp` beside the live file — a filename real repo-add refuses, because its database argument has to be a name pacman would accept. Every publish test passed; the first real package anyone tried to publish died at the last step with the release already committed. `render_db` now renders into a scratch directory under the served directory, under the name a consumer will download. Same filesystem, so the rename is still the atomic swap, and the live database is never the file repo-add is writing into. `publish`, `reconcile` and `withdraw_package` all had the bug and all share the helper now; `reconcile` sweeps scratch directories a crash left behind. `run_repo_add` drops `-s` too: repo-add would sign into scratch space that is about to be deleted, and `publish::sign` already signs the renamed file. The reason 238 tests missed this is that the shim would write the database anywhere it was told. It now enforces the accepted set — measured against `repo-add (pacman) 7.1.0`, not read out of its docs — with the real tool's wording and exit status, and a gated test re-derives the set against the installed tool, in the shape of the vercmp oracle. A shim that is more permissive than its tool is not a test of the tool.
* docs: the sandbox decisions, recorded where decisions get recordedaur-build12 days4-27/+168
| | | | | | | | | | | | | | | | | | | | | DECISIONS.md gains the three entries this work turned on: signing moved hub-side to ingest (the build machine must never hold the key), the devtools chroot is gone (the sandbox is the isolation boundary, and I9 gets stronger with it), and dependencies arrive pinned by digest via pacman -U rather than being resolved at build time. Each states the pressure, the choice, and the cost — including the costs: the unsigned window between build and ingest, the makechrootpkg-convention PKGBUILD tail to hunt in the gated tier, and the official-package pinning that is honestly still future work. DESIGN.md's step table and §8.3 now describe what the code does, and a new §8a documents the sandbox-backend seam: loopback, remote, kata, and the TTL as the guarantee under every leak. INVARIANTS.md's I9 note moves from 'enforced by the chroot' to 'enforced by the sandbox' — the pipeline's own hygiene test still pins what it always pinned. The README's testing section names the new shim surface and the two new test tiers, and the gated-tier list reflects the kata live tier in place of the retired real-chroot one.
* sandbox: failure-mode tier — a FakeBackend that breaks on purposeaur-build12 days4-5/+261
| | | | | | | | | | | | | | | | | | | 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.
* sandbox: kata backend — ad-hoc TTL sandboxes over the agent protocolaur-build12 days7-9/+514
| | | | | | | | | | | | | | | | | | | | | | | 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.
* sandbox: ephemeral agent, wire protocol, and the hub's remote backendaur-build12 days9-9/+870
| | | | | | | | | | | | | | | | | | | | | | | 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.
* pipeline: replace the devtools chroot with pinned pacman -U provisioningaur-build12 days11-110/+374
| | | | | | | | | | | | | | | | | | | | | | | 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.
* pipeline: signing moves from the build step to hub-side ingestaur-build13 days4-18/+69
| | | | | | | | | | | | | The build step used to pass -si<key> through makechrootpkg, which meant whatever machine ran the build had to hold the signing key - fine for a chroot on the hub, disqualifying for a remote sandbox. The build now produces unsigned bytes; ingest signs the exact bytes that entered the store, with the same key and code path that signs the database, and a gpg failure fails the build closed. verify() no longer checks for a build-made signature: the meaningful guarantee moved to 'ingest produced one or the build failed'. The shim makechrootpkg now only emits .sig when -si is passed, like the real tool, so the suite cannot accidentally test a signing path that no longer exists.
* sandbox: the seam between the pipeline and where build code runsaur-build13 days5-24/+320
| | | | | | | | | | | | 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.
* docs: the review's decisions, and the invariants that hold themaur-build13 days3-8/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | The structural findings are only durable if they are written down as rules with the test that enforces each one, so: `docs/INVARIANTS.md` gains a second table. The first one is the twelve numbered invariants from DESIGN.md §2 — claims about what the system does. The new one is about how the code is allowed to be shaped: SQL has one owner, a version is formatted in one place, the dependency arrows point one way, the state machines are the ones the transition table defines, the production binary carries no test scaffolding, the served index has one lock, `canonical_json` is canonical in fact, the session id is the credential, and a pinned clock pins everything derived from it. Each row names the test that fails if the shape regresses. `docs/DECISIONS.md` gains the decisions the review turned into code — the session id as the credential, `db/` as a boundary that does not hand out connections, a stale review and a broken database being different answers, shims compiled out of production, states as enums with compare-and-swap writes, unreadable rows failing the query, and only momentary I/O counting as transient. Two existing entries were amended rather than added to: the publisher lock (there is now one, and the second one that used to sit inside it is gone) and the test hooks (they are a gated submodule now, not fields on the production config). `README.md` says where the shims live and that none of them exist in a plain `cargo build`.
* http: routes split by direction of travelaur-build13 days4-1065/+1087
| | | | | | | | | | | | | | | | | | | n-4. `routes.rs` was 1,065 lines with the routing table, twenty-odd page renderers, every mutating POST, and the size/date formatting helpers in one file, so finding where a form landed meant scrolling past everything that did not touch it. It is a module now: `routes/mod.rs` keeps the gate, the login handlers, the routing table and the helpers two files share (207 lines); `routes/pages.rs` holds the read side, which only ever goes through `db.read`; `routes/mutations.rs` holds the write side, which is where the audit writes and the flash messages live. The split is by *read versus write*, which is the distinction the crate actually cares about — the read path uses the thread-local read-only connection and must never reach the writer — so the file boundary now matches the invariant rather than being an arbitrary line count. Behaviour is unchanged: the handlers are the same functions, re-exported into `routes` so the routing table still reads as one flat list of endpoints.
* pipeline, watch: a source identity that is complete when it existsaur-build13 days2-12/+31
| | | | | | | | | | | | | | | | | | | n-1. `SourceIdentity::from_candidate` returned a value with `aur_commit` and `recipe_hash` set to empty strings, which `Ctx::new` overwrote afterwards if it found the snapshot row. So the type had two meanings for "" — not filled in yet, and genuinely absent — and the second half of the construction was a convention rather than a requirement: a new call site could produce a build that recorded empty provenance and never noticed. The snapshot is an argument now, a candidate without its snapshot is an error rather than a quieter build, and the field `identity_hash`, which nothing ever read, is gone. n-2. `detect::Outcome` mirrors four of `candidates::Upsert`'s variants. Kept, with the reason in the code: `Upsert` answers "what did the candidate write do" and `Outcome` answers "what should the watcher do next", including the outcomes that never reach the candidate table (paused, gone, blocked, notice). Merging them would move watcher concerns into the review module and put storage vocabulary in the scheduler's matches. The converter is total and compiler-checked, which is what makes the mirror safe.
* db, watch: two N+1s and a version rule with one owneraur-build13 days4-41/+112
| | | | | | | | | | | | | | | | | | | | | | m-17. `watch::staleness::dependents_of` walked the index and asked for each package's recipe by name — one query per package, on the path that runs after every publish, with N equal to the size of the index. `db::index_recipes` returns the whole table in one query now. While there: a recipe that fails to parse is no longer treated as "does not depend on this package". An unreadable srcinfo used to hide a dependent from staleness by returning `None` into an `unwrap_or(false)`; now it is a reason to look. `db::builds::requeue_blocked` asked "is this name in the index?" once per dependency of every blocked build, inside the dispatcher's hot loop. The set of in-index names is read once per pass and tested in memory. Same answer, one query. m-18. `approved_but_unbuilt` assembled the version a human reads with two `CASE WHEN epoch='0'` expressions in SQL — a second, independent copy of the `epoch:pkgver-pkgrel` rule that `pkgver::full_version` owns. Two copies of a formatting rule is how the Attention page ends up describing versions differently from every other page. The query returns the parts; Rust formats them. A guard test fails if version-string concatenation reappears in SQL.
* http, pipeline: form pairs parsed once, and a rebuild identity in the real ↵aur-build13 days3-7/+54
| | | | | | | | | | | | | | | | | | | | | format n-3. `Req::form_get` called `form()`, which re-parsed the entire request body every time. The approve handler asks five times — two hashes, a note, a CSRF token, and a confirm flag — so a single POST parsed its own body five times. The pairs are parsed once at decode, next to the query pairs, and `form()` returns the stored slice. n-5. `enqueue_manual_rebuild` invented its own identity format, `hex("{aur_commit}|{recipe_hash}|manual")`, while every other identity in the system is a `sha256:` over the canonical JSON of the identity tuple (§3). Two formats for one concept is how a comparison quietly stops meaning anything, and the ad-hoc one had a delimiter that can appear inside a URL-shaped value and ignored the pins and digests that are the whole point of an identity. A rebuild is now identified by the canonical-JSON hash of the release's actual commit, recipe, pins and digests plus a `requested: manual_rebuild` marker — the marker being what keeps a rebuild a distinct build from the one that landed, while staying deterministic so that clicking rebuild twice is one build, not two.
* watch, review, config: the clarity minors — no-ops, dead params, one error ↵aur-build13 days10-64/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | type m-5. `mark_approved_but_unbuilt` was a function that did nothing, called from the failure path with a comment explaining that it did nothing. The mechanism is real — a failed build leaves the accepted pointer alone, and "approved, build failed, index still serving the old version" is what the derived query reads back — but a no-op in the failure path is a trap for whoever traces a build failure at 3am. Deleted; the explanation moved to the call site that needs it. m-6. The step loop extended the lease by a hardcoded 90 seconds while `Config` carried `lease_secs`, so an operator who raised the lease got leases that were silently reset to 90s after the first step. m-8. Dead parameters and `let _ =` debris: `upstream::run` took a `Db` it never used (and a `let _ = local;` after the value's only use), `risk::assess` took a `Pkgbase` it never used, `accepted_pins` took a `Db`, `detect::schedule_next` took a `Pkgbase` it discarded, `diff::version_delta` computed a `vercmp` and threw the answer away, and two HTTP handlers took arguments they ignored. All gone, with the callers following. m-11. `schedule_next` re-queried the subscription for `poll_interval_secs` that its caller had read moments earlier to decide whether the pkgbase was paused — two queries, and two chances to get different answers. The interval is now an argument, and the scheduler's own tick (which already holds the row) was already doing it the right way. m-15. `Config::load`/`save`/`ensure_dirs` returned `anyhow::Result` while the rest of the crate returns `error::Error`, which put two vocabularies on either side of one boundary and turned "there is no config yet, run init" — the one thing a caller can branch on — into an opaque string. They return the crate's error now; `main` keeps `anyhow` at the CLI edge, where it belongs. m-19. `skip_declared` was hardcoded `true` for VCS entries, so the field that means "the recipe gave us no checksum to trust" also meant "this is a git source", and a new `-git` source was rendered to a reviewer as `sha256sums=SKIP` — a warning about a recipe that had done nothing wrong. The field now means one thing everywhere, `SourceDigest::is_vcs()` says which integrity mechanism protects an entry, and the diff panel prints "pinned commit" for those. n-6. `recipe_at` was `pub` for no reason; it is `pub(crate)`.
* pipeline, db: the correctness minors — fsync, withdrawal, orphans, retry classaur-build13 days10-88/+315
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | m-7. `fsync_file` and `fsync_dir` opened, ignored every error, and returned Ok, in the module whose entire guarantee is "fsync, then rename". A filesystem that refused the sync — full, read-only, a network mount that had dropped — still produced a successful publish whose database might not be on disk. They propagate now, with the path and the cause. m-10. `withdraw_release_in` set `state='withdrawn'` unconditionally, so withdrawing twice reported success the second time while changing nothing, and withdrawing a release that had never been live did the same. The write is a compare-and-swap on `state='published'`, and a refusal names the state that was actually there ("release 1 is withdrawn, not published: nothing to withdraw"). m-16. Artifacts are copied into the served tree before the DB commit, and when the commit refused they stayed: files no index names, sitting in the directory consumers download from. `publish` now tracks which files it created (a file that already existed belongs to the release still being served and is never touched) and removes them if the publish does not land. m-14. `is_transient` treated every `Error::Io` as retryable, which made ENOSPC and EACCES — plain `Io` — into three identical failures and a silent build. Only the kinds that mean "ask again in a moment" retry now. This turned a test that had been asserting the bug: it simulated a transient failure by pointing `makechrootpkg` at a nonexistent path, which is a missing binary, not a flaky network. That test now asserts the opposite (one attempt, no retries), and a new one produces a genuinely transient failure the way production does — a `SKIP` source whose bytes go unreachable after detection, cache dropped, so the `sources` step fails over the fetch path and retries to the cap. m-13. `random_hex` read `/dev/urandom` into a zeroed buffer, ignored every error, and hashed it anyway. Since C-1 the session id is the whole credential, so a failed read is now a refusal: `new_session()` returns `Option`, and the two call sites answer 500 rather than mint a token derivable from the clock and a counter. m-9. The row-error policy is decided and applied: a row that cannot be read fails the query instead of vanishing from the result (six `filter_map(|r| r.ok())` sites, including the reaper's and the claimer's), and `setting_i64` documents its own policy — absent means default, nonsense means default *and a complaint*, because a typo that silently does nothing is worse than a knob that refuses to apply.