Skip to content

Release 0.8.0: record how a job ended in the transaction that ends it - #8

Merged
zaiev merged 2 commits into
mainfrom
record-how-a-job-ended
Dec 4, 2026
Merged

zaiev merged 2 commits into
mainfrom
record-how-a-job-ended

Conversation

@zaiev

@zaiev zaiev commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Why

An application keeping its own record of a job's work had no way to mark it when the job failed: a discard, an exhausted retry, an expiry, a cancel or a lapsed lease each ended the job in one of spool's statements, and the record was left pending (#6). A hook inside those statements was weighed and refused: it would run application code in every sweep, roll back unrelated jobs when it failed, and fire only where registered. Instead a failed job passes through a named state, failing, until a runner runs its kind's ~failed under a lease and settles it in the transaction of the callback's write, so the job and the record commit together or not at all.

Changes

  • Breaking: a job that fails is Failing until settled, then Discarded or Cancelled; Spool.Ending says how it ended (Exhausted, Discarded, Expired, Cancelled), and info.ending carries it.
  • Breaking: Spool.handle ?completed ?failed replaces handle_committing; each write commits in the transaction that ends the job.
  • Breaking: a job waited for is kept while anything waits for it, and waits read it under a lock, so a wait never counts a job gone as completed nor misses one ending as it is written.
  • enqueue_after ~until:All_ended waits for every job to end, however it ends, for a batch's last step.
  • cancel stops a blocked job, and dooms only the dependents that wait for completion.
  • The dashboard shows failing jobs, how a job ended, and is built on solidtype 0.15.
  • The docs: a lifecycle figure, how a job ends, the dashboard page rewritten around what it shows and does, with screenshots, and every OCaml snippet highlighted.

Verified

  • make lint (0 findings) and make test (17 and 75 cases) on the latest rowtype, wiretype, spindle and postgres-eio.
  • Mutation checks: removing the release on settle, the settle-only-with-its-write guard, or the waits-until condition each fails a test.
  • The dashboard example served and clicked through in a browser: failed, cancelled and workflow jobs, the limits form, no console errors.

Closes #6

zaiev added 2 commits December 4, 2026 00:17
An application keeping its own record of a job's work had no way to
mark it when the job failed: a discard, an exhausted retry, an expiry,
a cancel from the dashboard or a lease lapsing each ended the job in
some statement of spool's, in whichever process, and the record was
left saying pending (#6). A hook run inside those statements was
weighed and refused: it would run application code in every sweep,
roll back unrelated jobs when it failed, be global, and fire only where
it was registered.

Instead a failed job passes through a named state, failing, until a
runner runs its kind's ~failed under a lease and settles it in the same
transaction as the callback's write, so the job and the record commit
together or not at all, and a crash leaves the job for another runner.
~completed does the same for a completion, replacing the separate
committing handler. A job may also wait for others to end however they
end, for a batch's last step.

With it, waits are made sound: a job waited for is kept while anything
waits for it and is read under a lock its ending waits for, so a wait
never counts a job gone as completed nor misses one ending as it is
written. The README shows the dashboard, and the quick start runs
Postgres in Podman.

AGENTS.md keeps only what the code and its checks do not say, and the
docs reach their figure and screenshot by alias.

The dashboard's page is built on solidtype 0.15, so its bundle stops
lagging four releases behind the UI library it is written in.
@zaiev
zaiev merged commit 3791bdf into main Dec 4, 2026
4 checks passed
@zaiev
zaiev deleted the record-how-a-job-ended branch December 4, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: a hook in the ending's own transaction when a job ends without completing

1 participant