diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 09:25:13 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 09:25:13 +0000 |
| commit | bc543e4182d51917fe6bfa608af2c09c8b578671 (patch) | |
| tree | d6bb8f2dbc2a1f5e3924a3b495a3ce7f93328b15 | |
| parent | d9c8402180749df4452dc37febace4d933b8407d (diff) | |
| download | aur-build-bc543e4182d51917fe6bfa608af2c09c8b578671.tar.gz aur-build-bc543e4182d51917fe6bfa608af2c09c8b578671.zip | |
staleness: blocked builds wait properly, and the review answers §10.3 before you approve
Three real defects, all found while writing the tests that pin §10 down:
- **requeue_blocked requeued everything blocked.** The dispatcher sweeps it
every pass, so a build waiting on a package that has not arrived was put back
on the queue, claimed, blocked again, and repeated — a busy loop burning a
claim and a plan step each tick. It now only requeues a build whose every
blocking name is actually in the index. The old pipeline test asserted the
broken behaviour and has been rewritten to assert the correct one.
- **The review page could not warn about missing dependencies, because nothing
ever computed them.** candidates::set_missing_deps existed and was never
called; missing deps were discovered at plan time, i.e. after a human had
already approved. Detection now records them with the same rule the plan step
uses, so the reviewer sees 'the build will block until these are published'
before deciding, and the CLI and the page agree because both read the row.
- **The dependents question was unanswered.** §10.3 asks 'approving this marks N
packages stale'. The review page now says exactly that and names them, from
the same derivation the Attention page uses.
tests/staleness.rs (6 tests) also pins the claims that were easy to fake:
staleness is derived on read — a schema scan asserts no column anywhere stores
it, and withdrawing a dependency flips a dependent from Outdated to Missing
without a single write to the dependent; a blocked build names its blocker on
Attention and is not counted as a failure; a dependency we stopped publishing
reads as missing rather than outdated.
dep-partner added to the corpus so blocked builds are testable end to end.
149 tests pass, clippy clean.
| -rw-r--r-- | .pi/.goals-pool-snapshot.json | 2 | ||||
| -rw-r--r-- | .pi/goals/.goal-ledger-checkpoint.json | 2 | ||||
| -rw-r--r-- | .pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md | 20 | ||||
| -rw-r--r-- | .pi/goals/goal_events.jsonl | 2 | ||||
| -rw-r--r-- | src/db/builds.rs | 41 | ||||
| -rw-r--r-- | src/http/render.rs | 3 | ||||
| -rw-r--r-- | src/http/routes.rs | 1 | ||||
| -rw-r--r-- | src/watch/detect.rs | 29 | ||||
| -rw-r--r-- | templates/review.html | 5 | ||||
| -rw-r--r-- | testcorpus/dep-partner/PKGBUILD | 13 | ||||
| -rw-r--r-- | testcorpus/dep-partner/manifest.json | 33 | ||||
| -rw-r--r-- | tests/pipeline.rs | 14 | ||||
| -rw-r--r-- | tests/staleness.rs | 203 |
13 files changed, 345 insertions, 23 deletions
diff --git a/.pi/.goals-pool-snapshot.json b/.pi/.goals-pool-snapshot.json index d8b4e77..d04a0cb 100644 --- a/.pi/.goals-pool-snapshot.json +++ b/.pi/.goals-pool-snapshot.json @@ -1 +1 @@ -{"version":1,"dirMtimeMs":1794993139578.6387,"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":6879748,"activeSeconds":12788},"sisyphus":false,"createdAt":"2026-11-17T20:43:24.440Z","updatedAt":"2026-11-18T09:12:19.576Z","activePath":".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md","revision":675,"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":"complete","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":"complete","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).","completedAt":"2026-11-18T08:23:18.650Z","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down"}],"completedAt":"2026-11-18T08:24:11.640Z","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a"},{"id":"task-p3","title":"P3 — durability (§8.2, §8.3, §8.4)","status":"complete","subtasks":[{"id":"task-p3-dispatch","title":"Dispatcher actor, worker pool, leases, and reaper","status":"complete","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.","completedAt":"2026-11-18T08:36:46.877Z","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it"},{"id":"task-p3-crash","title":"Cancellation, retry policy, and crash-resume tests against shims (I5)","status":"complete","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'.","completedAt":"2026-11-18T08:47:32.080Z","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si"},{"id":"task-p3-sse","title":"SSE log tail + htmx live builds table","status":"complete","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.","completedAt":"2026-11-18T09:01:22.683Z","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE"}],"completedAt":"2026-11-18T09:03:07.796Z","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai"},{"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-p4-world"}]}
\ No newline at end of file +{"version":1,"dirMtimeMs":1794993903525.6309,"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":7348869,"activeSeconds":13534},"sisyphus":false,"createdAt":"2026-11-17T20:43:24.440Z","updatedAt":"2026-11-18T09:25:03.523Z","activePath":".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md","revision":708,"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":"complete","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":"complete","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).","completedAt":"2026-11-18T08:23:18.650Z","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down"}],"completedAt":"2026-11-18T08:24:11.640Z","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a"},{"id":"task-p3","title":"P3 — durability (§8.2, §8.3, §8.4)","status":"complete","subtasks":[{"id":"task-p3-dispatch","title":"Dispatcher actor, worker pool, leases, and reaper","status":"complete","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.","completedAt":"2026-11-18T08:36:46.877Z","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it"},{"id":"task-p3-crash","title":"Cancellation, retry policy, and crash-resume tests against shims (I5)","status":"complete","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'.","completedAt":"2026-11-18T08:47:32.080Z","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si"},{"id":"task-p3-sse","title":"SSE log tail + htmx live builds table","status":"complete","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.","completedAt":"2026-11-18T09:01:22.683Z","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE"}],"completedAt":"2026-11-18T09:03:07.796Z","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai"},{"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":"complete","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.","completedAt":"2026-11-18T09:12:33.747Z","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo "},{"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-p4-stale"}]}
\ No newline at end of file diff --git a/.pi/goals/.goal-ledger-checkpoint.json b/.pi/goals/.goal-ledger-checkpoint.json index d5ebdbf..34f09a9 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-18T09:04:51.619Z","coveredBytes":12285,"coveredEvents":39,"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-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"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"}]]],"runtimeIndex":[["mwl5tehk-xhe7fk",{"recent":[{"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"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"}],"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"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"}],"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-p4-world","at":"2026-11-18T09:04:51.588Z"}}]]}
\ No newline at end of file +{"version":4,"format":"goal-ledger-checkpoint","createdAt":"2026-11-18T09:14:30.209Z","coveredBytes":12716,"coveredEvents":41,"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-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo ","at":"2026-11-18T09:12:33.748Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","at":"2026-11-18T09:14:30.194Z"}]]],"runtimeIndex":[["mwl5tehk-xhe7fk",{"recent":[{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo ","at":"2026-11-18T09:12:33.748Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","at":"2026-11-18T09:14:30.194Z"}],"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"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2-surfaces","evidence":"tests/surfaces.rs (7 tests): attention_lists_outdated_dependencies_from_the_recorded_world (dep-client stale after plain-make moves, dependency + built-against + now all named); attention_lists_a_down","at":"2026-11-18T08:23:18.652Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p2","evidence":"All four P2 children complete: tiny_http server + CSRF/session gate, inbox with the full eight-panel diff set, optimistic-concurrency approve/reject with 409-on-stale and per-item bulk confirmation, a","at":"2026-11-18T08:24:11.640Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","at":"2026-11-18T08:25:05.524Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-dispatch","evidence":"src/pipeline/dispatch.rs + tests/dispatch.rs (9 tests): claim_batch runs SELECT+UPDATE in one BEGIN IMMEDIATE tx (db.writer.tx uses TransactionBehavior::Immediate); an_expired_lease_is_requeued_and_it","at":"2026-11-18T08:36:46.878Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","at":"2026-11-18T08:38:10.587Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-crash","evidence":"tests/crash.rs (4 tests): a_process_killed_mid_step_resumes_from_its_checkpoints_with_no_duplicate_work spawns the real aur-build binary, has a shim SIGKILL it inside the build step (asserts status.si","at":"2026-11-18T08:47:32.080Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","at":"2026-11-18T08:48:58.608Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"},{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo ","at":"2026-11-18T09:12:33.748Z"},{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","at":"2026-11-18T09:14:30.194Z"}],"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-p4-stale","at":"2026-11-18T09:14:30.194Z"}}]]}
\ 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 8d9e24f..261e5c0 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": 6879748, - "activeSeconds": 12788 + "tokensUsed": 7348869, + "activeSeconds": 13534 }, "sisyphus": false, "createdAt": "2026-11-17T20:43:24.440Z", - "updatedAt": "2026-11-18T09:12:19.576Z", + "updatedAt": "2026-11-18T09:25:03.523Z", "activePath": ".pi/goals/active_goal_2026111720432444_mwl5tehk-xhe7fk.md", - "revision": 675, + "revision": 708, "scheduler": { "version": 1, "owner": "01a1eb32-2e3f-757c-a79a-21ac993facc5", @@ -212,8 +212,10 @@ { "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." + "status": "complete", + "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.", + "completedAt": "2026-11-18T09:12:33.747Z", + "evidence": "src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo " }, { "id": "task-p4-stale", @@ -245,7 +247,7 @@ "blockCompletion": true, "proposedAt": "2026-11-17T20:39:23.165Z" }, - "currentTaskId": "task-p4-world" + "currentTaskId": "task-p4-stale" } # Goal Prompt @@ -278,8 +280,8 @@ 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: 3h33m08s -- Tokens used: 6.9M (6,879,748) tokens +- Time spent: 3h45m34s +- Tokens used: 7.3M (7,348,869) tokens ## Tasks <!-- blockCompletion: true --> diff --git a/.pi/goals/goal_events.jsonl b/.pi/goals/goal_events.jsonl index f4c6307..1dedff7 100644 --- a/.pi/goals/goal_events.jsonl +++ b/.pi/goals/goal_events.jsonl @@ -37,3 +37,5 @@ {"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3-sse","evidence":"tests/live.rs (5 tests): the_log_stream_delivers_bytes_as_they_are_appended_and_then_ends — a producer thread appends to the log while the SSE stream is open and the reader must see those bytes BEFORE","at":"2026-11-18T09:01:22.685Z"} {"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p3","evidence":"All three P3 children complete: dispatcher/worker pool/reaper with BEGIN IMMEDIATE claims and disk-headroom backpressure (e27e90a), a real SIGKILL mid-step crash test plus the approved_but_unbuilt fai","at":"2026-11-18T09:03:07.796Z"} {"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","at":"2026-11-18T09:04:51.588Z"} +{"type":"task_complete","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-world","evidence":"src/pkginfo.rs is now the production home for tar+text parsing (no libalpm); shims delegate to it and steps.rs uses it. tests/world.rs (5 tests) builds real .pkg.tar.zst archives and asserts: pkginfo ","at":"2026-11-18T09:12:33.748Z"} +{"type":"task_started","goalId":"mwl5tehk-xhe7fk","taskId":"task-p4-stale","at":"2026-11-18T09:14:30.194Z"} diff --git a/src/db/builds.rs b/src/db/builds.rs index 27fa23b..3770746 100644 --- a/src/db/builds.rs +++ b/src/db/builds.rs @@ -221,12 +221,43 @@ pub fn block_on(db: &Db, id: &str, blocked_on: &[String]) -> Result<()> { } /// Re-check blocked builds whenever a publish lands (§10.4). +/// Requeue blocked builds whose blocking packages have since arrived (§10.4). +/// +/// Not "requeue everything that is blocked": the dispatcher calls this every +/// pass, and requeueing a build that will immediately block again is a busy loop +/// that burns a claim and a plan step each tick. A build only goes back on the +/// queue when every name it is waiting for is actually in the index now. pub fn requeue_blocked(db: &Db) -> Result<usize> { - db.writer.tx(|tx| { - let n = tx.execute( - "UPDATE build SET state='queued', updated_at=?1 WHERE state='blocked_missing_dep'", - params![time::now()], - )?; + let now = time::now(); + db.writer.tx(move |tx| { + let rows: Vec<(String, String)> = { + let mut stmt = tx.prepare("SELECT id, blocked_on_json FROM build WHERE state='blocked_missing_dep'")?; + let out = stmt + .query_map([], |r| Ok((r.get::<_, String>(0)?, r.get::<_, String>(1)?)))? + .filter_map(|x| x.ok()) + .collect(); + out + }; + let mut n = 0; + for (id, blocked_on) in rows { + let waiting: Vec<String> = serde_json::from_str(&blocked_on).unwrap_or_default(); + let satisfied = waiting.iter().all(|name| { + tx.query_row( + "SELECT count(*) FROM package WHERE name=?1 AND state='in_index'", + params![name], + |r| r.get::<_, i64>(0), + ) + .unwrap_or(0) + > 0 + }); + if satisfied && !waiting.is_empty() { + tx.execute( + "UPDATE build SET state='queued', blocked_on_json='[]', updated_at=?1 WHERE id=?2", + params![now, id], + )?; + n += 1; + } + } Ok(n) }) } diff --git a/src/http/render.rs b/src/http/render.rs index 057ea14..ca3ba51 100644 --- a/src/http/render.rs +++ b/src/http/render.rs @@ -140,6 +140,9 @@ pub struct ReviewHead { pub risk: String, pub signals: Vec<String>, pub missing_deps: Vec<String>, + /// §10.3: "approving this marks N packages stale" — the packages of ours + /// whose own recipes name one of the packages this candidate produces. + pub dependents: Vec<String>, pub revision: i64, pub aur_commit: String, pub aur_commit_short: String, diff --git a/src/http/routes.rs b/src/http/routes.rs index 177ffcd..26aaa89 100644 --- a/src/http/routes.rs +++ b/src/http/routes.rs @@ -284,6 +284,7 @@ fn review_body( risk: c.risk_level.clone(), signals: c.risk_signals(), missing_deps: c.missing_deps(), + dependents: crate::watch::staleness::dependents_of(db, &c.pkgbase).unwrap_or_default(), revision: c.revision, aur_commit: snapshot.as_ref().map(|s| s.aur_commit.clone()).unwrap_or_default(), aur_commit_short: snapshot diff --git a/src/watch/detect.rs b/src/watch/detect.rs index 55b7543..3134e19 100644 --- a/src/watch/detect.rs +++ b/src/watch/detect.rs @@ -258,6 +258,35 @@ fn score( if let Ok(a) = crate::review::risk::assess(db, cfg, pb, recipe, digests, accepted) { let _ = crate::review::candidates::set_risk(db, id, &a.level, &a.signals); } + // Record now what would block the build later, using the same rule the plan + // step uses. A reviewer approving a package whose dependencies we have not + // published yet should see that before they approve it, not as a blocked + // build afterwards (§10.4). + let missing = missing_deps(db, pb, recipe); + let _ = crate::review::candidates::set_missing_deps(db, id, &missing); +} + +/// Dependencies that are ours to publish but are not in the index yet. +fn missing_deps(db: &Db, pb: &Pkgbase, recipe: &Recipe) -> Vec<String> { + let ours = match db::our_package_names(db) { + Ok(o) => o, + Err(_) => return Vec::new(), + }; + let mut out = Vec::new(); + for dep in crate::pkgver::dep_names(&recipe.depends) { + if ours.contains(&dep) || dep == pb.name || recipe.pkgnames.contains(&dep) { + continue; + } + let ours_to_publish = db::get_subscription(db, &dep) + .map(|s| s.is_some()) + .unwrap_or(false) + || db::get_pkgbase(db, &dep).map(|p| p.is_some()).unwrap_or(false); + if ours_to_publish { + out.push(dep); + } + } + out.sort(); + out } fn outcome_of(up: Upsert) -> Outcome { diff --git a/templates/review.html b/templates/review.html index 32441f9..e61482b 100644 --- a/templates/review.html +++ b/templates/review.html @@ -17,6 +17,11 @@ diff is measured against.</p> </div>{% endif %} {% if !c.signals.is_empty() %}<div class="card"><b>Risk signals</b><br> {% for s in c.signals %}<span class="tag risk-high">{{ s }}</span> {% endfor %}</div>{% endif %} +{% if !c.dependents.is_empty() %}<div class="card"><b>This will mark {{ c.dependents.len() }} package(s) stale</b> +<p class="mut">These are ours and their recipes name this one, so publishing changes what they were +built against. Nothing rebuilds automatically (§10) — they will appear on Attention until you +rebuild them.</p> +<p>{% for d in c.dependents %}<a class="tag" href="/packages/{{ d }}">{{ d }}</a> {% endfor %}</p></div>{% endif %} {% if !c.missing_deps.is_empty() %}<div class="card"><b>Missing dependencies</b> <p>The build will block until these are published: {% for d in c.missing_deps %}<span class="tag">{{ d }}</span> {% endfor %}</p></div>{% endif %} {% if c.is_first %} diff --git a/testcorpus/dep-partner/PKGBUILD b/testcorpus/dep-partner/PKGBUILD new file mode 100644 index 0000000..641b400 --- /dev/null +++ b/testcorpus/dep-partner/PKGBUILD @@ -0,0 +1,13 @@ +pkgbase=dep-partner +pkgver=1.0 +pkgrel=1 +pkgdesc="synthetic fixture that missing-dep waits for" +url="https://example.invalid/dep-partner" +license=(MIT) +arch=(x86_64) +build() { + echo building dep-partner +} +package_dep-partner() { + echo packaging dep-partner +} diff --git a/testcorpus/dep-partner/manifest.json b/testcorpus/dep-partner/manifest.json new file mode 100644 index 0000000..72a1ecb --- /dev/null +++ b/testcorpus/dep-partner/manifest.json @@ -0,0 +1,33 @@ +{ + "name": "dep-partner", + "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" + } + ], + "log_lines": [ + "==> Making package.", + "==> Entering fakeroot environment." + ], + "expect": { + "build": "succeed", + "packages": [ + "dep-partner" + ] + } +}
\ No newline at end of file diff --git a/tests/pipeline.rs b/tests/pipeline.rs index 1ad1dfd..5a2fa5a 100644 --- a/tests/pipeline.rs +++ b/tests/pipeline.rs @@ -307,18 +307,18 @@ fn an_unresolvable_dependency_blocks_instead_of_failing() { } #[test] -fn publishing_a_dependency_requeues_what_it_unblocks() { +fn a_blocked_build_waits_until_its_dependency_actually_arrives() { let (env, _fx) = env_with_fixture("missing-dep"); env.subscribe("dep-partner"); let c = approve_fixture(&env, "missing-dep"); assert!(matches!(run_for(&env, &c), pipeline::Outcome::Blocked { .. })); assert_eq!(builds::blocked_builds(&env.db).unwrap().len(), 1); - // Something lands in the index: blocked builds get another look (§10.4). - let n = publish::reconcile(&env.cfg, &env.db).unwrap_or(0); - let _ = n; - let requeued = builds::requeue_blocked(&env.db).unwrap(); - assert_eq!(requeued, 1); - assert_eq!(builds::blocked_builds(&env.db).unwrap().len(), 0); + // The dispatcher sweeps blocked builds every pass. Requeueing one whose + // blocker is still missing would block again immediately — a busy loop that + // burns a claim and a plan step each tick — so it must stay put. + let _ = publish::reconcile(&env.cfg, &env.db); + assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "requeued while still blocked"); + assert_eq!(builds::blocked_builds(&env.db).unwrap().len(), 1); } #[test] diff --git a/tests/staleness.rs b/tests/staleness.rs new file mode 100644 index 0000000..c99c666 --- /dev/null +++ b/tests/staleness.rs @@ -0,0 +1,203 @@ +//! Staleness, blocked builds and the dependents question (§10). +//! +//! The design's position is that staleness is a fact to be shown, not a state to +//! be stored: there is no automatic rebuild engine, and no `stale` column, because +//! a stored flag goes wrong the moment anything else is published and something +//! else always is. These tests pin that down — including the part that is easy to +//! fake, which is that the derivation is real and not a cached answer. + +mod common; + +use aur_build::db::{builds, model::*}; +use aur_build::pipeline; +use aur_build::review::{candidates, diff}; +use aur_build::watch::staleness; +use common::*; + +fn approved(env: &Env, name: &str) -> CandidateRow { + aur_build::watch::detect::check_pkgbase(&env.cfg, &env.db, name).unwrap(); + let c = candidates::pending_candidates(&env.db).unwrap().remove(0); + let dd = diff::render_and_store(&env.db, &env.cfg, &c).unwrap(); + let c = candidates::candidate_by_id(&env.db, c.id).unwrap().unwrap(); + aur_build::review::approve::approve(&env.db, "t", c.id, &c.identity_hash, &dd, None).unwrap(); + candidates::candidate_by_id(&env.db, c.id).unwrap().unwrap() +} + +fn publish(env: &Env, name: &str) { + let c = approved(env, name); + let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); + pipeline::run(&env.cfg, &env.db, &id).unwrap(); +} + +#[test] +fn staleness_is_derived_on_read_and_nothing_stores_it() { + let (env, plain, client) = env_with_two_fixtures("plain-make", "dep-client"); + publish(&env, "plain-make"); + publish(&env, "dep-client"); + assert!(staleness::stale_rows(&env.db).unwrap().is_empty(), "both were just published"); + + plain.bump(&[("pkgver", "2.0")]); + publish(&env, "plain-make"); + + let stale = staleness::stale_rows(&env.db).unwrap(); + assert_eq!(stale.len(), 1, "dep-client should be stale: {stale:?}"); + assert_eq!(stale[0].pkgbase, "dep-client"); + assert_eq!(stale[0].dependency, "plain-make"); + assert_eq!(stale[0].built_with, "1.0-1"); + assert_eq!(stale[0].now, "2.0-1"); + + // "Derived purely on read" has to mean there is nowhere for a stale answer to + // hide. No column on any table stores it. + let cols: Vec<String> = env + .db + .read(|c| { + let mut st = c.prepare( + "SELECT m.name || '.' || p.name FROM sqlite_master m, pragma_table_info(m.name) p + WHERE m.type='table' AND p.name LIKE '%stale%'", + )?; + let out = st.query_map([], |r| r.get::<_, String>(0))?.filter_map(|x| x.ok()).collect(); + Ok(out) + }) + .unwrap(); + assert!(cols.is_empty(), "staleness must not be persisted anywhere: {cols:?}"); + + // The answer tracks the index, not any stored flag: withdrawing plain-make + // changes what is true about dep-client without touching dep-client at all. + pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap(); + let after = staleness::stale_rows(&env.db).unwrap(); + assert!( + after.iter().any(|s| s.pkgbase == "dep-client" && s.kind == staleness::Kind::Missing), + "withdrawing the dependency should flip the answer to missing: {after:?}" + ); + // And nothing about dep-client was written to make that happen. + assert_eq!( + env.query_i64("SELECT count(*) FROM release WHERE pkgbase_id=(SELECT id FROM pkgbase WHERE name='dep-client')", &[]), + Some(1), + "the dependent was untouched by its dependency moving" + ); + let _ = client; +} + +#[test] +fn a_missing_dependency_blocks_the_build_and_names_the_blocker_everywhere() { + let (env, fx, _partner) = env_with_two_fixtures("missing-dep", "dep-partner"); + // dep-partner is a package we intend to publish but have not yet: the build + // cannot run, and that is a fact to report rather than a failure to retry. + let c = approved(&env, "missing-dep"); + assert_eq!(c.missing_deps(), vec!["dep-partner".to_string()], "the review must warn before approving"); + let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); + let out = pipeline::run(&env.cfg, &env.db, &id).unwrap(); + assert!(matches!(out, pipeline::Outcome::Blocked { .. }), "{out:?}"); + + let b = builds::get(&env.db, &id).unwrap().unwrap(); + assert_eq!(b.state, build_state::BLOCKED_MISSING_DEP); + let blocked_on: Vec<String> = serde_json::from_str(&b.blocked_on_json).unwrap(); + assert_eq!(blocked_on, vec!["dep-partner".to_string()]); + // Blocked is not failed: nothing went wrong with the build itself. + assert_eq!(env.query_i64("SELECT count(*) FROM build WHERE state='failed'", &[]), Some(0)); + + // It shows on Attention with the blocker named, not just "something is wrong". + let web = Web::attach(env, fx); + let page = web.get("/attention"); + assert!(page.body.contains("Blocked builds"), "no blocked section: {}", &page.body[..600.min(page.body.len())]); + assert!(page.body.contains("dep-partner"), "the blocking pkgbase is not named"); + assert!(page.body.contains("missing-dep"), "the blocked package is not named"); +} + +#[test] +fn a_blocked_build_waits_and_is_requeued_only_when_the_blocker_arrives() { + let (env, fx, _partner) = env_with_two_fixtures("missing-dep", "dep-partner"); + let c = approved(&env, "missing-dep"); + let id = pipeline::enqueue_for_candidate(&env.cfg, &env.db, &c).unwrap(); + let _ = fx; + pipeline::run(&env.cfg, &env.db, &id).unwrap(); + assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::BLOCKED_MISSING_DEP); + + // The dispatcher sweeps blocked builds every pass. Requeueing one that will + // immediately block again is a busy loop, so it must stay put. + assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "requeued while still blocked"); + assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::BLOCKED_MISSING_DEP); + + // Publishing dep-partner is what unblocks it. A build that was blocked and + // can now run is not a new decision — a human already approved it (§10). + publish(&env, "dep-partner"); + assert!( + aur_build::db::our_package_names(&env.db).unwrap().contains("dep-partner"), + "dep-partner should be in the index now: {:?}", + aur_build::db::our_package_names(&env.db) + ); + // Publishing the blocker requeues what was waiting on it — the publish path + // sweeps blocked builds itself, so an explicit call afterwards is a no-op. + assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::QUEUED, "the blocker arrived and the build stayed blocked"); + assert_eq!(builds::requeue_blocked(&env.db).unwrap(), 0, "nothing left to requeue"); + + // And it now runs to completion. + pipeline::run(&env.cfg, &env.db, &id).unwrap(); + assert_eq!(builds::get(&env.db, &id).unwrap().unwrap().state, build_state::SUCCEEDED); + assert!(aur_build::db::index_version(&env.db, "missing-dep").unwrap().is_some()); +} + +#[test] +fn the_review_page_warns_about_missing_deps_before_approval() { + let (env, fx, _partner) = env_with_two_fixtures("missing-dep", "dep-partner"); + aur_build::watch::detect::check_pkgbase(&env.cfg, &env.db, "missing-dep").unwrap(); + let c = candidates::pending_candidates(&env.db).unwrap().remove(0); + diff::render_and_store(&env.db, &env.cfg, &c).unwrap(); + + let web = Web::attach(env, fx); + let page = web.get(&format!("/reviews/{}", c.id)); + assert!(page.body.contains("Missing dependencies"), "no warning: {}", &page.body[..600.min(page.body.len())]); + assert!(page.body.contains("dep-partner"), "the missing dep is not named"); +} + +#[test] +fn the_review_page_answers_what_approving_this_would_disturb() { + // §10.3: "approving this marks N packages stale". A reviewer approving a + // plain-make bump needs to know that dep-client is about to need a rebuild. + let (env, plain, _client) = env_with_two_fixtures("plain-make", "dep-client"); + publish(&env, "plain-make"); + publish(&env, "dep-client"); + plain.bump(&[("pkgver", "2.0")]); + aur_build::watch::detect::check_pkgbase(&env.cfg, &env.db, "plain-make").unwrap(); + let c = candidates::pending_candidates(&env.db).unwrap().remove(0); + diff::render_and_store(&env.db, &env.cfg, &c).unwrap(); + + let web = Web::attach(env, plain); + let page = web.get(&format!("/reviews/{}", c.id)); + assert!( + page.body.contains("will mark 1 package(s) stale"), + "the dependents question is not answered: {}", + &page.body[..800.min(page.body.len())] + ); + assert!(page.body.contains("dep-client"), "the dependent is not named"); + + // And the same answer is available without the UI. + assert_eq!(staleness::dependents_of(&web.env.db, "plain-make").unwrap(), vec!["dep-client".to_string()]); + // Approving it does not rebuild anything by itself (§10: no rebuild engine). + assert_eq!(web.env.query_i64("SELECT count(*) FROM build", &[]), Some(2), "one build per published package"); +} + +#[test] +fn a_dependency_we_stopped_publishing_shows_as_missing_not_outdated() { + let (env, _plain, client) = env_with_two_fixtures("plain-make", "dep-client"); + publish(&env, "plain-make"); + publish(&env, "dep-client"); + // Withdraw plain-make from the index: dep-client was built against it and now + // depends on something we no longer serve. + pipeline::publish::withdraw_package(&env.cfg, &env.db, "plain-make").unwrap(); + + let stale = staleness::stale_rows(&env.db).unwrap(); + let missing: Vec<_> = stale + .iter() + .filter(|s| s.kind == staleness::Kind::Missing) + .cloned() + .collect(); + assert_eq!(missing.len(), 1, "withdrawal should read as missing: {stale:?}"); + assert_eq!(missing[0].pkgbase, "dep-client"); + assert_eq!(missing[0].dependency, "plain-make"); + + let web = Web::attach(env, client); + let page = web.get("/attention"); + assert!(page.body.contains("Missing:"), "no missing section: {}", &page.body[..600.min(page.body.len())]); + assert!(page.body.contains("dep-client")); +} |
