refactor(#2416): drop the now-always-none Spawned.sha field + deny tag leftover

This commit is contained in:
damocles 2026-07-15 20:58:37 +02:00 committed by mara
commit 12ce346d02
4 changed files with 8 additions and 17 deletions

View file

@ -576,15 +576,12 @@ root agent. Variants (`hive_sh4re::HelperEvent`):
The recipient responds via `Answer { id, answer }` and the The recipient responds via `Answer { id, answer }` and the
asker sees the matching `QuestionAnswered`. asker sees the matching `QuestionAnswered`.
Optional `sha` field on `ApprovalResolved`, `Spawned`, and `Rebuilt` Optional `sha` field on `ApprovalResolved` and `Rebuilt` carries the
carries the canonical hive-c0re-vouched commit sha. Optional `tag` canonical hive-c0re-vouched commit sha. Optional `tag` on the same two
on `ApprovalResolved` and `Rebuilt` only — the spawn path always carries the deploy bookkeeping tag — `deployed/<id>` on a successful
lands at `deployed/0`, so the tag is implicit and not echoed. The build or `failed/<id>` on a failed one, planted by the `MergeConfigPr`
tag values for the variants that do carry it: `deployed/<id>` / deploy. Both fields are `Option`: `None` on the paths that don't deploy
`failed/<id>` / `denied/<id>` for approval-driven flows; a new commit (spawn / init_config / meta-update / deny, and
`approved/<id>` for the rare bare-approval case where no underlying
action runs. Both fields are `Option`: `None` on the rebuild paths
that don't change the deployed commit (e.g.
`auto_update::rebuild_agent` reapplying the existing main, or the `auto_update::rebuild_agent` reapplying the existing main, or the
dashboard `↻ R3BU1LD` button when the lock didn't move). When set, dashboard `↻ R3BU1LD` button when the lock didn't move). When set,
`git show <sha>` against `/agents/<n>/applied.git` inside the `git show <sha>` against `/agents/<n>/applied.git` inside the

View file

@ -618,7 +618,6 @@ fn finish_approval(
agent: approval.agent.clone(), agent: approval.agent.clone(),
ok, ok,
note, note,
sha: approval.fetched_sha.clone(),
}, },
), ),
// MergeConfigPr ends in a container rebuild — surface a Rebuilt // MergeConfigPr ends in a container rebuild — surface a Rebuilt
@ -863,8 +862,6 @@ pub fn deny(coord: &Coordinator, id: i64, note: Option<&str>) -> Result<()> {
let approval = coord.approvals.get(id)?; let approval = coord.approvals.get(id)?;
coord.approvals.mark_denied(id, note)?; coord.approvals.mark_denied(id, note)?;
tracing::info!(%id, note, "approval denied"); tracing::info!(%id, note, "approval denied");
// MergeConfigPr denials carry no git tag — the PR stays open on the forge.
let tag: Option<String> = None;
if let Some(a) = approval { if let Some(a) = approval {
let sha = a.fetched_sha.clone(); let sha = a.fetched_sha.clone();
let approval_kind = a.kind.as_str(); let approval_kind = a.kind.as_str();
@ -880,7 +877,8 @@ pub fn deny(coord: &Coordinator, id: i64, note: Option<&str>) -> Result<()> {
status: ApprovalStatus::Denied, status: ApprovalStatus::Denied,
note: note.map(String::from), note: note.map(String::from),
sha, sha,
tag, // A denied config PR carries no git tag — it stays open on the forge.
tag: None,
}, },
); );
coord.emit_approval_resolved(crate::coordinator::ApprovalResolved { coord.emit_approval_resolved(crate::coordinator::ApprovalResolved {

View file

@ -247,7 +247,6 @@ async fn handle_spawn(coord: &Arc<Coordinator>, name: &str) -> Result<HostRespon
agent: name.to_owned(), agent: name.to_owned(),
ok: true, ok: true,
note: None, note: None,
sha: None,
}); });
// Update tmpfiles.d so the new agent's dirs survive a reboot. // Update tmpfiles.d so the new agent's dirs survive a reboot.
tokio::spawn(lifecycle::sync_tmpfiles()); tokio::spawn(lifecycle::sync_tmpfiles());
@ -259,7 +258,6 @@ async fn handle_spawn(coord: &Arc<Coordinator>, name: &str) -> Result<HostRespon
agent: name.to_owned(), agent: name.to_owned(),
ok: false, ok: false,
note: Some(format!("{e:#}")), note: Some(format!("{e:#}")),
sha: None,
}); });
return Err(e); return Err(e);
} }

View file

@ -817,8 +817,6 @@ pub enum HelperEvent {
ok: bool, ok: bool,
#[serde(default, skip_serializing_if = "Option::is_none")] #[serde(default, skip_serializing_if = "Option::is_none")]
note: Option<String>, note: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
sha: Option<String>,
}, },
/// A container was rebuilt (auto-update or manual). /// A container was rebuilt (auto-update or manual).
Rebuilt { Rebuilt {