| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Five http items were being counted as test-pinned on the strength of a
string alone, and are now `pub(crate)`:
render::Attention the word appears in crash.rs inside a message
Res::html "text/html" is a content type, not a call
Res::redirect "redirect" appears in an assertion message
routes::logout "/logout" is a route path
routes::route "mutating route" appears in an assertion message
Nothing in the test tier calls any of them; each carries a comment saying
so, because "the census said a test needed this" is not a reason and will
be re-asked by the next person to read the line.
`config::TestHooks` was already half-gated — the `hooks` field and the
`Default` line that fills it are both behind `test-support` — while the
type and its impl were not, so a release binary compiled a struct it
could never construct, read, or deserialize. Now gated whole.
The live kata tier moved into `src/sandbox/kata.rs`. It is not a fixture
test: it records its own absence without /dev/kvm or AUR_KATA_API, the
same way the vercmp live tier does. It was the only thing outside the
module naming `K8sSandboxProvisioner` field by field, so that struct is
`pub(crate)` now too.
One correction to the table, and it is the kind of correction a heuristic
deserves: `http::cookie` and `http::login` were classified `move-test`
because their tests contain no harness keyword. They do — `Web::` starts a
real HTTP listener, and a test that talks to one is not a unit test
however little code it holds. The detector now knows that, and both items
are residue, which is what they always were.
http: 27 pub -> 22 pub. Test-only items across the crate: 52 -> 46.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Six db items are now gated behind `test-support`, each with a comment
saying what it is for and why production never calls it:
builds::claim production leases a batch; `claim_batch` is
what the dispatcher runs
settings::set_setting the readers are used, the setter is not
Writer::shutdown the server runs until the process ends
snapshots::snapshot_by_commit
world::world_members production writes world snapshots, never
reads one back member by member
invariants::unapproved_index_entries
gated, not relocated: reading it needs this
module's private helpers, and widening those
to let a test out would be the wrong trade
Gating them exposed three things they were the only user of, and each is
gated with them rather than left compiling into a binary that cannot reach
it: `Msg::Shutdown` and its loop arm, and `model::json_or`.
`arch-census.py --write-budget` also stopped erasing the `test_surface`
section — two writers of one file must not delete each other's axis, or
the ratchet quietly stops checking it.
`steps::touch` is deleted, not narrowed. Nothing called it — not
production, not a test. The census had credited it to `tests/shims.rs`,
where the word appears inside a string.
In sandbox, two tests moved into `src/sandbox/kata.rs`: the container
record a lease provisions, and the TTL expiry of a sandbox that never
dials in. Neither builds a fixture. `KataBackend::shared_for`,
`provision_request`, `sandbox_cr` and `K8sSandboxProvisioner::for_config`
are `pub(crate)` as a result.
`KataBackend::reclaim` is deleted — same story as `touch`. It forwarded to
`self.provisioner.reclaim`, which the reaping site already calls itself,
and the TTL test the census credited it for implements the *trait's*
`reclaim` on a null provisioner. Same word, different function.
Two honest costs, both recorded rather than smoothed over:
- `Provisioner` and `ProvisionRequest` are now named by nobody outside
`sandbox`, yet cannot be narrowed: `LocalAgentProvisioner` is `pub`
because two fixture tests construct it, and Rust forbids a public type
implementing a private trait or taking a private parameter type.
`sandbox.deadonly` therefore rises 0 → 2, with the reason here as the
ratchet demands.
- `agent_sandbox_config()` now exists in both `tests/kata.rs` and
`src/sandbox/kata.rs`. Three of that file's remaining tests still need
it, and a test helper cannot be shared across the crate boundary without
making it public again.
sandbox: 27 pub / 15 dead -> 22 pub / 10 dead.
Suite: 284 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The census could say which `pub` items nothing outside their module
names, and which of those a test names. It could not say what to do about
them, because the two questions that actually decide it are ones a
raw-source name match cannot answer:
Does a test *call* it, or merely mention it inside a string?
Does production code *inside* the declaring module call it?
`tools/test-surface.py` asks both, and `tools/test-surface.md` records the
answer for all 61 items. Four dispositions, each with a hand-written
reason kept in `tools/test-surface-reasons.json`:
gate (9) production never calls it; a test does
move-test (9) the test that names it builds no fixture, so it is a
unit test in the wrong file
narrow (6) no test calls it at all — census false positives, the
name appears only inside a string literal
residue (34) stays pub, and the honest column
`residue` needs saying out loud. Rust has no test-conditional visibility:
no attribute makes an item `pub` under one feature and `pub(crate)` under
another, and `pub use` cannot re-export a `pub(crate)` item. An item that
production needs *inside* its own module and a fixture-bound integration
test needs from outside cannot be narrowed without breaking one side or
the other. That is not a gap in this analysis; it is a gap in the language,
and the way to close those 34 rows is to change the tests — move them into
the module, or exercise the behaviour through the module's real entry
point — not to invent a visibility that does not exist.
So the column is ratcheted rather than wished away.
`the_test_surface_is_disposed_of` fails if any row lacks a hand-written
reason, and if any count — including `gate_pending`, items decided to be
gated but not yet gated — exceeds its budget. It can only shrink.
Two census limitations surfaced and are now written down rather than
silently trusted: "module" means the top-level directory, so an item used
only from a sibling file in the same module reads as dead; and mentions
are matched over raw source, so a string counts as a reference. Six items
were being counted as test-pinned on the strength of a string alone.
No source file is edited here. This is the decision record the next
commits apply.
Suite: 284 passed, 0 failed. Release build: zero warnings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tests/state_machine.rs was built around a database, so two tests that
asserted nothing about a database still sat there: the column-text round
trip, and the enumeration of the transition table. Both moved into
src/db/model/build_state.rs, where `BuildState` and its table are
declared.
Making them in-module tests is what let the table stop being public.
`ALL` and `can_transition` had no reader outside db/model at all —
production enforces transitions by asking `predecessors(to)` and putting
the answer in a SQL `WHERE state IN (...)` guard — so both are now
private, and the five state enums' `ALL` consts with them.
One assertion moved rather than being dropped.
`a_terminal_build_is_history_and_does_not_move` made two claims per
state: a table claim (`!Succeeded.can_transition(to)`) and a database
claim (`set_state(...).is_err()`). The table claim now lives with the
table; the database claim stayed where the database is. Neither was
weakened.
Two findings, recorded rather than quietly acted on:
`ReleaseState::can_transition` and `SubscriptionState::can_transition`
are consulted by nothing — not by `predecessors`, not by a test. They are
dead tables for machines nothing enforces. Left `pub` with a NOTE and
handed to the disposition table, because deleting a stated invariant and
wiring up an unwired one are both decisions above this commit.
Added two round-trip tests (StepState, and the three enums declared in
state.rs) so the newly private `ALL` consts are still exercised.
db: 202 pub / 13 test-only -> 201 pub / 11 test-only.
Suite: 283 passed, 0 failed, 0 ignored. Clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tests/hash.rs held three tests and none of them belonged there. Two were
about `canonical_json` and moved into src/hash.rs. The third asserted
that the identity digest is a pure function of an identity's own fields
— a property of `db::model::Identity`, not of the hashing helper it
happens to call — so it moved to db::model, where the thing it tests
lives. The file is now empty and is deleted; the tests are moves, not
losses, and each is named in its new module.
tests/time.rs held three tests, two of which were clock arithmetic with
no dependencies at all. They moved into src/time.rs. The third pins a
build lease against a pinned clock and needs a database, so it stayed
where a database is available.
No visibility changed in this commit: `canonical_json` is used in
production and stays public, and `time::pin`/`unpin` are ungated test
escapes that the disposition table will decide on rather than being
quietly narrowed here as a side effect.
Suite: 281 passed, 0 failed, 0 ignored. Release build: zero warnings.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eleven tests in tests/config.rs exercised how a config parses, what it
refuses, and what it refuses to print. They reached those behaviours
through the crate's public API only because that was the only way in, and
that had been keeping two items public that nothing outside config names:
DEFAULT_SANDBOX_IMAGE resolved at config.rs:187 and :374, nowhere else
Sandbox::KINDS never read by production at all — serde builds
the unknown-kind message itself
KINDS is now `#[cfg(test)]` rather than merely private, and
`cargo check --release` without the test-support feature compiles with
zero warnings, which is the proof that nothing production needed was
gated away by mistake.
One honest caveat, recorded in the file: these tests still create a
tempdir, because `Config::load` takes a directory and so even a pure
parse needs a file on disk. That is plumbing for the signature, not the
subject of the test — none of them touches the database, the fixture
corpus, or a subprocess. What remains in tests/config.rs genuinely does:
root resolution against real paths under target/, and two tests that run
the built binary.
config: 31 pub / 5 test-only -> 29 pub / 3 test-only.
Suite: 281 passed, 0 failed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ten tests in tests/versions.rs were unit tests of pkgver wearing an
integration test's clothing: the comparison vectors, the chunk rule, the
epoch rules, the dependency grammar, the constraint checks, the recorded
oracle. None of them touched a database or a fixture. They were written
against the crate's public API because that was the only way to reach
them from outside, and that single fact — that a test had to import a
name to exercise it — is what had been keeping five items public:
vercmp_string, Dep, DepOp, Dep::satisfied_by, split_full_version
All five are private now. `vercmp_string` is called by `vercmp` and by
nothing else; `Dep` and `DepOp` are the internals of `dep_names`, which
*is* used in production; `satisfied_by` and `Dep::name` are used only by
this module's tests, so they are gated rather than merely private, and
`cargo check --release` without the test-support feature compiles clean,
which is the proof that nothing production needs them was left behind.
The oracle test now resolves testcorpus/ through CARGO_MANIFEST_DIR
rather than the harness helper, so it no longer depends on the working
directory. The live pacman differential came with it and stays gated on
AUR_LIVE_VERCMP, recording its absence the same way.
What remains in tests/versions.rs is two tests that genuinely need the
harness: they build a package, publish it, and move its upstream.
pkgver: 14 pub / 5 test-only -> 8 pub / 0 test-only.
Suite: 281 passed, 0 failed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The census report gets its after-table, and the README's Layout gets rewritten
— it had drifted into fiction, listing `db/queries.rs`'s successors as "queries"
and omitting `usecase`, `error`, `hash`, `time`, `urlutil`, `git`, `fetch` and
`recipe` entirely. It now states the ranks and says plainly that they are
enforced by `tests/architecture.rs`, not kept in hope, and names the two
commands that keep it true.
This commit also carries the last of the narrowing that fell out of writing the
report, because writing it meant actually reading the numbers:
- `watch::upstream::resolve` looked test-only and was not — the tests contain an
unrelated local function of the same name, which the census matches as a word.
It is crate-internal and now says so.
- `read_tree` closed with it. Its two integration tests were testing the module's
own batching behaviour from outside, so they moved inside as unit tests with a
throwaway git repo, which is where a test about one `ls-tree` and one
`cat-file --batch` belongs. They lost nothing: the empty-blob and NUL-byte
assertions came across verbatim, plus one the old test never made — binary
blobs are still listed, just not read.
- `Assessment::is_high`, `Tree::get`, `approve::current_accepted` and
`diff::full_recipe_text` were dead once their callers closed, and are gone.
- `set_risk_for_tests` is gone too. The bulk-refusal test needed a candidate
marked high-risk, and the honest way to get one was for the fixture to write
the row — `Env::execute` — rather than the library growing a public setter
that exists only so a test can pass. That was the last budget above baseline
apart from `error.pub`.
`error.pub` stays at 21 against a baseline of 15, and the report says why: the
six payload enums are constructed in four modules and matched in `error`, so
they are interface. `error.dead` is 0.
Final: 281 passed / 0 failed across 36 binaries (baseline 273), clippy
-D warnings clean, release clean, census within budget.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The leaf modules were the widest liars. `git` exported 19 names of which 5 were
named by nobody; `hash` exported a constant `EMPTY` that no code had ever
referenced; `time` exported a virtual clock, an `advance` and a `wrap` whose
only caller was a test that turned out not to exist. A leaf's interface is the
whole contract the rest of the crate can rely on, and these interfaces were
mostly decoration.
Nine items were genuinely dead and are gone: `hash::EMPTY`,
`git::{clone_source, count_commits, log_oneline, ls_remote_heads}`,
`recipe::is_diffable`, `pkginfo::values_of`, `time::virtual_now`, and a free
`time::advance` that had been shadowed by the `VirtualClock` method tests
actually call. Eighteen more were used only inside their own module and are now
private — `fetch`'s `Body` aside, which is the return type of a public parser
and so is part of the interface whether or not anyone writes its name.
http went 68 exported names to 27, and its last two glob re-exports
(`pub(crate) use mutations::*; use pages::*;`) are explicit lists now. That
makes the crate's glob count zero, so the allowlist in the architecture test is
empty and can stay that way.
Narrowing surfaced dead code that `pub` had been hiding, because a public item
is presumed used and never questioned: `Req::query` and `Req::body` were parsed
and stored and never read, `Res::found` had no callers, and `sse::FileBody` was
a reader nobody constructed. All four are deleted rather than re-published to
keep the warning quiet.
git 19→14, hash 8→7, recipe 11→7, urlutil 2→1, config 35→31, pkgver 18→14,
time 16→14, pkginfo 7→6, http 68→27. Crate totals: 585→516 pub, 219→115 dead,
4→0 globs.
281 passed / 0 failed, clippy -D warnings clean, release build clean,
architecture 8/8.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`main` opened the repository inline before its command match. `serve` opened it
again, four calls in an order that matters. The web routes wrote subscriptions,
toggles, notices and build retries straight through `db::`, so the CLI and the
UI were two independent guesses at the same product, and the guesses had already
drifted: `sub_add` fell back to repo id 1 where the CLI reported the repository
as uninitialised, and `build_retry` remembered to write the audit row while
nothing else did.
`src/usecase/` is the workflow layer now — bootstrap, detect, reviews,
subscriptions, builds, maintenance. A function earns a place here by having more
than one step in an order that matters: `approve` records the decision *and*
queues the build it authorises, because an approval that silently fails to queue
is the exact failure the review queue exists to prevent, and both front ends had
to remember to pair them.
Nothing in the layer formats output or knows a status code exists. Where the two
front ends genuinely disagree, the result carries the disagreement instead of
resolving it: `Approved::queued` is a `Result` because a failed enqueue is fatal
in the CLI — an approved candidate with no build is a stall nobody notices — and
a soft failure in the UI, which has already committed the decision and can retry
from the package page.
`src/http/routes/mutations.rs` now contains no `db::` call at all, and
`main.rs` is 314 lines with no multi-step sequence and nothing exported.
Rank map: usecase 9, http 10, composition roots 11. The layer test enforces
that usecase cannot name http, which is why `serve` starts the scheduler and the
build pool but leaves the HTTP server to `main`.
One user-visible message moves: `aur-build reject <missing>` now says
`not found: candidate N` (the review layer's wording) instead of
`no candidate #N` (main's). Both exit 1; the check moved with the workflow.
280 passed / 0 failed, clippy -D warnings clean, architecture 8/8.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Error::NotFound("no repo row; run `aur-build init`")` and
`Error::NotFound("pkgbase linux")` were the same variant. One is "the install
was never initialised, every page is wrong"; the other is "that page does not
exist, answer 404". The difference lived inside a string, so the only way to
act on it was to re-parse text the same process had written moments earlier.
Six variants now carry structure:
Missing pkgbase / candidate / release / build / snapshot /
mirror path / repo row
Refused IllegalTransition / WrongState / PointerMoved / Other
Guard HashMismatch / DigestMismatch / Invariant
WorldGap MissingPin / Other
PoolFull Backend{backend} / Other
TransientCause Upstream / Command / Other
`Refused` distinguishes the three refusals that were indistinguishable: a
transition no edge permits (caller bug), a row in the wrong state (stale
view), and the accepted pointer moving under a build (a lost race, and the
one a client may safely retry). `PoolFull::Backend` names which pool, because
a kata quota needs an operator and a local cap clears when a build exits.
`is_transient` and `is_pool_exhausted` already matched on variants rather than
strings, so they are unchanged — the typing is what lets the *next* branch be
a match instead of a `contains`.
No test assertion was edited. Where a message is load-bearing the Display was
written to reproduce it: `recipe_hash mismatch: approved X, materialized Y`,
`no release 4`, `illegal candidate transition approved → rejected`, `sandbox
world is missing plain-make-1.0-1 after installing the lease set` and kata's
`never dialed in` all come out of the new types byte-identical. Five messages
did change wording, none asserted anywhere:
release N is X, not published: nothing to withdraw
-> release N is X, not published (Refused::WrongState's shape)
illegal candidate transition a → b for review 7
-> ... for candidate 7 (it is a candidate id; "review"
was misleading)
no candidate 7 to resolve -> candidate 7 (Missing::Candidate's shape)
lease artifact n-v: store bytes hash to A but the index says B
-> source n-v hashed to A but the candidate recorded B (shares
Guard::DigestMismatch with the source-cache check)
vcs_cache clone URL: err -> upstream: vcs_cache clone URL: err
(TransientCause::Upstream tag)
error.pub 15->21 is the six payload enums, which is the point of the task
rather than a widening to apologise for. watch.dead/test each rose by one for
a subtler reason: `watch::upstream::resolve` looked live only because an
unrelated db message ended "... to resolve", and rewording that string removed
the phantom mention. The census now documents that a clean count is not always
an answer, since mentions are matched over raw source including string
literals.
281 passed / 0 failed (277 plus four new typing tests in src/error.rs), clippy
-D warnings clean, release build clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sandbox exported 35 items and 8 of them were named by nobody at all — not by a
caller, not by a test. `Frame`, `read_frame`, `write_frame`, `hex_bytes`,
`unhex` and `MAX_FRAME_BYTES` are the wire protocol, and the protocol is
sandbox's: the agent, the remote client and the loopback all speak it from
inside. Exporting it advertised a second way in that nothing used and everything
would have had to keep compatible. `LoopbackSandbox` and `RemoteSandbox` are
the same story — handles handed out by a constructor nobody calls by name.
Pipeline exported its step machine. `run_step`, `log_line`, `sweep_render_dirs`,
`from_candidate`, `from_release` and the four types they pass around
(`Collect`, `CollectedPkg`, `SourceIdentity`, `StepResult`) were all internal
plumbing reachable from `main`, which only ever wanted `run`, `Outcome`,
`enqueue_for_candidate`, `enqueue_manual_rebuild`, `publish::reconcile` and
`dispatch::Pool::spawn`.
sandbox.pub 35->27, pipeline.pub 30->21, and both modules now have zero items
named by nobody: what is left public is public because a test names it, which
is the allowlist the budget records rather than a hole in it.
Clippy caught what the tests did not: `Ctx::src` was a `pub` field of the newly
private `SourceIdentity`, a public face on a private type. The field narrowed
with the type. Re-widening `SourceIdentity` to silence it would have undone the
point.
The diff is visibility keywords only — no step id literal, no frame variant, no
wire byte changed. 277 passed / 0 failed across 36 binaries, including
remote_agent, failure_modes and the kata tier; clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The step machine reached into two of watch's internals and reassembled the
rules itself: `mirror::read_tree` then `Tree::recipe_hash` to re-derive the
hash a reviewer approved, and `digests::cached_path` then
`digests::download_and_cache` then its own comparison to check a payload.
The comparison is the part that must never be skipped, and it was sitting in
whichever step happened to want a file — a step could have forgotten it and
nothing would have noticed.
`watch::sources` is the interface now: what a tree hashes to, and a guarantee
that a cached source is the bytes its name claims. `verify_cached` owns the
fail-closed test and its message verbatim. `download_and_cache` and
`cached_path` are `pub(crate)` again, so the cache layout is watch's business
again; `watch/mod.rs` no longer re-exports them.
`src/pipeline` now names exactly one watch path.
Detection is untouched by construction — no git-invoking function changed —
and the census agrees: 264 successful git execs on the detect binary before
and after. (An initial reading of 1320 vs 264 was PATH-probe ENOENTs from a
differing shell PATH, not git work; counted with suite-cost.py's own rule of
successful execve only, the two runs are identical.)
watch.pub 31->30. `read_tree` moved into the test-only column: the pipeline
stopped naming it, and what remains are watch's own calls plus the two tests
that exercise its one-batch-read contract directly.
277 passed / 0 failed, clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`watch::detect` was performing review's write protocol by hand: look up the
accepted release, upsert the candidate, assess the risk, store the risk, work
out the missing dependencies, store those. Six calls that only make sense in
that order, issued from a module whose job is noticing that an upstream moved.
Get the order wrong and nothing complains — the candidate just quietly has no
risk score, and the reviewer approves it without one.
`review::intake::record` is the protocol now. The watcher hands over what it
observed and review decides what it means. `missing_deps` moved with it: it
computes a risk signal, which is a review question that happened to be living
in the watcher.
`accepted_for` was not a review question either. It reads a pointer column off
the pkgbase row, so it is now `db::accepted_release_for` — the watcher asks
persistence what is currently accepted, rather than asking review as a favour.
With intake owning the write path, three things became internal and closed:
`upsert_candidate`, `risk::assess`, and the risk/missing-deps column setters.
`approve::approval_for` was a pass-through to db that only the pipeline called;
it is gone, and the pipeline now asks `review::reads::{candidate, approval}` —
two named facts instead of a re-export of review's storage layout.
The budget rose in two places and both are moves, not growth: db.pub 201->202
is `accepted_release_for` arriving from review, and review.test 4->5 is
`set_risk_for_tests`, the one place a fixture still needs to force a score.
review.pub itself is unchanged at 29 — four names added, four removed.
`priv` was also dropped from the budget keys. Counting `pub(crate)` items
against a ceiling was backwards: closing an interface raises that number, so a
budget that punishes it punishes the work. The Rust test never checked it.
277 passed / 0 failed, clippy -D warnings clean, and every detect, approve and
staleness assertion intact.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
db handed out 226 items and 36 of them were named by nobody at all — not by
the crate, not by the tests. Making them private is the whole of this commit,
but the interesting part is what the compiler said afterwards.
Twenty-five closed cleanly. Eleven did not, and they are the ones worth
writing down: AuditRow, NoticeRow, PackageRow, Subscription, StepRow,
Unbuilt, OpenReview, ReviewSubject, Migration, Writer, predecessors. None is
named outside db, yet none can be made private, because a public query
returns them and callers bind them with `let` and call methods on them.
They are load-bearing and invisible to a name search. So the census's `dead`
count means "the name is never written outside the module", which is a lead
rather than a verdict, and the census now says so: the way to find out which
flagged items are real is to privatize them and let rustc answer. Those
eleven are budgeted with that reason, not zeroed to make a number look good.
Nineteen items turned out to be dead code rather than merely unexported —
set_release, set_candidate, set_pkgbase, set_profile, set_kind,
current_state, index_pkgbase_drift, wal_stats, call_for_tests, put_notice,
is_ours, list_pkgbases, set_unpinable, artifact_id_by_digest_in,
subscription_poll_interval, the four never-emitted notice kinds, and
StateEnum::as_str, which the impl_state_enum macro was required to define
for all five enums while nothing called it through the trait. Privatizing
is what proved they were unused; leaving them private-but-present would have
just hidden dead code behind a narrower address.
Ten items became pub(crate): the Writer actor's call/tx/send surface,
Readers, the StateEnum trait, json_or, predecessors, DEFAULT_SETTINGS.
`Db.readers` was named nowhere outside db, so the field closed with the type.
db: 226 pub / 36 dead-only -> 201 pub / 11 dead-only. 277 passed / 0 failed,
clippy -D warnings clean, schema_ownership and architecture green.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
queries.rs was 1,501 lines holding 83 queries across seventeen aggregates,
separated by comment banners that said "settings", "release", "notices" and
then kept them in one file. The banners were the design; they just never got
files. Each one has one now, verbatim — the split is provably content-only,
the moved text being identical to the original as a sorted set of lines.
model.rs and builds.rs were each two concerns deep, so they became
directories. model.rs held what a row looks like and, separately, the state
machines that say which moves are legal; builds.rs held the build machine and,
below its own `step rows` banner, the step machine. The impl_state_enum!
macro implements StateEnum for all five enums from one place, so it moved
with its invocations rather than being exported across a boundary to chase
them.
They are directories rather than new sibling modules on purpose:
`db::model::CandidateState` and `db::builds::steps` are used across the crate
and by the integration tests, and renaming them would be a bigger change than
the one being made. No call site and no test changed.
db/mod.rs now lists its interface instead of spraying one. `pub use model::*`
and `pub use queries::*` are gone, replaced by seventeen explicit exports, and
the query modules are private — so a query that was not chosen for export is
not reachable, and the width of the module is visible from its own text
rather than only from a grep.
The ratchet caught the win immediately: db.glob went 2 -> 0, which failed
a_shrunk_interface_is_written_back until the budget was written back at the
new value. db is off the glob allowlist now rather than holding a stale zero.
277 passed / 0 failed, clippy -D warnings clean, largest file in src/db 363
lines (candidates.rs, unchanged from before this work).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Four greps in tests/layers.rs were the entire enforcement. They could say
that db had stopped naming http; they could not say what the architecture
is, could not place a new module, and said nothing about the twenty-odd
modules nobody had tripped over yet.
tests/architecture.rs declares the whole map instead. Every module in src/
gets a rank with the reason it sits there, and a module may name only
modules ranked strictly below it — one rule, every module, cycles
impossible by construction rather than by luck. The census says the graph
already satisfies it, so the map is a description of what is true, not an
aspiration the suite immediately fails on.
The same file holds the interface budgets, because a boundary is only as
strong as what it refuses to let you export: per module, how many pub items
it hands out and how many of them nothing outside the module names. Budgets
live in architecture-budget.json and move one way. A number that grows
fails; a number that got smaller without being written back also fails,
which is what stops a won gain from quietly becoming the new ceiling.
Each rule was probed rather than trusted: naming http from db fails with
`db (rank 3) names http (rank 9)`, tightening db.pub to 200 fails with
`db.pub: 226 > 200`, and leaving a stale budget fails with
`db.deadonly: budget 99, actual 36`.
tests/layers.rs is deleted, not weakened. Three of its four rules are rank
consequences now (db, review, recipe all sit below everything they were
forbidden to name); the fourth, watch -> shims, was already covered by
production_surface.rs, which greps every non-shim file for shims:: and
would catch it in any module, not just watch.
The census definition now lives in two languages, so the test checks them
against each other the way the vercmp oracle checks the hand-written
comparator: without python3 the note prints and the suite moves on.
277 passed / 0 failed (273 + 8 new - 4 subsumed), clippy -D warnings clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
copy_tree walked a live repo and tried to copy .git/objects/maintenance.lock
after git's detached maintenance had already removed it - a claim, not content,
and a copied index.lock would have made the copy refuse to run anyway. Locks are
skipped now, and the test git helper runs with maintenance.auto and gc.auto off,
so nothing repacks a repo behind a test that is still copying it. Background
maintenance spawns in a sampled pair of binaries went 72 to 21; the rest come
from the library's own clone and fetch, in directories nobody copies from.
Five consecutive full-suite runs clean, against roughly two in three failing
before.
|
| |
|
|
|
|
|
|
|
|
|
| |
The HTTP test cannot show delivery per append: the stream response is buffered
until it ends, so every line lands in one read no matter what the tail is doing,
and the sleeps that used to stage the appends proved nothing. The property moves
to where it is observable - drive LogTail, append between reads, and each append
has to arrive as its own event. The socket test keeps proving the wiring, the
headers and the end event.
copy_tree now names the file it failed on, which it did not do before.
|
| |
|
|
|
| |
Sandbox::default was a hand-written derivable_impl, and copy_tree borrowed an
owned PathBuf.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Every env_with_fixture call built an AUR stand-in and up to two upstreams from
scratch - six git processes a repo, and most fixtures build three of them. The
trees are built once per test binary under a cache and copied into the tempdir
now, so each test still owns a mutable copy and fx.bump still commits into it.
A recipe that names its own directories is the one thing the copy cannot get
right, so those few rewrite their work tree and amend instead.
Also stopped paying two git config calls and a rev-parse per repo: identity goes
in the environment of every test git call, and a repo this file made has one
branch and one commit, so the ref file is the tip.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The dispatch and crash waits polled every 50ms and 25ms against a dispatcher
that ticks every two seconds; live.rs staged its log appends with 400ms sleeps;
vcs.rs waited 80ms to conclude that a blocked racer had not entered. The pool
tests take the virtual clock and poll a 2ms condition wait, live.rs appends
without sleeping at all, and the Stage B test queues every racer on the slot
before releasing it, so the window a broken cap would slip through is set up
rather than hoped for.
live.rs no longer proves delivery mid-stream, because it never could: the stream
response is buffered until it ends, so the sleeps were not observable. Worth
fixing on the serving side, but that is a behaviour change, not a test one.
|
| |
|
|
|
|
|
|
| |
Advancing the clock on every wait made virtual time outrun real work: a build
taking a few hundred ms would burn forty ticks and expire its own lease. Under
a virtual clock a wait now costs a yield and the clock only moves when a test
moves it with time::advance, so a frozen lease stays frozen however fast the
loop runs.
|
| |
|
|
|
|
|
|
|
|
| |
The dispatcher tick, watcher tick, SSE poll, agent watchdog and remote
keepalive each slept on the wall clock in their own slice loop, so every test
that wanted a tick waited for real time. They call crate::time::wait/sleep now,
which is the same real sleep in a production build and a virtual clock advance
under test-support: a test that takes the clock owns it, and threads it spawns
inherit it. production_surface checks the virtual path is compiled out and that
no control loop went back to std::thread::sleep.
|
| |
|
|
|
|
|
|
|
| |
The differential against pacman's vercmp is the suite's second biggest
process cost, and its verdicts are a function of two strings plus the pacman
that produced them. They are recorded in testcorpus/vercmp-oracle.tsv now and
compared in process on every run, antisymmetry of the table included. The live
differential is still there - AUR_LIVE_VERCMP=1 runs it and says so when it is
not run.
|
| |
|
|
|
|
|
|
| |
read_tree cost a cat-file -e, an ls-tree and a cat-file blob per file, so
the number of processes a detection paid for scaled with how many files a
recipe ships. One ls-tree plus one batch read is now constant, and a commit
that is gone from the mirror surfaces from ls-tree itself - still fail
closed, still the same message.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
what it means
The end-to-end claim of the seam, tested as one thing: `plain-make` detected,
approved, built and published through `KataBackend` + `LocalAgentProvisioner` —
a real `sandbox-agent` process, a real nonce-matched rendezvous, real frames —
with a VM being the only thing this host cannot provide. The index ends up
serving the package, the agent's output reaches the same log the SSE tail reads,
and the shim saw exactly one `makepkg`.
Documented where the project records such things: the enum and the refusal of an
unwired kind, the shared listener and the shared Kata backend, and the
`shared_workspace` assertion as a guard rather than a fix — the workspace sync is
still the unimplemented thing it was, and the config now says so at startup
instead of letting `makepkg` discover it.
Also reaped two unreaped `sandbox-agent` children in the remote tests, which was
the last clippy warning in the tree; `--all-targets` is now silent.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`sandbox_backend` was a string and `backend_for` matched it with `_ => loopback`,
so the documented Kata backend was unreachable from configuration: a hub told to
use agent-sandbox would have quietly built untrusted PKGBUILDs as its own user.
The kind now parses, validates, and produces a real `KataBackend` over
`K8sSandboxProvisioner`, with the CR's `runtimeClass`, `activeDeadlineSeconds`,
nonce, image and cluster coordinates all traced back to the config that produced
them.
Kata shares a *backend* per configuration rather than only a listener: it routes
each dial-in by the nonce in its `Hello` into a map that belongs to it, so two
backends on one address would each see half the dial-ins and neither could
complete a rendezvous. The cache key is a digest of the distinguishing fields so
the token and bearer are not copied into a second place.
The containerd/`nerdctl` payload builder is deleted rather than left unused. It
was a second deployment shape with no provisioner, no config path and no live
tier — a builder that advertises a route the configuration refuses is worse than
no builder, because someone will eventually assume the route exists. DESIGN.md
now names one provisioning shape, which is the one that exists.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`Ctx::new` constructed a backend for every build, and constructing a remote
backend bound the agent listener. With a fixed `listen` — which is what any real
deployment configures, since the operator has to tell the agents where to dial —
the second concurrent build died of EADDRINUSE. A build failing for a reason
that had nothing to do with its package is the worst kind of flake: it looks like
the package's fault.
`RemoteBackend::bind` now shares one bound listener per `(address, token)` for
the life of the process, and hands each backend a clone of the dial-in queue.
That is also what `remote` already meant: an agent dials in when the operator
boots one and whichever build is waiting takes it. The token is part of the key
deliberately — two tokens cannot share a listener, and quietly reusing the first
one's would be a fail-open surprise, so the second bind is attempted and fails
loudly instead.
Backend construction moved out of `Ctx` into `sandbox::backend_for`, so "which
backend" has exactly one answer and the validation guard travels with it. Tests
cover the shared listener, the shared queue (the *second* backend takes the
dial-in), the two-token refusal, and two concurrent `Ctx`es on one address —
with an assertion that a raw second bind still fails, so the test cannot rot
into proving nothing.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The enum makes the impossible unrepresentable, but two things survive any type:
a field that is present and empty, and an assertion the type leaves defaulted on
purpose. `Config::validate` catches both, and it runs at startup — before the
watcher, the dispatcher or the UI are up and looking healthy — and again where a
backend is constructed, so nothing that builds one can skip it.
The one that matters is the workspace. `Run` frames carry a hub-side working
directory and the srcdir is never shipped to the sandbox, so a `remote` backend
on a machine that does not share the hub's filesystem would fail in `makepkg`
with a missing directory — and, worse, would *succeed* in the case nobody wants:
quietly building untrusted code on the hub. So a remote or agent-sandbox config
must say `"shared_workspace": true`, and the refusal says why rather than just
naming the field. Loopback needs no assertion because it shares the filesystem by
construction, which is also why it stays the zero-config default.
Empty `listen`, `token`, `api`, `namespace`, `bearer` and `image` are each refused
by name. Two tests drive the compiled binary rather than the library, because a
guard that only exists as a callable function is a guard the CLI can walk past.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`sandbox_backend` was a free-form string and `backend_for` matched it with
`_ => loopback`. So `sandbox_backend = "kata"` — a real, intended backend,
documented in the design — meant "run the untrusted PKGBUILD as the hub's own
user", and nothing anywhere said so. There was also no validation of any kind in
the crate: an empty `agent_token` with a remote backend, or a missing listen
address, parsed fine and failed later as something else.
The four flat fields become one tagged `sandbox` object with three kinds:
`loopback` (needs nothing, still the default, so every config on disk keeps
working), `remote` (listen + token), and `agent-sandbox` (api, namespace,
bearer, image, listen, token). Required fields are required by the type, an
unknown kind is a parse error naming the valid set, and `deny_unknown_fields`
means a misspelled field is named rather than read as absent. `agent-sandbox`
parses and is refused at backend construction until it is wired up — a valid
kind that is not implemented is an error, never a substitution.
Retired keys are refused when they carry intent: a config saying
`sandbox_backend: "remote"` errors and names the replacement shape, because
quietly reinterpreting it as loopback is the bug being removed. A config saying
`"loopback"` with the empty strings `init` wrote is noise, not intent, and loads
unchanged. The token and the cluster bearer are redacted in `Debug`, so a config
that reaches a log line cannot leak them.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`--root` names a directory and `init` writes config.json inside it, so the root
was already named by where the config lived. The `root` field in the file was
treated as a second source of truth instead: a relative one was re-joined onto
the config's own directory, and `init` saved whatever it had been handed. So
`--root runtime` wrote `"root": "runtime"`, and every command after `init`
resolved it to `runtime/runtime/` — a second tree with its own empty database,
while `init` had created and migrated the first one. The user-visible half was a
path like `runtime/runtime/repo/aur-build/os/x86_64/…` in an error message.
Compounding it, the CLI fell back to a default config whenever loading failed, so
a typo'd `--root` produced a fresh empty server that answered every command as
though it were the one you meant. `load` now sets the root to the directory it
found the config in, absolutized, and a missing config is an error for every
command except `init` — the only one that runs before one exists.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Publishing renders the index before the DB commits and renames it into place
after, so a crash between the two leaves the old index serving (I4). The way
that was written did it at `<db>.tar.gz.tmp` beside the live file — a filename
real repo-add refuses, because its database argument has to be a name pacman
would accept. Every publish test passed; the first real package anyone tried to
publish died at the last step with the release already committed.
`render_db` now renders into a scratch directory under the served directory,
under the name a consumer will download. Same filesystem, so the rename is still
the atomic swap, and the live database is never the file repo-add is writing
into. `publish`, `reconcile` and `withdraw_package` all had the bug and all share
the helper now; `reconcile` sweeps scratch directories a crash left behind.
`run_repo_add` drops `-s` too: repo-add would sign into scratch space that is
about to be deleted, and `publish::sign` already signs the renamed file.
The reason 238 tests missed this is that the shim would write the database
anywhere it was told. It now enforces the accepted set — measured against
`repo-add (pacman) 7.1.0`, not read out of its docs — with the real tool's
wording and exit status, and a gated test re-derives the set against the
installed tool, in the shape of the vercmp oracle. A shim that is more
permissive than its tool is not a test of the tool.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recovery paths a remote pool makes newly reachable are now executed,
not described. A decorator over the loopback backend injects the four
faults that matter: a sandbox that vanishes mid-run (the step fails, the
lease expires, the reaper requeues, a healthy pool finishes from the
checkpoints — I5 across the sandbox boundary); a TTL that bites mid-build
(a failed step, not a retry-burned one); a pool at quota (the build
blocks on sandbox-pool using the same blocked machinery as missing deps,
rather than failing on an infrastructure fact); and a sandbox whose
pacman -Q lies about the installed world (provisioning refuses with a
dedicated world-mismatch class, so 'the sandbox lied' never reads as
'the sandbox broke').
Two error classes carry that vocabulary: PoolExhausted — capacity, so
wait, never retry — and WorldMismatch — fail-closed, never retried. The
remote and kata acquire timeouts now speak the first, which is what
makes a full pool a queue fact instead of a build failure.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The kata lease path is composition, not a new protocol: acquire mints a
rendezvous nonce, asks a Provisioner for a sandbox pointed at this hub,
and leases only the dial-in whose hello carries that nonce back. A box
that never dials in is a TTL expiry — the same vocabulary every other
failure here speaks (I5) — and a stray box that greets with a nonce
nobody ordered is dropped unread, never leased.
Two payload shapes are constructed as pure, unit-tested functions
because both are real targets: an agent-sandbox-style Kubernetes CR
(runtimeClass kata, activeDeadlineSeconds so the orchestrator enforces
the TTL even if the hub dies) and a nerdctl/containerd argv for hosts
without a cluster. The K8s provisioner is real ureq code exercised only
by the gated live tier, which skips with a printed note wherever
/dev/kvm or AUR_KATA_API is absent — the recorded-skip convention, not
a silent pass.
The rendezvous and TTL logic runs for real on any machine via
LocalAgentProvisioner: a real sandbox-agent process, real frames, real
nonce matching, no VM. That is the same honesty as the loopback
backend — the interface is under test, not a mock of it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The seam from the previous commits only had one body. This adds the
other one: a sandbox-agent binary that dials the hub (outbound
rendezvous — the hub never needs a route into an untrusted box), serves
Run/Put/Get frames over length-prefixed JSON, streams the child's
stdout/stderr as they fill, and dies — taking its child with it — when
the connection drops or its TTL expires. The TTL watchdog is the
backstop under every leak: hub crash, partition, a forgotten destroy.
Hub side, RemoteBackend implements the same SandboxBackend: acquire
waits for a dial-in and verifies the shared token and profile before a
lease exists; a vanished sandbox fails the step, which is already the
shape of an expired lease (I5), so the remote path adds no new failure
vocabulary. Run frames carry the hub's child environment, so the §16a
shim protocol reaches remote children exactly as local ones — which is
what makes the end-to-end test honest: a real build, real frames, real
log streaming into the SSE-tailed file, no root and no container.
Workspace sync over the wire is deliberately not here: Run carries a
hub-side cwd, honest for loopback-shaped deployments and this test
tier, and the module says so rather than pretending.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The build step used to pass -si<key> through makechrootpkg, which meant
whatever machine ran the build had to hold the signing key - fine for a
chroot on the hub, disqualifying for a remote sandbox. The build now
produces unsigned bytes; ingest signs the exact bytes that entered the
store, with the same key and code path that signs the database, and a
gpg failure fails the build closed. verify() no longer checks for a
build-made signature: the meaningful guarantee moved to 'ingest produced
one or the build failed'. The shim makechrootpkg now only emits .sig
when -si is passed, like the real tool, so the suite cannot accidentally
test a signing path that no longer exists.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
m-17. `watch::staleness::dependents_of` walked the index and asked for each
package's recipe by name — one query per package, on the path that runs after
every publish, with N equal to the size of the index. `db::index_recipes` returns
the whole table in one query now. While there: a recipe that fails to parse is no
longer treated as "does not depend on this package". An unreadable srcinfo used
to hide a dependent from staleness by returning `None` into an `unwrap_or(false)`;
now it is a reason to look.
`db::builds::requeue_blocked` asked "is this name in the index?" once per
dependency of every blocked build, inside the dispatcher's hot loop. The set of
in-index names is read once per pass and tested in memory. Same answer, one
query.
m-18. `approved_but_unbuilt` assembled the version a human reads with two
`CASE WHEN epoch='0'` expressions in SQL — a second, independent copy of the
`epoch:pkgver-pkgrel` rule that `pkgver::full_version` owns. Two copies of a
formatting rule is how the Attention page ends up describing versions
differently from every other page. The query returns the parts; Rust formats
them. A guard test fails if version-string concatenation reappears in SQL.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
m-7. `fsync_file` and `fsync_dir` opened, ignored every error, and returned Ok,
in the module whose entire guarantee is "fsync, then rename". A filesystem that
refused the sync — full, read-only, a network mount that had dropped — still
produced a successful publish whose database might not be on disk. They
propagate now, with the path and the cause.
m-10. `withdraw_release_in` set `state='withdrawn'` unconditionally, so
withdrawing twice reported success the second time while changing nothing, and
withdrawing a release that had never been live did the same. The write is a
compare-and-swap on `state='published'`, and a refusal names the state that was
actually there ("release 1 is withdrawn, not published: nothing to withdraw").
m-16. Artifacts are copied into the served tree before the DB commit, and when
the commit refused they stayed: files no index names, sitting in the directory
consumers download from. `publish` now tracks which files it created (a file
that already existed belongs to the release still being served and is never
touched) and removes them if the publish does not land.
m-14. `is_transient` treated every `Error::Io` as retryable, which made ENOSPC
and EACCES — plain `Io` — into three identical failures and a silent build.
Only the kinds that mean "ask again in a moment" retry now. This turned a test
that had been asserting the bug: it simulated a transient failure by pointing
`makechrootpkg` at a nonexistent path, which is a missing binary, not a flaky
network. That test now asserts the opposite (one attempt, no retries), and a new
one produces a genuinely transient failure the way production does — a `SKIP`
source whose bytes go unreachable after detection, cache dropped, so the
`sources` step fails over the fetch path and retries to the cap.
m-13. `random_hex` read `/dev/urandom` into a zeroed buffer, ignored every
error, and hashed it anyway. Since C-1 the session id is the whole credential,
so a failed read is now a refusal: `new_session()` returns `Option`, and the two
call sites answer 500 rather than mint a token derivable from the clock and a
counter.
m-9. The row-error policy is decided and applied: a row that cannot be read
fails the query instead of vanishing from the result (six `filter_map(|r|
r.ok())` sites, including the reaper's and the claimer's), and `setting_i64`
documents its own policy — absent means default, nonsense means default *and a
complaint*, because a typo that silently does nothing is worse than a knob that
refuses to apply.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
m-2. `hosts` existed twice, verbatim, in `review::diff` and `review::risk`. The
duplication that matters is the other one: "did the executable part of the
recipe change" also existed twice, with *different* semantics. The risk scorer
compared everything from the first function definition onward; the diff panel
compared only the lines that name a function, so a `build()` rewritten to
`curl … | sh` under the same function names told the risk scorer "code changed,
high" and told the reviewer nothing at all — the one reader who could have
caught it. Both questions now have one answer: `urlutil::hosts` (which also
strips the `git@` from ssh URLs, so a scheme change stops crying "new source
host" wolf) and `recipe::bodies_changed`, in the module that owns the recipe.
m-4. The three review decisions each hand-built an `AuditEntry` literal, and
their `detail` shapes drifted: approve recorded the identity hash, reject
recorded only the note, withdraw only the reason — so for two of the three the
log cannot answer which candidate bytes the decision was about. `AuditEntry` is
built by `::human` / `::system` now, and reject records the identity hash it
rejected.
m-3, the four-times-copied 21-column candidate `SELECT`, was already gone: the
`CANDIDATE_COLS` constant came with moving the candidate SQL into `db/` in an
earlier commit.
Tests: the body rule is pinned at the unit level with the exact drift case
(same function names, different body), `tests/production_surface.rs` fails if
either module grows a private copy again or if an audit row is hand-built, and
the reject test reads its own audit row back and requires the identity in it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`now()` returned the pinned instant when a test had pinned one, but
`secs_ago`/`secs_ahead` called `Utc::now()` directly (m-1). Anything built from
them — every lease expiry, every `next_check_at`, every cooldown cutoff — was
therefore computed against the real wall clock and then compared against the
pinned one. A test that pinned 2026-01-01 and took a 90-second lease got an
expiry 90 seconds after *today*, so the reaper comparing `lease_expires_at <
now()` saw a lease that would not expire for a century, or one that had expired
millions of seconds ago, depending on which way the pin pointed. The test still
passed, because nothing asserted on the number.
Both now go through a `base()` that reads the pinned instant, so a pinned test
computes and compares on the same clock. `tests/time.rs` pins the arithmetic
directly and then does the thing the bug actually broke: claim a lease under a
pinned clock, assert the expiry is 90 seconds after the pinned now, assert the
reaper sees nothing yet, advance the pinned clock 91 seconds, and assert it
reaps.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
M-6. `db::stage_b_cache_get` and `db::stage_b_recent` returned
`watch::upstream::StageB`, so the persistence layer could not be read without
the VCS watcher, and the table's row shape was defined by whatever the watcher
happened to find convenient. The row is `db::model::StageBCacheRow` now —
epoch, pkgver, pkgrel, pins — and `watch::upstream` converts at its own
boundary. The two types are deliberately not the same one: `StageB` carries
`cached`, and "was this answer a cache hit?" is a fact about the resolution
that just happened, not a column.
M-7. `review::risk` called `watch::digests::skip_on_non_vcs` while
`watch::detect` called into `review::candidates`, a cycle between two sibling
domains. Whether a recipe declines to verify its own sources is a question about
the recipe, so `skip_on_non_vcs` — with `SKIP`, `declared_sums` and
`is_hex_digest`, which it needed and which the watcher had no business owning —
moved to `recipe.rs`, a leaf both sides may look down at. `watch::digests` keeps
its use of them for digest resolution; the re-export is gone.
`tests/layers.rs` enforces the direction from now on: `src/db` names no module
above itself, `src/review` does not name `watch`, `src/watch` does not name
`pipeline` or `http`, and `recipe.rs` names nothing at all. Each rule failed
before this commit and each failure message prints the exact file and line of
the offending edge, so the next reasonable-looking commit cannot reintroduce
one quietly.
|