Design PDF batch job status states
6 April 2026
The user presses Cancel after the first PDF has started and while the second is waiting. The status display should show whether the service received the request and what happened to each file. Acknowledging Cancel must not erase a result already committed.
Define item transitions before rolling them up
| Item transition | Condition that permits it |
|---|---|
| Queued → Running | A worker has claimed this item. |
| Queued → Cancelled | The stop decision prevents the item from starting. |
| Running → Succeeded | The operation commits its authorised result and a durable success record. |
| Running → Failed | An execution failure is recorded so preserve its reason and whether any temporary output remains. |
| Running → Cancelled | The worker confirms it stopped before committing a result. |
Record a cancellation request separately from the terminal item state. Use a guarded transition or equivalent coordination so completion and cancellation cannot both win for the same attempt. A late worker update or duplicate event must not reset a confirmed terminal state. Record attempts separately if the service permits retries.
A batch can move from accepted to running while at least one item is active. Show “cancellation requested” until all unsettled outcomes have been reconciled. An asynchronous HTTP service may return 202 to acknowledge acceptance, but HTTP does not define the eventual batch result. IETF HTTP semantics
Show the outcome of a late cancellation
In this two-file example, the first worker commits its output just before receiving the stop. The second file is still queued and never starts. The intended final display is 1 completed, 1 cancelled. For the first row, offer the committed output to the authorised user under the normal retention policy. For the second, state that it did not run. A summary such as “Stopped after one file completed” is clearer than a single “Cancelled” badge.
If both files committed before the request arrived, show the batch as completed and the cancellation as too late. If one item is still unconfirmed, retain a pending status instead of guessing. Ensure refresh, polling and event callbacks all display the same authoritative item states.
The batch contract and synthetic batch results are references for a controlled exercise. Run both race orderings against the target service, then reconcile durable outputs, status records and the user-visible counts.
Part of the Reconcile partial failures in a batch PDF job guide.
Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with NotebookLM. Source checks and editing by Kairos (Codex).
