summaryrefslogtreecommitdiffstats
path: root/src/db/queries.rs
Commit message (Collapse)AuthorAgeFilesLines
* pipeline: a real process kill, and the failure state the UI must show ↵aur-build13 days1-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (§8.4, I5) The crash-resume invariant was only ever simulated before: an in-process fault hook returns an error, and an error can be caught, unwound and cleaned up by accident. So the shims gained AUR_SHIM_KILL_PARENT — the named tool SIGKILLs the process running the pipeline, mid-step, with no Drop and no atexit. The test spawns the real aur-build binary, watches it die of SIGKILL inside the build step, and then asserts the things that matter: - the database is intact, because no transaction ever spans a build step - the completed steps are checkpointed succeeded and the running one is recorded running - after the lease expires the reaper requeues it and marks the step interrupted - resuming publishes exactly one release, and the shim invocation log proves mkarchroot ran once, makechrootpkg twice (crash + resume, not twice per attempt) and repo-add once **This found a real bug.** reap_expired only matched state='leased', but a worker sets state='running' the moment it starts a step, so a process that dies mid-step leaves a running row — and every real crash would have been stranded forever. The reaper now reaps leased and running. Also §8.4's other half, which was a comment rather than a feature: a failed build must not leave the old version looking healthy. db::approved_but_unbuilt finds approvals whose build failed and never published, and Attention and the package page now say 'v2 approved, build failed, index still serving v1' with a link to the log. Retrying is an explicit, audited POST, not something the system does to itself. Cancellation is asserted to be cooperative at a step boundary: a cancelled build runs no steps, publishes nothing, and is not counted as a failure.
* review: complete the §6 panel set — source, dependency, build-env, ↵aur-build13 days1-1/+39
| | | | | | | | | | | | | | | | | | | | | | install-hook A reviewer deciding 'is this safe to serve to every installer' needs more than the recipe text. These four panels answer the questions the recipe diff hides: - source delta: added/removed entries, NEW SOURCE HOSTS (the classic supply-chain shape), a checksum that became SKIP, validpgpkeys dropped - dependency delta: per-array add/remove plus 'tests will no longer run' when checkdepends empties out - build-env delta: options, arch, pkgbase rename, split-package set changes - install-script delta: .install hooks are code that runs on every consumer machine, so a change to build()/package() bodies is called out explicitly All panels compare the accepted release against the candidate (I2); a first introduction still gets the whole recipe instead of a diff (I2b). Also: index_packages now carries artifact size and published_at so the index page shows real numbers.
* review: advisory risk scoring and non-publishable change handling (§6, ↵aur-build13 days1-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | §5.3, I11) Every candidate is scored against the recipe the accepted release was actually built from (release -> candidate -> snapshot), never against 'last seen'. Signals: SKIP on a non-VCS source, a sum changed to SKIP, new source host, --skippgpcheck, removed validpgpkeys, new makedepends and fetching build tools (cargo/npm/go/pip), .install scripts, weakened options, removed checkdepends, pkgrel reset, epoch bump, downgrade, a diff touching build()/package() bodies rather than metadata, upstream ranges that touch a build-system file, and first introduction. Advisory only — there is no auto-approval, so a wrong score costs attention and never safety (§7.3). Fixes a fixture bug the new tests exposed: digest-drift and skip-checksum declared bare paths as sources, which parse as local recipe files rather than remote downloads, so the drift path never fired. They now use file:// URLs like a real remote would. tests/notices.rs: integrity_alert is high severity and leaves no candidate, pin_drift is informational, recipe drift under a static version is a warning, SKIP-on-non-VCS is a high risk signal, repeated polling of one drift is one notice, and an I11 sweep over twelve fixtures proving a change is never silently dropped.
* watch: two-stage VCS watcher — ls-remote probe, pkgver() resolution, pin ↵aur-build13 days1-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | capture (§5.2) Stage A probes every VCS source in source=() with git ls-remote, respecting #commit/#tag/#branch fragments, and returns one UpstreamPin per source. If the tip set equals the accepted release's pins, nothing can have changed and Stage B never runs — the common case costs one round trip per source and no clone. svn/hg have no cheap universal probe, so they are reported as unprobed and force Stage B rather than being silently treated as unchanged. Stage B runs only on movement: it fetches into a persistent vcs_cache (rather than re-cloning a multi-gigabyte upstream daily), runs makepkg --vercheck, and captures the pins from the clone it already has. Results are cached on (pkgbase, recipe_hash, upstream_tip) with a per-pkgbase cooldown, and a process-wide slot cap bounds concurrent resolutions. The resolved epoch:pkgver-pkgrel plus the pins go into identity_hash, so a different commit is a different thing to approve. Also fixes a misclassification the new path exposed: a VCS source's digest is its pin, so upstream movement showed up as an integrity_alert. Integrity events are now restricted to fixed downloads; VCS movement under a frozen pkgver is pin_drift, as §5.2 specifies. New fixtures git-multi (two upstreams) and git-tagged (#tag pin). 10 tests in tests/vcs.rs.
* feat: SQLite schema, migrations, single writer actoraur-build14 days1-0/+808
The §11 data model as four migrations, plus the §11a concurrency model: one writer thread owning the write connection (mutations arrive as closures over a crossbeam channel, so SQLITE_BUSY is not part of the design) and thread-local read-only connections under WAL. Invariants that are database guarantees rather than conventions: I7 partial unique index -> at most one pending_review per pkgbase I3 UNIQUE(pkgbase_id, identity_hash) -> no duplicate candidates I10 audit table rejects UPDATE and DELETE by trigger §16 current_accepted_release_id moves only by compare-and-swap Also: vercmp + dependency-string parsing (ALPM algorithm, no libalpm), hash helpers including recipe_hash over the whole AUR tree, the clock helper that stamps every write, and the config/root layout. Part of P0 (DESIGN.md §17).