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:
müde 2026-07-06 21:48:55 +02:00
commit f74c1984d7
4 changed files with 25 additions and 35 deletions

View file

@ -526,14 +526,7 @@ fn history_view(a: Approval) -> ApprovalHistoryView {
// Pending shouldn't appear in recent_resolved, but be defensive.
hive_sh4re::ApprovalStatus::Pending => "pending",
};
let kind = match a.kind {
hive_sh4re::ApprovalKind::ApplyCommit => "apply_commit",
hive_sh4re::ApprovalKind::Spawn => "spawn",
hive_sh4re::ApprovalKind::InitConfig => "init_config",
hive_sh4re::ApprovalKind::UpdateMetaInputs => "update_meta_inputs",
hive_sh4re::ApprovalKind::SchedulePrompt => "schedule_prompt",
hive_sh4re::ApprovalKind::MergeConfigPr => "merge_config_pr",
};
let kind = a.kind.as_str();
ApprovalHistoryView {
id: a.id,
agent: a.agent,