summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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 days3-41/+83
| | | | | | | | | | | | | | | | | | | | | | 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 days2-7/+31
| | | | | | | | | | | | | | | | | | | | | 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 days7-81/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* review: one host rule, one body rule, one audit constructoraur-build13 days7-98/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | m-2. `hosts` existed twice, verbatim, in `review::diff` and `review::risk`. The duplication that matters is the other one: "did the executable part of the recipe change" also existed twice, with *different* semantics. The risk scorer compared everything from the first function definition onward; the diff panel compared only the lines that name a function, so a `build()` rewritten to `curl … | sh` under the same function names told the risk scorer "code changed, high" and told the reviewer nothing at all — the one reader who could have caught it. Both questions now have one answer: `urlutil::hosts` (which also strips the `git@` from ssh URLs, so a scheme change stops crying "new source host" wolf) and `recipe::bodies_changed`, in the module that owns the recipe. m-4. The three review decisions each hand-built an `AuditEntry` literal, and their `detail` shapes drifted: approve recorded the identity hash, reject recorded only the note, withdraw only the reason — so for two of the three the log cannot answer which candidate bytes the decision was about. `AuditEntry` is built by `::human` / `::system` now, and reject records the identity hash it rejected. m-3, the four-times-copied 21-column candidate `SELECT`, was already gone: the `CANDIDATE_COLS` constant came with moving the candidate SQL into `db/` in an earlier commit. Tests: the body rule is pinned at the unit level with the exact drift case (same function names, different body), `tests/production_surface.rs` fails if either module grows a private copy again or if an audit row is hand-built, and the reject test reads its own audit row back and requires the identity in it.
* config: the test hooks are a gated submodule, not the production surfaceaur-build13 days2-48/+89
| | | | | | | | | | | | | | | | | | | | | | | Seven fields sat on `Config` next to `signing_key_id` and `bind`: a PATH override, three shim protocol variables, a fault-injection point in the middle of `publish()`, and two more shims could obey. m-9's complaint was not that they exist — the shims are how I4, I5 and I9 are tested for real, and a mock would have asserted the mock's own behaviour — but that nothing said which of these was production and which was scaffolding, and the publish path carried a test branch on every real publish. They are one `TestHooks` submodule now, documented as what it is, and the whole submodule is `#[cfg(feature = "test-support")]` — the same feature that already gates the shims and the raw SQL escape hatch, and which only this crate's own dev-dependency turns on. A production build has no `hooks` field, no shim protocol in `child_env`, and no fault-injection branch in `publish()`; the serialized config skips the section entirely when nothing is hooked, so a real `config.json` never mentions any of it. `TestHooks::is_empty()` names the state a real process runs in, and three tests hold the line: the hook fields may be declared exactly once and only inside `TestHooks`, every `publish_fault` read in `publish.rs` must sit behind the feature gate, and a default config serializes without a trace of hooks.
* time: relative arithmetic honors the pinned clockaur-build13 days1-7/+24
| | | | | | | | | | | | | | | | | | | `now()` returned the pinned instant when a test had pinned one, but `secs_ago`/`secs_ahead` called `Utc::now()` directly (m-1). Anything built from them — every lease expiry, every `next_check_at`, every cooldown cutoff — was therefore computed against the real wall clock and then compared against the pinned one. A test that pinned 2026-01-01 and took a 90-second lease got an expiry 90 seconds after *today*, so the reaper comparing `lease_expires_at < now()` saw a lease that would not expire for a century, or one that had expired millions of seconds ago, depending on which way the pin pointed. The test still passed, because nothing asserted on the number. Both now go through a `base()` that reads the pinned instant, so a pinned test computes and compares on the same clock. `tests/time.rs` pins the arithmetic directly and then does the thing the bug actually broke: claim a lease under a pinned clock, assert the expiry is 90 seconds after the pinned now, assert the reaper sees nothing yet, advance the pinned clock 91 seconds, and assert it reaps.
* db: the review, step, release and subscription states are enums tooaur-build13 days11-97/+444
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | M-8 named four more machines after `build_state`, and each had the same defect in miniature: `&str` constants, a writer that took any `&str`, and a rule that lived only in the caller's discipline. They are `CandidateState`, `StepState`, `ReleaseState` and `SubscriptionState` now, all parsed through one `db::state_col` at the row boundary — a column value the code cannot name fails the read rather than becoming a state it did not ask for. The one that mattered is the review machine. `resolve_in(tx, id, &str)` would move a candidate to any state from any state, so an approval racing a rejection, or a stale worker resolving a review that had already been superseded, silently overwrote what a human had decided — the direct route to breaking I2 and I3 with no symptom anywhere. It is a compare-and-swap on `CandidateState` now: a decided review is only ever frozen, never re-decided, and a refusal names both states. `supersede_in` goes through it, so the freeze cannot resurrect a superseded review either. `StepState` gives I5 teeth. `begin_step` upserted over any existing checkpoint, including one recorded `succeeded`, so a resume that asked to re-run a finished step could rewrite the very row that told it to skip; the upsert now refuses to touch a done checkpoint and `finish_step` is a CAS. The blocked path (`running → pending`) and the reaper's `running → interrupted` are unchanged, and both are in the table. Two behaviour changes, both for the better and both tested: the UI's pause button now says "orphaned: nothing to pause" instead of rewriting an orphaned subscription back to a pausable state, and a step checkpoint that is already done makes `begin_step` an error rather than a quiet overwrite. Five tests in `tests/state_machine.rs` cover the review CAS in both directions, the frozen checkpoint, the interrupted/blocked transitions, and the unknown value in a candidate and a step row.
* db: the build state machine is an enum, and a state write is a compare-and-swapaur-build13 days7-77/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `build_state` was seven `&str` constants and `set_state(&str)` would write any string a caller invented, so the machine existed only as `WHERE state IN (...)` clauses scattered across six modules and nothing could say that `succeeded → running` is nonsense. It is `db::model::BuildState` now: parsed where a row is read (a state the code cannot name is an error, not an empty string — which also retires m-12's `current_state` returning `""`), and `set_state` takes the variant and writes only if the row's current state is one of `to`'s legal predecessors. A refused transition writes nothing and says why. Writing the machine down surfaced three things that were true of the flows but of nobody's documentation. The step loop re-asserts `Running` at every step boundary, so a self-write is a no-op and not a move — every state accepts its own name. A failed build is resumed *on its own row* (I5: the step checkpoints say where to continue), so `failed → running` is a real transition. And `builds::retry` — the UI's requeue button — moved any row to `queued` unconditionally, including one that had already published, re-queueing a build whose every step was checkpointed as done; it goes through the machine now and is refused with a reason. `requeue_transient` likewise. What the CAS buys is the zombie case, which no test covered: a worker's lease expires mid-step, the reaper returns the build to the queue, and the original worker — still running — comes back and writes `succeeded` over whatever the new owner has since done. That write now fails loudly and the queue keeps ownership. `builds_for_pkgbase` had a second, hand-copied row mapper that dropped unreadable rows with `filter_map(|r| r.ok())`; it shares `row_to_build` now and a bad row fails the query instead of vanishing from the package page (m-9's policy, applied where it bit). `tests/state_machine.rs` pins the whole table, the zombie refusal, the unknown state, the terminal build that does not move, and the requeue-of-a-published- build refusal. `tests/live.rs` walks a build through `running` before succeeding instead of teleporting it.
* db, watch: two upward edges removed, and the layering is now a testaur-build13 days7-42/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | M-6. `db::stage_b_cache_get` and `db::stage_b_recent` returned `watch::upstream::StageB`, so the persistence layer could not be read without the VCS watcher, and the table's row shape was defined by whatever the watcher happened to find convenient. The row is `db::model::StageBCacheRow` now — epoch, pkgver, pkgrel, pins — and `watch::upstream` converts at its own boundary. The two types are deliberately not the same one: `StageB` carries `cached`, and "was this answer a cache hit?" is a fact about the resolution that just happened, not a column. M-7. `review::risk` called `watch::digests::skip_on_non_vcs` while `watch::detect` called into `review::candidates`, a cycle between two sibling domains. Whether a recipe declines to verify its own sources is a question about the recipe, so `skip_on_non_vcs` — with `SKIP`, `declared_sums` and `is_hex_digest`, which it needed and which the watcher had no business owning — moved to `recipe.rs`, a leaf both sides may look down at. `watch::digests` keeps its use of them for digest resolution; the re-export is gone. `tests/layers.rs` enforces the direction from now on: `src/db` names no module above itself, `src/review` does not name `watch`, `src/watch` does not name `pipeline` or `http`, and `recipe.rs` names nothing at all. Each rule failed before this commit and each failure message prints the exact file and line of the offending edge, so the next reasonable-looking commit cannot reintroduce one quietly.
* pipeline: one lock guards the served index, and it says so onceaur-build13 days1-21/+33
| | | | | | | | | | | | | | | | | | | | | | | | | `publish.rs` had two static mutexes, each documented as *the* "one publish per repo" guarantee — `PUBLISH_LOCK` taken at the top of `publish()`, `REPO_LOCK` taken partway through and by `withdraw_package`. Either the second was redundant or the guarantee was incomplete, and a reader could not tell which, which is worse than either answer: the comment on `REPO_LOCK` claimed a single-writer property that its own position in the function did not provide (artifacts were already staged by then), and the comment on `PUBLISH_LOCK` claimed it for a section that did not include the rename. There is one lock now. `REPO_LOCK` is taken at the top of `publish()` and held for the whole of it — staging, render, DB commit, rename, sign — which is the sequence that must not interleave, and `withdraw_package` takes the same lock for the same reason. The poison-recovery rule that belonged to both is stated once, on the lock. `reconcile` is documented as the one rewriter that does not take it, because it runs at startup before the dispatcher exists. M-5 is a clarity defect rather than a live misbehaviour, so the guard is structural: `tests/production_surface.rs` fails if `publish.rs` declares a second serialization mutex, if `PUBLISH_LOCK` comes back, or if either index writer stops taking the one that remains. A timing-based test would have been the flaky kind and would not have proven anything the I4 and I8 crash tests do not already prove.
* review: a database failure is never reported to a reviewer as a stale reviewaur-build13 days3-66/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `approve()` returned `Result<Approval, Stale>` and then collapsed every inner failure into `Stale::NotPending { state: e.to_string() }`, so a SQLite error reached the human as "review is no longer pending (state: sqlite: …)". That is the one message that tells a reviewer to look again when the truth is that the write failed — and the transaction had already rolled back, so their review was still pending and nothing on screen explained why. `bulk()` bent the same variant to mean "high risk", "unknown decision" and "the database failed", and handed back a fabricated `Approval { id: 0 }` for a rejection that recorded no approval at all. `approve()` now returns `Result<Approval, ApproveError>` with two families: `Stale(Stale)` — what is stored is not what was displayed, look again — and `System(Error)` — the write failed, nothing about the review is at fault. The UI answers the first with the 409 and fresh diff it already gave, and the second with a 500 that names the cause; the CLI exits 2 for the first and propagates the second as an error. `bulk()` got its own vocabulary — `BulkOutcome::{Approved, Rejected, Refused(BulkRefusal)}` with `HighRiskUnconfirmed`, `UnknownDecision`, `NotFound`, `Stale` and `System` — and returns no approval row for a rejection, because there is none. The invented `id: 0` is gone. The web handler had its own copy of the bulk loop; it now calls `approve::bulk`, so the page and the library cannot disagree about what §7.4 says. Three tests: a dropped `audit` table mid-transaction must surface as `System` and must leave the review pending and the approval table empty; bulk refusals must name the risk, the unknown decision, and (after a real approval) the genuine staleness as three different things; a bulk rejection must record a `rejected` row and hand back nothing.
* pipeline: the name we publish comes from the real .PKGINFO parser, and the ↵aur-build13 days3-78/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | shims are test-only `publish.rs::package_name` — the function that decides which package a built artifact is, and therefore what the index says — called into the test harness (`shims::read_pkginfo`) to read it. Worse, the shim module carried its own `.PKGINFO` field parser alongside the real one in `pkginfo.rs`. Two parsers that can drift is a supply-chain-shaped foot-gun in a system whose whole job is provenance: the bytes we sign and the bytes the tests believed in would be interpreted by different code, and a green shim test would not have meant the pipeline read the package the same way. There is now one parser. `package_name` uses `pkginfo::pkginfo_text` and `pkginfo::parse_pkginfo`; the shim's `repo-add` renders its `DESC` entry from the same `PkgInfo` the production code parses, so the fake tool and the real pipeline cannot disagree about what a package calls itself. The duplicate parser and the two wrapper functions are deleted, and the harness test reads its artifact with `pkginfo` too. The module itself is now test-only in the way the review asked for. `pub(crate)` was not available — the shim binaries are separate crates that link the library — so the equivalent enforcement is used instead: `shims` is compiled out unless the `test-support` feature is on, and every shim binary declares `required-features = ["test-support"]`. A production `cargo build --release` neither builds the fakes nor links their code; `cargo build --bin makepkg` says so out loud. `tests/production_surface.rs` covers the half the compiler cannot see: no module in `src/` outside the harness may name `shims::`, and the binaries must keep declaring the feature.
* db: the schema gets an owner — every statement moves into db/, and the ↵aur-build13 days16-756/+1234
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | writer stops handing out connections Twelve modules outside `db/` contained hand-rolled SQL — 22 statements in `ops.rs`, 17 in `approve.rs`, 15 in `candidates.rs`, 11 in `publish.rs`, and a dozen more scattered through `watch`, `pipeline`, `http` — which meant the blast radius of a schema change was "any module", and `db/` was a directory rather than a boundary. The audit trail alone was defined in four places with three different detail payloads. Every statement now lives in `db/`. New modules `db::candidates` and `db::approvals` own their tables (including the 21-column candidate select, spelled once as `CANDIDATE_COLS` instead of four times); `db::queries` gains the metrics reads, the retention reads and writes, the publish writes (`insert_release_in`, `cas_accepted_release_in`, `remove_index_packages_in`), the staleness reads and the source-cache lookups; `db::builds` gains `set_release_in`. Where a mutation is a *decision* — the collapse rules, the approval gate, the publish compare-and-swap — the decision stays where it was and the statements are called through the transaction handle, so the atomicity is unchanged and only the SQL moved. `audit_in` is the in-transaction audit append, and `audit` is now a wrapper over it: a decision and its audit row commit together or not at all, which is what I10 actually claims. Enforcement is two-layered, because one layer is a lie. `Writer::call`, `tx` and `send` are `pub(crate)`, which keeps the crate's *users* out — the integration tests and the shim binaries — but `pub(crate)` is crate-wide, so on its own it would not stop `approve.rs` from writing SQL tomorrow. The layer that does is `tests/schema_ownership.rs`: it walks `src/` and fails the build if a statement literal or a rusqlite statement call appears outside `src/db/`. It was checked against a deliberate violation. The test harness still needs to construct states no typed API reaches, so the raw door exists but only under the `test-support` feature, which nothing but this crate's own dev-dependency enables; a production binary cannot see it.
* hash: canonical_json is canonical now, and a serialization failure is an erroraur-build13 days6-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | The function behind `Identity::hash` — the digest an approval echoes back — did two things its name promised and it did not do. It did not order anything: the doc comment conceded that callers were expected to pass "already-canonical values", which is a convention, not a property, and a struct serializes in whatever order its fields were declared. And on a serialization failure it returned `"{}"`, so every value that failed to serialize hashed to one shared digest. For a system whose whole job is provenance, "two identities that could not be serialized would look identical to the approval echo" is the worst possible failure to have available. Serialization now routes through `serde_json::Value`, whose map is a `BTreeMap`, so object keys come out sorted whatever the input's construction order — the name describes what happens. A failure propagates: `canonical_json` returns `Result`, `Identity::hash` returns `Result`, and the four call sites (detect, put_world_snapshot, the world step, both enqueue paths) pass it on. There is no path left where a digest is invented for a value that could not be rendered. `tests/hash.rs` pins all three properties: an unserializable value is an error naming itself, two same-field-different-declaration-order values render identically (and to the exact compact sorted bytes), and the identity digest changes when any element of the tuple changes.
* http: the session id is the credential, not a cookie a client can typeaur-build13 days3-24/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | The gate asked whether the request carried `Cookie: auth=1`, and login did nothing but set that literal value, so the password protected the login form and nothing else: anyone could read the reviews, the audit log, the settings and the build logs by typing the cookie themselves, and the CSRF step then happily minted them a session to POST with. The random sid machinery was already there and already unguessable; it was just never bound to the flag that said "someone authenticated". A session now carries that flag. `auth.rs` holds a map of live sids to whether they passed the password gate; `authenticate` can only flip a sid this process minted, so a login attempt cannot mint a session as a side effect. `gate` asks `is_authenticated(sid)` and nothing else, and the `auth` cookie is gone from both the login response and the logout one. Login rotates the sid rather than promoting the anonymous one, so the session that existed before the password was typed is never the one that carries the privilege after it; logout drops the sid, which invalidates its derived CSRF token with it. Two tests, both over a bare socket because a client that follows redirects turns "you are not signed in" into the login page's 200 and hides the whole point: `a_forged_auth_cookie_is_not_a_session` (the exact forgery, on every sensitive surface, GET and POST) and `login_rotates_the_session_and_logout_ends_it` (rotation, dead pre-login sid, dead logged-out sid). The audit actor is honest now too: with a password set, only an authenticated session is "web".
* the real chroot caught what no shim test could: mkarchroot has no -N flagaur-build13 days3-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ran the gated tier as far as this host allows, with real devtools, real root and real network, and it paid for itself immediately. `mkarchroot` has no `-N` option. The pipeline was calling `mkarchroot -N <seed>`; the shim ignored the unknown flag, so every test passed, and the real tool answered with a usage error. The first real chroot build would have died on its first step in a code path the shim harness structurally cannot exercise. The seed's package list is now configuration (`mkarchroot_args`, default `base`) and the call follows the real usage: `mkarchroot <working-dir> <packages...>`. What else the attempt verified, with the real binaries rather than the shims: a generated GPG key detached-signed the artifact the pipeline produced and `gpg --verify` reported a good signature; real `repo-add -s -k` built and signed a pacman database over it, and that signature verified too. So "both the packages and the .db are signed" now rests on real crypto. Where it stops: `mkarchroot <dir> base` downloaded and installed the base set into the chroot (437 MB, 14 packages, install scripts ran) and then failed in devtools' init stage with `Failed to parse --bind(-ro)= argument` from systemd-nspawn 262 inside an unprivileged container. DECISIONS.md records exactly what was run, what passed, what failed and why, and what therefore remains modelled rather than crossed — a silent skip would have hidden all of the above, including the flag bug. Also fixes the I9 test's expectation: a refused build is an `Outcome::Failed` at the `collect` step, not an `Err` from the runner, which is the correct shape (the build failed closed and said why) and the test now asserts the step name. 171 tests pass, clippy clean.
* I9: the pipeline stops trusting paths the build could have placed, plus ↵aur-build13 days3-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | README and the invariant index Three things. **A real hole, closed.** `collect` scans the build's srcdir for `*.pkg.tar.zst`, and `ingest` copies whatever those paths resolve to into the content-addressed store — from where the bytes are served from our repo and signed with our key. The paths are generated by our own scan, but their *targets* are not: a PKGBUILD that drops a symlink called `evil.pkg.tar.zst` pointing at the signing keyring, the database, or anyone's home directory would have its target copied in, published and signed by us. The chroot is supposed to be the layer that prevents that, and the chroot tier is gated — but two protection layers must not be load-bearing on each other, and the control plane should not depend on isolation for the safety of its own secrets. `collect` now rejects symlinks and rejects anything whose canonicalized target escapes the build's own staging directory, failing the build closed with the path in the message. `i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir` acts the attack out — the shim plants a symlink to the database file — and asserts the build fails, the store is byte-for-byte untouched, and nothing publishes. This is the last §2 invariant that had no named test; docs/INVARIANTS.md says plainly which part of I9 this covers and which part belongs to the gated chroot tier. **README.md**, written for the person who has to operate this at 3am: the rule everything else follows, the quick start, the layout, how the shim harness makes the whole pipeline testable without root or network, the ops commands, the route table, and the §14 constraints stated as the hard edges they are. **docs/INVARIANTS.md**, mapping I1-I12 to the named tests that hold them, with corroborating tests listed, and an explicit note on the two invariants enforced by the schema (the partial unique index for I7, the append-only triggers for I10/I7) so a future code path cannot forget them. Also recorded in DECISIONS.md: metrics served without a session and why, retention recording a purge instead of deleting the row, and the real-chroot tier being explicitly skipped with what stands in for it and how to actually run it. .gitignore already covered .pi/ but the goal-tracker files were tracked from before the rule existed; untracked now so they stop appearing in every diff.
* ops: retention that never lies about what is on disk, metrics that cannot ↵aur-build13 days6-1/+758
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drift, and a backup that restores Three §15 features, each with a failure mode worth designing against. **Retention** evicts the files of releases beyond the keep window and never deletes a row. The artifact keeps its digest, size and provenance and gains a purged_at, so the record says 'these bytes existed and were dropped at T' instead of continuing to claim a file that is no longer there. A package, its signature, its build log and its cached sources are evicted as one unit — a package whose log is gone but whose bytes remain is the worst outcome: full price, no explanation. Shared content-addressed files are reference-checked against every *retained* release first, because two releases built from the same source share one cached archive and aging one out must not corrupt the other. The currently accepted release and anything still backing an in_index package are kept regardless of how far down the list they sit: deleting the bytes the index is pointing at is the one thing retention must never do. **Staging sweep** derives 'abandoned' rather than guessing it: the dir's build is terminal, or has no build row at all, and the dir is older than a grace period. A dir whose build is running is left alone however old it looks, because a long build is not an abandoned one. **Metrics** are computed from live state on every scrape. There are no counters incremented at event sites, because a counter maintained by every code path is a counter that quietly drifts the first time a path is added; a query cannot drift. Includes queue depth, the review-debt age histogram (not just how many reviews are pending but how stale they are), build success rate, WAL size, stale counts by reason and staging usage. A fresh install reports success rate 1.0 rather than NaN or 0%, so an empty system does not page anyone. Served at GET /metrics and by 'aur-build metrics'. **Backup** uses VACUUM INTO on the writer connection, so it cannot interleave with a write, and refuses to overwrite an existing file — a backup that silently replaces last week's backup is a way of losing the only copy on the day you need it. The snapshot is then reopened and checked for schema version and approval rows: if it does not open on its own it is a file, not a backup. New CLI: metrics, gc [--keep N] [--dry-run], backup <path>. tests/ops.rs: 9 tests. 170 tests pass, clippy clean.
* vercmp: three real bugs, found by comparing against pacman's own binaryaur-build13 days1-46/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tests/versions.rs started as a hand-typed table of ALPM ordering vectors and turned into something better: a differential test that runs the hand-written comparator against pacman's `vercmp` over a 34-fragment cross-product (1156 pairs) of shapes that appear in real recipes. It found three bugs, all of which would have shipped. 1. **Numeric vs alphabetic chunks were inverted.** The code had 'a numeric chunk is always older than an alphabetic one'. It is the opposite: 1.0.1 > 1.0.a. The unit test asserted the wrong direction with the comment 'alpha sorts after numeric', so the suite was protecting the bug. 2. **Separators were ignored entirely.** They are not merely skipped. ALPM distinguishes an alphabetic chunk glued to the previous chunk from one after a separator, and the separated one is newer regardless of the letters: 1.0 > 1.0a, but 1.0 < 1.0.a, and 1.0z < 1.0.a. Two versions differing only in where the dot sits were being called equal. 3. **The end-of-string rule looked at the wrong thing.** When one side runs out, the decision comes from the other side's *next raw character* before any separator skipping: a letter there makes the exhausted string newer (the 1.0rc1 < 1.0 rule), anything else makes it older. The rewrite is character-wise rather than a chunk pre-pass, because the glued-or-separated distinction cannot be made after the separators have been thrown away. Rule 3 is the kind of thing nobody can be confident about from the spec alone, which is exactly what the oracle is for; it is skipped with a note when pacman is not installed, and the curated table — every pair of which was also checked against the binary — always runs. Also: the recipe parser's epoch is now exercised end to end (an epoch added to a PKGBUILD must land on the candidate, and 1:0.9-1 must beat 1.0-1 rather than read as a downgrade), and the downgrade path asserts the index keeps serving the higher version, since a downgrade is a human decision and not an automatic rebuild. 161 tests pass, clippy clean.
* staleness: blocked builds wait properly, and the review answers §10.3 ↵aur-build13 days4-5/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | before you approve Three real defects, all found while writing the tests that pin §10 down: - **requeue_blocked requeued everything blocked.** The dispatcher sweeps it every pass, so a build waiting on a package that has not arrived was put back on the queue, claimed, blocked again, and repeated — a busy loop burning a claim and a plan step each tick. It now only requeues a build whose every blocking name is actually in the index. The old pipeline test asserted the broken behaviour and has been rewritten to assert the correct one. - **The review page could not warn about missing dependencies, because nothing ever computed them.** candidates::set_missing_deps existed and was never called; missing deps were discovered at plan time, i.e. after a human had already approved. Detection now records them with the same rule the plan step uses, so the reviewer sees 'the build will block until these are published' before deciding, and the CLI and the page agree because both read the row. - **The dependents question was unanswered.** §10.3 asks 'approving this marks N packages stale'. The review page now says exactly that and names them, from the same derivation the Attention page uses. tests/staleness.rs (6 tests) also pins the claims that were easy to fake: staleness is derived on read — a schema scan asserts no column anywhere stores it, and withdrawing a dependency flips a dependent from Outdated to Missing without a single write to the dependent; a blocked build names its blocker on Attention and is not counted as a failure; a dependency we stopped publishing reads as missing rather than outdated. dep-partner added to the corpus so blocked builds are testable end to end. 149 tests pass, clippy clean.
* pkginfo: .PKGINFO/.BUILDINFO parsing gets a real home, and a parser bug fix ↵aur-build13 days4-79/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (§10.1) Ingest decides what the index claims about a package and what the world snapshot records by reading two text files out of a tar inside a zstd stream. That code was living in src/shims — the test harness — which meant production depended on the harness for its view of a package's own metadata. Moved to src/pkginfo.rs, with the shim now delegating to it so the harness and the production path cannot disagree about what a package says about itself. Still no libalpm: tar + zstd + eighty lines of key = value parsing. Unknown keys are ignored rather than rejected, because makepkg adds fields over time and a new one must not stop us publishing. **The parser had a real bug.** A .BUILDINFO installed block puts its first entry on the same line as the key: installed = glibc 2.39-1 x86_64 - gmp 6.3.0-1 x86_64 - The old code skipped the header line, so the first dependency was silently dropped from every snapshot — exactly the kind of gap that makes staleness quietly wrong. The header line is parsed now. tests/world.rs builds real .pkg.tar.zst files and asserts the fields come out of the archive: repeated keys stay lists, an archive with no .PKGINFO is refused rather than defaulted from the filename, and the world snapshot contains our own packages and none of glibc/pacman/binutils. The empty-snapshot case for a first build is asserted too — nothing of ours existed yet, and recording that honestly beats inventing a world. Split pkgbases produce one approval, one release and N index rows each with its own artifact, asserted directly here. 143 tests pass, clippy clean.
* http: SSE log tail, htmx-refreshed builds table, vendored JS budget (§13)aur-build13 days4-16/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GET /builds/:id/log.stream serves the build log as server-sent events from a blocking std::io::Read polled by the connection's thread — no async runtime, no timer wheel. The pipeline appends to a plain file and never learns the reader exists, so a viewer that hangs up, stalls or never shows up cannot slow a build by a microsecond. The stream ends when the build reaches a terminal state instead of holding a connection open forever, and there is a 30-minute lifetime cap so a wedged build cannot wedge a browser tab indefinitely. The test proves it is actually live rather than buffered: a producer thread appends while the stream is open, and the reader must see those bytes before the build finishes, then see the end event. The builds table refreshes with hx-trigger="every 3s" against a fragment endpoint, so htmx swaps one <div> rather than a whole document. Without JavaScript the same HTML already contains the table — the refresh is an enhancement, never a requirement. Static assets are served from include_bytes!, precompressed, with the Content-Length forced so tiny_http does not chunk a file whose size we know. Vendoring decision, recorded in docs/DECISIONS.md: the design's '~14 KB htmx' does not exist — released htmx is 48 KB minified. We vendor 1.9.12 unmodified and serve the 15.6 KB gzip, and the budget is asserted on served bytes with a bare-socket test, because an HTTP client would transparently decompress and hide the number. htmx's SSE extension is deliberately NOT vendored: it swaps with innerHTML and a build log is untrusted text from someone else's PKGBUILD, so wiring it up would be an XSS hole opened to make a log scroll by itself. The review surface still ships no JavaScript at all, asserted by grepping the rendered page for <script. Also: styles moved out of base.html into static/app.css, and docs/DECISIONS.md started with the decisions made so far. 138 tests pass, clippy clean.
* pipeline: a real process kill, and the failure state the UI must show ↵aur-build13 days6-4/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (§8.4, I5) The crash-resume invariant was only ever simulated before: an in-process fault hook returns an error, and an error can be caught, unwound and cleaned up by accident. So the shims gained AUR_SHIM_KILL_PARENT — the named tool SIGKILLs the process running the pipeline, mid-step, with no Drop and no atexit. The test spawns the real aur-build binary, watches it die of SIGKILL inside the build step, and then asserts the things that matter: - the database is intact, because no transaction ever spans a build step - the completed steps are checkpointed succeeded and the running one is recorded running - after the lease expires the reaper requeues it and marks the step interrupted - resuming publishes exactly one release, and the shim invocation log proves mkarchroot ran once, makechrootpkg twice (crash + resume, not twice per attempt) and repo-add once **This found a real bug.** reap_expired only matched state='leased', but a worker sets state='running' the moment it starts a step, so a process that dies mid-step leaves a running row — and every real crash would have been stranded forever. The reaper now reaps leased and running. Also §8.4's other half, which was a comment rather than a feature: a failed build must not leave the old version looking healthy. db::approved_but_unbuilt finds approvals whose build failed and never published, and Attention and the package page now say 'v2 approved, build failed, index still serving v1' with a link to the log. Retrying is an explicit, audited POST, not something the system does to itself. Cancellation is asserted to be cooperative at a step boundary: a cancelled build runs no steps, publishes nothing, and is not counted as a failure.
* pipeline: dispatcher actor, worker pool and reaper (§8.2, §8.4)aur-build13 days6-1/+302
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One dispatcher thread, N workers, one crossbeam channel between them. The dispatcher loop is reap -> cancel -> claim -> send, and the reaper runs first on every pass including the first, so 'recover from a crash' and 'notice an expired lease' are literally the same code path. There is no startup recovery routine to get wrong. - claim_batch does the SELECT and the UPDATE in one BEGIN IMMEDIATE transaction. SQLite has no SKIP LOCKED, but with exactly one writer the claim cannot race: nobody can see a row between the two statements. - Backpressure is min(max_concurrent_builds - in_flight, disk headroom), measured with statvfs. A build that cannot fit on disk stays queued instead of filling the filesystem halfway through a compile. - Retry policy (§8.4): transient failures (IO, HTTP) requeue up to max_transient_attempts; a deterministic build failure is never retried, and the release stays approved_but_unbuilt so the old version never looks healthy. Tests assert attempt==1 for build-fails and attempt==3 for a transient one. - A superseded candidate sets cancel_requested on in-flight builds; the worker stops at the step boundary rather than mid-step, which is what keeps the checkpoints honest. - Publish takes a process-wide lock so two workers cannot interleave the index rewrite. The critical section is the db file rewrite, never a build. - The deterministic build id makes re-enqueue an INSERT OR IGNORE no-op, so a careless 'rebuild that again' is harmless. tests/dispatch.rs drives the real threads: the pool takes a queued build all the way to publication, a reaped build resumes from its checkpoints without re-running makechrootpkg, and backpressure admits exactly one build per slot. Serve now starts the pool alongside the watcher and the HTTP server.
* http: surfaces driven by live state — staleness, downgrades, deps, rebuild ↵aur-build13 days4-19/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | (I6) Attention, the package page and the builds page now answer real questions instead of rendering empty tables: - Attention lists outdated dependencies derived from the recorded world snapshots, naming the dependency that moved, what the artifact was built against and what the index holds now; also missing dependencies and downgrades (AUR offering a lower version than we serve), which is an announcement for a human, not a build request. - The package page shows depends-on from the recipe we actually serve and needed-by from the packages whose recipes name it, plus staleness and the aur_commit timeline, each release linking into cgit at that exact commit. - Builds rows carry the version they are about, in both the live and the recently-finished table. - A manual rebuild reuses the approved source identity and mints no approval (I6); the test asserts the approval count is unchanged before and after the rebuild runs. - A paused subscription is not observed at all: detection returns Paused without polling, so pausing a broken package stops it opening reviews. - Staleness stays computed on read (§10.2). Nothing stores a stale flag, so nothing can serve a stale lie. Also: dep-client fixture added for dependency pairs.
* http: the review surface — server-rendered, no JavaScript required (§12, ↵aur-build13 days9-0/+1821
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | §13) tiny_http, thread-per-connection, askama templates. Every §13 surface is server-rendered HTML that works with scripts switched off: Inbox, review detail with the full panel set, Builds, Attention, Index, Subscriptions, Ops/audit, Settings. The parts that are easy to get wrong: - Handlers read through thread-local READ-ONLY connections. They cannot take the write lock even by accident, so a slow page render never blocks the build pipeline's writer. tests/http.rs asserts this by trying to write through a read connection and requiring failure. - Every POST requires a CSRF token derived from the session id. Logout drops the session, which invalidates every form still open in a browser. - Approve carries identity_hash AND diff_digest (§7.1a). If either has moved, the approval is refused with 409 and the page re-renders the review AS IT IS NOW — never a silent retarget onto the newer state. - Bulk approve refuses high-risk items unless each one is individually confirmed by id. Bulk is per-item, never 'approve everything forever'. - Reject requires a note; it is re-openable, not a deletion. - Optional password gate; anonymous visitors are redirected to /login. Also: the index page states the pacman conf snippet including 'SigLevel = Required DatabaseOptional', because a repo consumers ignore the signature is a repo that gets MITM'd.
* review: complete the §6 panel set — source, dependency, build-env, ↵aur-build13 days2-1/+220
| | | | | | | | | | | | | | | | | | | | | | install-hook A reviewer deciding 'is this safe to serve to every installer' needs more than the recipe text. These four panels answer the questions the recipe diff hides: - source delta: added/removed entries, NEW SOURCE HOSTS (the classic supply-chain shape), a checksum that became SKIP, validpgpkeys dropped - dependency delta: per-array add/remove plus 'tests will no longer run' when checkdepends empties out - build-env delta: options, arch, pkgbase rename, split-package set changes - install-script delta: .install hooks are code that runs on every consumer machine, so a change to build()/package() bodies is called out explicitly All panels compare the accepted release against the candidate (I2); a first introduction still gets the whole recipe instead of a diff (I2b). Also: index_packages now carries artifact size and published_at so the index page shows real numbers.
* db: identity_hash is a digest of the canonical identity tuple (§5.1a)aur-build13 days1-1/+4
| | | | | | | The identity is the tuple an approval pins. Rendering it as raw canonical JSON made the 'hash' a blob of unescaped JSON that no form field could carry faithfully; hash the canonical form instead and keep the JSON internal.
* review: advisory risk scoring and non-publishable change handling (§6, ↵aur-build14 days4-4/+328
| | | | | | | | | | | | | | | | | | | | | | | | | | §5.3, I11) Every candidate is scored against the recipe the accepted release was actually built from (release -> candidate -> snapshot), never against 'last seen'. Signals: SKIP on a non-VCS source, a sum changed to SKIP, new source host, --skippgpcheck, removed validpgpkeys, new makedepends and fetching build tools (cargo/npm/go/pip), .install scripts, weakened options, removed checkdepends, pkgrel reset, epoch bump, downgrade, a diff touching build()/package() bodies rather than metadata, upstream ranges that touch a build-system file, and first introduction. Advisory only — there is no auto-approval, so a wrong score costs attention and never safety (§7.3). Fixes a fixture bug the new tests exposed: digest-drift and skip-checksum declared bare paths as sources, which parse as local recipe files rather than remote downloads, so the drift path never fired. They now use file:// URLs like a real remote would. tests/notices.rs: integrity_alert is high severity and leaves no candidate, pin_drift is informational, recipe drift under a static version is a warning, SKIP-on-non-VCS is a high risk signal, repeated polling of one drift is one notice, and an I11 sweep over twelve fixtures proving a change is never silently dropped.
* watch: two-stage VCS watcher — ls-remote probe, pkgver() resolution, pin ↵aur-build14 days6-11/+462
| | | | | | | | | | | | | | | | | | | | | | | | | | | | capture (§5.2) Stage A probes every VCS source in source=() with git ls-remote, respecting #commit/#tag/#branch fragments, and returns one UpstreamPin per source. If the tip set equals the accepted release's pins, nothing can have changed and Stage B never runs — the common case costs one round trip per source and no clone. svn/hg have no cheap universal probe, so they are reported as unprobed and force Stage B rather than being silently treated as unchanged. Stage B runs only on movement: it fetches into a persistent vcs_cache (rather than re-cloning a multi-gigabyte upstream daily), runs makepkg --vercheck, and captures the pins from the clone it already has. Results are cached on (pkgbase, recipe_hash, upstream_tip) with a per-pkgbase cooldown, and a process-wide slot cap bounds concurrent resolutions. The resolved epoch:pkgver-pkgrel plus the pins go into identity_hash, so a different commit is a different thing to approve. Also fixes a misclassification the new path exposed: a VCS source's digest is its pin, so upstream movement showed up as an integrity_alert. Integrity events are now restricted to fixed downloads; VCS movement under a frozen pkgver is pin_drift, as §5.2 specifies. New fixtures git-multi (two upstreams) and git-tagged (#tag pin). 10 tests in tests/vcs.rs.
* cli: operator command line with the approval path (§7.2)aur-build14 days4-10/+357
| | | | | | | | | | | | | | | | | aur-build init/subscribe/detect/reviews/show/approve/reject/build/run/ builds/status/packages/audit. approve renders the review and then approves with the hashes it just rendered, so the CLI cannot approve a diff it did not show you; --identity/--diff reproduce the stale case explicitly and a refusal exits 2 (the web equivalent is 409). Approvals are now immutable at the schema level: migration 0006 rejects UPDATE and DELETE on the approval table, because that row is the only proof the system has of what a human actually looked at (§7.2, I10). Publishing also refuses when no approval is reachable, including the manual-rebuild path that inherits one. 10 tests, including two that drive the compiled binary end to end against a file:// AUR fixture.
* pipeline: ten-step build machine with atomic signed publishaur-build14 days10-1/+1647
| | | | | | | | | | | | | | | | | | | | | materialize -> plan -> chroot -> sources -> pkgver -> build -> collect -> verify -> ingest -> publish, each checkpointed in build_step so a worker that dies resumes at the next incomplete step without repeating the expensive one (I5). Step 0 materializes from the local mirror only and re-hashes the tree: there is no path from 'AUR moved since the review' to 'we built it anyway' (I3). Step 4 re-resolves a VCS pkgver and refuses when it no longer matches the approved identity. Publish renders the index to .tmp, fsyncs, commits release + package rows and the accepted pointer under a compare-and-swap, then renames over the served database and signs it, so a crash leaves the old index byte-for-byte intact (I4) and every index entry traces back to an approval (I1). Ingest records the world snapshot as the BUILDINFO installed set intersected with our own packages, which is what keeps staleness meaningful (I12). 17 shim-driven end-to-end tests, including kill-mid-publish and crash-resume, with no root, network, or real chroot.
* test: toolchain shims and the fake-package corpus (§16a)aur-build14 days9-6/+693
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The harness that makes the rest of this developable. Six real binaries named exactly like the tools the pipeline shells out to, sharing one shim module, driven entirely by environment so no production code path is test-only: AUR_SHIM_DIR where invocations are recorded (jsonl) AUR_SHIM_MANIFEST the fixture manifest to obey AUR_SHIM_FAIL optional tool forced to fail makechrootpkg emits real .pkg.tar.zst files with .PKGINFO and .BUILDINFO (the full chroot world, which is why §10.1 filters it), makepkg answers --printsrcinfo and --vercheck for Stage B, repo-add rebuilds a gzip'd .db with %FILENAME%/%VERSION%/%SHA256SUM% DESC entries, gpg writes a detached signature, mkarchroot creates a warm root. Each one records its invocation so tests assert on what actually ran. testcorpus/ holds 17 fixtures, each a PKGBUILD plus a manifest with the scripted outcome: plain-make, with-patch, install-hooks, skip-checksum, split-pkgbase, build-fails, check-fails, missing-dep, dep-cycle, epoch-bump, pkgrel-reset, downgrade, digest-drift, pin-drift, git-sourced, git-submodules, unresolvable. The harness commits a fixture into a real git repo standing in for AUR, materialises a local upstream git repo for VCS fixtures, and swaps payload bytes for the drift cases. Config.child_env is what puts the shims on PATH for child processes, so the pipeline runs completely unmodified under test. Part of P0 (DESIGN.md §17).
* feat: AUR mirror watcher, recipe parsing, candidate creationaur-build14 days16-3/+2206
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The detection path (§5.1, §5.1a, §5.3, §7.1): * git helpers, all subprocess git in one auditable place. Mirrors are cloned with --mirror and polled with git ls-remote, fetching only when the tip actually moved; --no-prune keeps history we may need forever. * .SRCINFO parsing (authoritative) with a PKGBUILD fallback, and source=() parsing that keeps VCS kind, #commit/#tag/#branch refs and the filename:: form. * recipe_hash over the whole snapshot tree, so a shipped patch is part of the recipe and cannot change silently. * source digest resolution: declared checksums are trusted-as-declared (makepkg enforces them, no bandwidth), local files are hashed from the mirror, and SKIP sources are downloaded and stream-hashed into the content-addressed source cache. Detection always re-fetches SKIP sources — answering from our own cache would defeat drift detection. * candidate creation with base = current_accepted_release, collapse in place while unviewed, supersede only once a human has looked, and a previously rejected identity is not re-raised. * non-publishable change handling (I11): unchanged version string means no review, but never silence — recipe drift and pin drift become notices, and a changed digest on a remote source with an unchanged version becomes a high-severity integrity_alert. Also vercmp + dep-string parsing with the ALPM test vectors, and the approval record with optimistic concurrency (§7.1a) that the CLI and web layers will both call. 16 detection tests against real file:// git fixtures, incl. I2 across three unattended detections and I11 for all three drift kinds. Part of P0 (DESIGN.md §17).
* feat: SQLite schema, migrations, single writer actoraur-build14 days10-0/+2364
| | | | | | | | | | | | | | | | | | | The §11 data model as four migrations, plus the §11a concurrency model: one writer thread owning the write connection (mutations arrive as closures over a crossbeam channel, so SQLITE_BUSY is not part of the design) and thread-local read-only connections under WAL. Invariants that are database guarantees rather than conventions: I7 partial unique index -> at most one pending_review per pkgbase I3 UNIQUE(pkgbase_id, identity_hash) -> no duplicate candidates I10 audit table rejects UPDATE and DELETE by trigger §16 current_accepted_release_id moves only by compare-and-swap Also: vercmp + dependency-string parsing (ALPM algorithm, no libalpm), hash helpers including recipe_hash over the whole AUR tree, the clock helper that stamps every write, and the config/root layout. Part of P0 (DESIGN.md §17).
* chore: scaffold cargo project, toolchain shim binaries, git baselineaur-build14 days8-0/+10
Provisions rustup + devtools from the distro package set and lays down the crate skeleton: library, CLI binary, and one binary per external tool the pipeline shells out to (mkarchroot, makechrootpkg, makepkg, repo-add, gpg, pacman) so the §16a PATH shims are real executables that cargo builds and tests can locate via CARGO_BIN_EXE_*. Part of P0 (DESIGN.md §17).