US05-06: Automate Phase E End-to-End Acceptance (#76)

This commit was merged in pull request #76.
This commit is contained in:
2026-08-16 17:05:13 +02:00
parent ac9943884d
commit 3ccef58796
13 changed files with 844 additions and 161 deletions

View File

@@ -96,6 +96,16 @@ class Worker:
return
try:
if cancelled or snapshot["state"] == JobState.CANCELLING:
# A handler may stop on its own — an upload batch cancelled through
# its own API never touches the job — so the job can still be
# ``running`` here. Record the request before the outcome: a stop is
# always observable as cancelling → cancelled, and ``running ->
# cancelled`` is not a legal jump. Without this hop the transition
# is rejected and the job keeps its lock forever.
if snapshot["state"] == JobState.RUNNING:
self.service.transition(
job_id, JobState.CANCELLING, worker_id=self.worker_id, fencing_token=token
)
self.service.transition(
job_id, JobState.CANCELLED, worker_id=self.worker_id, fencing_token=token
)