feat: withdraw a waiting submission with POST /submissions/{id}/cancel - #3
Merged
Conversation
The first live acceptance test on the P1S left an approved job in the queue with no way to remove it, which is what this closes. Cancel is a queue operation, not an abort. It is legal only from `queued` and `approved` (`CANCELLABLE_STATES`), reaches no printer, and is refused for anything past the queue: stopping a running print is a control-plane action that needs a claim, and this surface has none. A test pins that `cancelled` is unreachable from `dispatching` / `running` / `finished` / `failed` / `rejected`. Cancelling deletes the stored artifact -- a withdrawn job has no further use for it, and it is the submitter's data -- and marks `artifact_removed`. The job record stays, with the actor and any reason in its history, so the withdrawal remains auditable. An approved job that is cancelled has `dispatch_ready` retracted, or the record would still read as cleared to run. There is no undo; a withdrawn job is resubmitted, not revived. Note this goes beyond the design's §5 state machine, which declares no `cancelled` state. Recorded in docs/TODO.md as an addition to fold back into SUBMISSION_PIPELINE_DESIGN.md when that doc is next revised. `uv run ruff check .` and `uv run pytest -q` (126 tests) pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQvsfEeDitEyNzbCwrcEdD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first live acceptance test on the P1S left an approved job in the queue with no way to remove it. This closes that gap.
Cancel is a queue operation, not an abort
Legal only from
queuedandapproved(CANCELLABLE_STATES). It reaches no printer and is refused for anything past the queue — stopping a running print is a control-plane action that needs a claim, and this surface has none. That is structural rather than conventional: a test pins thatcancelledis unreachable fromdispatching/running/finished/failed/rejected, so it stays true once dispatch lands.Other choices worth reviewing
artifact_removed: truemarks that the file is gone. No undo — a withdrawn job is resubmitted, not revived.dispatch_ready, or the record would still read as cleared to run.Beyond the contract
The design's §5 state machine declares no
cancelledstate. Recorded indocs/TODO.mdas an addition to fold back intoSUBMISSION_PIPELINE_DESIGN.mdwhen that doc is next revised, rather than editing the contract unilaterally here.uv run ruff check .anduv run pytest -q(126 tests, 12 new) pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01UQvsfEeDitEyNzbCwrcEdD