# `Squidie.Runtime.Journal.Executor`
[🔗](https://github.com/dark-trench/squidie/blob/main/lib/squidie/runtime/journal/executor.ex#L1)

Executes one visible attempt from the journal-backed runtime queue.

The runtime step boundary is the side-effect boundary for the journal-backed runtime. It
claims a visible attempt with the dispatch agent, runs the declared workflow
step once, records either a completed or failed attempt fact, and then applies
any completed dispatch results back to the workflow journal.

# `execute_error`

```elixir
@type execute_error() ::
  {:invalid_option,
   {:opts, term()}
   | {:runtime, term()}
   | {:journal_storage, nil}
   | {:queue, term()}
   | {:now, term()}
   | {:finished_at, term()}
   | {:owner_id, term()}
   | {:claim_id, term()}
   | {:claim_token, term()}
   | {:heartbeat_interval_ms, term()}
   | {:action_registry, term()}
   | {:test_after_claim, term()}
   | {:test_before_completion, term()}
   | {:test_after_transaction_step, term()}
   | {:option, atom()}}
  | Squidie.Workflow.Definition.load_error()
  | {:unknown_step, atom()}
  | term()
```

# `execute_result`

```elixir
@type execute_result() ::
  {:ok, Squidie.ReadModel.Inspection.Snapshot.t()}
  | {:ok, :none}
  | {:error, execute_error()}
```

# `execute_next`

```elixir
@spec execute_next(keyword()) :: execute_result()
```

Executes the next visible journal attempt, if one exists.

Options:

- `:runtime` must be `:journal`.
- `:journal_storage` is the Jido storage adapter config.
- `:queue` selects the dispatch queue and defaults to `"default"`.
- `:owner_id` identifies the worker claiming the attempt.
- `:claim_id` and `:claim_token` may be supplied by tests or host lease backends
  that need deterministic fencing values.
- `:heartbeat_interval_ms` renews the claim lease while the executor owns a
  running attempt. The executor keeps claim tokens internal.
- `:now` controls visibility, lease, and event timestamps.
- `:finished_at` controls completion/failure timestamps for deterministic
  tests. Runtime callers normally omit it so the timestamp is captured after
  action execution.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
