| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(§10.1)
Ingest decides what the index claims about a package and what the world
snapshot records by reading two text files out of a tar inside a zstd stream.
That code was living in src/shims — the test harness — which meant production
depended on the harness for its view of a package's own metadata. Moved to
src/pkginfo.rs, with the shim now delegating to it so the harness and the
production path cannot disagree about what a package says about itself.
Still no libalpm: tar + zstd + eighty lines of key = value parsing. Unknown keys
are ignored rather than rejected, because makepkg adds fields over time and a new
one must not stop us publishing.
**The parser had a real bug.** A .BUILDINFO installed block puts its first entry
on the same line as the key:
installed = glibc 2.39-1 x86_64 -
gmp 6.3.0-1 x86_64 -
The old code skipped the header line, so the first dependency was silently
dropped from every snapshot — exactly the kind of gap that makes staleness
quietly wrong. The header line is parsed now.
tests/world.rs builds real .pkg.tar.zst files and asserts the fields come out of
the archive: repeated keys stay lists, an archive with no .PKGINFO is refused
rather than defaulted from the filename, and the world snapshot contains our own
packages and none of glibc/pacman/binutils. The empty-snapshot case for a first
build is asserted too — nothing of ours existed yet, and recording that honestly
beats inventing a world.
Split pkgbases produce one approval, one release and N index rows each with its
own artifact, asserted directly here. 143 tests pass, clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GET /builds/:id/log.stream serves the build log as server-sent events from a
blocking std::io::Read polled by the connection's thread — no async runtime,
no timer wheel. The pipeline appends to a plain file and never learns the
reader exists, so a viewer that hangs up, stalls or never shows up cannot slow
a build by a microsecond. The stream ends when the build reaches a terminal
state instead of holding a connection open forever, and there is a 30-minute
lifetime cap so a wedged build cannot wedge a browser tab indefinitely.
The test proves it is actually live rather than buffered: a producer thread
appends while the stream is open, and the reader must see those bytes before
the build finishes, then see the end event.
The builds table refreshes with hx-trigger="every 3s" against a fragment
endpoint, so htmx swaps one <div> rather than a whole document. Without
JavaScript the same HTML already contains the table — the refresh is an
enhancement, never a requirement.
Static assets are served from include_bytes!, precompressed, with the
Content-Length forced so tiny_http does not chunk a file whose size we know.
Vendoring decision, recorded in docs/DECISIONS.md: the design's '~14 KB htmx'
does not exist — released htmx is 48 KB minified. We vendor 1.9.12 unmodified
and serve the 15.6 KB gzip, and the budget is asserted on served bytes with a
bare-socket test, because an HTTP client would transparently decompress and
hide the number. htmx's SSE extension is deliberately NOT vendored: it swaps
with innerHTML and a build log is untrusted text from someone else's PKGBUILD,
so wiring it up would be an XSS hole opened to make a log scroll by itself.
The review surface still ships no JavaScript at all, asserted by grepping the
rendered page for <script.
Also: styles moved out of base.html into static/app.css, and docs/DECISIONS.md
started with the decisions made so far. 138 tests pass, clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(§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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
One dispatcher thread, N workers, one crossbeam channel between them. The
dispatcher loop is reap -> cancel -> claim -> send, and the reaper runs first
on every pass including the first, so 'recover from a crash' and 'notice an
expired lease' are literally the same code path. There is no startup recovery
routine to get wrong.
- claim_batch does the SELECT and the UPDATE in one BEGIN IMMEDIATE
transaction. SQLite has no SKIP LOCKED, but with exactly one writer the
claim cannot race: nobody can see a row between the two statements.
- Backpressure is min(max_concurrent_builds - in_flight, disk headroom),
measured with statvfs. A build that cannot fit on disk stays queued instead
of filling the filesystem halfway through a compile.
- Retry policy (§8.4): transient failures (IO, HTTP) requeue up to
max_transient_attempts; a deterministic build failure is never retried, and
the release stays approved_but_unbuilt so the old version never looks
healthy. Tests assert attempt==1 for build-fails and attempt==3 for a
transient one.
- A superseded candidate sets cancel_requested on in-flight builds; the worker
stops at the step boundary rather than mid-step, which is what keeps the
checkpoints honest.
- Publish takes a process-wide lock so two workers cannot interleave the index
rewrite. The critical section is the db file rewrite, never a build.
- The deterministic build id makes re-enqueue an INSERT OR IGNORE no-op, so a
careless 'rebuild that again' is harmless.
tests/dispatch.rs drives the real threads: the pool takes a queued build all
the way to publication, a reaped build resumes from its checkpoints without
re-running makechrootpkg, and backpressure admits exactly one build per slot.
Serve now starts the pool alongside the watcher and the HTTP server.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(I6)
Attention, the package page and the builds page now answer real questions
instead of rendering empty tables:
- Attention lists outdated dependencies derived from the recorded world
snapshots, naming the dependency that moved, what the artifact was built
against and what the index holds now; also missing dependencies and
downgrades (AUR offering a lower version than we serve), which is an
announcement for a human, not a build request.
- The package page shows depends-on from the recipe we actually serve and
needed-by from the packages whose recipes name it, plus staleness and the
aur_commit timeline, each release linking into cgit at that exact commit.
- Builds rows carry the version they are about, in both the live and the
recently-finished table.
- A manual rebuild reuses the approved source identity and mints no approval
(I6); the test asserts the approval count is unchanged before and after the
rebuild runs.
- A paused subscription is not observed at all: detection returns Paused
without polling, so pausing a broken package stops it opening reviews.
- Staleness stays computed on read (§10.2). Nothing stores a stale flag, so
nothing can serve a stale lie.
Also: dep-client fixture added for dependency pairs.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
§13)
tiny_http, thread-per-connection, askama templates. Every §13 surface is
server-rendered HTML that works with scripts switched off: Inbox, review
detail with the full panel set, Builds, Attention, Index, Subscriptions,
Ops/audit, Settings.
The parts that are easy to get wrong:
- Handlers read through thread-local READ-ONLY connections. They cannot
take the write lock even by accident, so a slow page render never blocks
the build pipeline's writer. tests/http.rs asserts this by trying to
write through a read connection and requiring failure.
- Every POST requires a CSRF token derived from the session id. Logout
drops the session, which invalidates every form still open in a browser.
- Approve carries identity_hash AND diff_digest (§7.1a). If either has
moved, the approval is refused with 409 and the page re-renders the
review AS IT IS NOW — never a silent retarget onto the newer state.
- Bulk approve refuses high-risk items unless each one is individually
confirmed by id. Bulk is per-item, never 'approve everything forever'.
- Reject requires a note; it is re-openable, not a deletion.
- Optional password gate; anonymous visitors are redirected to /login.
Also: the index page states the pacman conf snippet including
'SigLevel = Required DatabaseOptional', because a repo consumers ignore the
signature is a repo that gets MITM'd.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
§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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
One named test per invariant, each asserted as a post-condition on a real
end-to-end run rather than as a unit test of whichever helper happens to
maintain it: I1 index entry -> release -> approval, I2 base is the
accepted release after five unreviewed detections, I3 materialize fails
closed on the recipe pin, I4 a mid-publish crash leaves the served index
byte-identical, I5 resume repeats no completed step and records no
duplicate artifact, I6 a rebuild needs no new approval, I7 the partial
unique index refuses a second open review, I8 the index equals the
accepted pointers in the DB and in the .db file on disk, I10 audit and
approval are append-only, I12 every build records its world snapshot.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
aur-build init/subscribe/detect/reviews/show/approve/reject/build/run/
builds/status/packages/audit. approve renders the review and then
approves with the hashes it just rendered, so the CLI cannot approve a
diff it did not show you; --identity/--diff reproduce the stale case
explicitly and a refusal exits 2 (the web equivalent is 409).
Approvals are now immutable at the schema level: migration 0006 rejects
UPDATE and DELETE on the approval table, because that row is the only
proof the system has of what a human actually looked at (§7.2, I10).
Publishing also refuses when no approval is reachable, including the
manual-rebuild path that inherits one.
10 tests, including two that drive the compiled binary end to end
against a file:// AUR fixture.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
materialize -> plan -> chroot -> sources -> pkgver -> build -> collect ->
verify -> ingest -> publish, each checkpointed in build_step so a worker
that dies resumes at the next incomplete step without repeating the
expensive one (I5).
Step 0 materializes from the local mirror only and re-hashes the tree:
there is no path from 'AUR moved since the review' to 'we built it
anyway' (I3). Step 4 re-resolves a VCS pkgver and refuses when it no
longer matches the approved identity. Publish renders the index to .tmp,
fsyncs, commits release + package rows and the accepted pointer under a
compare-and-swap, then renames over the served database and signs it, so
a crash leaves the old index byte-for-byte intact (I4) and every index
entry traces back to an approval (I1). Ingest records the world
snapshot as the BUILDINFO installed set intersected with our own
packages, which is what keeps staleness meaningful (I12).
17 shim-driven end-to-end tests, including kill-mid-publish and
crash-resume, with no root, network, or real chroot.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The harness that makes the rest of this developable. Six real binaries
named exactly like the tools the pipeline shells out to, sharing one
shim module, driven entirely by environment so no production code path
is test-only:
AUR_SHIM_DIR where invocations are recorded (jsonl)
AUR_SHIM_MANIFEST the fixture manifest to obey
AUR_SHIM_FAIL optional tool forced to fail
makechrootpkg emits real .pkg.tar.zst files with .PKGINFO and
.BUILDINFO (the full chroot world, which is why §10.1 filters it),
makepkg answers --printsrcinfo and --vercheck for Stage B, repo-add
rebuilds a gzip'd .db with %FILENAME%/%VERSION%/%SHA256SUM% DESC
entries, gpg writes a detached signature, mkarchroot creates a warm
root. Each one records its invocation so tests assert on what actually
ran.
testcorpus/ holds 17 fixtures, each a PKGBUILD plus a manifest with the
scripted outcome: plain-make, with-patch, install-hooks, skip-checksum,
split-pkgbase, build-fails, check-fails, missing-dep, dep-cycle,
epoch-bump, pkgrel-reset, downgrade, digest-drift, pin-drift,
git-sourced, git-submodules, unresolvable. The harness commits a fixture
into a real git repo standing in for AUR, materialises a local upstream
git repo for VCS fixtures, and swaps payload bytes for the drift cases.
Config.child_env is what puts the shims on PATH for child processes, so
the pipeline runs completely unmodified under test.
Part of P0 (DESIGN.md §17).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The detection path (§5.1, §5.1a, §5.3, §7.1):
* git helpers, all subprocess git in one auditable place. Mirrors are
cloned with --mirror and polled with git ls-remote, fetching only when
the tip actually moved; --no-prune keeps history we may need forever.
* .SRCINFO parsing (authoritative) with a PKGBUILD fallback, and
source=() parsing that keeps VCS kind, #commit/#tag/#branch refs and
the filename:: form.
* recipe_hash over the whole snapshot tree, so a shipped patch is part
of the recipe and cannot change silently.
* source digest resolution: declared checksums are trusted-as-declared
(makepkg enforces them, no bandwidth), local files are hashed from the
mirror, and SKIP sources are downloaded and stream-hashed into the
content-addressed source cache. Detection always re-fetches SKIP
sources — answering from our own cache would defeat drift detection.
* candidate creation with base = current_accepted_release, collapse in
place while unviewed, supersede only once a human has looked, and a
previously rejected identity is not re-raised.
* non-publishable change handling (I11): unchanged version string means
no review, but never silence — recipe drift and pin drift become
notices, and a changed digest on a remote source with an unchanged
version becomes a high-severity integrity_alert.
Also vercmp + dep-string parsing with the ALPM test vectors, and the
approval record with optimistic concurrency (§7.1a) that the CLI and web
layers will both call.
16 detection tests against real file:// git fixtures, incl. I2 across
three unattended detections and I11 for all three drift kinds.
Part of P0 (DESIGN.md §17).
|
|
|
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).
|