From c712124f214fc53a57b23c10ed98e8e869cbf7c2 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 18:02:43 +0000 Subject: =?UTF-8?q?watch,=20review,=20config:=20the=20clarity=20minors=20?= =?UTF-8?q?=E2=80=94=20no-ops,=20dead=20params,=20one=20error=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit m-5. `mark_approved_but_unbuilt` was a function that did nothing, called from the failure path with a comment explaining that it did nothing. The mechanism is real — a failed build leaves the accepted pointer alone, and "approved, build failed, index still serving the old version" is what the derived query reads back — but a no-op in the failure path is a trap for whoever traces a build failure at 3am. Deleted; the explanation moved to the call site that needs it. m-6. The step loop extended the lease by a hardcoded 90 seconds while `Config` carried `lease_secs`, so an operator who raised the lease got leases that were silently reset to 90s after the first step. m-8. Dead parameters and `let _ =` debris: `upstream::run` took a `Db` it never used (and a `let _ = local;` after the value's only use), `risk::assess` took a `Pkgbase` it never used, `accepted_pins` took a `Db`, `detect::schedule_next` took a `Pkgbase` it discarded, `diff::version_delta` computed a `vercmp` and threw the answer away, and two HTTP handlers took arguments they ignored. All gone, with the callers following. m-11. `schedule_next` re-queried the subscription for `poll_interval_secs` that its caller had read moments earlier to decide whether the pkgbase was paused — two queries, and two chances to get different answers. The interval is now an argument, and the scheduler's own tick (which already holds the row) was already doing it the right way. m-15. `Config::load`/`save`/`ensure_dirs` returned `anyhow::Result` while the rest of the crate returns `error::Error`, which put two vocabularies on either side of one boundary and turned "there is no config yet, run init" — the one thing a caller can branch on — into an opaque string. They return the crate's error now; `main` keeps `anyhow` at the CLI edge, where it belongs. m-19. `skip_declared` was hardcoded `true` for VCS entries, so the field that means "the recipe gave us no checksum to trust" also meant "this is a git source", and a new `-git` source was rendered to a reviewer as `sha256sums=SKIP` — a warning about a recipe that had done nothing wrong. The field now means one thing everywhere, `SourceDigest::is_vcs()` says which integrity mechanism protects an entry, and the diff panel prints "pinned commit" for those. n-6. `recipe_at` was `pub` for no reason; it is `pub(crate)`. --- src/http/routes.rs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'src/http') diff --git a/src/http/routes.rs b/src/http/routes.rs index f475d3a..4a988b2 100644 --- a/src/http/routes.rs +++ b/src/http/routes.rs @@ -195,8 +195,7 @@ fn dashboard(state: &State, req: &Req) -> Res { // ---------------------------------------------------------------- inbox -- -fn review_rows(state: &State) -> Vec { - let db = &state.db; +fn review_rows(db: &Db) -> Vec { let mut rows: Vec = candidates::pending_candidates(db) .unwrap_or_default() .into_iter() @@ -218,13 +217,12 @@ fn review_rows(state: &State) -> Vec { _ => 2, }; rows.sort_by_key(|r| (rank(&r.risk), r.age.clone(), r.id)); - let _ = state; rows } fn reviews(state: &State, req: &Req) -> Res { let page = chrome(state, req, "Reviews", "nav_reviews"); - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 200) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 200) } fn full_version(c: &CandidateRow) -> String { @@ -363,7 +361,7 @@ fn review_approve(state: &State, req: &Req, id: &str) -> Res { page.flash_err = true; } } - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 200) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 200) } Err(ap::ApproveError::System(e)) => { // The database refused. Telling the reviewer their review went stale @@ -372,7 +370,7 @@ fn review_approve(state: &State, req: &Req, id: &str) -> Res { page.flash = format!("the approval could not be recorded: {e}"); page.has_flash = true; page.flash_err = true; - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 500) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 500) } Err(ap::ApproveError::Stale(stale)) => { // §7.1a: refuse, re-render what it is now, and say why. Never @@ -419,21 +417,21 @@ fn review_reject(state: &State, req: &Req, id: &str) -> Res { page.flash = "a rejection needs a reason: it is the only record of why".into(); page.has_flash = true; page.flash_err = true; - return page_to_res(ReviewsPage { page, rows: review_rows(state) }, 400); + return page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 400); }; match ap::reject(db, actor(state, req), id, ¬e) { Ok(()) => { let mut page = chrome(state, req, "Reviews", "nav_reviews"); page.flash = format!("rejected #{id}; it can be re-opened from the package page"); page.has_flash = true; - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 200) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 200) } Err(e) => { let mut page = chrome(state, req, "Reviews", "nav_reviews"); page.flash = format!("could not reject: {e}"); page.has_flash = true; page.flash_err = true; - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 409) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 409) } } } @@ -463,7 +461,7 @@ fn reviews_bulk(state: &State, req: &Req) -> Res { page.flash = "nothing selected".into(); page.has_flash = true; page.flash_err = true; - return page_to_res(ReviewsPage { page, rows: review_rows(state) }, 400); + return page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 400); } // The rule itself lives in `review::approve::bulk`, so the page and the // library cannot disagree about what a bulk decision means (§7.4). @@ -480,7 +478,7 @@ fn reviews_bulk(state: &State, req: &Req) -> Res { page.flash = format!("the decisions could not be recorded: {e}"); page.has_flash = true; page.flash_err = true; - return page_to_res(ReviewsPage { page, rows: review_rows(state) }, 500); + return page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 500); } }; let mut done = Vec::new(); @@ -506,7 +504,7 @@ fn reviews_bulk(state: &State, req: &Req) -> Res { ); page.has_flash = true; page.flash_err = !refused.is_empty(); - page_to_res(ReviewsPage { page, rows: review_rows(state) }, 200) + page_to_res(ReviewsPage { page, rows: review_rows(&state.db) }, 200) } /// Who the audit trail says made a decision. With no password configured the @@ -674,7 +672,6 @@ fn notice_ack(state: &State, req: &Req) -> Res { let _ = db::acknowledge_notice(&state.db.writer, id); // POST-redirect-GET: the notice vanishing from the list is its own // confirmation, and a refresh can no longer re-POST. - let _ = req; Res::redirect("/attention") } @@ -789,9 +786,11 @@ fn package_detail(state: &State, req: &Req, name: &str) -> Res { fn package_rebuild(state: &State, req: &Req, name: &str) -> Res { match pipeline::enqueue_manual_rebuild(&state.cfg, &state.db, name) { Ok(id) => { - let _ = id; let mut page = chrome(state, req, "Builds", "nav_builds"); - page.flash = format!("queued a rebuild of the approved version of {name} (no new approval needed)"); + page.flash = format!( + "queued a rebuild of the approved version of {name} (build {}, no new approval needed)", + &id[..8.min(id.len())] + ); page.has_flash = true; builds_with(state, req, page) } -- cgit v1.2.3