Skip to content

Commit 47a3f56

Browse files
committed
fix(jobs): enumerate the interrupted error code
The code reaches an operator through `ob audit` but was not in the registry, so the generated error reference could not document it. The enumeration test missed it because it matches the struct-literal form and the assignment was a tuple; written as separate statements it is now covered by that test too. Claude-Session: https://claude.ai/code/session_01JaxHfqFZk8GdrBNbtQZ6c2
1 parent 9bdf6ee commit 47a3f56

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎internal/engine/job.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ func (e *Engine) RunJobWithJournalID(ctx context.Context, request JobRunRequest)
117117
// a failure, so the reason has to ride on ErrorCode.
118118
journalContext := ctx
119119
if interruptedRun(ctx, runErr) {
120-
record.Status, record.ErrorCode = "fail", "interrupted"
120+
record = journal.Record{
121+
Phase: "job", Event: "finish", Status: "fail", ErrorCode: "interrupted",
122+
OperationKind: "job_run", Service: job,
123+
}
121124
var cancel context.CancelFunc
122125
journalContext, cancel = context.WithTimeout(context.Background(), journalCleanupTimeout)
123126
defer cancel()

‎internal/onebox/operation_errors.go‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ var operationFailureDefinitions = map[string]OperationFailure{
119119
Message: "this host is owned by a different Onebox application, and one host has one owner",
120120
Command: "ob preflight --output json",
121121
},
122+
"interrupted": {
123+
// Not a failure of the job and not an incomplete operation: the client
124+
// went away, and what the job did is unknown unless it journaled a
125+
// result first. Reconciliation on the next operation writes this.
126+
Message: "the operation's client went away before its outcome could be recorded",
127+
Command: "ob audit --output json",
128+
},
122129
"job_plan_failed": {
123130
Message: "the one-shot job plan could not be produced",
124131
Command: "ob job plan <job> --output json",

‎site/src/content/docs/reference/errors.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ step to complete rather than a line to run verbatim.
136136
| `finalize_refused` | the release cannot be finalized because the recorded activation evidence disagrees with the live host | diagnostic | `ob status --output json` |
137137
| `host_environment_mismatch` | this host is claimed by a different environment of the same application, which would share its container and volume names | diagnostic | `ob preflight --output json` |
138138
| `host_owner_mismatch` | this host is owned by a different Onebox application, and one host has one owner | diagnostic | `ob preflight --output json` |
139+
| `interrupted` | the operation's client went away before its outcome could be recorded | diagnostic | `ob audit --output json` |
139140
| `job_plan_failed` | the one-shot job plan could not be produced | next | `ob job plan <job> --output json` |
140141
| `logs_failed` | log retrieval failed | diagnostic | `ob status --output json` |
141142
| `manifest_invalid` | a release manifest is not valid closed JSON for its schema | diagnostic | `ob status --output json` |

0 commit comments

Comments
 (0)