| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The function behind `Identity::hash` — the digest an approval echoes back —
did two things its name promised and it did not do. It did not order anything:
the doc comment conceded that callers were expected to pass "already-canonical
values", which is a convention, not a property, and a struct serializes in
whatever order its fields were declared. And on a serialization failure it
returned `"{}"`, so every value that failed to serialize hashed to one shared
digest. For a system whose whole job is provenance, "two identities that could
not be serialized would look identical to the approval echo" is the worst
possible failure to have available.
Serialization now routes through `serde_json::Value`, whose map is a
`BTreeMap`, so object keys come out sorted whatever the input's construction
order — the name describes what happens. A failure propagates: `canonical_json`
returns `Result`, `Identity::hash` returns `Result`, and the four call sites
(detect, put_world_snapshot, the world step, both enqueue paths) pass it on.
There is no path left where a digest is invented for a value that could not be
rendered.
`tests/hash.rs` pins all three properties: an unserializable value is an error
naming itself, two same-field-different-declaration-order values render
identically (and to the exact compact sorted bytes), and the identity digest
changes when any element of the tuple changes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
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).
|