summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-18 08:23:14 +0000
committeraur-build <aur-build@localhost>2026-11-18 08:23:14 +0000
commiteefbefed9cbea6b2edef65900fbe6cb6da0b48e4 (patch)
tree1249788a49812fc15b644687af7c1384f94ba236
parenta6b652985f40cf022d6c522415c36fad13bc663d (diff)
downloadaur-build-eefbefed9cbea6b2edef65900fbe6cb6da0b48e4.tar.gz
aur-build-eefbefed9cbea6b2edef65900fbe6cb6da0b48e4.zip
http: surfaces driven by live state — staleness, downgrades, deps, rebuild (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.
-rw-r--r--.pi/.goals-pool-snapshot.json2
-rw-r--r--.pi/goals/.goal-ledger-checkpoint.json2
-rw-r--r--.pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md46
-rw-r--r--.pi/goals/goal_events.jsonl7
-rw-r--r--src/http/render.rs2
-rw-r--r--src/http/routes.rs76
-rw-r--r--src/watch/detect.rs12
-rw-r--r--src/watch/staleness.rs42
-rw-r--r--templates/attention.html7
-rw-r--r--templates/builds.html5
-rw-r--r--testcorpus/dep-client/PKGBUILD14
-rw-r--r--testcorpus/dep-client/manifest.json38
-rw-r--r--tests/common/mod.rs147
-rw-r--r--tests/http.rs110
-rw-r--r--tests/surfaces.rs177
15 files changed, 537 insertions, 150 deletions
diff --git a/.pi/.goals-pool-snapshot.json b/.pi/.goals-pool-snapshot.json
index cba45fa..e74c75d 100644
--- a/.pi/.goals-pool-snapshot.json
+++ b/.pi/.goals-pool-snapshot.json
@@ -1 +1 @@
-{"version":1,"dirMtimeMs":1794986940018.6958,"goals":[{"id":"mwl5tehk-xhe7fk","objective":"Implement the AUR Build Server described in DESIGN.md as a single-process Rust binary in /workspace/aur-build, delivering phases P0–P4 (walking skeleton + test harness, VCS/pkgver detection, review web UI, durable build pipeline, staleness tracking), with every §2 invariant expressed as an executable test and the work committed incrementally to git.\n\nSUCCESS CRITERIA (observable):\n1. `cargo test` passes on the host with no `#[ignore]`-tier tests required; the §16a fake-package corpus and toolchain PATH shims drive the full step machine, publishing and crash-resume tests without root, network, or a real chroot.\n2. Invariants I1–I12 of §2 each have a named test that passes (I1 no-artifact-without-approval is a post-test query; I2 diff-base-is-last-accepted; I4 atomic publish survives kill-mid-publish; I5 step checkpoint/resume; I7 one open review enforced by the partial unique index; I12 world snapshots recorded).\n3. End-to-end against shims: subscribe pkgbase → detect → review → approve → build → publish a signed repo where both packages and the .db are signed, and the served index equals the set of current_accepted_release pointers (I8).\n4. Web UI serves the five §13 surfaces (Inbox, Builds, Attention, Index, Subscriptions) plus Ops/audit as server-rendered HTML; approve carries identity_hash + diff_digest and returns HTTP 409 on a stale approval (§7.1a).\n5. `cargo clippy` reports no errors; `git log` shows a sequence of small, meaningful commits from the initial scaffold to the final state; README documents build, run, and test commands.\n\nBOUNDARIES — IN SCOPE: P0, P1, P2, P3, P4 of §17, the §11 schema, §16 edge cases, §16a test harness, and one gated real-chroot integration attempt (devtools installed) if time permits.\nOUT OF SCOPE: everything in §20 (auto-approval policies, automatic dependency rebuilds, recipe-mutating hardening transforms, build-time upstream-pin honouring, network controls, cost-weighted admission, notifications), P5 polish, multi-tenancy/RBAC, non-x86_64 arches, and any change to DESIGN.md's decided decisions in §18.\n\nCONSTRAINTS (hard):\n- Rust edition 2021, no `async`/`await`, no tokio/axum/actix/reqwest/sqlx/libgit2; threads + crossbeam channels only; blocking HTTP via tiny_http; outbound HTTP via ureq; git by shelling out.\n- SQLite via rusqlite in WAL mode with exactly one writer actor thread (channel-based `Tx` enum) and thread-local read-only readers; no transaction may span a build step.\n- UI is server-rendered (askama or minijinja) with at most vendored htmx (~14 KB) plus ~30 lines of glue; no JS written by us beyond that glue, no bundler.\n- Fail closed on every pin assertion (recipe_hash, pkgver match against approved identity); non-publishable changes become `notice` rows, never candidates, never dropped (I11).\n- Provisioning: `sudo pacman -S --needed rustup devtools` (fall back to `pacman -S rust` only if rustup is unusable); no other system mutations; never commit secrets, the signing key, or build artifacts.\n- Commit incrementally: one commit per coherent step with a descriptive message; never a single monolithic commit; DESIGN.md stays untouched.\n- If a §19 open question blocks a design choice, pick the least-entangling option, record it in a `docs/DECISIONS.md` entry, and keep moving; stop and ask only if the choice is genuinely irreversible.\n\nIF BLOCKED: stop and ask the user (e.g. no network for crates, toolchain uninstallable, an invariant that cannot be made testable).","status":"active","autoContinue":true,"usage":{"tokensUsed":3247406,"activeSeconds":6929},"sisyphus":false,"createdAt":"2026-11-17T20:43:24.440Z","updatedAt":"2026-11-18T07:29:00.016Z","activePath":".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md","revision":310,"scheduler":{"version":1,"owner":"01a1eb32-2e3f-757c-a79a-21ac993facc5","generation":"dfbaf4f2-dad9-4dc6-9717-5038550aa75e","used":1,"phase":"running","repairUsed":false,"decision":{"kind":"ready","purpose":"kickoff"},"dispatch":{"id":"27430841-6f83-4343-a9fa-dd1c866de9d3","kind":"kickoff","claimedAt":1794985072841}},"taskList":{"tasks":[{"id":"task-setup","title":"Provision toolchain (pacman rustup + devtools) and initialize git","status":"complete","verificationContract":"`rustup show` and `cargo --version` work; `git -C /workspace/aur-build log` contains an initial commit with DESIGN.md, .gitignore, and a scaffolded Cargo.toml that `cargo build` compiles.","completedAt":"2026-11-17T20:48:20.900Z","evidence":"rustup 1.29.3 (pacman) + stable 1.100.0, devtools installed (mkarchroot/makechrootpkg present); git repo initialized on main with commit 3762c7c containing DESIGN.md, .gitignore, Cargo.toml; `cargo bu"},{"id":"task-p0","title":"P0 — walking skeleton + test harness (§17 P0, §16a)","status":"complete","subtasks":[{"id":"task-p0-schema","title":"SQLite schema, migrations, and single writer actor (§11, §11a)","status":"complete","verificationContract":"Migrations apply from empty DB; partial unique index rejects a second pending_review per pkgbase; audit table rejects UPDATE/DELETE by trigger; concurrent readers do not block the writer in a test.","completedAt":"2026-11-17T21:00:03.122Z","evidence":"tests/db.rs: 10 tests pass — migrations from empty + idempotent + WAL, default settings, I7 partial unique index rejects 2nd pending_review, candidate identity uniqueness, audit append-only triggers, "},{"id":"task-p0-shims","title":"Toolchain PATH shims + fake-package corpus (§16a)","status":"complete","verificationContract":"Fakes for mkarchroot/makechrootpkg/makepkg/repo-add/gpg/pacman record invocations and emit plausible .PKGINFO/.BUILDINFO/.sig per fixture manifest; at least plain-make, with-patch, skip-checksum, split-pkgbase, build-fails, missing-dep, epoch-bump, pkgrel-reset and downgrade fixtures exist and are driven by a test.","completedAt":"2026-11-17T21:31:09.120Z","evidence":"src/shims + src/bin/{mkarchroot,makechrootpkg,makepkg,repo-add,gpg,pacman}: shims record invocations to AUR_SHIM_DIR/invocations.jsonl, obey AUR_SHIM_MANIFEST, and emit real .pkg.tar.zst with .PKGINFO"},{"id":"task-p0-detect","title":"AUR mirror watcher: aur_commit pin, recipe_hash, source digests, candidate creation (§5.1, §5.1a, §5.3)","status":"complete","verificationContract":"Against a local file:// 'AUR' repo fixture: clone + ls-remote poll + fetch only on SHA move; snapshot records aur_commit and recipe_hash covering PKGBUILD/.SRCINFO/*.install/patches; SKIP sources are stream-hashed into source_cache; candidate.base is current_accepted_release; a brand-new pkgbase yields kind=first_introduction.","completedAt":"2026-11-17T21:20:02.693Z","evidence":"tests/detect.rs: 16 tests pass against real file:// git fixtures — clone+ls-remote poll with fetch only on SHA move (Sync::Unchanged vs Fetched), snapshot records aur_commit + recipe_hash covering shi"},{"id":"task-p0-approve","title":"Approval semantics + CLI approval path (§7.1, §7.1a, §7.2)","status":"complete","verificationContract":"CLI approve writes an immutable approval row with diff_digest and identity_hash; approving with a stale identity_hash or diff_digest is refused; collapse-in-place bumps revision without a new row while unviewed and freezes as superseded once viewed; a rejected identity is not re-detected.","completedAt":"2026-11-17T22:10:06.063Z","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi"},{"id":"task-p0-build","title":"Build pipeline steps 0–9 and atomic signed publish (§8.1, §9)","status":"complete","verificationContract":"Shim-driven run of materialize→plan→chroot→sources→pkgver→build→collect→verify→ingest→publish; step 0 materializes from the local mirror and fails closed on recipe_hash mismatch; step 4 fails closed on pkgver mismatch; publish writes .tmp, fsyncs, renames, signs package and db, and updates current_accepted_release_id by compare-and-swap.","completedAt":"2026-11-17T21:58:00.936Z","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean"},{"id":"task-p0-invariants","title":"Executable invariant tests I1/I2/I4/I5/I8","status":"complete","verificationContract":"cargo test includes: post-run query proving no index entry lacks an approval (I1); multi-detection fixture proving the diff base is the last accepted version (I2); kill-mid-publish leaving the old index intact (I4); restart-resumes-at-next-incomplete-step with no duplicate side effects (I5); index set equals accepted-release pointers (I8).","completedAt":"2026-11-18T07:01:31.398Z","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re"}],"completedAt":"2026-11-18T07:02:29.831Z","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit"},{"id":"task-p1","title":"P1 — VCS / computed pkgver detection (§5.2, §3)","status":"pending","subtasks":[{"id":"task-p1-stageA","title":"Stage A upstream probes over all VCS sources + persistent vcs_cache","status":"complete","verificationContract":"Parses source=() for git+/svn+/hg+ with #tag/#commit refs; probes via git ls-remote against local file:// repos; an unchanged HEAD set short-circuits before Stage B; multiple VCS sources each get their own pin entry.","completedAt":"2026-11-18T07:16:40.077Z","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma"},{"id":"task-p1-stageB","title":"Stage B pkgver() resolution with pin capture + identity tuple","status":"complete","verificationContract":"Resolved epoch:pkgver-pkgrel plus upstream_pins become part of identity_hash; cooldown and global concurrency cap enforced; cache keyed on (pkgbase, recipe_hash, upstream_tip); a git-sourced fixture produces a candidate whose pins match the fixture repo HEAD.","completedAt":"2026-11-18T07:17:57.387Z","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o"},{"id":"task-p1-notices","title":"Non-publishable change handling: pin_drift, recipe drift, digest drift → notice / integrity_alert (§5.2, §5.3, I11)","status":"pending","verificationContract":"pin-drift fixture yields a notice and no candidate; digest-drift fixture yields a high-severity integrity_alert and no candidate; SKIP-on-non-VCS is flagged as a risk signal; nothing publishable is silently dropped."}]},{"id":"task-p2","title":"P2 — review surface (§12, §13, §6)","status":"pending","subtasks":[{"id":"task-p2-http","title":"tiny_http server, templating, thread-local readers, CSRF + session gate","status":"pending","verificationContract":"Thread-per-connection server renders all §12 routes; every POST requires a CSRF token; handlers never use the write connection; pages render with JS disabled."},{"id":"task-p2-inbox","title":"Inbox + diff panels + advisory risk scoring (§6, §7.1b)","status":"pending","verificationContract":"Review detail renders recipe / version / source-digest / upstream / source / dependency / build-env / install-hook panels, all based on accepted→candidate; risk signals computed and shown inline; base and aur_commit displayed with an AUR cgit link; first_introduction renders the full recipe with the subtle accent and no diff pane."},{"id":"task-p2-approve409","title":"Optimistic-concurrency approve/reject + bulk operations (§7.1a, §7.4)","status":"pending","verificationContract":"Approve POST with a stale identity_hash/diff_digest returns 409 and re-renders the current diff with an explanation; bulk approve refuses high-risk items without per-item confirmation; reject requires a note and is re-openable."},{"id":"task-p2-surfaces","title":"Subscriptions, Index, Builds, Attention, Ops/audit pages","status":"pending","verificationContract":"Each §13 surface renders from live DB state; Attention shows outdated-dependency, downgrade and blocked-build rows; the package page shows timeline, deps in/out, staleness and aur_commit history; manual rebuild reuses the approved source identity without a new approval (I6)."}]},{"id":"task-p3","title":"P3 — durability (§8.2, §8.3, §8.4)","status":"pending","subtasks":[{"id":"task-p3-dispatch","title":"Dispatcher actor, worker pool, leases, and reaper","status":"pending","verificationContract":"Dispatcher claims with BEGIN IMMEDIATE + lease expiry, requeues expired leases on startup, marks in-flight steps interrupted; the deterministic build id makes re-enqueue an INSERT OR IGNORE no-op; backpressure respects max_concurrent_builds and disk headroom."},{"id":"task-p3-crash","title":"Cancellation, retry policy, and crash-resume tests against shims (I5)","status":"pending","verificationContract":"A test kills the process mid-step and asserts resume at the next incomplete step with no duplicate side effects; cancel_requested stops a worker at a step boundary; deterministic build failures do not auto-retry and the release stays approved_but_unbuilt with the UI showing 'index still serving v1'."},{"id":"task-p3-sse","title":"SSE log tail + htmx live builds table","status":"pending","verificationContract":"GET /builds/:id/log.stream streams appended log bytes from a blocking thread; the builds table refreshes via htmx every 3s; vendored htmx is the only JS shipped and total vendored JS stays under 20 KB."}]},{"id":"task-p4","title":"P4 — staleness, retention, metrics (§10, §15)","status":"pending","subtasks":[{"id":"task-p4-world","title":".PKGINFO/.BUILDINFO parsing and world_snapshot filtered to our own repo","status":"pending","verificationContract":"Ingest parses tar+text without libalpm; world_snapshot members are intersected with our index at ingest time (not query time); split pkgbases produce N package rows from one approval."},{"id":"task-p4-stale","title":"Staleness query, downgrades, blocked_missing_dep, and dependents view","status":"pending","verificationContract":"stale_outdated and stale_missing are derived purely on read; a build with an unresolvable dep enters blocked_missing_dep, appears on Attention with the blocking pkgbase named, and the review page warns about missing deps before approval; the dep_edge view answers 'approving this marks N packages stale'."},{"id":"task-p4-ops","title":"Retention/GC, metrics endpoint, and backup helper","status":"pending","verificationContract":"Retention keeps N versions with logs and sources as a unit and sweeps abandoned staging dirs; GET /metrics emits prometheus text including queue depth, pending-review age histogram, build success rate and WAL size; backup uses VACUUM INTO (never cp of a live WAL db)."},{"id":"task-p4-deps","title":"vercmp + dependency-string parser and version-delta flagging (§4, §6)","status":"pending","verificationContract":"Hand-written vercmp and dep-string parser pass a table-driven test suite (epoch, pkgrel reset, alpha/numeric boundaries, provides/conflicts syntax); downgrade and epoch-bump detection use them and are covered by tests."}]},{"id":"task-verify","title":"Final verification pass, real-chroot attempt, and documentation","status":"pending","verificationContract":"Full `cargo test` and `cargo clippy` run clean; every §2 invariant maps to a named passing test (list produced); README + docs/DECISIONS.md written; git history reviewed for incremental commits; the gated real-chroot integration attempt against devtools is run or explicitly recorded as skipped with the reason."}],"blockCompletion":true,"proposedAt":"2026-11-17T20:39:23.165Z"},"currentTaskId":"task-p1-notices"}]} \ No newline at end of file
+{"version":1,"dirMtimeMs":1794990189939.1113,"goals":[{"id":"mwl5tehk-xhe7fk","objective":"Implement the AUR Build Server described in DESIGN.md as a single-process Rust binary in /workspace/aur-build, delivering phases P0–P4 (walking skeleton + test harness, VCS/pkgver detection, review web UI, durable build pipeline, staleness tracking), with every §2 invariant expressed as an executable test and the work committed incrementally to git.\n\nSUCCESS CRITERIA (observable):\n1. `cargo test` passes on the host with no `#[ignore]`-tier tests required; the §16a fake-package corpus and toolchain PATH shims drive the full step machine, publishing and crash-resume tests without root, network, or a real chroot.\n2. Invariants I1–I12 of §2 each have a named test that passes (I1 no-artifact-without-approval is a post-test query; I2 diff-base-is-last-accepted; I4 atomic publish survives kill-mid-publish; I5 step checkpoint/resume; I7 one open review enforced by the partial unique index; I12 world snapshots recorded).\n3. End-to-end against shims: subscribe pkgbase → detect → review → approve → build → publish a signed repo where both packages and the .db are signed, and the served index equals the set of current_accepted_release pointers (I8).\n4. Web UI serves the five §13 surfaces (Inbox, Builds, Attention, Index, Subscriptions) plus Ops/audit as server-rendered HTML; approve carries identity_hash + diff_digest and returns HTTP 409 on a stale approval (§7.1a).\n5. `cargo clippy` reports no errors; `git log` shows a sequence of small, meaningful commits from the initial scaffold to the final state; README documents build, run, and test commands.\n\nBOUNDARIES — IN SCOPE: P0, P1, P2, P3, P4 of §17, the §11 schema, §16 edge cases, §16a test harness, and one gated real-chroot integration attempt (devtools installed) if time permits.\nOUT OF SCOPE: everything in §20 (auto-approval policies, automatic dependency rebuilds, recipe-mutating hardening transforms, build-time upstream-pin honouring, network controls, cost-weighted admission, notifications), P5 polish, multi-tenancy/RBAC, non-x86_64 arches, and any change to DESIGN.md's decided decisions in §18.\n\nCONSTRAINTS (hard):\n- Rust edition 2021, no `async`/`await`, no tokio/axum/actix/reqwest/sqlx/libgit2; threads + crossbeam channels only; blocking HTTP via tiny_http; outbound HTTP via ureq; git by shelling out.\n- SQLite via rusqlite in WAL mode with exactly one writer actor thread (channel-based `Tx` enum) and thread-local read-only readers; no transaction may span a build step.\n- UI is server-rendered (askama or minijinja) with at most vendored htmx (~14 KB) plus ~30 lines of glue; no JS written by us beyond that glue, no bundler.\n- Fail closed on every pin assertion (recipe_hash, pkgver match against approved identity); non-publishable changes become `notice` rows, never candidates, never dropped (I11).\n- Provisioning: `sudo pacman -S --needed rustup devtools` (fall back to `pacman -S rust` only if rustup is unusable); no other system mutations; never commit secrets, the signing key, or build artifacts.\n- Commit incrementally: one commit per coherent step with a descriptive message; never a single monolithic commit; DESIGN.md stays untouched.\n- If a §19 open question blocks a design choice, pick the least-entangling option, record it in a `docs/DECISIONS.md` entry, and keep moving; stop and ask only if the choice is genuinely irreversible.\n\nIF BLOCKED: stop and ask the user (e.g. no network for crates, toolchain uninstallable, an invariant that cannot be made testable).","status":"active","autoContinue":true,"usage":{"tokensUsed":4907415,"activeSeconds":9918},"sisyphus":false,"createdAt":"2026-11-17T20:43:24.440Z","updatedAt":"2026-11-18T08:23:09.937Z","activePath":".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md","revision":527,"scheduler":{"version":1,"owner":"01a1eb32-2e3f-757c-a79a-21ac993facc5","generation":"dfbaf4f2-dad9-4dc6-9717-5038550aa75e","used":1,"phase":"running","repairUsed":false,"decision":{"kind":"ready","purpose":"kickoff"},"dispatch":{"id":"27430841-6f83-4343-a9fa-dd1c866de9d3","kind":"kickoff","claimedAt":1794985072841}},"taskList":{"tasks":[{"id":"task-setup","title":"Provision toolchain (pacman rustup + devtools) and initialize git","status":"complete","verificationContract":"`rustup show` and `cargo --version` work; `git -C /workspace/aur-build log` contains an initial commit with DESIGN.md, .gitignore, and a scaffolded Cargo.toml that `cargo build` compiles.","completedAt":"2026-11-17T20:48:20.900Z","evidence":"rustup 1.29.3 (pacman) + stable 1.100.0, devtools installed (mkarchroot/makechrootpkg present); git repo initialized on main with commit 3762c7c containing DESIGN.md, .gitignore, Cargo.toml; `cargo bu"},{"id":"task-p0","title":"P0 — walking skeleton + test harness (§17 P0, §16a)","status":"complete","subtasks":[{"id":"task-p0-schema","title":"SQLite schema, migrations, and single writer actor (§11, §11a)","status":"complete","verificationContract":"Migrations apply from empty DB; partial unique index rejects a second pending_review per pkgbase; audit table rejects UPDATE/DELETE by trigger; concurrent readers do not block the writer in a test.","completedAt":"2026-11-17T21:00:03.122Z","evidence":"tests/db.rs: 10 tests pass — migrations from empty + idempotent + WAL, default settings, I7 partial unique index rejects 2nd pending_review, candidate identity uniqueness, audit append-only triggers, "},{"id":"task-p0-shims","title":"Toolchain PATH shims + fake-package corpus (§16a)","status":"complete","verificationContract":"Fakes for mkarchroot/makechrootpkg/makepkg/repo-add/gpg/pacman record invocations and emit plausible .PKGINFO/.BUILDINFO/.sig per fixture manifest; at least plain-make, with-patch, skip-checksum, split-pkgbase, build-fails, missing-dep, epoch-bump, pkgrel-reset and downgrade fixtures exist and are driven by a test.","completedAt":"2026-11-17T21:31:09.120Z","evidence":"src/shims + src/bin/{mkarchroot,makechrootpkg,makepkg,repo-add,gpg,pacman}: shims record invocations to AUR_SHIM_DIR/invocations.jsonl, obey AUR_SHIM_MANIFEST, and emit real .pkg.tar.zst with .PKGINFO"},{"id":"task-p0-detect","title":"AUR mirror watcher: aur_commit pin, recipe_hash, source digests, candidate creation (§5.1, §5.1a, §5.3)","status":"complete","verificationContract":"Against a local file:// 'AUR' repo fixture: clone + ls-remote poll + fetch only on SHA move; snapshot records aur_commit and recipe_hash covering PKGBUILD/.SRCINFO/*.install/patches; SKIP sources are stream-hashed into source_cache; candidate.base is current_accepted_release; a brand-new pkgbase yields kind=first_introduction.","completedAt":"2026-11-17T21:20:02.693Z","evidence":"tests/detect.rs: 16 tests pass against real file:// git fixtures — clone+ls-remote poll with fetch only on SHA move (Sync::Unchanged vs Fetched), snapshot records aur_commit + recipe_hash covering shi"},{"id":"task-p0-approve","title":"Approval semantics + CLI approval path (§7.1, §7.1a, §7.2)","status":"complete","verificationContract":"CLI approve writes an immutable approval row with diff_digest and identity_hash; approving with a stale identity_hash or diff_digest is refused; collapse-in-place bumps revision without a new row while unviewed and freezes as superseded once viewed; a rejected identity is not re-detected.","completedAt":"2026-11-17T22:10:06.063Z","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi"},{"id":"task-p0-build","title":"Build pipeline steps 0–9 and atomic signed publish (§8.1, §9)","status":"complete","verificationContract":"Shim-driven run of materialize→plan→chroot→sources→pkgver→build→collect→verify→ingest→publish; step 0 materializes from the local mirror and fails closed on recipe_hash mismatch; step 4 fails closed on pkgver mismatch; publish writes .tmp, fsyncs, renames, signs package and db, and updates current_accepted_release_id by compare-and-swap.","completedAt":"2026-11-17T21:58:00.936Z","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean"},{"id":"task-p0-invariants","title":"Executable invariant tests I1/I2/I4/I5/I8","status":"complete","verificationContract":"cargo test includes: post-run query proving no index entry lacks an approval (I1); multi-detection fixture proving the diff base is the last accepted version (I2); kill-mid-publish leaving the old index intact (I4); restart-resumes-at-next-incomplete-step with no duplicate side effects (I5); index set equals accepted-release pointers (I8).","completedAt":"2026-11-18T07:01:31.398Z","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re"}],"completedAt":"2026-11-18T07:02:29.831Z","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit"},{"id":"task-p1","title":"P1 — VCS / computed pkgver detection (§5.2, §3)","status":"complete","subtasks":[{"id":"task-p1-stageA","title":"Stage A upstream probes over all VCS sources + persistent vcs_cache","status":"complete","verificationContract":"Parses source=() for git+/svn+/hg+ with #tag/#commit refs; probes via git ls-remote against local file:// repos; an unchanged HEAD set short-circuits before Stage B; multiple VCS sources each get their own pin entry.","completedAt":"2026-11-18T07:16:40.077Z","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma"},{"id":"task-p1-stageB","title":"Stage B pkgver() resolution with pin capture + identity tuple","status":"complete","verificationContract":"Resolved epoch:pkgver-pkgrel plus upstream_pins become part of identity_hash; cooldown and global concurrency cap enforced; cache keyed on (pkgbase, recipe_hash, upstream_tip); a git-sourced fixture produces a candidate whose pins match the fixture repo HEAD.","completedAt":"2026-11-18T07:17:57.387Z","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o"},{"id":"task-p1-notices","title":"Non-publishable change handling: pin_drift, recipe drift, digest drift → notice / integrity_alert (§5.2, §5.3, I11)","status":"complete","verificationContract":"pin-drift fixture yields a notice and no candidate; digest-drift fixture yields a high-severity integrity_alert and no candidate; SKIP-on-non-VCS is flagged as a risk signal; nothing publishable is silently dropped.","completedAt":"2026-11-18T07:29:10.456Z","evidence":"tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-"}],"completedAt":"2026-11-18T07:30:36.958Z","evidence":"All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri"},{"id":"task-p2","title":"P2 — review surface (§12, §13, §6)","status":"pending","subtasks":[{"id":"task-p2-http","title":"tiny_http server, templating, thread-local readers, CSRF + session gate","status":"complete","verificationContract":"Thread-per-connection server renders all §12 routes; every POST requires a CSRF token; handlers never use the write connection; pages render with JS disabled.","completedAt":"2026-11-18T08:06:45.433Z","evidence":"tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr"},{"id":"task-p2-inbox","title":"Inbox + diff panels + advisory risk scoring (§6, §7.1b)","status":"complete","verificationContract":"Review detail renders recipe / version / source-digest / upstream / source / dependency / build-env / install-hook panels, all based on accepted→candidate; risk signals computed and shown inline; base and aur_commit displayed with an AUR cgit link; first_introduction renders the full recipe with the subtle accent and no diff pane.","completedAt":"2026-11-18T08:07:10.624Z","evidence":"src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r"},{"id":"task-p2-approve409","title":"Optimistic-concurrency approve/reject + bulk operations (§7.1a, §7.4)","status":"complete","verificationContract":"Approve POST with a stale identity_hash/diff_digest returns 409 and re-renders the current diff with an explanation; bulk approve refuses high-risk items without per-item confirmation; reject requires a note and is re-openable.","completedAt":"2026-11-18T08:07:36.401Z","evidence":"tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written"},{"id":"task-p2-surfaces","title":"Subscriptions, Index, Builds, Attention, Ops/audit pages","status":"pending","verificationContract":"Each §13 surface renders from live DB state; Attention shows outdated-dependency, downgrade and blocked-build rows; the package page shows timeline, deps in/out, staleness and aur_commit history; manual rebuild reuses the approved source identity without a new approval (I6)."}]},{"id":"task-p3","title":"P3 — durability (§8.2, §8.3, §8.4)","status":"pending","subtasks":[{"id":"task-p3-dispatch","title":"Dispatcher actor, worker pool, leases, and reaper","status":"pending","verificationContract":"Dispatcher claims with BEGIN IMMEDIATE + lease expiry, requeues expired leases on startup, marks in-flight steps interrupted; the deterministic build id makes re-enqueue an INSERT OR IGNORE no-op; backpressure respects max_concurrent_builds and disk headroom."},{"id":"task-p3-crash","title":"Cancellation, retry policy, and crash-resume tests against shims (I5)","status":"pending","verificationContract":"A test kills the process mid-step and asserts resume at the next incomplete step with no duplicate side effects; cancel_requested stops a worker at a step boundary; deterministic build failures do not auto-retry and the release stays approved_but_unbuilt with the UI showing 'index still serving v1'."},{"id":"task-p3-sse","title":"SSE log tail + htmx live builds table","status":"pending","verificationContract":"GET /builds/:id/log.stream streams appended log bytes from a blocking thread; the builds table refreshes via htmx every 3s; vendored htmx is the only JS shipped and total vendored JS stays under 20 KB."}]},{"id":"task-p4","title":"P4 — staleness, retention, metrics (§10, §15)","status":"pending","subtasks":[{"id":"task-p4-world","title":".PKGINFO/.BUILDINFO parsing and world_snapshot filtered to our own repo","status":"pending","verificationContract":"Ingest parses tar+text without libalpm; world_snapshot members are intersected with our index at ingest time (not query time); split pkgbases produce N package rows from one approval."},{"id":"task-p4-stale","title":"Staleness query, downgrades, blocked_missing_dep, and dependents view","status":"pending","verificationContract":"stale_outdated and stale_missing are derived purely on read; a build with an unresolvable dep enters blocked_missing_dep, appears on Attention with the blocking pkgbase named, and the review page warns about missing deps before approval; the dep_edge view answers 'approving this marks N packages stale'."},{"id":"task-p4-ops","title":"Retention/GC, metrics endpoint, and backup helper","status":"pending","verificationContract":"Retention keeps N versions with logs and sources as a unit and sweeps abandoned staging dirs; GET /metrics emits prometheus text including queue depth, pending-review age histogram, build success rate and WAL size; backup uses VACUUM INTO (never cp of a live WAL db)."},{"id":"task-p4-deps","title":"vercmp + dependency-string parser and version-delta flagging (§4, §6)","status":"pending","verificationContract":"Hand-written vercmp and dep-string parser pass a table-driven test suite (epoch, pkgrel reset, alpha/numeric boundaries, provides/conflicts syntax); downgrade and epoch-bump detection use them and are covered by tests."}]},{"id":"task-verify","title":"Final verification pass, real-chroot attempt, and documentation","status":"pending","verificationContract":"Full `cargo test` and `cargo clippy` run clean; every §2 invariant maps to a named passing test (list produced); README + docs/DECISIONS.md written; git history reviewed for incremental commits; the gated real-chroot integration attempt against devtools is run or explicitly recorded as skipped with the reason."}],"blockCompletion":true,"proposedAt":"2026-11-17T20:39:23.165Z"},"currentTaskId":"task-p2-surfaces"}]} \ No newline at end of file
diff --git a/.pi/goals/.goal-ledger-checkpoint.json b/.pi/goals/.goal-ledger-checkpoint.json
index 694b67e..1e5844b 100644
--- a/.pi/goals/.goal-ledger-checkpoint.json
+++ b/.pi/goals/.goal-ledger-checkpoint.json
@@ -1 +1 @@
-{"version":4,"format":"goal-ledger-checkpoint","createdAt":"2026-11-18T07:19:15.897Z","coveredBytes":8071,"coveredEvents":22,"acc":{"goals":[{"goalId":"mwl5tehk-xhe7fk","latestStatus":"active","latestFocus":false,"createdAt":"2026-11-17T20:43:24.440Z","resumedAt":"2026-11-18T06:57:52.837Z"}],"terminalGoals":[],"focusedGoalId":null,"focusGeneration":0,"focusGenByGoal":[]},"recentEventsByGoal":[["mwl5tehk-xhe7fk",[{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","at":"2026-11-17T21:32:52.768Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean","at":"2026-11-17T21:58:00.937Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","at":"2026-11-17T21:58:43.315Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi","at":"2026-11-17T22:10:06.063Z"},{"type":"goal_paused","goalId":"mwl5tehk-xhe7fk","reason":"user","status":"paused","at":"2026-11-17T22:12:03.674Z"},{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-invariants","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re","at":"2026-11-18T07:01:31.400Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"}]]],"runtimeIndex":[["mwl5tehk-xhe7fk",{"recent":[{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","at":"2026-11-17T21:32:52.768Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean","at":"2026-11-17T21:58:00.937Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","at":"2026-11-17T21:58:43.315Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi","at":"2026-11-17T22:10:06.063Z"},{"type":"goal_paused","goalId":"mwl5tehk-xhe7fk","reason":"user","status":"paused","at":"2026-11-17T22:12:03.674Z"},{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-invariants","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re","at":"2026-11-18T07:01:31.400Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"}],"activity":[{"type":"goal_created","goalId":"mwl5tehk-xhe7fk","objective":"Implement the AUR Build Server described in DESIGN.md as a single-process Rust binary in /workspace/aur-build, delivering phases P0–P4 (walking skeleton + test harness, VCS/pkgver detection, review web UI, durable build pipeline, staleness tracking), with every §2 invariant expressed as an executable test and the work committed incrementally to git.\n\nSUCCESS CRITERIA (observable):\n1. `cargo test` passes on the host with no `#[ignore]`-tier tests required; the §16a fake-package corpus and toolchain PATH shims drive the full step machine, publishing and crash-resume tests without root, network, or a real chroot.\n2. Invariants I1–I12 of §2 each have a named test that passes (I1 no-artifact-without-approval is a post-test query; I2 diff-base-is-last-accepted; I4 atomic publish survives kill-mid-publish; I5 step checkpoint/resume; I7 one open review enforced by the partial unique index; I12 world snapshots recorded).\n3. End-to-end against shims: subscribe pkgbase → detect → review → approve → build → publish a signed repo where both packages and the .db are signed, and the served index equals the set of current_accepted_release pointers (I8).\n4. Web UI serves the five §13 surfaces (Inbox, Builds, Attention, Index, Subscriptions) plus Ops/audit as server-rendered HTML; approve carries identity_hash + diff_digest and returns HTTP 409 on a stale approval (§7.1a).\n5. `cargo clippy` reports no errors; `git log` shows a sequence of small, meaningful commits from the initial scaffold to the final state; README documents build, run, and test commands.\n\nBOUNDARIES — IN SCOPE: P0, P1, P2, P3, P4 of §17, the §11 schema, §16 edge cases, §16a test harness, and one gated real-chroot integration attempt (devtools installed) if time permits.\nOUT OF SCOPE: everything in §20 (auto-approval policies, automatic dependency rebuilds, recipe-mutating hardening transforms, build-time upstream-pin honouring, network controls, cost-weighted admission, notifications), P5 polish, multi-tenancy/RBAC, non-x86_64 arches, and any change to DESIGN.md's decided decisions in §18.\n\nCONSTRAINTS (hard):\n- Rust edition 2021, no `async`/`await`, no tokio/axum/actix/reqwest/sqlx/libgit2; threads + crossbeam channels only; blocking HTTP via tiny_http; outbound HTTP via ureq; git by shelling out.\n- SQLite via rusqlite in WAL mode with exactly one writer actor thread (channel-based `Tx` enum) and thread-local read-only readers; no transaction may span a build step.\n- UI is server-rendered (askama or minijinja) with at most vendored htmx (~14 KB) plus ~30 lines of glue; no JS written by us beyond that glue, no bundler.\n- Fail closed on every pin assertion (recipe_hash, pkgver match against approved identity); non-publishable changes become `notice` rows, never candidates, never dropped (I11).\n- Provisioning: `sudo pacman -S --needed rustup devtools` (fall back to `pacman -S rust` only if rustup is unusable); no other system mutations; never commit secrets, the signing key, or build artifacts.\n- Commit incrementally: one commit per coherent step with a descriptive message; never a single monolithic commit; DESIGN.md stays untouched.\n- If a §19 open question blocks a design choice, pick the least-entangling option, record it in a `docs/DECISIONS.md` entry, and keep moving; stop and ask only if the choice is genuinely irreversible.\n\nIF BLOCKED: stop and ask the user (e.g. no network for crates, toolchain uninstallable, an invariant that cannot be made testable).","sisyphus":false,"autoContinue":true,"at":"2026-11-17T20:43:24.440Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-setup","at":"2026-11-17T20:43:42.908Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-setup","evidence":"rustup 1.29.3 (pacman) + stable 1.100.0, devtools installed (mkarchroot/makechrootpkg present); git repo initialized on main with commit 3762c7c containing DESIGN.md, .gitignore, Cargo.toml; `cargo bu","at":"2026-11-17T20:48:20.900Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-schema","at":"2026-11-17T20:48:42.903Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-schema","evidence":"tests/db.rs: 10 tests pass — migrations from empty + idempotent + WAL, default settings, I7 partial unique index rejects 2nd pending_review, candidate identity uniqueness, audit append-only triggers, ","at":"2026-11-17T21:00:03.124Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-detect","at":"2026-11-17T21:00:47.994Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-detect","evidence":"tests/detect.rs: 16 tests pass against real file:// git fixtures — clone+ls-remote poll with fetch only on SHA move (Sync::Unchanged vs Fetched), snapshot records aur_commit + recipe_hash covering shi","at":"2026-11-17T21:20:02.693Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-shims","at":"2026-11-17T21:21:27.981Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-shims","evidence":"src/shims + src/bin/{mkarchroot,makechrootpkg,makepkg,repo-add,gpg,pacman}: shims record invocations to AUR_SHIM_DIR/invocations.jsonl, obey AUR_SHIM_MANIFEST, and emit real .pkg.tar.zst with .PKGINFO","at":"2026-11-17T21:31:09.121Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","at":"2026-11-17T21:32:52.768Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean","at":"2026-11-17T21:58:00.937Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","at":"2026-11-17T21:58:43.315Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi","at":"2026-11-17T22:10:06.063Z"},{"type":"goal_paused","goalId":"mwl5tehk-xhe7fk","reason":"user","status":"paused","at":"2026-11-17T22:12:03.674Z"},{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-invariants","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re","at":"2026-11-18T07:01:31.400Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"}],"oracle":[],"lifecycle":{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},"lastActivityEvent":{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"}}]]} \ No newline at end of file
+{"version":4,"format":"goal-ledger-checkpoint","createdAt":"2026-11-18T08:08:13.922Z","coveredBytes":9920,"coveredEvents":29,"acc":{"goals":[{"goalId":"mwl5tehk-xhe7fk","latestStatus":"active","latestFocus":false,"createdAt":"2026-11-17T20:43:24.440Z","resumedAt":"2026-11-18T06:57:52.837Z"}],"terminalGoals":[],"focusedGoalId":null,"focusGeneration":0,"focusGenByGoal":[]},"recentEventsByGoal":[["mwl5tehk-xhe7fk",[{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","evidence":"tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-","at":"2026-11-18T07:29:10.457Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1","evidence":"All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri","at":"2026-11-18T07:30:36.958Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","at":"2026-11-18T07:32:27.434Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","evidence":"tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr","at":"2026-11-18T08:06:45.433Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-inbox","evidence":"src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r","at":"2026-11-18T08:07:10.624Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-approve409","evidence":"tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written","at":"2026-11-18T08:07:36.401Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","at":"2026-11-18T08:08:13.901Z"}]]],"runtimeIndex":[["mwl5tehk-xhe7fk",{"recent":[{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","evidence":"tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-","at":"2026-11-18T07:29:10.457Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1","evidence":"All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri","at":"2026-11-18T07:30:36.958Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","at":"2026-11-18T07:32:27.434Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","evidence":"tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr","at":"2026-11-18T08:06:45.433Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-inbox","evidence":"src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r","at":"2026-11-18T08:07:10.624Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-approve409","evidence":"tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written","at":"2026-11-18T08:07:36.401Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","at":"2026-11-18T08:08:13.901Z"}],"activity":[{"type":"goal_created","goalId":"mwl5tehk-xhe7fk","objective":"Implement the AUR Build Server described in DESIGN.md as a single-process Rust binary in /workspace/aur-build, delivering phases P0–P4 (walking skeleton + test harness, VCS/pkgver detection, review web UI, durable build pipeline, staleness tracking), with every §2 invariant expressed as an executable test and the work committed incrementally to git.\n\nSUCCESS CRITERIA (observable):\n1. `cargo test` passes on the host with no `#[ignore]`-tier tests required; the §16a fake-package corpus and toolchain PATH shims drive the full step machine, publishing and crash-resume tests without root, network, or a real chroot.\n2. Invariants I1–I12 of §2 each have a named test that passes (I1 no-artifact-without-approval is a post-test query; I2 diff-base-is-last-accepted; I4 atomic publish survives kill-mid-publish; I5 step checkpoint/resume; I7 one open review enforced by the partial unique index; I12 world snapshots recorded).\n3. End-to-end against shims: subscribe pkgbase → detect → review → approve → build → publish a signed repo where both packages and the .db are signed, and the served index equals the set of current_accepted_release pointers (I8).\n4. Web UI serves the five §13 surfaces (Inbox, Builds, Attention, Index, Subscriptions) plus Ops/audit as server-rendered HTML; approve carries identity_hash + diff_digest and returns HTTP 409 on a stale approval (§7.1a).\n5. `cargo clippy` reports no errors; `git log` shows a sequence of small, meaningful commits from the initial scaffold to the final state; README documents build, run, and test commands.\n\nBOUNDARIES — IN SCOPE: P0, P1, P2, P3, P4 of §17, the §11 schema, §16 edge cases, §16a test harness, and one gated real-chroot integration attempt (devtools installed) if time permits.\nOUT OF SCOPE: everything in §20 (auto-approval policies, automatic dependency rebuilds, recipe-mutating hardening transforms, build-time upstream-pin honouring, network controls, cost-weighted admission, notifications), P5 polish, multi-tenancy/RBAC, non-x86_64 arches, and any change to DESIGN.md's decided decisions in §18.\n\nCONSTRAINTS (hard):\n- Rust edition 2021, no `async`/`await`, no tokio/axum/actix/reqwest/sqlx/libgit2; threads + crossbeam channels only; blocking HTTP via tiny_http; outbound HTTP via ureq; git by shelling out.\n- SQLite via rusqlite in WAL mode with exactly one writer actor thread (channel-based `Tx` enum) and thread-local read-only readers; no transaction may span a build step.\n- UI is server-rendered (askama or minijinja) with at most vendored htmx (~14 KB) plus ~30 lines of glue; no JS written by us beyond that glue, no bundler.\n- Fail closed on every pin assertion (recipe_hash, pkgver match against approved identity); non-publishable changes become `notice` rows, never candidates, never dropped (I11).\n- Provisioning: `sudo pacman -S --needed rustup devtools` (fall back to `pacman -S rust` only if rustup is unusable); no other system mutations; never commit secrets, the signing key, or build artifacts.\n- Commit incrementally: one commit per coherent step with a descriptive message; never a single monolithic commit; DESIGN.md stays untouched.\n- If a §19 open question blocks a design choice, pick the least-entangling option, record it in a `docs/DECISIONS.md` entry, and keep moving; stop and ask only if the choice is genuinely irreversible.\n\nIF BLOCKED: stop and ask the user (e.g. no network for crates, toolchain uninstallable, an invariant that cannot be made testable).","sisyphus":false,"autoContinue":true,"at":"2026-11-17T20:43:24.440Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-setup","at":"2026-11-17T20:43:42.908Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-setup","evidence":"rustup 1.29.3 (pacman) + stable 1.100.0, devtools installed (mkarchroot/makechrootpkg present); git repo initialized on main with commit 3762c7c containing DESIGN.md, .gitignore, Cargo.toml; `cargo bu","at":"2026-11-17T20:48:20.900Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-schema","at":"2026-11-17T20:48:42.903Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-schema","evidence":"tests/db.rs: 10 tests pass — migrations from empty + idempotent + WAL, default settings, I7 partial unique index rejects 2nd pending_review, candidate identity uniqueness, audit append-only triggers, ","at":"2026-11-17T21:00:03.124Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-detect","at":"2026-11-17T21:00:47.994Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-detect","evidence":"tests/detect.rs: 16 tests pass against real file:// git fixtures — clone+ls-remote poll with fetch only on SHA move (Sync::Unchanged vs Fetched), snapshot records aur_commit + recipe_hash covering shi","at":"2026-11-17T21:20:02.693Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-shims","at":"2026-11-17T21:21:27.981Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-shims","evidence":"src/shims + src/bin/{mkarchroot,makechrootpkg,makepkg,repo-add,gpg,pacman}: shims record invocations to AUR_SHIM_DIR/invocations.jsonl, obey AUR_SHIM_MANIFEST, and emit real .pkg.tar.zst with .PKGINFO","at":"2026-11-17T21:31:09.121Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","at":"2026-11-17T21:32:52.768Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-build","evidence":"tests/pipeline.rs: 17 shim-driven e2e tests pass (fail-closed recipe_hash + pkgver, kill-mid-publish I4, crash-resume I5, CAS pointer, signed db+pkgs); cargo clippy clean","at":"2026-11-17T21:58:00.937Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","at":"2026-11-17T21:58:43.315Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-approve","evidence":"tests/approve.rs: 10 tests pass incl. both-hash immutable approval row (migration 0006 trigger), stale identity/diff refused, collapse-in-place revision bump, viewed→superseded freeze, rejected identi","at":"2026-11-17T22:10:06.063Z"},{"type":"goal_paused","goalId":"mwl5tehk-xhe7fk","reason":"user","status":"paused","at":"2026-11-17T22:12:03.674Z"},{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0-invariants","evidence":"tests/invariants.rs: 10 named invariant tests pass as post-conditions on real runs (I1 approval trace, I2 base after 5 detections, I3 recipe pin, I4 byte-identical index after mid-publish crash, I5 re","at":"2026-11-18T07:01:31.400Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p0","evidence":"All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit","at":"2026-11-18T07:02:29.831Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","at":"2026-11-18T07:04:12.225Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","evidence":"tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-","at":"2026-11-18T07:29:10.457Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1","evidence":"All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri","at":"2026-11-18T07:30:36.958Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","at":"2026-11-18T07:32:27.434Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","evidence":"tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr","at":"2026-11-18T08:06:45.433Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-inbox","evidence":"src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r","at":"2026-11-18T08:07:10.624Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-approve409","evidence":"tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written","at":"2026-11-18T08:07:36.401Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","at":"2026-11-18T08:08:13.901Z"}],"oracle":[],"lifecycle":{"type":"goal_resumed","goalId":"mwl5tehk-xhe7fk","reason":"user","at":"2026-11-18T06:57:52.837Z"},"lastActivityEvent":{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","at":"2026-11-18T08:08:13.901Z"}}]]} \ No newline at end of file
diff --git a/.pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md b/.pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md
index 3e04e56..c228f43 100644
--- a/.pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md
+++ b/.pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md
@@ -5,14 +5,14 @@
"status": "active",
"autoContinue": true,
"usage": {
- "tokensUsed": 3247406,
- "activeSeconds": 6929
+ "tokensUsed": 4907415,
+ "activeSeconds": 9918
},
"sisyphus": false,
"createdAt": "2026-11-17T20:43:24.440Z",
- "updatedAt": "2026-11-18T07:29:00.016Z",
+ "updatedAt": "2026-11-18T08:23:09.937Z",
"activePath": ".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md",
- "revision": 310,
+ "revision": 527,
"scheduler": {
"version": 1,
"owner": "01a1eb32-2e3f-757c-a79a-21ac993facc5",
@@ -100,7 +100,7 @@
{
"id": "task-p1",
"title": "P1 — VCS / computed pkgver detection (§5.2, §3)",
- "status": "pending",
+ "status": "complete",
"subtasks": [
{
"id": "task-p1-stageA",
@@ -121,10 +121,14 @@
{
"id": "task-p1-notices",
"title": "Non-publishable change handling: pin_drift, recipe drift, digest drift → notice / integrity_alert (§5.2, §5.3, I11)",
- "status": "pending",
- "verificationContract": "pin-drift fixture yields a notice and no candidate; digest-drift fixture yields a high-severity integrity_alert and no candidate; SKIP-on-non-VCS is flagged as a risk signal; nothing publishable is silently dropped."
+ "status": "complete",
+ "verificationContract": "pin-drift fixture yields a notice and no candidate; digest-drift fixture yields a high-severity integrity_alert and no candidate; SKIP-on-non-VCS is flagged as a risk signal; nothing publishable is silently dropped.",
+ "completedAt": "2026-11-18T07:29:10.456Z",
+ "evidence": "tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-"
}
- ]
+ ],
+ "completedAt": "2026-11-18T07:30:36.958Z",
+ "evidence": "All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri"
},
{
"id": "task-p2",
@@ -134,20 +138,26 @@
{
"id": "task-p2-http",
"title": "tiny_http server, templating, thread-local readers, CSRF + session gate",
- "status": "pending",
- "verificationContract": "Thread-per-connection server renders all §12 routes; every POST requires a CSRF token; handlers never use the write connection; pages render with JS disabled."
+ "status": "complete",
+ "verificationContract": "Thread-per-connection server renders all §12 routes; every POST requires a CSRF token; handlers never use the write connection; pages render with JS disabled.",
+ "completedAt": "2026-11-18T08:06:45.433Z",
+ "evidence": "tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr"
},
{
"id": "task-p2-inbox",
"title": "Inbox + diff panels + advisory risk scoring (§6, §7.1b)",
- "status": "pending",
- "verificationContract": "Review detail renders recipe / version / source-digest / upstream / source / dependency / build-env / install-hook panels, all based on accepted→candidate; risk signals computed and shown inline; base and aur_commit displayed with an AUR cgit link; first_introduction renders the full recipe with the subtle accent and no diff pane."
+ "status": "complete",
+ "verificationContract": "Review detail renders recipe / version / source-digest / upstream / source / dependency / build-env / install-hook panels, all based on accepted→candidate; risk signals computed and shown inline; base and aur_commit displayed with an AUR cgit link; first_introduction renders the full recipe with the subtle accent and no diff pane.",
+ "completedAt": "2026-11-18T08:07:10.624Z",
+ "evidence": "src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r"
},
{
"id": "task-p2-approve409",
"title": "Optimistic-concurrency approve/reject + bulk operations (§7.1a, §7.4)",
- "status": "pending",
- "verificationContract": "Approve POST with a stale identity_hash/diff_digest returns 409 and re-renders the current diff with an explanation; bulk approve refuses high-risk items without per-item confirmation; reject requires a note and is re-openable."
+ "status": "complete",
+ "verificationContract": "Approve POST with a stale identity_hash/diff_digest returns 409 and re-renders the current diff with an explanation; bulk approve refuses high-risk items without per-item confirmation; reject requires a note and is re-openable.",
+ "completedAt": "2026-11-18T08:07:36.401Z",
+ "evidence": "tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written"
},
{
"id": "task-p2-surfaces",
@@ -223,7 +233,7 @@
"blockCompletion": true,
"proposedAt": "2026-11-17T20:39:23.165Z"
},
- "currentTaskId": "task-p1-notices"
+ "currentTaskId": "task-p2-surfaces"
}
# Goal Prompt
@@ -256,14 +266,14 @@ IF BLOCKED: stop and ask the user (e.g. no network for crates, toolchain uninsta
- Status: running
- Auto-continue: on
- Sisyphus mode: no
-- Time spent: 1h55m29s
-- Tokens used: 3.2M (3,247,406) tokens
+- Time spent: 2h45m18s
+- Tokens used: 4.9M (4,907,415) tokens
## Tasks
<!-- blockCompletion: true -->
- [x] task-setup: Provision toolchain (pacman rustup + devtools) and initialize git — evidence: rustup 1.29.3 (pacman) + stable 1.100.0, devtools installed (mkarchroot/makechrootpkg present); git repo initialized on main with commit 3762c7c containing DESIGN.md, .gitignore, Cargo.toml; `cargo bu
- [x] task-p0: P0 — walking skeleton + test harness (§17 P0, §16a) — evidence: All P0 children complete: schema+writer actor, shims+corpus, mirror watcher, approval semantics+CLI, 10-step pipeline with signed atomic publish, invariant index. 81 tests pass, clippy clean, 7 commit
-- [ ] task-p1: P1 — VCS / computed pkgver detection (§5.2, §3)
+- [x] task-p1: P1 — VCS / computed pkgver detection (§5.2, §3) — evidence: All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri
- [ ] task-p2: P2 — review surface (§12, §13, §6)
- [ ] task-p3: P3 — durability (§8.2, §8.3, §8.4)
- [ ] task-p4: P4 — staleness, retention, metrics (§10, §15)
diff --git a/.pi/goals/goal_events.jsonl b/.pi/goals/goal_events.jsonl
index ba0cb4b..519cb08 100644
--- a/.pi/goals/goal_events.jsonl
+++ b/.pi/goals/goal_events.jsonl
@@ -20,3 +20,10 @@
{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageA","evidence":"tests/vcs.rs: stage_a_probes_every_vcs_source_not_just_the_first (git-multi → 2 pins matching both repo HEADs), stage_a_respects_a_tag_pin, stage_a_short_circuits_before_stage_b_when_nothing_moved (ma","at":"2026-11-18T07:16:40.078Z"}
{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-stageB","evidence":"tests/vcs.rs: stage_b_resolves_pkgver_and_captures_the_pins (pins in identity_hash via Identity hash comparison), stage_b_is_cached_on_pkgbase_recipe_and_tip (cache row reuse + cooldown + re-resolve o","at":"2026-11-18T07:17:57.387Z"}
{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","at":"2026-11-18T07:19:15.892Z"}
+{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1-notices","evidence":"tests/notices.rs: 8 tests — digest-drift fixture → high-severity integrity_alert + no candidate, pin-drift → info notice + no candidate, recipe drift → warning, skip-checksum → HIGH risk signal 'skip-","at":"2026-11-18T07:29:10.457Z"}
+{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p1","evidence":"All three P1 children complete: Stage A probe (every VCS source, #tag/#commit, short-circuit), Stage B resolution (pin capture, cache on pkgbase+recipe_hash+tip, cooldown, concurrency cap), notices+ri","at":"2026-11-18T07:30:36.958Z"}
+{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","at":"2026-11-18T07:32:27.434Z"}
+{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-http","evidence":"tests/http.rs (14 tests, all pass): every_surface_renders covers all §12 routes on a live tiny_http server; every_post_requires_a_csrf_token asserts 403 for missing and forged tokens with zero rows wr","at":"2026-11-18T08:06:45.433Z"}
+{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-inbox","evidence":"src/review/diff.rs now emits all eight §6 panels (recipe, version, source-digest, upstream, source, dependency, build-env, install-hook), each computed accepted→candidate; commit ab8d33d. tests/http.r","at":"2026-11-18T08:07:10.624Z"}
+{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-approve409","evidence":"tests/http.rs: a_stale_approval_is_a_409_that_renders_the_current_diff (upstream moves mid-review → 409, body explains the ground moved, re-render shows the new 9.9 version, zero approval rows written","at":"2026-11-18T08:07:36.401Z"}
+{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","at":"2026-11-18T08:08:13.901Z"}
diff --git a/src/http/render.rs b/src/http/render.rs
index 2fad5c8..9e3d801 100644
--- a/src/http/render.rs
+++ b/src/http/render.rs
@@ -211,6 +211,8 @@ pub struct NoticeRow {
#[derive(Debug, Clone)]
pub struct StaleRow {
pub pkgbase: String,
+ /// The dependency that moved (or `aur` for a downgrade row).
+ pub dependency: String,
pub built_with: String,
pub now: String,
}
diff --git a/src/http/routes.rs b/src/http/routes.rs
index 784024d..ab68069 100644
--- a/src/http/routes.rs
+++ b/src/http/routes.rs
@@ -4,7 +4,7 @@
//! connection — and hands mutations to the writer actor. A slow client can
//! therefore never hold the write lock, which is the whole point of the split.
-use crate::db::{self, builds, model::*};
+use crate::db::{self, builds, model::*, Db};
use crate::review::{approve as ap, candidates, diff, risk};
use crate::{pipeline, time};
@@ -592,15 +592,19 @@ fn attention(state: &State, req: &Req) -> Res {
.iter()
.filter(|s| s.kind == crate::watch::staleness::Kind::Outdated)
.cloned()
- .map(|s| StaleRow { pkgbase: s.pkgbase, built_with: s.built_with, now: s.now })
+ .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now })
.collect();
let missing: Vec<StaleRow> = stale
.iter()
.filter(|s| s.kind == crate::watch::staleness::Kind::Missing)
.cloned()
- .map(|s| StaleRow { pkgbase: s.pkgbase, built_with: s.built_with, now: s.now })
+ .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now })
+ .collect();
+ let downgrades: Vec<StaleRow> = crate::watch::staleness::downgrades(db)
+ .unwrap_or_default()
+ .into_iter()
+ .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now })
.collect();
- let downgrades: Vec<StaleRow> = Vec::new();
let empty = notices.is_empty() && outdated.is_empty() && missing.is_empty() && blocked.is_empty();
page_to_res(
Attention { page, empty, notices, outdated, missing, downgrades, blocked },
@@ -687,6 +691,19 @@ fn package_detail(state: &State, req: &Req, name: &str) -> Res {
step: b.current_step.unwrap_or_default(),
})
.collect();
+ // Depends-on comes from the recipe we actually serve; needed-by comes from
+ // the packages whose own recipes name this one (§10.3).
+ let deps_in: Vec<String> = accepted
+ .as_ref()
+ .and_then(|r| db::accepted_recipe(db, r).ok().flatten())
+ .map(|r| {
+ let mut v = crate::pkgver::dep_names(&r.depends);
+ v.sort();
+ v.dedup();
+ v
+ })
+ .unwrap_or_default();
+ let deps_out: Vec<String> = crate::watch::staleness::dependents_of(db, name).unwrap_or_default();
let stale: Vec<String> = crate::watch::staleness::stale_for(db, name)
.unwrap_or_default()
.into_iter()
@@ -703,8 +720,8 @@ fn package_detail(state: &State, req: &Req, name: &str) -> Res {
summary,
can_withdraw: accepted.is_some(),
stale,
- deps_in: Vec::new(),
- deps_out: Vec::new(),
+ deps_in,
+ deps_out,
timeline,
builds,
},
@@ -746,6 +763,22 @@ fn package_withdraw(state: &State, req: &Req, name: &str) -> Res {
// --------------------------------------------------------------- builds --
+/// The version a build is about. A build points at a candidate, or — for a
+/// manual rebuild of something already published — at a release.
+fn build_version(db: &Db, b: &builds::BuildRow) -> String {
+ if let Some(cid) = b.candidate_id {
+ if let Some(c) = candidates::candidate_by_id(db, cid).ok().flatten() {
+ return c.version();
+ }
+ }
+ if let Some(rid) = b.release_id {
+ if let Some(r) = db::release_by_id(db, rid).ok().flatten() {
+ return r.version();
+ }
+ }
+ String::new()
+}
+
fn build_rows(state: &State) -> Vec<BuildRow> {
builds::list(
&state.db,
@@ -760,11 +793,12 @@ fn build_rows(state: &State) -> Vec<BuildRow> {
.flatten()
.map(|p| p.name)
.unwrap_or_default();
+ let version = build_version(&state.db, &b);
BuildRow {
id_short: short(&b.id),
id: b.id,
pkgbase,
- version: String::new(),
+ version,
kind: b.kind,
state: b.state,
step: b.current_step.unwrap_or_default(),
@@ -785,17 +819,21 @@ fn builds_with(state: &State, _req: &Req, page: Page) -> Res {
let recent: Vec<BuildRow> = builds::list(&state.db, &[build_state::FAILED, build_state::SUCCEEDED], 10)
.unwrap_or_default()
.into_iter()
- .map(|b| BuildRow {
- id_short: short(&b.id),
- id: b.id,
- pkgbase: db::get_pkgbase_by_id(&state.db, b.pkgbase_id).ok().flatten().map(|p| p.name).unwrap_or_default(),
- version: String::new(),
- kind: b.kind,
- state: b.state,
- step: b.current_step.unwrap_or_default(),
- lease: String::new(),
- cancel: b.cancel_requested,
- error: b.error.unwrap_or_default(),
+ .map(|b| {
+ let pkgbase = db::get_pkgbase_by_id(&state.db, b.pkgbase_id).ok().flatten().map(|p| p.name).unwrap_or_default();
+ let version = build_version(&state.db, &b);
+ BuildRow {
+ id_short: short(&b.id),
+ id: b.id,
+ pkgbase,
+ version,
+ kind: b.kind,
+ state: b.state,
+ step: b.current_step.unwrap_or_default(),
+ lease: String::new(),
+ cancel: b.cancel_requested,
+ error: b.error.unwrap_or_default(),
+ }
})
.collect();
page_to_res(Builds { page, rows: build_rows(state), recent }, 200)
@@ -834,7 +872,7 @@ fn build_detail(state: &State, req: &Req, id: &str) -> Res {
id: id.to_string(),
id_short: short(id),
pkgbase,
- version: String::new(),
+ version: build_version(db, &b),
kind: b.kind,
state: b.state,
error: b.error.clone().unwrap_or_default(),
diff --git a/src/watch/detect.rs b/src/watch/detect.rs
index 084052f..55b7543 100644
--- a/src/watch/detect.rs
+++ b/src/watch/detect.rs
@@ -20,6 +20,8 @@ use crate::watch::mirror::{read_tree, sync_mirror, Sync};
pub enum Outcome {
/// Nothing moved at all.
NoChange,
+ /// The subscription is paused: we look at nothing and change nothing.
+ Paused,
/// A new review was opened.
Candidate { id: i64, kind: String },
/// The open review was updated in place (I7).
@@ -47,6 +49,16 @@ pub struct CheckReport {
pub fn check_pkgbase(cfg: &Config, db: &Db, name: &str) -> Result<CheckReport> {
let pb = get_pkgbase(db, name)?
.ok_or_else(|| crate::error::Error::not_found(format!("pkgbase {name}")))?;
+ // A paused subscription is not observed at all. Pausing because a package is
+ // broken must not keep opening reviews nobody is going to act on, and it
+ // must not keep polling AUR either. The pause lives on the subscription, so
+ // that is what we consult.
+ let paused = db::get_subscription(db, name)?
+ .map(|s| s.state == subscription_state::PAUSED)
+ .unwrap_or(false);
+ if paused {
+ return Ok(CheckReport { pkgbase: name.into(), head: String::new(), outcome: Outcome::Paused });
+ }
let sync = sync_mirror(cfg, db, name, &pb.aur_url)?;
let head = match &sync {
Sync::Gone => {
diff --git a/src/watch/staleness.rs b/src/watch/staleness.rs
index 40bafeb..210632e 100644
--- a/src/watch/staleness.rs
+++ b/src/watch/staleness.rs
@@ -86,6 +86,48 @@ pub fn stale_for(db: &Db, pkgbase: &str) -> Result<Vec<Stale>> {
Ok(stale_rows(db)?.into_iter().filter(|s| s.pkgbase == pkgbase).collect())
}
+/// AUR now offers a **lower** version than we serve (§10.2). This is not a
+/// build request; it is an announcement that the mirror and the upstream have
+/// disagreed, and someone has to decide which one consumers follow.
+///
+/// Derived on read from the newest candidate per pkgbase against the accepted
+/// release, so it disappears the moment either side moves.
+pub fn downgrades(db: &Db) -> Result<Vec<Stale>> {
+ let rows: Vec<(String, String, String)> = db.read(|c| {
+ let mut st = c.prepare(
+ "SELECT p.name, r.pkgver, (
+ SELECT c.pkgver FROM candidate c
+ WHERE c.pkgbase_id = r.pkgbase_id
+ ORDER BY c.id DESC LIMIT 1)
+ FROM release r
+ JOIN pkgbase p ON p.current_accepted_release_id = r.id
+ WHERE r.state = 'published'",
+ )?;
+ let rows = st.query_map([], |r| {
+ Ok((
+ r.get::<_, String>(0)?,
+ r.get::<_, String>(1)?,
+ r.get::<_, Option<String>>(2)?.unwrap_or_default(),
+ ))
+ })?;
+ Ok(rows.filter_map(|r| r.ok()).collect::<Vec<_>>())
+ })?;
+ let mut out = Vec::new();
+ for (pkgbase, served, offered) in rows {
+ if offered.is_empty() || !crate::pkgver::is_downgrade(&served, &offered) {
+ continue;
+ }
+ out.push(Stale {
+ kind: Kind::Outdated,
+ pkgbase: pkgbase.clone(),
+ dependency: "aur".into(),
+ built_with: served,
+ now: offered,
+ });
+ }
+ Ok(out)
+}
+
/// "If I approve this, what goes stale?" — the dependents question (§10.3).
/// A package depends on `name` if `name` appears in its recorded world or in
/// its recipe dependencies.
diff --git a/templates/attention.html b/templates/attention.html
index caa277f..ba8aacb 100644
--- a/templates/attention.html
+++ b/templates/attention.html
@@ -13,16 +13,17 @@
<button type="submit">acknowledge</button></form></td></tr>{% endfor %}</table>{% endif %}
{% if !outdated.is_empty() %}<h2>Outdated: a dependency we publish has a newer version</h2>
-<table><tr><th>package</th><th>built against</th><th>now in the index</th><th></th></tr>
+<table><tr><th>package</th><th>dependency</th><th>built against</th><th>now in the index</th><th></th></tr>
{% for o in outdated %}<tr><td><a href="/packages/{{ o.pkgbase }}">{{ o.pkgbase }}</a></td>
+<td><a href="/packages/{{ o.dependency }}">{{ o.dependency }}</a></td>
<td>{{ o.built_with }}</td><td class="ok">{{ o.now }}</td>
<td><form class="inline" method="post" action="/packages/{{ o.pkgbase }}/rebuild">
<input type="hidden" name="csrf" value="{{ page.csrf }}"><button type="submit">rebuild</button></form></td></tr>
{% endfor %}</table>{% endif %}
{% if !missing.is_empty() %}<h2>Missing: a dependency we no longer publish</h2>
-<table><tr><th>package</th><th>missing</th></tr>
-{% for m in missing %}<tr><td>{{ m.pkgbase }}</td><td class="risk-high">{{ m.now }}</td></tr>{% endfor %}</table>{% endif %}
+<table><tr><th>package</th><th>missing</th><th>was built against</th></tr>
+{% for m in missing %}<tr><td><a href="/packages/{{ m.pkgbase }}">{{ m.pkgbase }}</a></td><td class="risk-high">{{ m.dependency }}</td><td>{{ m.built_with }}</td></tr>{% endfor %}</table>{% endif %}
{% if !blocked.is_empty() %}<h2>Blocked builds</h2>
<table><tr><th>build</th><th>pkgbase</th><th>waiting on</th></tr>
diff --git a/templates/builds.html b/templates/builds.html
index 7f83239..745f0e9 100644
--- a/templates/builds.html
+++ b/templates/builds.html
@@ -16,7 +16,8 @@
</tr>{% endfor %}</table>{% endif %}
</div>
{% if !recent.is_empty() %}<h2>Recently finished</h2>
-<table><tr><th>id</th><th>pkgbase</th><th>state</th><th>error</th></tr>
+<table><tr><th>id</th><th>pkgbase</th><th>version</th><th>kind</th><th>state</th><th>error</th></tr>
{% for b in recent %}<tr><td><a href="/builds/{{ b.id }}">{{ b.id_short }}</a></td>
-<td>{{ b.pkgbase }}</td><td>{{ b.state }}</td><td class="risk-high">{{ b.error }}</td></tr>{% endfor %}</table>{% endif %}
+<td><a href="/packages/{{ b.pkgbase }}">{{ b.pkgbase }}</a></td>
+<td>{{ b.version }}</td><td>{{ b.kind }}</td><td>{{ b.state }}</td><td class="risk-high">{{ b.error }}</td></tr>{% endfor %}</table>{% endif %}
{% endblock %}
diff --git a/testcorpus/dep-client/PKGBUILD b/testcorpus/dep-client/PKGBUILD
new file mode 100644
index 0000000..191c201
--- /dev/null
+++ b/testcorpus/dep-client/PKGBUILD
@@ -0,0 +1,14 @@
+pkgbase=dep-client
+pkgver=1.0
+pkgrel=1
+pkgdesc="synthetic fixture that depends on plain-make"
+url="https://example.invalid/dep-client"
+license=(MIT)
+arch=(x86_64)
+depends=(plain-make)
+build() {
+ echo building dep-client
+}
+package_dep-client() {
+ echo packaging dep-client
+}
diff --git a/testcorpus/dep-client/manifest.json b/testcorpus/dep-client/manifest.json
new file mode 100644
index 0000000..6ea5f3d
--- /dev/null
+++ b/testcorpus/dep-client/manifest.json
@@ -0,0 +1,38 @@
+{
+ "name": "dep-client",
+ "build": "succeed",
+ "sig": true,
+ "packages": [],
+ "installed": [
+ {
+ "name": "glibc",
+ "version": "2.39-1",
+ "arch": "x86_64"
+ },
+ {
+ "name": "pacman",
+ "version": "6.1.0-1",
+ "arch": "x86_64"
+ },
+ {
+ "name": "binutils",
+ "version": "2.42-1",
+ "arch": "x86_64"
+ },
+ {
+ "name": "plain-make",
+ "version": "1.0-1",
+ "arch": "x86_64"
+ }
+ ],
+ "log_lines": [
+ "==> Making package.",
+ "==> Entering fakeroot environment."
+ ],
+ "expect": {
+ "build": "succeed",
+ "packages": [
+ "dep-client"
+ ]
+ }
+} \ No newline at end of file
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index d2582c9..8d5497e 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -228,6 +228,29 @@ pub fn env_with_fixture(name: &str) -> (Env, Fixture) {
(env, fx)
}
+/// Two fixtures sharing one server root, so a test can talk about packages that
+/// depend on each other. The second fixture's manifest wins for the shim, which
+/// is what you want when the second one is the dependent.
+pub fn env_with_two_fixtures(a: &str, b: &str) -> (Env, Fixture, Fixture) {
+ let tmp = tempfile::tempdir().expect("tempdir");
+ let fa = materialize_fixture(tmp.path(), a);
+ let fb = materialize_fixture(tmp.path(), b);
+ let cfg = Config {
+ root: tmp.path().to_path_buf(),
+ signing_key_id: "TESTKEY".into(),
+ path_prepend: Some(shim_dir()),
+ shim_manifest: Some(fb.manifest.clone()),
+ shim_dir: Some(tmp.path().join("shimlog")),
+ ..Config::default()
+ };
+ std::fs::create_dir_all(cfg.shim_dir.as_ref().unwrap()).unwrap();
+ cfg.ensure_dirs().unwrap();
+ let env = Env::with_cfg(tmp, cfg);
+ env.subscribe(a);
+ env.subscribe(b);
+ (env, fa, fb)
+}
+
/// Copy a corpus fixture into a server root: recipe files into a git repo that
/// stands in for AUR, payload files beside it so their bytes can be swapped,
/// and a local upstream repo when the recipe references one.
@@ -421,3 +444,127 @@ pub fn git(dir: &Path, args: &[&str]) -> String {
);
String::from_utf8_lossy(&out.stdout).trim().to_string()
}
+
+// ------------------------------------------------------------- web driver --
+
+/// A tiny HTTP client for the surface tests: keeps the session cookie and the
+/// CSRF token, and hands back status + body.
+pub struct Web {
+ pub env: Env,
+ pub fx: Fixture,
+ #[allow(dead_code)]
+ pub server: aur_build::http::Server,
+ pub cookie: String,
+ pub csrf: String,
+}
+
+pub struct Page {
+ pub status: u16,
+ pub body: String,
+}
+
+impl Web {
+ pub fn new(name: &str) -> Self {
+ Self::with_password(name, "")
+ }
+
+ pub fn with_password(name: &str, password: &str) -> Self {
+ let (mut env, fx) = env_with_fixture(name);
+ env.cfg.password = password.into();
+ Self::attach(env, fx)
+ }
+
+ /// Start a server on an env the test already built (two fixtures, odd
+ /// configs) and pick up the session it hands out.
+ pub fn attach(mut env: Env, fx: Fixture) -> Self {
+ env.cfg.bind = "127.0.0.1:0".into();
+ let server = aur_build::http::spawn(env.cfg.clone(), env.db.clone()).unwrap();
+ let mut web = Self { env, fx, server, cookie: String::new(), csrf: String::new() };
+ let first = web.raw_get("/");
+ web.cookie = first
+ .0
+ .iter()
+ .find(|(k, _)| k == "set-cookie")
+ .and_then(|(_, v)| v.split(';').next().map(|s| s.to_string()))
+ .unwrap_or_default();
+ let body = web.get("/");
+ web.csrf = extract(&body.body, "name=\"csrf\" content=\"", "\"").unwrap_or_default();
+ web
+ }
+
+ /// Subscribe, detect and render a review so an approval can be attempted.
+ pub fn open_review(&self, name: &str) -> aur_build::db::model::CandidateRow {
+ aur_build::watch::detect::check_pkgbase(&self.env.cfg, &self.env.db, name).unwrap();
+ let c = aur_build::review::candidates::pending_candidates(&self.env.db).unwrap().remove(0);
+ aur_build::review::diff::render_and_store(&self.env.db, &self.env.cfg, &c).unwrap();
+ aur_build::review::candidates::candidate_by_id(&self.env.db, c.id).unwrap().unwrap()
+ }
+
+ /// Approve through the library and run the build to publication, so a test
+ /// can talk about "what the index serves" without re-implementing P0.
+ pub fn publish(&self, name: &str) {
+ let c = self.open_review(name);
+ aur_build::review::approve::approve(&self.env.db, "test", c.id, &c.identity_hash, &c.diff_digest, None)
+ .unwrap();
+ let c = aur_build::review::candidates::candidate_by_id(&self.env.db, c.id).unwrap().unwrap();
+ let id = aur_build::pipeline::enqueue_for_candidate(&self.env.cfg, &self.env.db, &c).unwrap();
+ aur_build::pipeline::run(&self.env.cfg, &self.env.db, &id).unwrap();
+ }
+
+ pub fn url(&self, path: &str) -> String {
+ format!("http://{}{}", self.server.addr, path)
+ }
+
+ pub fn raw_get(&self, path: &str) -> (Vec<(String, String)>, String) {
+ let resp = ureq::get(&self.url(path)).set("Cookie", &self.cookie).call();
+ let r = match resp {
+ Ok(r) => r,
+ Err(ureq::Error::Status(_, r)) => r,
+ Err(e) => panic!("GET {path}: {e}"),
+ };
+ let cookie = r.header("set-cookie").map(|s| s.to_string()).unwrap_or_default();
+ (vec![("set-cookie".to_string(), cookie)], r.into_string().unwrap_or_default())
+ }
+
+ pub fn get(&self, path: &str) -> Page {
+ let resp = ureq::get(&self.url(path)).set("Cookie", &self.cookie).call();
+ self.finish(resp, path)
+ }
+
+ pub fn post(&self, path: &str, form: &[(&str, &str)]) -> Page {
+ let resp = ureq::post(&self.url(path)).set("Cookie", &self.cookie).send_form(form);
+ self.finish(resp, path)
+ }
+
+ /// POST with exactly the fields given and nothing added — used to prove the
+ /// CSRF gate refuses a form that omitted the token.
+ pub fn post_bare(&self, path: &str, form: &[(&str, &str)]) -> Page {
+ let resp = ureq::post(&self.url(path)).set("Cookie", &self.cookie).send_form(form);
+ self.finish(resp, path)
+ }
+
+ fn finish(&self, resp: Result<ureq::Response, ureq::Error>, path: &str) -> Page {
+ match resp {
+ Ok(r) => Page { status: r.status(), body: r.into_string().unwrap_or_default() },
+ Err(ureq::Error::Status(code, r)) => Page { status: code, body: r.into_string().unwrap_or_default() },
+ Err(e) => panic!("{path}: {e}"),
+ }
+ }
+}
+
+/// Pull an attribute or meta value out of rendered HTML and undo the escaping
+/// the templates applied — a page is the contract here, so we read it as one.
+pub fn extract(hay: &str, open: &str, close: &str) -> Option<String> {
+ let i = hay.find(open)? + open.len();
+ let rest = &hay[i..];
+ let j = rest.find(close)?;
+ Some(unescape(&rest[..j]))
+}
+
+fn unescape(s: &str) -> String {
+ s.replace("&amp;", "&")
+ .replace("&quot;", "\"")
+ .replace("&lt;", "<")
+ .replace("&gt;", ">")
+ .replace("&#39;", "'")
+}
diff --git a/tests/http.rs b/tests/http.rs
index 20dcbcb..d5387dc 100644
--- a/tests/http.rs
+++ b/tests/http.rs
@@ -8,109 +8,9 @@
mod common;
-use aur_build::db::model::*;
-use aur_build::http::{self, Server};
use aur_build::review::{candidates, diff};
use common::*;
-struct Web {
- env: Env,
- fx: Fixture,
- #[allow(dead_code)]
- server: Server,
- cookie: String,
- csrf: String,
-}
-
-struct Page {
- status: u16,
- body: String,
-}
-
-impl Web {
- fn new(name: &str) -> Self {
- Self::with_password(name, "")
- }
-
- fn with_password(name: &str, password: &str) -> Self {
- let (mut env, fx) = env_with_fixture(name);
- env.cfg.bind = "127.0.0.1:0".into();
- env.cfg.password = password.into();
- let server = http::spawn(env.cfg.clone(), env.db.clone()).unwrap();
- let mut web = Self { env, fx, server, cookie: String::new(), csrf: String::new() };
- // First contact mints the session cookie and the CSRF token.
- let first = web.raw_get("/");
- web.cookie = first
- .0
- .iter()
- .find(|(k, _)| k == "set-cookie")
- .and_then(|(_, v)| v.split(';').next().map(|s| s.to_string()))
- .unwrap_or_default();
- let body = web.get("/");
- web.csrf = extract(&body.body, "name=\"csrf\" content=\"", "\"").unwrap_or_default();
- web
- }
-
- fn url(&self, path: &str) -> String {
- format!("http://{}{}", self.server.addr, path)
- }
-
- fn raw_get(&self, path: &str) -> (Vec<(String, String)>, String) {
- let resp = ureq::get(&self.url(path)).set("Cookie", &self.cookie).call();
- let r = match resp {
- Ok(r) => r,
- Err(ureq::Error::Status(_, r)) => r,
- Err(e) => panic!("GET {path}: {e}"),
- };
- let cookie = r.header("set-cookie").map(|s| s.to_string()).unwrap_or_default();
- (vec![("set-cookie".to_string(), cookie)], r.into_string().unwrap_or_default())
- }
-
- fn get(&self, path: &str) -> Page {
- let resp = ureq::get(&self.url(path)).set("Cookie", &self.cookie).call();
- self.finish(resp, path)
- }
-
- fn post(&self, path: &str, form: &[(&str, &str)]) -> Page {
- let resp = ureq::post(&self.url(path)).set("Cookie", &self.cookie).send_form(form);
- self.finish(resp, path)
- }
-
- fn finish(&self, resp: Result<ureq::Response, ureq::Error>, path: &str) -> Page {
- match resp {
- Ok(r) => Page { status: r.status(), body: r.into_string().unwrap_or_default() },
- Err(ureq::Error::Status(code, r)) => Page { status: code, body: r.into_string().unwrap_or_default() },
- Err(e) => panic!("{path}: {e}"),
- }
- }
-
- /// Subscribe, detect and render a review so an approval can be attempted.
- fn open_review(&self, name: &str) -> CandidateRow {
- aur_build::watch::detect::check_pkgbase(&self.env.cfg, &self.env.db, name).unwrap();
- let c = candidates::pending_candidates(&self.env.db).unwrap().remove(0);
- let dd = diff::render_and_store(&self.env.db, &self.env.cfg, &c).unwrap();
- let _ = dd;
- candidates::candidate_by_id(&self.env.db, c.id).unwrap().unwrap()
- }
-}
-
-fn extract(hay: &str, open: &str, close: &str) -> Option<String> {
- let i = hay.find(open)? + open.len();
- let rest = &hay[i..];
- let j = rest.find(close)?;
- Some(unescape(&rest[..j]))
-}
-
-/// Templates escape attribute values; a test comparing one back to a Rust
-/// string has to undo that.
-fn unescape(s: &str) -> String {
- s.replace("&amp;", "&")
- .replace("&quot;", "\"")
- .replace("&lt;", "<")
- .replace("&gt;", ">")
- .replace("&#39;", "'")
-}
-
#[test]
fn every_surface_renders() {
let web = Web::new("plain-make");
@@ -192,12 +92,10 @@ fn every_post_requires_a_csrf_token() {
let web = Web::new("plain-make");
let c = web.open_review("plain-make");
// A form post with no token at all is refused outright.
- let page = {
- let resp = ureq::post(&web.url(&format!("/reviews/{}/approve", c.id)))
- .set("Cookie", &web.cookie)
- .send_form(&[("identity_hash", "x"), ("diff_digest", "y")]);
- web.finish(resp, "approve")
- };
+ let page = web.post_bare(
+ &format!("/reviews/{}/approve", c.id),
+ &[("identity_hash", "x"), ("diff_digest", "y")],
+ );
assert_eq!(page.status, 403, "a POST without CSRF must be refused");
// And so is one with a token from someone else's session.
let page = web.post(&format!("/reviews/{}/approve", c.id), &[
diff --git a/tests/surfaces.rs b/tests/surfaces.rs
new file mode 100644
index 0000000..659123f
--- /dev/null
+++ b/tests/surfaces.rs
@@ -0,0 +1,177 @@
+//! The §13 surfaces driven by live state, not fixtures of HTML: Attention must
+//! name outdated dependencies, downgrades and blocked builds; the package page
+//! must answer "what does this depend on and what depends on it"; and a manual
+//! rebuild must reuse the approved source identity without asking again (I6).
+
+mod common;
+
+use aur_build::db::{self, builds, model::*};
+use aur_build::pipeline;
+use aur_build::review::candidates;
+use common::*;
+
+#[test]
+fn attention_lists_a_downgrade_when_aur_moves_below_what_we_serve() {
+ let web = Web::new("plain-make");
+ web.publish("plain-make");
+ assert!(!web.get("/attention").body.contains("Downgrades"), "nothing is stale yet");
+
+ // The maintainer reverts their version bump. We still serve the higher one.
+ web.fx.bump(&[("pkgver", "0.9")]);
+ aur_build::watch::detect::check_pkgbase(&web.env.cfg, &web.env.db, "plain-make").unwrap();
+
+ let page = web.get("/attention");
+ assert_eq!(page.status, 200);
+ assert!(page.body.contains("Downgrade"), "no downgrade section: {}", &page.body[..400.min(page.body.len())]);
+ assert!(page.body.contains("0.9"), "the offered version is not shown");
+ assert!(page.body.contains("1.0"), "the served version is not shown");
+}
+
+#[test]
+fn attention_lists_outdated_dependencies_from_the_recorded_world() {
+ let (env, plain, client) = env_with_two_fixtures("plain-make", "dep-client");
+ let web = Web::attach(env, client);
+ web.publish("plain-make");
+ web.publish("dep-client");
+ assert!(
+ !web.get("/attention").body.contains("Outdated:"),
+ "dep-client is fresh right after both were published"
+ );
+
+ // plain-make moves; dep-client was built against the old one.
+ plain.bump(&[("pkgver", "2.0")]);
+ web.publish("plain-make");
+
+ let page = web.get("/attention");
+ assert!(page.body.contains("Outdated:"), "no outdated section: {}", &page.body[..600.min(page.body.len())]);
+ assert!(page.body.contains("dep-client"), "the stale package is not named");
+ assert!(page.body.contains("plain-make"), "the dependency is not named");
+ assert!(page.body.contains("1.0") && page.body.contains("2.0"), "the built-against/now pair is missing");
+}
+
+#[test]
+fn the_package_page_answers_dependencies_and_staleness() {
+ let (env, plain, client) = env_with_two_fixtures("plain-make", "dep-client");
+ let web = Web::attach(env, client);
+ web.publish("plain-make");
+ web.publish("dep-client");
+ plain.bump(&[("pkgver", "2.0")]);
+ web.publish("plain-make");
+
+ let page = web.get("/packages/dep-client");
+ assert_eq!(page.status, 200);
+ assert!(page.body.contains("Depends on"), "no depends block");
+ assert!(page.body.contains("plain-make"), "the dependency is not listed");
+ assert!(page.body.contains("Stale"), "staleness is not shown on the package page");
+
+ // And from the other side: what would a change to plain-make disturb?
+ let other = web.get("/packages/plain-make");
+ assert!(other.body.contains("Needed by"), "no needed-by block");
+ assert!(other.body.contains("dep-client"), "the dependent is not listed");
+ // The timeline is the aur_commit history: one row per release, each linking
+ // into AUR's cgit at that exact commit.
+ assert!(other.body.contains("aur.archlinux.org/cgit/aur.git/tree/?h=plain-make&amp;id="), "no per-release cgit link");
+ assert!(other.body.contains("serving 2.0"), "the summary does not say what is served");
+}
+
+#[test]
+fn a_manual_rebuild_reuses_the_approved_identity_without_a_new_approval() {
+ // I6: rebuilding what is already approved is not a new decision. It must
+ // not create an approval, and it must not need one.
+ let web = Web::new("plain-make");
+ web.publish("plain-make");
+ let approvals_before = web.env.query_i64("SELECT count(*) FROM approval", &[]).unwrap();
+ assert_eq!(approvals_before, 1);
+
+ let res = web.post("/packages/plain-make/rebuild", &[("csrf", &web.csrf)]);
+ assert_eq!(res.status, 200, "rebuild should be accepted: {}", &res.body[..200.min(res.body.len())]);
+ assert!(res.body.contains("no new approval"), "the confirmation does not say why no approval is needed");
+ assert_eq!(
+ web.env.query_i64("SELECT count(*) FROM approval", &[]).unwrap(),
+ approvals_before,
+ "a manual rebuild must not mint an approval"
+ );
+
+ let queued = web
+ .env
+ .query_i64("SELECT count(*) FROM build WHERE kind='manual_rebuild'", &[])
+ .unwrap();
+ assert_eq!(queued, 1, "the rebuild was not queued");
+
+ // Run it: it publishes the same version, still on the one approval.
+ let id: String = web
+ .env
+ .db
+ .read(|c| {
+ use rusqlite::OptionalExtension;
+ c.query_row(
+ "SELECT id FROM build WHERE kind='manual_rebuild'",
+ [],
+ |r| r.get::<_, String>(0),
+ )
+ .optional()
+ .map_err(Into::into)
+ })
+ .unwrap()
+ .unwrap();
+ pipeline::run(&web.env.cfg, &web.env.db, &id).unwrap();
+ let b = builds::get(&web.env.db, &id).unwrap().unwrap();
+ assert_eq!(b.state, build_state::SUCCEEDED, "rebuild failed: {:?}", b.error);
+ assert_eq!(
+ web.env.query_i64("SELECT count(*) FROM approval", &[]).unwrap(),
+ approvals_before,
+ "running a rebuild must not mint an approval either"
+ );
+ assert_eq!(db::index_version(&web.env.db, "plain-make").unwrap().as_deref(), Some("1.0-1"));
+}
+
+#[test]
+fn the_builds_page_names_the_version_and_the_audit_page_records_the_decision() {
+ let web = Web::new("plain-make");
+ web.publish("plain-make");
+ let page = web.get("/builds");
+ assert_eq!(page.status, 200);
+ assert!(page.body.contains("plain-make"), "the build row has no pkgbase");
+ assert!(page.body.contains("1.0-1"), "the build row has no version: {}", &page.body[..600.min(page.body.len())]);
+ assert!(page.body.contains("succeeded") || page.body.contains("Succeeded"), "the finished build is not shown");
+
+ let audit = web.get("/audit");
+ assert!(audit.body.contains("approve"), "the approval is not in the audit log");
+ assert!(audit.body.contains("test") || audit.body.contains("cli"), "no actor recorded");
+}
+
+#[test]
+fn the_subscriptions_page_shows_state_and_last_check() {
+ let web = Web::new("plain-make");
+ web.publish("plain-make");
+ let page = web.get("/subscriptions");
+ assert_eq!(page.status, 200);
+ assert!(page.body.contains("plain-make"), "the subscription is not listed");
+ assert!(page.body.contains("active"), "no state shown");
+ // Pause and remove are per-subscription POSTs, not links that mutate.
+ assert!(page.body.contains("action=\"/subscriptions/pause\""), "no pause form");
+ assert!(page.body.contains("action=\"/subscriptions/remove\""), "no remove form");
+}
+
+#[test]
+fn pausing_a_subscription_stops_detection_and_resuming_starts_it_again() {
+ let web = Web::new("plain-make");
+ web.post("/subscriptions/pause", &[("csrf", &web.csrf), ("pkgbase", "plain-make")]);
+ assert_eq!(
+ web.env.query_i64("SELECT count(*) FROM subscription WHERE state='paused'", &[]),
+ Some(1),
+ "pause did not take"
+ );
+ // A paused pkgbase is not re-detected even when upstream moves.
+ web.fx.bump(&[("pkgver", "3.0")]);
+ let report = aur_build::watch::detect::check_pkgbase(&web.env.cfg, &web.env.db, "plain-make").unwrap();
+ assert!(matches!(report.outcome, aur_build::watch::detect::Outcome::Paused), "a paused subscription was still inspected");
+ assert_eq!(
+ candidates::pending_candidates(&web.env.db).unwrap().len(),
+ 0,
+ "a paused subscription produced a candidate"
+ );
+ web.post("/subscriptions/pause", &[("csrf", &web.csrf), ("pkgbase", "plain-make")]);
+ aur_build::watch::detect::check_pkgbase(&web.env.cfg, &web.env.db, "plain-make").unwrap();
+ assert_eq!(candidates::pending_candidates(&web.env.db).unwrap().len(), 1, "resuming did not restore detection");
+}