OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Cancel a pending job.
Goal
Allow cancellation of jobs that are no longer needed.
Context
Only pending jobs can be cancelled.
Emitted Events
•
`job.cancelled` (v1.0.0)
Source Definition
import { defineCommand, defineQuery } from '@lssm-tech/lib.contracts-spec';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
export const CancelJobContract = defineCommand({
meta: {
key: 'jobs.cancel',
version: '1.0.0',
stability: 'stable',
owners: ['platform.jobs'],
tags: ['jobs', 'cancel'],
description: 'Cancel a pending job.',
goal: 'Allow cancellation of jobs that are no longer needed.',
context: 'Only pending jobs can be cancelled.',
},
io: {
input: CancelJobInput,
output: CancelJobOutput,
errors: {
JOB_NOT_FOUND: {
description: 'Job does not exist',
http: 404,
gqlCode: 'JOB_NOT_FOUND',
when: 'Job ID is invalid',
},
JOB_NOT_PENDING: {
description: 'Job is not in pending state',
http: 409,
gqlCode: 'JOB_NOT_PENDING',
when: 'Job has already started or completed',
},
},
},
policy: {
auth: 'user',
},
sideEffects: {
emits: [
{
key: 'job.cancelled',
version: '1.0.0',
when: 'Job is cancelled',
payload: JobCancelledPayload,
},
],
},
});