feat: add optional description to request_apply_commit and request_spawn

This commit is contained in:
damocles 2026-05-16 14:26:12 +02:00
parent a6d1464071
commit 4a8a668348
9 changed files with 97 additions and 30 deletions

View file

@ -237,6 +237,9 @@ struct ApprovalView {
sha_short: Option<String>,
/// Pre-rendered syntax-coloured diff HTML, for `ApplyCommit` only.
diff_html: Option<String>,
/// Manager-supplied description shown on the approval card.
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
}
/// Replace silent `.unwrap_or_default()` on the data sources behind
@ -605,10 +608,11 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
let diff = approval_diff(&a.agent, a.id).await;
ApprovalView {
id: a.id,
agent: a.agent,
agent: a.agent.clone(),
kind: "apply_commit",
sha_short: Some(sha),
diff_html: Some(render_diff_lines(&diff)),
description: a.description,
}
}
hive_sh4re::ApprovalKind::Spawn => ApprovalView {
@ -617,6 +621,7 @@ async fn build_approval_views(approvals: Vec<Approval>) -> Vec<ApprovalView> {
kind: "spawn",
sha_short: None,
diff_html: None,
description: a.description,
},
});
}
@ -1065,7 +1070,7 @@ async fn post_request_spawn(
match state
.coord
.approvals
.submit_kind(&name, hive_sh4re::ApprovalKind::Spawn, "")
.submit_kind(&name, hive_sh4re::ApprovalKind::Spawn, "", None)
{
Ok(id) => {
tracing::info!(%id, %name, "operator: spawn approval queued via dashboard");