Skip to main content

dispatch_approval_requested

Function dispatch_approval_requested 

Source
pub fn dispatch_approval_requested(
    conn: &Connection,
    pending_id: &str,
    db_path: &Path,
)
Expand description

v0.7.0 K4 — dispatch the approval_requested lifecycle event for a freshly-inserted pending_actions row.

Thin convenience wrapper around dispatch_event_with_details:

  • Resolves the canonical row via crate::db::get_pending_action so the payload reflects what was actually committed (not what the caller intended to commit).
  • Synthesises an ApprovalRequestedEventDetails block from the row.
  • Routes the event through the existing subscription dispatch path so opt-in subscribers (event_types: ["approval_requested"]) and legacy wildcard subscribers both receive it.

Best-effort and fire-and-forget — same posture as the K2 pending_action_expired dispatch in crate::daemon_runtime::spawn_pending_timeout_sweep_loop. A dispatch failure must NOT roll back the pending-action row.

Caller passes the pending_id returned from crate::db::queue_pending_action / crate::db::upsert_pending_action. A missing or unreadable row is logged and otherwise treated as a no-op (lost-event semantics, never block the write path).