fix(workflows): execute immutable signed revisions

Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-08-24 23:21:40 -04:00
parent e8ec3c8b4d
commit 5dc8e4750d
8 changed files with 268 additions and 152 deletions

View File

@@ -326,16 +326,9 @@ pub async fn trigger_workflow(
// Resolve the current signed definition at trigger time. The relay binds
// authorization and execution to this exact revision and rejects a stale
// result if an update races this command.
let prior = query_relay(
&state,
&[serde_json::json!({
"kinds": [30620],
"#d": [workflow_id.clone()],
"limit": 1
})],
)
.await?;
let definition_event_id = current_workflow_revision(&prior)?;
let revision: nostr::Event =
get_relay_json(&state, &format!("/workflows/{workflow_id}/revision")).await?;
let definition_event_id = revision.id.to_hex();
let builder = events::build_workflow_trigger(&workflow_id, &definition_event_id)?;
let result = submit_event(builder, &state).await?;
trigger_wire_from_message(workflow_id, &result.message)