@shipfox/api-workflows 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +13 -0
- package/dist/core/entities/job-execution.d.ts +1 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -1
- package/dist/core/entities/job-execution.js.map +1 -1
- package/dist/core/entities/job.d.ts +1 -1
- package/dist/core/entities/job.d.ts.map +1 -1
- package/dist/core/entities/job.js +3 -1
- package/dist/core/entities/job.js.map +1 -1
- package/dist/core/errors.d.ts +3 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +4 -2
- package/dist/core/errors.js.map +1 -1
- package/dist/core/step-config/job-output-limits.d.ts.map +1 -1
- package/dist/core/step-config/job-output-limits.js +2 -2
- package/dist/core/step-config/job-output-limits.js.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +2 -2
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/db/db.d.ts +42 -8
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/schema/job-executions.d.ts +19 -2
- package/dist/db/schema/job-executions.d.ts.map +1 -1
- package/dist/db/schema/job-executions.js +2 -0
- package/dist/db/schema/job-executions.js.map +1 -1
- package/dist/db/schema/jobs.d.ts +3 -3
- package/dist/db/schema/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.d.ts +7 -0
- package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
- package/dist/db/workflow-runs/job-executions.js +26 -4
- package/dist/db/workflow-runs/job-executions.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +4 -2
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/presentation/dto/job.d.ts.map +1 -1
- package/dist/presentation/dto/job.js +1 -0
- package/dist/presentation/dto/job.js.map +1 -1
- package/dist/presentation/subscribers/on-failure-annotations.d.ts.map +1 -1
- package/dist/presentation/subscribers/on-failure-annotations.js +6 -3
- package/dist/presentation/subscribers/on-failure-annotations.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/drizzle/0002_output_failure_details.sql +2 -0
- package/drizzle/0003_output_invalid_reason.sql +1 -0
- package/drizzle/meta/0002_snapshot.json +1718 -0
- package/drizzle/meta/0003_snapshot.json +1719 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +2 -2
- package/src/core/entities/job-execution.ts +1 -0
- package/src/core/entities/job.ts +2 -0
- package/src/core/errors.test.ts +18 -0
- package/src/core/errors.ts +9 -2
- package/src/core/step-config/job-output-limits.ts +2 -2
- package/src/core/step-config/materialize-workflow-model.test.ts +67 -3
- package/src/core/step-config/materialize-workflow-model.ts +2 -2
- package/src/db/schema/job-executions.ts +2 -0
- package/src/db/workflow-runs/job-executions.test.ts +149 -4
- package/src/db/workflow-runs/job-executions.ts +44 -9
- package/src/db/workflow-runs/job-status.test.ts +30 -0
- package/src/db/workflow-runs/jobs.ts +5 -1
- package/src/presentation/dto/job.ts +1 -0
- package/src/presentation/subscribers/on-failure-annotations.test.ts +47 -1
- package/src/presentation/subscribers/on-failure-annotations.ts +10 -2
- package/test/helpers/workflow-runs.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -230,7 +230,12 @@ describe('failure annotations', () => {
|
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
it('projects a job failure from the current execution origin', async () => {
|
|
233
|
-
const payload = jobTerminatedPayload({
|
|
233
|
+
const payload = jobTerminatedPayload({
|
|
234
|
+
status: 'failed',
|
|
235
|
+
statusReason: 'output_too_large',
|
|
236
|
+
statusReasonMessage:
|
|
237
|
+
'Job output "payload" exceeds the per-value size limit of 16384 bytes (measured 16385 bytes; overshoot 1 bytes).',
|
|
238
|
+
});
|
|
234
239
|
dbMocks.getJobScope.mockResolvedValue({
|
|
235
240
|
workspaceId: '44444444-4444-4444-8444-444444444444',
|
|
236
241
|
projectId: '55555555-5555-4555-8555-555555555555',
|
|
@@ -264,6 +269,47 @@ describe('failure annotations', () => {
|
|
|
264
269
|
}),
|
|
265
270
|
}),
|
|
266
271
|
);
|
|
272
|
+
expect(replaceOrRemoveAnnotation).toHaveBeenCalledWith(
|
|
273
|
+
expect.objectContaining({
|
|
274
|
+
annotation: expect.objectContaining({
|
|
275
|
+
body: expect.stringContaining('measured 16385 bytes; overshoot 1 bytes'),
|
|
276
|
+
}),
|
|
277
|
+
}),
|
|
278
|
+
);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('projects an output-invalid job failure with its status message', async () => {
|
|
282
|
+
const payload = jobTerminatedPayload({
|
|
283
|
+
statusReason: 'output_invalid',
|
|
284
|
+
statusReasonMessage: 'Job output "payload" cannot be persisted as JSON: undefined.',
|
|
285
|
+
});
|
|
286
|
+
dbMocks.getJobScope.mockResolvedValue({
|
|
287
|
+
workspaceId: '44444444-4444-4444-8444-444444444444',
|
|
288
|
+
projectId: '55555555-5555-4555-8555-555555555555',
|
|
289
|
+
triggerReference: null,
|
|
290
|
+
});
|
|
291
|
+
dbMocks.getWorkflowRunAttemptById.mockResolvedValue({attempt: 3});
|
|
292
|
+
dbMocks.getJobExecutionFailureOrigin.mockResolvedValue({
|
|
293
|
+
jobExecutionId: payload.jobExecutionId,
|
|
294
|
+
stepId: '77777777-7777-4777-8777-777777777777',
|
|
295
|
+
stepName: 'Run tests',
|
|
296
|
+
stepStatus: 'succeeded',
|
|
297
|
+
stepAttempt: 1,
|
|
298
|
+
stepError: null,
|
|
299
|
+
attemptStatus: 'succeeded',
|
|
300
|
+
attemptError: null,
|
|
301
|
+
attemptExitCode: 0,
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
await onJobTerminatedFailureAnnotation(annotations)(payload);
|
|
305
|
+
|
|
306
|
+
expect(replaceOrRemoveAnnotation).toHaveBeenCalledWith(
|
|
307
|
+
expect.objectContaining({
|
|
308
|
+
annotation: expect.objectContaining({
|
|
309
|
+
body: expect.stringContaining('Job output "payload" cannot be persisted as JSON'),
|
|
310
|
+
}),
|
|
311
|
+
}),
|
|
312
|
+
);
|
|
267
313
|
});
|
|
268
314
|
|
|
269
315
|
it('projects a condition evaluation error from a skipped job', async () => {
|
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
} from '#db/index.js';
|
|
17
17
|
import {recordWorkflowFailureAnnotationFailed} from '#metrics/instance.js';
|
|
18
18
|
|
|
19
|
-
const JOB_FAILURE_ANNOTATION_REASONS = new Set([
|
|
19
|
+
const JOB_FAILURE_ANNOTATION_REASONS = new Set([
|
|
20
|
+
'timed_out',
|
|
21
|
+
'runner_lost',
|
|
22
|
+
'condition_errored',
|
|
23
|
+
'output_too_large',
|
|
24
|
+
'output_invalid',
|
|
25
|
+
]);
|
|
20
26
|
|
|
21
27
|
export function onStepAttemptTerminatedFailureAnnotation(
|
|
22
28
|
annotations: AnnotationsInterModuleClient,
|
|
@@ -123,7 +129,7 @@ export function onJobTerminatedFailureAnnotation(annotations: AnnotationsInterMo
|
|
|
123
129
|
},
|
|
124
130
|
context: failureContext('job', payload.jobId),
|
|
125
131
|
failed: true,
|
|
126
|
-
body: jobFailureBody(payload.statusReason, origin),
|
|
132
|
+
body: jobFailureBody(payload.statusReason, payload.statusReasonMessage, origin),
|
|
127
133
|
});
|
|
128
134
|
} catch (error) {
|
|
129
135
|
recordFailureAnnotationFailure(error, 'lookup', {jobId: payload.jobId});
|
|
@@ -200,6 +206,7 @@ function stepFailureBody(
|
|
|
200
206
|
|
|
201
207
|
function jobFailureBody(
|
|
202
208
|
reason: string | null,
|
|
209
|
+
statusReasonMessage: string | null | undefined,
|
|
203
210
|
origin: {
|
|
204
211
|
stepName: string;
|
|
205
212
|
attemptStatus: string | null;
|
|
@@ -220,6 +227,7 @@ function jobFailureBody(
|
|
|
220
227
|
'',
|
|
221
228
|
progress,
|
|
222
229
|
`Reason: \`${reason ?? 'unknown'}\``,
|
|
230
|
+
statusReasonMessage ? `Failure: ${statusReasonMessage}` : null,
|
|
223
231
|
message ? `Failure: ${message}` : null,
|
|
224
232
|
exitCode,
|
|
225
233
|
]
|