Skip to main content

handle

Function handle 

Source
pub async fn handle(
    root: &Path,
    ticket_dir: &Path,
    work_state: &LocalSqlite,
    args: &PostArgs,
    now_ms: i64,
    at_eligible_ms: Option<i64>,
    ticket_prefix: &str,
    agent: Option<&AgentConfig>,
    flows: &BTreeMap<String, Flow>,
    default_flow: &str,
) -> Result<Value, PostError>
Expand description

Registers a ticket file: validates and stamps frontmatter, indexes the ticket, and for auto and at creates one queued trigger. Reposting a stamped file is idempotent; reposting with a different --at time reschedules the queued trigger. The dispatcher is the only caller and computes at_eligible_ms from its injected clock, so plain reads before writes here cannot race another writer.

A trigger is queued only when the post leaves the ticket in ready. Reposting a settled ticket still refreshes the indexed content — editing a merged ticket’s file must keep working — but queues nothing.