refactor: drop kind_to_str wrapper, call ApprovalKind::as_str directly

This commit is contained in:
müde 2026-07-06 21:49:46 +02:00
commit 34b21b8038
2 changed files with 2 additions and 10 deletions

View file

@ -118,7 +118,7 @@ impl Approvals {
VALUES (?1, ?2, ?3, ?4, 'pending', ?5, ?6)",
params![
agent,
kind_to_str(kind),
kind.as_str(),
commit_ref,
now_unix(),
description,
@ -410,13 +410,6 @@ fn row_to_approval(row: &rusqlite::Row<'_>) -> rusqlite::Result<Approval> {
})
}
/// Stable kind→str mapping used wherever we emit `ApprovalResolved`
/// or persist a kind to sqlite. Thin alias over
/// [`ApprovalKind::as_str`] (the wire-type owns the mapping) kept for
/// the existing call sites' name.
pub(crate) fn kind_to_str(kind: ApprovalKind) -> &'static str {
kind.as_str()
}
fn kind_from_str(s: &str) -> Result<ApprovalKind> {
Ok(match s {

View file

@ -18,7 +18,6 @@
use std::sync::Arc;
use crate::approvals::kind_to_str;
use crate::coordinator::Coordinator;
use crate::limits;
use crate::socket_server::spawn_question_watchdog;
@ -229,7 +228,7 @@ pub fn handle_cancel_loose_end(
coord.emit_approval_resolved(crate::coordinator::ApprovalResolved {
id: approval.id,
agent: &approval.agent,
approval_kind: kind_to_str(approval.kind),
approval_kind: approval.kind.as_str(),
sha_short,
status: "cancelled",
note: approval.note,