| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
A gated item used to carry its own defence: why it is `pub` only under
`test-support`, which census once mistook a filename for a caller, why a
wrapper is compiled out rather than deleted. The budget file already
holds those claims and the ratchet already checks them, so the source
keeps the one line that says what the item is.
The module headers stop narrating the refactor that produced them. What
survives is the wire protocol, the git pipe, the poisoned lock that must
be recovered rather than unwedged.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rustfmt.toml fixes the shape the tree is written in (120 columns, small
items kept on one line) and one canonical pass makes it the truth.
[lints.clippy] names the idiom lints worth enforcing and leaves out the
two that would add doc-comment boilerplate rather than remove it. The
tree pays them off here: write!/writeln! instead of push_str(&format!()),
let-else instead of match-on-Option, borrows where a thread entry point
only reads what it owns, no `&self` on a Copy state and no `self` nobody
reads.
ops::to_prometheus gains one gauge helper: a metric's HELP, TYPE and
value are now emitted by the same call instead of three.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The census's 35 `deadonly` items were a lead, not a verdict, and the compiler
answered it: 17 of them are read only inside their own module and were declared
`pub` for no reason, so they are `pub(crate)` now — `db::OpenReview` and its two
queries, `ReviewSubject` and its query, `fetch::Body`, `http`'s `form_get`,
`query_get` and `Page::flash`, `ops::EvictPlan`, `usecase`'s `StageB`… — and two
are read by nobody: `ReleaseState::can_transition` and
`SubscriptionState::can_transition`, both already annotated "nothing consults
this table today", which is the definition of dead rather than the argument for
keeping.
Narrowing them is what made the compiler look harder, and it found three more:
`ReviewSubject::pkgbase` was selected out of the database and never read,
`StageB::cached` was written in three places and never read, and
`StageB::version` was never called. All gone, the SELECT column with them.
The other 18 cannot be narrowed and now say so, once at the declaration and once
in the budget file: a row type the `aur-build` binary binds without naming
(`PackageRow`, `Checked`, `GcPlan`, `Prepared`), a type behind a `pub` fn a test
calls (`Unbuilt`, `BulkItem`, `StageA`, `CheckReport`, `PkgInfo`, `Installed`,
`Subscription`, `Manifest`), a trait a public test provisioner implements
(`Provisioner`, `ProvisionRequest`), and three that a release build never even
compiles because their module is `test-support`-gated (`shims::*`, `VirtualClock`).
`deadonly` therefore means *dead and unargued* now: an allowlisted item leaves the
dead columns, which is the only way the number can be held at zero forever.
448 pub, 49 dead, 0 unargued; 284 tests pass, one ignored, none lost.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The auditor's two counterexamples were real, and fixing the detector exposed
seventeen more items it had never listed. Each was checked individually rather
than dispositioned in bulk, and the check changed what the right answer was:
- `review::approve::withdraw` — gated. The CLI and the web UI both go through
`usecase::withdraw_package`; nothing invokes this. tests/pipeline.rs pins its
invariants, so it is gated rather than deleted: the test is the cover for an
operation production has not grown yet.
- `pipeline::dispatch::Pool::shutdown` — gated. Production runs the pool until
the process exits; a test needs the join to assert on effects after the
threads stop. Its two fields now carry a matching `cfg_attr(allow(dead_code))`
because in a release build they are stored and never read.
- `shims::{mkarchroot,makechrootpkg,makepkg,gpg,pacman,record}` — plain
`pub(crate)`. `run` dispatches to them by tool name; no module outside `shims`
names them and no test calls them. The tool names appear in test *strings*,
which is not a caller.
- `db::Writer::start`, `fetch::open`, `http::Req::form`, `http::Page::new`,
`http::Panel::new`, `http::render::BuildRow` — plain `pub(crate)`, same
reason: used only from inside their own module.
- `db::AuditEntry::system` — deleted. `audit_system` builds the row through the
free `audit()`; nothing ever called the constructor, production or otherwise.
- `pkgver::Version::display` — deleted, a wrapper around `to_string` with no
callers.
- `http::Server`, `watch::Stale`, `pkgver::Version` — private inner module with a
gated alias. `Server` is what `spawn` hands back and `main` holds without
naming; `Stale` is what `stale_rows` returns to `http` and `ops`; `Version` is
what `parse` returns. All three must stay nameable to those callers in shape
but not in name, which is exactly what the inner-module alias gives.
Measured on the release build's public surface: 466 reachable public names at the
start of this goal, 402 now, newly-public set empty.
|
| |
|
|
| |
build
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GET /builds/:id/log.stream serves the build log as server-sent events from a
blocking std::io::Read polled by the connection's thread — no async runtime,
no timer wheel. The pipeline appends to a plain file and never learns the
reader exists, so a viewer that hangs up, stalls or never shows up cannot slow
a build by a microsecond. The stream ends when the build reaches a terminal
state instead of holding a connection open forever, and there is a 30-minute
lifetime cap so a wedged build cannot wedge a browser tab indefinitely.
The test proves it is actually live rather than buffered: a producer thread
appends while the stream is open, and the reader must see those bytes before
the build finishes, then see the end event.
The builds table refreshes with hx-trigger="every 3s" against a fragment
endpoint, so htmx swaps one <div> rather than a whole document. Without
JavaScript the same HTML already contains the table — the refresh is an
enhancement, never a requirement.
Static assets are served from include_bytes!, precompressed, with the
Content-Length forced so tiny_http does not chunk a file whose size we know.
Vendoring decision, recorded in docs/DECISIONS.md: the design's '~14 KB htmx'
does not exist — released htmx is 48 KB minified. We vendor 1.9.12 unmodified
and serve the 15.6 KB gzip, and the budget is asserted on served bytes with a
bare-socket test, because an HTTP client would transparently decompress and
hide the number. htmx's SSE extension is deliberately NOT vendored: it swaps
with innerHTML and a build log is untrusted text from someone else's PKGBUILD,
so wiring it up would be an XSS hole opened to make a log scroll by itself.
The review surface still ships no JavaScript at all, asserted by grepping the
rendered page for <script.
Also: styles moved out of base.html into static/app.css, and docs/DECISIONS.md
started with the decisions made so far. 138 tests pass, clippy clean.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(§8.4, I5)
The crash-resume invariant was only ever simulated before: an in-process fault
hook returns an error, and an error can be caught, unwound and cleaned up by
accident. So the shims gained AUR_SHIM_KILL_PARENT — the named tool SIGKILLs
the process running the pipeline, mid-step, with no Drop and no atexit.
The test spawns the real aur-build binary, watches it die of SIGKILL inside
the build step, and then asserts the things that matter:
- the database is intact, because no transaction ever spans a build step
- the completed steps are checkpointed succeeded and the running one is
recorded running
- after the lease expires the reaper requeues it and marks the step
interrupted
- resuming publishes exactly one release, and the shim invocation log proves
mkarchroot ran once, makechrootpkg twice (crash + resume, not twice per
attempt) and repo-add once
**This found a real bug.** reap_expired only matched state='leased', but a
worker sets state='running' the moment it starts a step, so a process that
dies mid-step leaves a running row — and every real crash would have been
stranded forever. The reaper now reaps leased and running.
Also §8.4's other half, which was a comment rather than a feature: a failed
build must not leave the old version looking healthy. db::approved_but_unbuilt
finds approvals whose build failed and never published, and Attention and the
package page now say 'v2 approved, build failed, index still serving v1' with
a link to the log. Retrying is an explicit, audited POST, not something the
system does to itself.
Cancellation is asserted to be cooperative at a step boundary: a cancelled
build runs no steps, publishes nothing, and is not counted as a failure.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|