OXYGENHUB

Coverage / crates/hub/src/web/runner_updates.rs 92.5%

321 of 347 lines run, 57 of 136 functions · run #474 on main · run missed

1
//! Admin → Runners → Updates (oxygenhub#322): where runner builds come
2
//! from, and who takes them: the site's, each owner's, each test group's
3
//! and each runner's settings, the nearest winning; test groups of chosen
4
//! runners or a percentage of them.
5
6
use super::settings::csrf;
7
use super::{filters, Error, Page, Shell};
8
use crate::auth::Viewer;
9
use crate::db::runner_updates::{self as rdb, Group, Policy};
10
use crate::db::{accounts, runners};
11
use crate::runner_updates::{self as ru, Levels};
12
use crate::Shared;
13
use askama::Template;
14
use axum::extract::{Form, Path, State};
15
use flow_core::api::UpdatePolicy;
16
use serde::Deserialize;
17
1818×
fn require_admin(viewer: &Viewer, shell: &Shell) -> Result<accounts::Account, Error> {
1918×
    match viewer.account() {
2017×
        Some(a) if a.is_admin => Ok(a.clone()),
211×
        _ => Err(Error::not_found(shell.clone())),
22
    }
2318×
}
24
25
/// One level's settings as its form shows them: `inherit`, `on` or `off`
26
/// for the switches, blank for an inherited channel or window.
27
pub struct PolicyView {
28
    pub scope: String,
29
    pub key: String,
30
    pub label: String,
31
    pub updates: &'static str,
32
    pub channel: String,
33
    pub window: String,
34
    pub dry_run: &'static str,
35
}
36
37
impl PolicyView {
38156×
    fn of(p: &Policy, label: String) -> PolicyView {
39312×
        let tri = |b: Option<bool>| match b {
4049×
            Some(true) => "on",
4117×
            Some(false) => "off",
42246×
            None => "inherit",
43312×
        };
44
        PolicyView {
45156×
            scope: p.scope.clone(),
46156×
            key: p.key.clone(),
47156×
            label,
48156×
            updates: tri(p.updates),
49156×
            channel: p.channel.clone().unwrap_or_default(),
50156×
            window: match (p.window_from, p.window_to) {
5110×
                (Some(a), Some(b)) => format!("{a:02}-{b:02}"),
52146×
                _ => String::new(),
53
            },
54156×
            dry_run: tri(p.dry_run),
55
        }
56156×
    }
57
58
    /// The settings in words, for a table.
5924×
    pub fn summary(&self) -> String {
6024×
        let mut s = vec![];
6124×
        if self.updates != "inherit" {
6218×
            s.push(format!("updates {}", self.updates));
6318×
        }
6424×
        if !self.channel.is_empty() {
652×
            s.push(format!("channel {}", self.channel));
6622×
        }
6724×
        if !self.window.is_empty() {
681×
            s.push(format!("window {} UTC", self.window));
6923×
        }
7024×
        if self.dry_run != "inherit" {
7113×
            s.push(format!("dry run {}", self.dry_run));
7213×
        }
7324×
        if s.is_empty() {
745×
            "inherits everything".into()
75
        } else {
7619×
            s.join(", ")
77
        }
7824×
    }
79
}
80
81
pub struct GroupView {
82
    pub g: Group,
83
    /// Whom it can hold, in words.
84
    pub reach: String,
85
    /// Its members now, by name.
86
    pub members: Vec<String>,
87
    pub chosen: Vec<i64>,
88
    pub policy: PolicyView,
89
}
90
91
pub struct RunnerView {
92
    pub r: runners::Runner,
93
    pub groups: Vec<String>,
94
    pub effective: UpdatePolicy,
95
    /// What the hub would offer it now.
96
    pub offer: String,
97
    pub policy: PolicyView,
98
}
99
100
impl RunnerView {
101
    /// Its effective settings, each with where it came from.
10252×
    pub fn effective_words(&self) -> String {
10352×
        let e = &self.effective;
10452×
        let mut s = vec![format!("updates {} ({})", if e.updates { "on" } else { "off" }, e.from[0])];
10552×
        if e.updates {
10638×
            s.push(format!("channel {} ({})", e.channel, e.from[1]));
10738×
            if let Some((a, b)) = e.window {
10810×
                s.push(format!("window {a:02}–{b:02} UTC ({})", e.from[2]));
10928×
            }
11038×
            if e.dry_run {
11122×
                s.push(format!("dry run ({})", e.from[3]));
11222×
            }
11314×
        }
11452×
        s.join(" · ")
11552×
    }
116
}
117
118
#[derive(Template)]
119
#[template(path = "admin_runner_updates.html")]
120
pub struct UpdatesPage {
121
    shell: Shell,
122
    repo: String,
123
    site: PolicyView,
124
    owners: Vec<PolicyView>,
125
    groups: Vec<GroupView>,
126
    runners: Vec<RunnerView>,
127
    /// Builds held back after rolling back on a runner (#326).
128
    holds: Vec<rdb::Hold>,
129
    notice: Option<String>,
130
    error: Option<String>,
131
}
132
133
/// Who changes runner updates: the site's administrators anything; an
134
/// organisation's owners their organisation's setting, its test groups and
135
/// its runners (Andy: an organisation tries a build on some of its runners
136
/// before the rest).
137
#[derive(Clone, Debug, PartialEq, Eq)]
138
pub enum Reach {
139
    Site,
140
    Org(String),
141
}
142
143
impl Reach {
14468×
    fn holds_runner(&self, r: &runners::Runner) -> bool {
14568×
        match self {
14633×
            Reach::Site => true,
14735×
            Reach::Org(o) => r.scope_owner == *o,
148
        }
14968×
    }
150
15126×
    fn holds_group(&self, g: &Group) -> bool {
15226×
        match self {
15317×
            Reach::Site => true,
1549×
            Reach::Org(o) => g.owner == *o,
155
        }
15626×
    }
157
}
158
159
/// What a page shows of runner updates, within `reach`.
160
pub struct UpdateViews {
161
    pub site: PolicyView,
162
    pub owners: Vec<PolicyView>,
163
    pub groups: Vec<GroupView>,
164
    pub runners: Vec<RunnerView>,
165
}
166
16748×
pub async fn views(app: &Shared, reach: &Reach) -> sqlx::Result<UpdateViews> {
16848×
    let levels = Levels::load(&app.db).await?;
16948×
    let all = runners::list(&app.db).await?;
170149×
    let policy = |scope: &str, key: &str| {
171149×
        levels.policies.get(&(scope.to_string(), key.to_string())).cloned().unwrap_or(Policy {
172149×
            scope: scope.into(),
173149×
            key: key.into(),
174149×
            ..Policy::default()
175149×
        })
176149×
    };
17748×
    let mut owners: Vec<PolicyView> = match reach {
178
        Reach::Site => {
17935×
            levels.policies.values().filter(|p| p.scope == "owner").map(|p| PolicyView::of(p, format!("owner {}", p.key))).collect()
180
        }
18131×
        Reach::Org(o) => vec![PolicyView::of(&policy("owner", o), format!("owner {o}"))],
182
    };
18348×
    owners.sort_by(|a, b| a.key.cmp(&b.key));
18448×
    let groups = levels
18548×
        .groups
18648×
        .iter()
18748×
        .filter(|g| reach.holds_group(g))
18848×
        .map(|g| GroupView {
18918×
            g: g.clone(),
19018×
            reach: if g.owner.is_empty() { "the site's runners".into() } else { format!("{}'s runners", g.owner) },
19141×
            members: all.iter().filter(|r| levels.member(g, r)).map(|r| r.name.clone()).collect(),
19218×
            chosen: levels.chosen.iter().filter(|(gid, _)| *gid == g.id).map(|(_, r)| *r).collect(),
19318×
            policy: PolicyView::of(&policy("group", &g.id.to_string()), format!("group {}", g.name)),
19418×
        })
19548×
        .collect();
19648×
    let hour = time::OffsetDateTime::now_utc().hour();
19748×
    let mut out = vec![];
19865×
    for r in all.into_iter().filter(|r| reach.holds_runner(r)) {
19952×
        let effective = levels.resolve(&r);
20052×
        let (_, offer) = ru::offer(&app.db, &r, &effective, hour).await?;
20152×
        out.push(RunnerView {
20252×
            groups: levels.groups_of(&r).iter().map(|g| g.name.clone()).collect(),
20352×
            policy: PolicyView::of(&policy("runner", &r.id.to_string()), format!("runner {}", r.name)),
20452×
            effective,
20552×
            offer,
20652×
            r,
207
        });
208
    }
20948×
    Ok(UpdateViews { site: PolicyView::of(&policy("site", ""), "the site".into()), owners, groups, runners: out })
21048×
}
211
21217×
async fn page(app: &Shared, shell: Shell, notice: Option<String>, error: Option<String>) -> Result<Page<UpdatesPage>, Error> {
21317×
    let e = |e| Error::from_db(shell.clone(), e);
21417×
    let repo = accounts::setting(&app.db, ru::SETTING_REPO).await.map_err(e)?.unwrap_or_default();
21517×
    let v = views(app, &Reach::Site).await.map_err(e)?;
21617×
    let holds = rdb::holds(&app.db).await.map_err(e)?;
21717×
    Ok(Page(UpdatesPage { shell, repo, site: v.site, owners: v.owners, groups: v.groups, runners: v.runners, holds, notice, error }))
21817×
}
219
220
/// What a change did, to say on the page: `Ok` a notice, `Err` what was wrong.
221
pub type Outcome = Result<String, String>;
222
223
/// [`page`] saying what `outcome` did.
22410×
async fn page_after(app: &Shared, shell: Shell, outcome: Outcome) -> Result<Page<UpdatesPage>, Error> {
22510×
    match outcome {
2267×
        Ok(n) => page(app, shell, Some(n), None).await,
2273×
        Err(why) => page(app, shell, None, Some(why)).await,
228
    }
22910×
}
230
2314×
pub async fn show(State(app): State<Shared>, viewer: Viewer) -> Result<Page<UpdatesPage>, Error> {
2324×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
2334×
    require_admin(&viewer, &shell)?;
2343×
    page(&app, shell, None, None).await
2354×
}
236
237
#[derive(Deserialize)]
238
pub struct SourceForm {
239
    #[serde(rename = "_csrf")]
240
    csrf_token: String,
241
    repo: String,
242
}
243
244
/// `POST /admin/runners/updates/source`: the repository whose releases carry runner builds.
2452×
pub async fn save_source(State(app): State<Shared>, viewer: Viewer, Form(f): Form<SourceForm>) -> Result<Page<UpdatesPage>, Error> {
2462×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
2472×
    let me = require_admin(&viewer, &shell)?;
2482×
    csrf(&viewer, &f.csrf_token, &shell)?;
2492×
    let repo = f.repo.trim().trim_matches('/').to_string();
2502×
    if !repo.is_empty() {
2512×
        let found = match repo.split_once('/') {
2522×
            Some((o, n)) => crate::db::repos::get(&app.db, o, n).await.map_err(|e| Error::from_db(shell.clone(), e))?,
2530×
            None => None,
254
        };
2552×
        if found.is_none() {
2561×
            return page(&app, shell, None, Some(format!("There is no repository {repo:?} here; give it as owner/name."))).await;
2571×
        }
2580×
    }
2591×
    accounts::set_setting(&app.db, ru::SETTING_REPO, &repo).await.map_err(|e| Error::from_db(shell.clone(), e))?;
2601×
    accounts::audit(&app.db, Some(&me), "runner.updates.source", &repo, "runner builds come from its releases").await.ok();
2611×
    let n = if repo.is_empty() {
2620×
        "Saved: no repository, so no runner is offered a build.".into()
263
    } else {
2641×
        format!("Saved: runner builds come from {repo}'s releases.")
265
    };
2661×
    page(&app, shell, Some(n), None).await
2672×
}
268
269
#[derive(Deserialize)]
270
pub struct PolicyForm {
271
    #[serde(rename = "_csrf")]
272
    pub(crate) csrf_token: String,
273
    scope: String,
274
    #[serde(default)]
275
    key: String,
276
    #[serde(default)]
277
    updates: String,
278
    #[serde(default)]
279
    channel: String,
280
    #[serde(default)]
281
    window: String,
282
    #[serde(default)]
283
    dry_run: String,
284
}
285
286
/// Set one level's settings, within `reach`.
28712×
pub async fn apply_policy(app: &Shared, me: &accounts::Account, reach: &Reach, f: &PolicyForm) -> sqlx::Result<Outcome> {
28812×
    let key = f.key.trim().to_string();
28912×
    let label = match (f.scope.as_str(), reach) {
29012×
        ("site", Reach::Site) if key.is_empty() => "the site".to_string(),
2918×
        ("owner", Reach::Org(o)) if key != *o => return Ok(Err("An organisation sets its own runners' updates only.".into())),
292
        ("owner", _) => {
2931×
            let known = accounts::account_by_name(&app.db, &key).await?.is_some() || accounts::org_by_name(&app.db, &key).await?.is_some();
2941×
            if !known {
2950×
                return Ok(Err(format!("There is no account or organisation {key:?}.")));
2961×
            }
2971×
            format!("owner {key}")
298
        }
2996×
        ("group", _) => match key.parse().ok() {
3003×
            Some(id) => match rdb::group(&app.db, id).await?.filter(|g| reach.holds_group(g)) {
3013×
                Some(g) => format!("group {}", g.name),
3020×
                None => return Ok(Err("That test group is gone.".into())),
303
            },
3040×
            None => return Ok(Err("That test group is gone.".into())),
305
        },
3063×
        ("runner", _) => match key.parse().ok() {
3073×
            Some(id) => match runners::get(&app.db, id).await?.filter(|r| reach.holds_runner(r)) {
3082×
                Some(r) => format!("runner {}", r.name),
3091×
                None => return Ok(Err("That runner is gone.".into())),
310
            },
3110×
            None => return Ok(Err("That runner is gone.".into())),
312
        },
3131×
        _ => return Ok(Err("Choose the site, an owner, a test group or a runner.".into())),
314
    };
31514×
    let tri = |v: &str| match v {
31614×
        "on" => Some(true),
3179×
        "off" => Some(false),
3187×
        _ => None,
31914×
    };
3209×
    let channel = f.channel.trim().to_string();
3219×
    if !channel.is_empty() && !ru::valid_channel(&channel) {
3221×
        return Ok(Err(format!("A channel is stable, canary or a version such as 0.3.4, not {channel:?}.")));
3238×
    }
3248×
    let window = match ru::parse_window(&f.window) {
3257×
        Ok(w) => w,
3261×
        Err(why) => return Ok(Err(format!("{why}."))),
327
    };
3287×
    let p = Policy {
3297×
        scope: f.scope.clone(),
3307×
        key,
3317×
        updates: tri(&f.updates),
3327×
        channel: Some(channel).filter(|c| !c.is_empty()),
3337×
        window_from: window.map(|w| w.0 as i64),
3347×
        window_to: window.map(|w| w.1 as i64),
3357×
        dry_run: tri(&f.dry_run),
336
    };
3377×
    rdb::set_policy(&app.db, &p).await?;
3387×
    let words = PolicyView::of(&p, label.clone()).summary();
3397×
    accounts::audit(&app.db, Some(me), "runner.updates.policy", &label, &words).await.ok();
3407×
    Ok(Ok(format!("Saved for {label}: {words}.")))
34112×
}
342
343
/// `POST /admin/runners/updates/policy`: one level's settings.
3446×
pub async fn save_policy(State(app): State<Shared>, viewer: Viewer, Form(f): Form<PolicyForm>) -> Result<Page<UpdatesPage>, Error> {
3456×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
3466×
    let me = require_admin(&viewer, &shell)?;
3476×
    csrf(&viewer, &f.csrf_token, &shell)?;
3486×
    let outcome = apply_policy(&app, &me, &Reach::Site, &f).await.map_err(|e| Error::from_db(shell.clone(), e))?;
3496×
    page_after(&app, shell, outcome).await
3506×
}
351
352
#[derive(Deserialize)]
353
pub struct GroupForm {
354
    #[serde(rename = "_csrf")]
355
    pub(crate) csrf_token: String,
356
    #[serde(default)]
357
    owner: String,
358
    #[serde(default)]
359
    name: String,
360
    /// `percent` or `chosen`.
361
    #[serde(default)]
362
    mode: String,
363
    #[serde(default)]
364
    percent: String,
365
    #[serde(default)]
366
    runner: Vec<i64>,
367
}
368
369
/// The percentage a form gives, or why it cannot be one.
3704×
fn percent_of(f: &GroupForm) -> Result<Option<i64>, String> {
3714×
    if f.mode != "percent" {
3722×
        return Ok(None);
3732×
    }
3742×
    match f.percent.trim().trim_end_matches('%').parse::<i64>() {
3752×
        Ok(p) if (1..=100).contains(&p) => Ok(Some(p)),
3761×
        _ => Err("A percentage is a whole number from 1 to 100.".into()),
377
    }
3784×
}
379
380
/// The chosen runners a form names that `owner`'s group may hold.
3812×
async fn chosen_in_reach(app: &Shared, owner: &str, f: &GroupForm) -> sqlx::Result<Vec<i64>> {
3822×
    let all = runners::list(&app.db).await?;
3836×
    Ok(f.runner.iter().copied().filter(|id| all.iter().any(|r| r.id == *id && (owner.is_empty() || r.scope_owner == owner))).collect())
3842×
}
385
386
/// Make a test group, within `reach` (an organisation's are its own).
3873×
pub async fn apply_create_group(app: &Shared, me: &accounts::Account, reach: &Reach, f: &GroupForm) -> sqlx::Result<Outcome> {
3883×
    let name = f.name.trim().to_string();
3893×
    if name.is_empty() || name.len() > 60 {
3900×
        return Ok(Err("A test group needs a name of up to 60 characters.".into()));
3913×
    }
3923×
    let owner = match reach {
3932×
        Reach::Site => f.owner.trim().to_string(),
3941×
        Reach::Org(o) => o.clone(),
395
    };
3963×
    if !owner.is_empty()
3971×
        && accounts::account_by_name(&app.db, &owner).await?.is_none()
3981×
        && accounts::org_by_name(&app.db, &owner).await?.is_none()
399
    {
4000×
        return Ok(Err(format!("There is no account or organisation {owner:?}.")));
4013×
    }
4023×
    let percent = match percent_of(f) {
4032×
        Ok(p) => p,
4041×
        Err(why) => return Ok(Err(why)),
405
    };
4062×
    if rdb::groups(&app.db).await?.iter().any(|g| g.owner == owner && g.name == name) {
4070×
        return Ok(Err(format!("There is already a test group {name:?} for those runners.")));
4082×
    }
4092×
    let chosen = chosen_in_reach(app, &owner, f).await?;
4102×
    let g = rdb::create_group(&app.db, &owner, &name, percent).await?;
4112×
    if percent.is_none() {
4122×
        rdb::set_members(&app.db, g.id, &chosen).await?;
4130×
    }
4142×
    let what = match percent {
4150×
        Some(p) => format!("{p}% of {}", if owner.is_empty() { "the site's runners".into() } else { format!("{owner}'s runners") }),
4162×
        None => format!("{} chosen runners", chosen.len()),
417
    };
4182×
    accounts::audit(&app.db, Some(me), "runner.updates.group", &name, &format!("created: {what}")).await.ok();
4192×
    Ok(Ok(format!("Test group {name} made: {what}. Give it its settings below.")))
4203×
}
421
422
/// `POST /admin/runners/updates/groups`: a new test group.
4232×
pub async fn create_group(
4242×
    State(app): State<Shared>,
4252×
    viewer: Viewer,
4262×
    axum_extra::extract::Form(f): axum_extra::extract::Form<GroupForm>,
4272×
) -> Result<Page<UpdatesPage>, Error> {
4282×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
4292×
    let me = require_admin(&viewer, &shell)?;
4302×
    csrf(&viewer, &f.csrf_token, &shell)?;
4312×
    let outcome = apply_create_group(&app, &me, &Reach::Site, &f).await.map_err(|e| Error::from_db(shell.clone(), e))?;
4322×
    page_after(&app, shell, outcome).await
4332×
}
434
435
/// Set who is in test group `id`, within `reach`.
4361×
pub async fn apply_save_group(app: &Shared, me: &accounts::Account, reach: &Reach, id: i64, f: &GroupForm) -> sqlx::Result<Outcome> {
4371×
    let Some(g) = rdb::group(&app.db, id).await?.filter(|g| reach.holds_group(g)) else {
4380×
        return Ok(Err("That test group is gone.".into()));
439
    };
4401×
    let percent = match percent_of(f) {
4411×
        Ok(p) => p,
4420×
        Err(why) => return Ok(Err(why)),
443
    };
4441×
    let chosen = if percent.is_some() { vec![] } else { chosen_in_reach(app, &g.owner, f).await? };
4451×
    rdb::set_percent(&app.db, id, percent).await?;
4461×
    rdb::set_members(&app.db, id, &chosen).await?;
4471×
    let what = match percent {
4481×
        Some(p) => format!("{p}% of its runners"),
4490×
        None => format!("{} chosen runners", chosen.len()),
450
    };
4511×
    accounts::audit(&app.db, Some(me), "runner.updates.group", &g.name, &what).await.ok();
4521×
    Ok(Ok(format!("Test group {} is now {what}.", g.name)))
4531×
}
454
455
/// `POST /admin/runners/updates/groups/{id}`: who is in a test group.
4561×
pub async fn save_group(
4571×
    State(app): State<Shared>,
4581×
    viewer: Viewer,
4591×
    Path(id): Path<i64>,
4601×
    axum_extra::extract::Form(f): axum_extra::extract::Form<GroupForm>,
4611×
) -> Result<Page<UpdatesPage>, Error> {
4621×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
4631×
    let me = require_admin(&viewer, &shell)?;
4641×
    csrf(&viewer, &f.csrf_token, &shell)?;
4651×
    let outcome = apply_save_group(&app, &me, &Reach::Site, id, &f).await.map_err(|e| Error::from_db(shell.clone(), e))?;
4661×
    page_after(&app, shell, outcome).await
4671×
}
468
469
#[derive(Deserialize)]
470
pub struct CsrfOnly {
471
    #[serde(rename = "_csrf")]
472
    pub(crate) csrf_token: String,
473
}
474
475
/// Remove test group `id`, within `reach`.
4762×
pub async fn apply_delete_group(app: &Shared, me: &accounts::Account, reach: &Reach, id: i64) -> sqlx::Result<Outcome> {
4772×
    let Some(g) = rdb::group(&app.db, id).await?.filter(|g| reach.holds_group(g)) else {
4781×
        return Ok(Err("That test group is gone.".into()));
479
    };
4801×
    rdb::delete_group(&app.db, id).await?;
4811×
    accounts::audit(&app.db, Some(me), "runner.updates.group", &g.name, "removed").await.ok();
4821×
    Ok(Ok(format!("Test group {} removed; its runners follow the levels above it.", g.name)))
4832×
}
484
485
/// `POST /admin/runners/updates/groups/{id}/delete`.
4861×
pub async fn delete_group(
4871×
    State(app): State<Shared>,
4881×
    viewer: Viewer,
4891×
    Path(id): Path<i64>,
4901×
    Form(f): Form<CsrfOnly>,
4911×
) -> Result<Page<UpdatesPage>, Error> {
4921×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
4931×
    let me = require_admin(&viewer, &shell)?;
4941×
    csrf(&viewer, &f.csrf_token, &shell)?;
4951×
    let outcome = apply_delete_group(&app, &me, &Reach::Site, id).await.map_err(|e| Error::from_db(shell.clone(), e))?;
4961×
    page_after(&app, shell, outcome).await
4971×
}
498
499
#[derive(Deserialize)]
500
pub struct LiftForm {
501
    #[serde(rename = "_csrf")]
502
    csrf_token: String,
503
    version: String,
504
}
505
506
/// `POST /admin/runners/updates/holds/lift`: offer a held build again (#326).
5072×
pub async fn lift_hold(State(app): State<Shared>, viewer: Viewer, Form(f): Form<LiftForm>) -> Result<Page<UpdatesPage>, Error> {
5082×
    let shell = Shell::new(&app, "/admin/runners/updates", &viewer);
5092×
    let me = require_admin(&viewer, &shell)?;
5102×
    csrf(&viewer, &f.csrf_token, &shell)?;
5112×
    let v = f.version.trim();
5122×
    if !rdb::lift(&app.db, v).await.map_err(|e| Error::from_db(shell.clone(), e))? {
5131×
        return page(&app, shell, None, Some(format!("flow {v} is not held."))).await;
5141×
    }
5151×
    accounts::audit(&app.db, Some(&me), "runner.update.lifted", v, "offered again").await.ok();
5161×
    page(&app, shell, Some(format!("flow {v} is offered again where the settings say so.")), None).await
5172×
}