Getting started

Laravel for Rust Compatibility

From docs/compatibility/laravel-rust.md at commit 548821a.

Spinto 0.1.0. These docs follow the main branch. Spinto isn't on crates.io yet, so you install it from a clone.

Supported Versions

Spinto laravel-rust Checked against
0.1.0 0.1.4 crates.io laravel-rust 0.1.4, and the laravel/rust-framework source at commit 3693a2d

The workflow crate and the workflow::tables! migration published as 0.1.4 are identical to the source at 3693a2d.

Spinto has no public API to list runs to build on, so it reads the database workflow store’s tables. A change to those tables, or to what the runtime writes in them, can break Spinto without breaking the framework’s own API. capabilities().schema and each run’s runtime-agreement check exist to catch that at runtime.

The Columns Spinto Reads

The table names are configurable in config.workflow; these are the defaults. capabilities().schema reports any of these columns that are missing.

Table Columns
workflow_runs id, workflow, input, context, connection, queue, status, output, error, wake_at, leased_until, created_at, finished_at, purge_data
workflow_steps id, run_id, kind, name, status, tries, output, error, wake_at, started_at, finished_at
workflow_waits token, run_id, number, resumed_at
workflow_resumes run_id, token, number, created_at
workflow_attributes run_id, name, value

Spinto never reads lease_token, unique_key or workflow_resumes.value, and never writes to any of these tables.

Values Spinto interprets:

  • workflow_runs.status: pending, running, waiting, completed, failed, cancelled. Any other value shows as unrecognized rather than failing.
  • workflow_steps.kind: step, sleep, wait, inbox. Inbox entries are named token #N; unnamed sleeps are named sleep N.
  • workflow_steps.status: pending, completed, failed.
  • workflow_runs.context: a JSON object whose logged object holds the context values that may be named.
  • workflow_steps.id: increasing, so it gives journal order.
  • workflow_runs.id: a UUIDv7, so ID order is creation order.

Runtime Behavior Spinto Relies On

From laravel-rust-workflow 0.1.4 (src/workflow/run.rs and src/workflow/database.rs):

  • A step’s row is written when a try ends, not when it starts. A running step has no row.
  • A failed try that will be retried leaves the step pending, with the try’s error and the retry time in wake_at. The final failure sets failed and finished_at. A success clears error.
  • tries counts the tries that reported. The defaults are 3 tries with a backoff of 10 and 60 seconds.
  • A sleep is recorded pending with wake_at when it’s reached, and gets finished_at when the run wakes.
  • A wait or inbox entry is recorded pending when it’s reached, with its timeout in wake_at. It completes with an output when resumed and without one when it timed out.
  • When a run ends, its tokens are released (its workflow_waits rows are deleted), and its resumes are deleted unless the run failed and isn’t purged.
  • With purge_data, an ended run’s input becomes null, its context {}, its output and error NULL, and its entries lose their outputs and errors. A cancelled run keeps its reason.
  • laravel::workflow::find returns RunInfo with the run’s status, error, output, times, attributes and entries (kind, name, status, tries, error, times, timed out). It doesn’t return input, context, queue or entry outputs. workflow:show --json prints the same RunInfo.

What the Runtime Doesn’t Record

Spinto shows these as unsupported or unavailable, with the reason, and never fills them in:

  • The start and end times and errors of tries before the last one.
  • Tries that a stopped worker never reported.
  • Which step a running run is in, until that step’s try ends.
  • When a value was delivered to a wait, once the run has ended.
  • The next step of an unfinished run.
  • Which workflow types the application registers: registration uses inventory with private fields.
  • Whether a purged run’s wait was resumed or timed out, when it ended after its timeout.

Known Runtime Issues

  • StepInfo::timed_out() is true for every completed wait of a purged run, including resumed ones, because purging deletes the outputs it checks. Spinto infers the outcome from the times instead, and reports unknown when they can’t tell.

Checking a New Version

Before supporting a new laravel-rust version:

  1. Compare workflow_tables in laravel-rust-database-macros/src/tables.rs with the table above.
  2. Read the changes to laravel-rust-workflow/src/workflow/database.rs and run.rs for anything that changes when rows are written.
  3. Run cargo test, which includes tests/reader_sqlite.rs against the framework’s own store.
  4. Run tests/reader_postgres.rs against PostgreSQL, as docs/architecture/reader.md shows, and check every runtime-agreement check passes.