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
- The Columns Spinto Reads
- Runtime Behavior Spinto Relies On
- What the Runtime Doesn’t Record
- Known Runtime Issues
- Checking a New Version
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 namedtoken #N; unnamed sleeps are namedsleep N.workflow_steps.status:pending,completed,failed.workflow_runs.context: a JSON object whoseloggedobject 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’serrorand the retry time inwake_at. The final failure setsfailedandfinished_at. A success clearserror. triescounts the tries that reported. The defaults are 3 tries with a backoff of 10 and 60 seconds.- A sleep is recorded
pendingwithwake_atwhen it’s reached, and getsfinished_atwhen the run wakes. - A wait or inbox entry is recorded
pendingwhen it’s reached, with its timeout inwake_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_waitsrows are deleted), and its resumes are deleted unless the run failed and isn’t purged. - With
purge_data, an ended run’sinputbecomesnull, itscontext{}, itsoutputanderrorNULL, and its entries lose their outputs and errors. A cancelled run keeps its reason. laravel::workflow::findreturnsRunInfowith 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 --jsonprints the sameRunInfo.
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
inventorywith 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()istruefor 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 reportsunknownwhen they can’t tell.
Checking a New Version
Before supporting a new laravel-rust version:
- Compare
workflow_tablesinlaravel-rust-database-macros/src/tables.rswith the table above. - Read the changes to
laravel-rust-workflow/src/workflow/database.rsandrun.rsfor anything that changes when rows are written. - Run
cargo test, which includestests/reader_sqlite.rsagainst the framework’s own store. - Run
tests/reader_postgres.rsagainst PostgreSQL, asdocs/architecture/reader.mdshows, and check everyruntime-agreementcheck passes.