| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
The §n, I-n, M-n and m-n references survived in string literals the comment
strip never touched: migration SQL comments, assertion messages, runtime error
text, Cargo.toml, a CSS and template note, and one corpus manifest. They named
sections of files that no longer exist, so the prose stays and the citation
goes.
|
| |
|
|
|
|
|
|
|
|
|
| |
Stripped every comment that described what an item does, documented its
arguments or fields, or cited the design docs (§n, I-n, m-n, decision n).
2247 comments down to 83.
What survives: the section dividers that segment the large modules, the
secret-handling warnings, the agent wire-frame directions, and the few notes
without which the code they attach to reads as redundant, reorderable, or
unsound.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Every module-level `//!` header is gone, and the comments that remained
either re-explained the line below them or had grown into paragraphs.
Density went from one comment line per 6.7 lines of code to one per 10.
827 insertions against 2194 deletions across 86 files.
What survived: the invariants (I1-I12), the design cross-references into
DESIGN.md, and the notes recording a bug that was found and fixed — those
are the comments that carry weight, because they answer a question the
code cannot answer about itself. What did not: restating a function
signature in prose, and narration of the statement underneath.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The chroot step existed to run mkarchroot/makechrootpkg, whose sudo
requirement was the whole reason a build had to run on the hub under
root-adjacent rules. The sandbox model makes the chroot redundant: the
sandbox boots from a base that already carries the official packages,
and step 2 now provisions it with a lease manifest instead — every
dependency we publish, pinned to the exact version and digest of the
artifact the index serves. The hub re-hashes every blob before staging
it, installs with pacman -U (no -Sy, no live resolution, no mirror at
build time), and the sandbox's own pacman -Q must confirm the pinned
world landed before a build may start. A byte that hashes differently,
or a world that drifted, fails closed.
The build step is now plain makepkg -c -f: no -s (dependencies arrive
installed; resolving at build time is what the pinning model forbids)
and no -si (ingest signs). mkarchroot/makechrootpkg are gone from the
pipeline and the config; their shims stay as stand-ins for the real
devtools so the shim protocol itself remains exercised. The shim pacman
grew a real fake installed-database: -U refuses bytes that do not hash
to the digest their name claims, -Q reports what landed, so the world
check is a test and not a no-op.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
format
n-3. `Req::form_get` called `form()`, which re-parsed the entire request body
every time. The approve handler asks five times — two hashes, a note, a CSRF
token, and a confirm flag — so a single POST parsed its own body five times. The
pairs are parsed once at decode, next to the query pairs, and `form()` returns
the stored slice.
n-5. `enqueue_manual_rebuild` invented its own identity format,
`hex("{aur_commit}|{recipe_hash}|manual")`, while every other identity in the
system is a `sha256:` over the canonical JSON of the identity tuple (§3). Two
formats for one concept is how a comparison quietly stops meaning anything, and
the ad-hoc one had a delimiter that can appear inside a URL-shaped value and
ignored the pins and digests that are the whole point of an identity. A rebuild
is now identified by the canonical-JSON hash of the release's actual commit,
recipe, pins and digests plus a `requested: manual_rebuild` marker — the marker
being what keeps a rebuild a distinct build from the one that landed, while
staying deterministic so that clicking rebuild twice is one build, not two.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Seven fields sat on `Config` next to `signing_key_id` and `bind`: a PATH
override, three shim protocol variables, a fault-injection point in the middle
of `publish()`, and two more shims could obey. m-9's complaint was not that they
exist — the shims are how I4, I5 and I9 are tested for real, and a mock would
have asserted the mock's own behaviour — but that nothing said which of these
was production and which was scaffolding, and the publish path carried a test
branch on every real publish.
They are one `TestHooks` submodule now, documented as what it is, and the whole
submodule is `#[cfg(feature = "test-support")]` — the same feature that already
gates the shims and the raw SQL escape hatch, and which only this crate's own
dev-dependency turns on. A production build has no `hooks` field, no shim
protocol in `child_env`, and no fault-injection branch in `publish()`; the
serialized config skips the section entirely when nothing is hooked, so a real
`config.json` never mentions any of it.
`TestHooks::is_empty()` names the state a real process runs in, and three tests
hold the line: the hook fields may be declared exactly once and only inside
`TestHooks`, every `publish_fault` read in `publish.rs` must sit behind the
feature gate, and a default config serializes without a trace of hooks.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
M-8 named four more machines after `build_state`, and each had the same defect
in miniature: `&str` constants, a writer that took any `&str`, and a rule that
lived only in the caller's discipline. They are `CandidateState`, `StepState`,
`ReleaseState` and `SubscriptionState` now, all parsed through one
`db::state_col` at the row boundary — a column value the code cannot name fails
the read rather than becoming a state it did not ask for.
The one that mattered is the review machine. `resolve_in(tx, id, &str)` would
move a candidate to any state from any state, so an approval racing a
rejection, or a stale worker resolving a review that had already been
superseded, silently overwrote what a human had decided — the direct route to
breaking I2 and I3 with no symptom anywhere. It is a compare-and-swap on
`CandidateState` now: a decided review is only ever frozen, never re-decided,
and a refusal names both states. `supersede_in` goes through it, so the freeze
cannot resurrect a superseded review either.
`StepState` gives I5 teeth. `begin_step` upserted over any existing checkpoint,
including one recorded `succeeded`, so a resume that asked to re-run a finished
step could rewrite the very row that told it to skip; the upsert now refuses to
touch a done checkpoint and `finish_step` is a CAS. The blocked path
(`running → pending`) and the reaper's `running → interrupted` are unchanged,
and both are in the table.
Two behaviour changes, both for the better and both tested: the UI's pause
button now says "orphaned: nothing to pause" instead of rewriting an orphaned
subscription back to a pausable state, and a step checkpoint that is already
done makes `begin_step` an error rather than a quiet overwrite.
Five tests in `tests/state_machine.rs` cover the review CAS in both directions,
the frozen checkpoint, the interrupted/blocked transitions, and the unknown
value in a candidate and a step row.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`build_state` was seven `&str` constants and `set_state(&str)` would write any
string a caller invented, so the machine existed only as `WHERE state IN (...)`
clauses scattered across six modules and nothing could say that
`succeeded → running` is nonsense. It is `db::model::BuildState` now: parsed
where a row is read (a state the code cannot name is an error, not an empty
string — which also retires m-12's `current_state` returning `""`), and
`set_state` takes the variant and writes only if the row's current state is one
of `to`'s legal predecessors. A refused transition writes nothing and says why.
Writing the machine down surfaced three things that were true of the flows but
of nobody's documentation. The step loop re-asserts `Running` at every step
boundary, so a self-write is a no-op and not a move — every state accepts its
own name. A failed build is resumed *on its own row* (I5: the step checkpoints
say where to continue), so `failed → running` is a real transition. And
`builds::retry` — the UI's requeue button — moved any row to `queued`
unconditionally, including one that had already published, re-queueing a build
whose every step was checkpointed as done; it goes through the machine now and
is refused with a reason. `requeue_transient` likewise.
What the CAS buys is the zombie case, which no test covered: a worker's lease
expires mid-step, the reaper returns the build to the queue, and the original
worker — still running — comes back and writes `succeeded` over whatever the new
owner has since done. That write now fails loudly and the queue keeps ownership.
`builds_for_pkgbase` had a second, hand-copied row mapper that dropped unreadable
rows with `filter_map(|r| r.ok())`; it shares `row_to_build` now and a bad row
fails the query instead of vanishing from the package page (m-9's policy,
applied where it bit).
`tests/state_machine.rs` pins the whole table, the zombie refusal, the unknown
state, the terminal build that does not move, and the requeue-of-a-published-
build refusal. `tests/live.rs` walks a build through `running` before succeeding
instead of teleporting it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
writer stops handing out connections
Twelve modules outside `db/` contained hand-rolled SQL — 22 statements in
`ops.rs`, 17 in `approve.rs`, 15 in `candidates.rs`, 11 in `publish.rs`, and a
dozen more scattered through `watch`, `pipeline`, `http` — which meant the
blast radius of a schema change was "any module", and `db/` was a directory
rather than a boundary. The audit trail alone was defined in four places with
three different detail payloads.
Every statement now lives in `db/`. New modules `db::candidates` and
`db::approvals` own their tables (including the 21-column candidate select,
spelled once as `CANDIDATE_COLS` instead of four times); `db::queries` gains
the metrics reads, the retention reads and writes, the publish writes
(`insert_release_in`, `cas_accepted_release_in`, `remove_index_packages_in`),
the staleness reads and the source-cache lookups; `db::builds` gains
`set_release_in`. Where a mutation is a *decision* — the collapse rules, the
approval gate, the publish compare-and-swap — the decision stays where it was
and the statements are called through the transaction handle, so the atomicity
is unchanged and only the SQL moved.
`audit_in` is the in-transaction audit append, and `audit` is now a wrapper
over it: a decision and its audit row commit together or not at all, which is
what I10 actually claims.
Enforcement is two-layered, because one layer is a lie. `Writer::call`, `tx`
and `send` are `pub(crate)`, which keeps the crate's *users* out — the
integration tests and the shim binaries — but `pub(crate)` is crate-wide, so
on its own it would not stop `approve.rs` from writing SQL tomorrow. The layer
that does is `tests/schema_ownership.rs`: it walks `src/` and fails the build
if a statement literal or a rusqlite statement call appears outside `src/db/`.
It was checked against a deliberate violation. The test harness still needs to
construct states no typed API reaches, so the raw door exists but only under
the `test-support` feature, which nothing but this crate's own dev-dependency
enables; a production binary cannot see it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ran the gated tier as far as this host allows, with real devtools, real root and
real network, and it paid for itself immediately.
`mkarchroot` has no `-N` option. The pipeline was calling `mkarchroot -N <seed>`;
the shim ignored the unknown flag, so every test passed, and the real tool
answered with a usage error. The first real chroot build would have died on its
first step in a code path the shim harness structurally cannot exercise. The
seed's package list is now configuration (`mkarchroot_args`, default `base`) and
the call follows the real usage: `mkarchroot <working-dir> <packages...>`.
What else the attempt verified, with the real binaries rather than the shims: a
generated GPG key detached-signed the artifact the pipeline produced and
`gpg --verify` reported a good signature; real `repo-add -s -k` built and signed
a pacman database over it, and that signature verified too. So "both the packages
and the .db are signed" now rests on real crypto.
Where it stops: `mkarchroot <dir> base` downloaded and installed the base set into
the chroot (437 MB, 14 packages, install scripts ran) and then failed in
devtools' init stage with `Failed to parse --bind(-ro)= argument` from
systemd-nspawn 262 inside an unprivileged container. DECISIONS.md records exactly
what was run, what passed, what failed and why, and what therefore remains
modelled rather than crossed — a silent skip would have hidden all of the above,
including the flag bug.
Also fixes the I9 test's expectation: a refused build is an `Outcome::Failed` at
the `collect` step, not an `Err` from the runner, which is the correct shape (the
build failed closed and said why) and the test now asserts the step name.
171 tests pass, clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
README and the invariant index
Three things.
**A real hole, closed.** `collect` scans the build's srcdir for
`*.pkg.tar.zst`, and `ingest` copies whatever those paths resolve to into the
content-addressed store — from where the bytes are served from our repo and
signed with our key. The paths are generated by our own scan, but their *targets*
are not: a PKGBUILD that drops a symlink called `evil.pkg.tar.zst` pointing at
the signing keyring, the database, or anyone's home directory would have its
target copied in, published and signed by us. The chroot is supposed to be the
layer that prevents that, and the chroot tier is gated — but two protection
layers must not be load-bearing on each other, and the control plane should not
depend on isolation for the safety of its own secrets.
`collect` now rejects symlinks and rejects anything whose canonicalized target
escapes the build's own staging directory, failing the build closed with the path
in the message. `i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir`
acts the attack out — the shim plants a symlink to the database file — and
asserts the build fails, the store is byte-for-byte untouched, and nothing
publishes. This is the last §2 invariant that had no named test; docs/INVARIANTS.md
says plainly which part of I9 this covers and which part belongs to the gated
chroot tier.
**README.md**, written for the person who has to operate this at 3am: the rule
everything else follows, the quick start, the layout, how the shim harness makes
the whole pipeline testable without root or network, the ops commands, the route
table, and the §14 constraints stated as the hard edges they are.
**docs/INVARIANTS.md**, mapping I1-I12 to the named tests that hold them, with
corroborating tests listed, and an explicit note on the two invariants enforced
by the schema (the partial unique index for I7, the append-only triggers for
I10/I7) so a future code path cannot forget them.
Also recorded in DECISIONS.md: metrics served without a session and why,
retention recording a purge instead of deleting the row, and the real-chroot tier
being explicitly skipped with what stands in for it and how to actually run it.
.gitignore already covered .pi/ but the goal-tracker files were tracked from
before the rule existed; untracked now so they stop appearing in every diff.
|
|
|
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.
|