summaryrefslogtreecommitdiffstats
path: root/src/watch/staleness.rs
Commit message (Collapse)AuthorAgeFilesLines
* src: close the items the stricter detector surfacedaur-build10 days1-7/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* comments: keep only what the code cannot showaur-build12 days1-19/+0
| | | | | | | | | | | 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.
* comments: say why, not whataur-build12 days1-16/+3
| | | | | | | | | | | | | | 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.
* db, watch: two N+1s and a version rule with one owneraur-build13 days1-11/+12
| | | | | | | | | | | | | | | | | | | | | | 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.
* db: the schema gets an owner — every statement moves into db/, and the ↵aur-build13 days1-56/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* http: surfaces driven by live state — staleness, downgrades, deps, rebuild ↵aur-build14 days1-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* http: the review surface — server-rendered, no JavaScript required (§12, ↵aur-build14 days1-0/+125
§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.