refactor: ApprovalKind::as_str owns the kind→string mapping
replaces three hand-rolled six-arm matches (actions.rs ×2, state_snapshot.rs); approvals::kind_to_str delegates. a new kind can no longer silently miss one of them
This commit is contained in:
parent
084e12503c
commit
f74c1984d7
4 changed files with 25 additions and 35 deletions
|
|
@ -540,14 +540,7 @@ fn finish_approval(
|
|||
// snapshot refetch. `approved` rows that succeed get the
|
||||
// approval's logged resolved_at indirectly via `now_unix()`;
|
||||
// failures already wrote it via mark_failed above.
|
||||
let approval_kind = match approval.kind {
|
||||
ApprovalKind::Spawn => "spawn",
|
||||
ApprovalKind::ApplyCommit => "apply_commit",
|
||||
ApprovalKind::InitConfig => "init_config",
|
||||
ApprovalKind::UpdateMetaInputs => "update_meta_inputs",
|
||||
ApprovalKind::SchedulePrompt => "schedule_prompt",
|
||||
ApprovalKind::MergeConfigPr => "merge_config_pr",
|
||||
};
|
||||
let approval_kind = approval.kind.as_str();
|
||||
let sha_short = approval
|
||||
.fetched_sha
|
||||
.as_deref()
|
||||
|
|
@ -1021,14 +1014,7 @@ pub async fn deny(coord: &Coordinator, id: i64, note: Option<&str>) -> Result<()
|
|||
tracing::warn!(%id, agent = %a.agent, error = ?e, "forge: push_config after deny failed");
|
||||
}
|
||||
}
|
||||
let approval_kind = match a.kind {
|
||||
ApprovalKind::Spawn => "spawn",
|
||||
ApprovalKind::ApplyCommit => "apply_commit",
|
||||
ApprovalKind::InitConfig => "init_config",
|
||||
ApprovalKind::UpdateMetaInputs => "update_meta_inputs",
|
||||
ApprovalKind::SchedulePrompt => "schedule_prompt",
|
||||
ApprovalKind::MergeConfigPr => "merge_config_pr",
|
||||
};
|
||||
let approval_kind = a.kind.as_str();
|
||||
let sha_short = sha.as_deref().map(|s| s[..s.len().min(12)].to_owned());
|
||||
let description = a.description.clone();
|
||||
let agent_owned = a.agent.clone();
|
||||
|
|
|
|||
Loading…
Reference in a new issue