Cancel queued work without racing a completed preview
A user cancels a batch just as one preview finishes. The portal reports Cancelled while retaining an accessible success artifact, and a retry renders it again.
- Focused work estimate
- 3h + prerequisites
- Priority in the scenario
- Medium
- Engineering practice
- Cancellation · State transitions · Race handling
Estimated field mix
- Backend50%
- Platform engineering30%
- Distributed systems20%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional internal document portal creates previews through a trusted mock renderer. Large batches crowd out small teams, failed documents retry forever, and operators lack a safe replay command. This exercise never executes uploaded code or real document macros.
Setup prerequisites
- Queue semantics
- Database transactions
- Operational metrics
Preceding work
Complete these dependencies, or supply their agreed outputs before taking this ticket.
- QUEUE-101 · Expose a document job's current phase and terminal reason
- QUEUE-102 · Reject oversized document batches before accepting work
- QUEUE-103 · Commit job acceptance and dispatch intent together
- QUEUE-104 · Stop retrying unsupported document formats
- QUEUE-105 · Keep one team's bulk import from occupying every worker
- QUEUE-106 · Fence a late worker after its rendering lease expires
Acceptance criteria
- Make cancellation an authorized state transition with documented running-job semantics.
- Resolve cancellation and completion races to one terminal result.
- Prevent cancelled jobs from being newly dispatched or retried.
Implementation constraints
- For the mock renderer, cancellation can be cooperative; disclose work that cannot stop immediately.
Verification to include
- Cancel queued work and prove the renderer is never called.
- Race running completion and cancellation, then replay both commands and inspect stable state.
Deliverables
- Cancellation contract and race regression
Rollout and recovery
Enable queued cancellation first, then running cancellation after the race cases pass; retain terminal records on rollback.
Value of the work
For the engineer: Practice asynchronous lifecycle control, fair scheduling, bounded retries, and artifact recovery with a deterministic provider.
For the team: See how an engineer accounts for accepted work and reduces operational toil without granting operators broad data access.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.