diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 08:23:14 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 08:23:14 +0000 |
| commit | eefbefed9cbea6b2edef65900fbe6cb6da0b48e4 (patch) | |
| tree | 1249788a49812fc15b644687af7c1384f94ba236 /src/http | |
| parent | a6b652985f40cf022d6c522415c36fad13bc663d (diff) | |
| download | aur-build-eefbefed9cbea6b2edef65900fbe6cb6da0b48e4.tar.gz aur-build-eefbefed9cbea6b2edef65900fbe6cb6da0b48e4.zip | |
http: surfaces driven by live state — staleness, downgrades, deps, rebuild (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.
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/render.rs | 2 | ||||
| -rw-r--r-- | src/http/routes.rs | 76 |
2 files changed, 59 insertions, 19 deletions
diff --git a/src/http/render.rs b/src/http/render.rs index 2fad5c8..9e3d801 100644 --- a/src/http/render.rs +++ b/src/http/render.rs @@ -211,6 +211,8 @@ pub struct NoticeRow { #[derive(Debug, Clone)] pub struct StaleRow { pub pkgbase: String, + /// The dependency that moved (or `aur` for a downgrade row). + pub dependency: String, pub built_with: String, pub now: String, } diff --git a/src/http/routes.rs b/src/http/routes.rs index 784024d..ab68069 100644 --- a/src/http/routes.rs +++ b/src/http/routes.rs @@ -4,7 +4,7 @@ //! connection — and hands mutations to the writer actor. A slow client can //! therefore never hold the write lock, which is the whole point of the split. -use crate::db::{self, builds, model::*}; +use crate::db::{self, builds, model::*, Db}; use crate::review::{approve as ap, candidates, diff, risk}; use crate::{pipeline, time}; @@ -592,15 +592,19 @@ fn attention(state: &State, req: &Req) -> Res { .iter() .filter(|s| s.kind == crate::watch::staleness::Kind::Outdated) .cloned() - .map(|s| StaleRow { pkgbase: s.pkgbase, built_with: s.built_with, now: s.now }) + .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now }) .collect(); let missing: Vec<StaleRow> = stale .iter() .filter(|s| s.kind == crate::watch::staleness::Kind::Missing) .cloned() - .map(|s| StaleRow { pkgbase: s.pkgbase, built_with: s.built_with, now: s.now }) + .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now }) + .collect(); + let downgrades: Vec<StaleRow> = crate::watch::staleness::downgrades(db) + .unwrap_or_default() + .into_iter() + .map(|s| StaleRow { pkgbase: s.pkgbase, dependency: s.dependency, built_with: s.built_with, now: s.now }) .collect(); - let downgrades: Vec<StaleRow> = Vec::new(); let empty = notices.is_empty() && outdated.is_empty() && missing.is_empty() && blocked.is_empty(); page_to_res( Attention { page, empty, notices, outdated, missing, downgrades, blocked }, @@ -687,6 +691,19 @@ fn package_detail(state: &State, req: &Req, name: &str) -> Res { step: b.current_step.unwrap_or_default(), }) .collect(); + // Depends-on comes from the recipe we actually serve; needed-by comes from + // the packages whose own recipes name this one (§10.3). + let deps_in: Vec<String> = accepted + .as_ref() + .and_then(|r| db::accepted_recipe(db, r).ok().flatten()) + .map(|r| { + let mut v = crate::pkgver::dep_names(&r.depends); + v.sort(); + v.dedup(); + v + }) + .unwrap_or_default(); + let deps_out: Vec<String> = crate::watch::staleness::dependents_of(db, name).unwrap_or_default(); let stale: Vec<String> = crate::watch::staleness::stale_for(db, name) .unwrap_or_default() .into_iter() @@ -703,8 +720,8 @@ fn package_detail(state: &State, req: &Req, name: &str) -> Res { summary, can_withdraw: accepted.is_some(), stale, - deps_in: Vec::new(), - deps_out: Vec::new(), + deps_in, + deps_out, timeline, builds, }, @@ -746,6 +763,22 @@ fn package_withdraw(state: &State, req: &Req, name: &str) -> Res { // --------------------------------------------------------------- builds -- +/// The version a build is about. A build points at a candidate, or — for a +/// manual rebuild of something already published — at a release. +fn build_version(db: &Db, b: &builds::BuildRow) -> String { + if let Some(cid) = b.candidate_id { + if let Some(c) = candidates::candidate_by_id(db, cid).ok().flatten() { + return c.version(); + } + } + if let Some(rid) = b.release_id { + if let Some(r) = db::release_by_id(db, rid).ok().flatten() { + return r.version(); + } + } + String::new() +} + fn build_rows(state: &State) -> Vec<BuildRow> { builds::list( &state.db, @@ -760,11 +793,12 @@ fn build_rows(state: &State) -> Vec<BuildRow> { .flatten() .map(|p| p.name) .unwrap_or_default(); + let version = build_version(&state.db, &b); BuildRow { id_short: short(&b.id), id: b.id, pkgbase, - version: String::new(), + version, kind: b.kind, state: b.state, step: b.current_step.unwrap_or_default(), @@ -785,17 +819,21 @@ fn builds_with(state: &State, _req: &Req, page: Page) -> Res { let recent: Vec<BuildRow> = builds::list(&state.db, &[build_state::FAILED, build_state::SUCCEEDED], 10) .unwrap_or_default() .into_iter() - .map(|b| BuildRow { - id_short: short(&b.id), - id: b.id, - pkgbase: db::get_pkgbase_by_id(&state.db, b.pkgbase_id).ok().flatten().map(|p| p.name).unwrap_or_default(), - version: String::new(), - kind: b.kind, - state: b.state, - step: b.current_step.unwrap_or_default(), - lease: String::new(), - cancel: b.cancel_requested, - error: b.error.unwrap_or_default(), + .map(|b| { + let pkgbase = db::get_pkgbase_by_id(&state.db, b.pkgbase_id).ok().flatten().map(|p| p.name).unwrap_or_default(); + let version = build_version(&state.db, &b); + BuildRow { + id_short: short(&b.id), + id: b.id, + pkgbase, + version, + kind: b.kind, + state: b.state, + step: b.current_step.unwrap_or_default(), + lease: String::new(), + cancel: b.cancel_requested, + error: b.error.unwrap_or_default(), + } }) .collect(); page_to_res(Builds { page, rows: build_rows(state), recent }, 200) @@ -834,7 +872,7 @@ fn build_detail(state: &State, req: &Req, id: &str) -> Res { id: id.to_string(), id_short: short(id), pkgbase, - version: String::new(), + version: build_version(db, &b), kind: b.kind, state: b.state, error: b.error.clone().unwrap_or_default(), |
