fix: move matrix_sweep_banner to module scope (items_after_statements)

This commit is contained in:
iris 2026-07-17 01:10:48 +02:00 committed by mara
commit cfed36582e

View file

@ -197,6 +197,22 @@ async fn main() -> Result<()> {
}
}
/// Banner message for a failing matrix `ensure_all` sweep, shared by both
/// the initial and periodic `record_err` call sites in `cmd_serve` so the
/// wording can't drift between them.
fn matrix_sweep_banner(ctx: sweep_health::SweepFailure) -> String {
let age = ctx.since_last_ok.map_or_else(
|| "no success this session".to_owned(),
|d| format!("last ok {} ago", sweep_health::fmt_age(d)),
);
format!(
"matrix user/space sweep failing ({} consecutive, {age}) \
some agents may be missing matrix accounts, space membership, \
or chat-room invites",
ctx.consecutive
)
}
/// Start the coordinator daemon: open the broker, run migrations, spawn
/// background tasks (auto-update, vacuums, crash-watcher, reminder-scheduler,
/// dashboard), then serve the admin socket until a signal arrives.
@ -401,21 +417,6 @@ async fn cmd_serve(
}
}
});
/// Banner message for a failing matrix `ensure_all` sweep, shared by
/// both the initial and periodic `record_err` call sites below so the
/// wording can't drift between them.
fn matrix_sweep_banner(ctx: sweep_health::SweepFailure) -> String {
let age = ctx.since_last_ok.map_or_else(
|| "no success this session".to_owned(),
|d| format!("last ok {} ago", sweep_health::fmt_age(d)),
);
format!(
"matrix user/space sweep failing ({} consecutive, {age}) \
some agents may be missing matrix accounts, space membership, \
or chat-room invites",
ctx.consecutive
)
}
// Matrix user sweep: same shape — ensure every container has
// an account on the local matrix-tuwunel homeserver with an
// access_token persisted to `<state>/matrix-token`. No-op when