summaryrefslogtreecommitdiffstats
path: root/src/usecase/maintenance.rs
Commit message (Collapse)AuthorAgeFilesLines
* src: narrow what only its own module reads, and delete what nothing reads at allaur-build10 days1-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* usecase: one implementation of each workflow, run by both front endsdev11 days1-0/+43
`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.