@shipfox/api-workflows 12.2.0 → 12.3.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 +16 -0
- package/README.md +20 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/core/errors.d.ts +2 -1
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +3 -2
- package/dist/core/errors.js.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
- package/dist/core/step-config/materialize-workflow-model.js +6 -4
- package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/index.js.map +1 -1
- package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
- package/dist/db/workflow-runs/jobs.js +4 -0
- package/dist/db/workflow-runs/jobs.js.map +1 -1
- package/dist/db/workflow-runs/outbox.d.ts +1 -0
- package/dist/db/workflow-runs/outbox.d.ts.map +1 -1
- package/dist/db/workflow-runs/outbox.js +1 -0
- package/dist/db/workflow-runs/outbox.js.map +1 -1
- package/dist/db/workflow-runs/steps.d.ts +28 -0
- package/dist/db/workflow-runs/steps.d.ts.map +1 -1
- package/dist/db/workflow-runs/steps.js +49 -1
- package/dist/db/workflow-runs/steps.js.map +1 -1
- package/dist/db/workflow-runs.d.ts +2 -2
- package/dist/db/workflow-runs.d.ts.map +1 -1
- package/dist/db/workflow-runs.js +1 -1
- package/dist/db/workflow-runs.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/metrics/instance.d.ts +1 -0
- package/dist/metrics/instance.d.ts.map +1 -1
- package/dist/metrics/instance.js +8 -0
- package/dist/metrics/instance.js.map +1 -1
- package/dist/presentation/dto/evaluation-trace.d.ts +4 -0
- package/dist/presentation/dto/evaluation-trace.d.ts.map +1 -0
- package/dist/presentation/dto/evaluation-trace.js +39 -0
- package/dist/presentation/dto/evaluation-trace.js.map +1 -0
- package/dist/presentation/dto/index.d.ts +2 -1
- package/dist/presentation/dto/index.d.ts.map +1 -1
- package/dist/presentation/dto/index.js +2 -1
- package/dist/presentation/dto/index.js.map +1 -1
- package/dist/presentation/dto/job.d.ts.map +1 -1
- package/dist/presentation/dto/job.js +6 -0
- package/dist/presentation/dto/job.js.map +1 -1
- package/dist/presentation/dto/step.d.ts +2 -1
- package/dist/presentation/dto/step.d.ts.map +1 -1
- package/dist/presentation/dto/step.js +12 -0
- package/dist/presentation/dto/step.js.map +1 -1
- package/dist/presentation/index.d.ts +1 -1
- package/dist/presentation/index.d.ts.map +1 -1
- package/dist/presentation/index.js +1 -1
- package/dist/presentation/index.js.map +1 -1
- package/dist/presentation/routes/get-step-attempt-detail.d.ts +3 -0
- package/dist/presentation/routes/get-step-attempt-detail.d.ts.map +1 -0
- package/dist/presentation/routes/get-step-attempt-detail.js +38 -0
- package/dist/presentation/routes/get-step-attempt-detail.js.map +1 -0
- package/dist/presentation/routes/index.d.ts.map +1 -1
- package/dist/presentation/routes/index.js +2 -0
- package/dist/presentation/routes/index.js.map +1 -1
- package/dist/presentation/subscribers/index.d.ts +1 -0
- package/dist/presentation/subscribers/index.d.ts.map +1 -1
- package/dist/presentation/subscribers/index.js +1 -0
- package/dist/presentation/subscribers/index.js.map +1 -1
- package/dist/presentation/subscribers/on-failure-annotations.d.ts +5 -0
- package/dist/presentation/subscribers/on-failure-annotations.d.ts.map +1 -0
- package/dist/presentation/subscribers/on-failure-annotations.js +160 -0
- package/dist/presentation/subscribers/on-failure-annotations.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -8
- package/src/config.test.ts +85 -0
- package/src/config.ts +71 -0
- package/src/core/errors.ts +9 -2
- package/src/core/job-execution.test.ts +1 -0
- package/src/core/step-config/materialize-workflow-model.catalog.test.ts +117 -0
- package/src/core/step-config/materialize-workflow-model.ts +5 -3
- package/src/db/index.ts +4 -0
- package/src/db/workflow-runs/job-status.test.ts +10 -3
- package/src/db/workflow-runs/jobs.ts +7 -0
- package/src/db/workflow-runs/outbox.ts +7 -1
- package/src/db/workflow-runs/steps.test.ts +148 -0
- package/src/db/workflow-runs/steps.ts +105 -1
- package/src/db/workflow-runs.ts +4 -0
- package/src/index.ts +9 -0
- package/src/metrics/instance.ts +10 -0
- package/src/presentation/dto/evaluation-trace.ts +27 -0
- package/src/presentation/dto/index.ts +2 -1
- package/src/presentation/dto/job.ts +6 -0
- package/src/presentation/dto/step.test.ts +96 -1
- package/src/presentation/dto/step.ts +17 -0
- package/src/presentation/index.ts +2 -0
- package/src/presentation/routes/get-step-attempt-detail.test.ts +159 -0
- package/src/presentation/routes/get-step-attempt-detail.ts +33 -0
- package/src/presentation/routes/index.ts +2 -0
- package/src/presentation/subscribers/index.ts +4 -0
- package/src/presentation/subscribers/on-failure-annotations.test.ts +510 -0
- package/src/presentation/subscribers/on-failure-annotations.ts +237 -0
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/db/workflow-runs/jobs.ts"],"sourcesContent":["import {readPersistedWorkflowModel} from '@shipfox/api-definitions-dto';\nimport {WORKFLOWS_JOB_TERMINATED} from '@shipfox/api-workflows-dto';\nimport type {ExpressionType} from '@shipfox/expression';\nimport {and, asc, desc, eq, inArray, notInArray, sql} from 'drizzle-orm';\nimport {isJobTerminal, type Job, type JobStatus, type JobStatusReason} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {JobNotFoundError} from '#core/errors.js';\nimport {\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobSuccess,\n runtimeCompletionStatusForJob,\n} from '#core/job-transition/index.js';\nimport type {JobContextInput} from '#core/step-config/assemble-run-context.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\nimport {recordWorkflowJobStatusChanged} from '#metrics/instance.js';\nimport {db, type Tx} from '../db.js';\nimport {writeWorkflowsOutboxEvent} from '../outbox-writes.js';\nimport {jobExecutions, toJobExecution} from '../schema/job-executions.js';\nimport {jobs, toJob} from '../schema/jobs.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {toWorkflowRun, workflowRuns} from '../schema/workflow-runs.js';\nimport {getWorkflowRunById} from './queries.js';\nimport {getWorkflowContextForJob, optimisticLockRetry, TERMINAL_JOB_STATUSES} from './shared.js';\n\nfunction outputTypesByJobKey(\n model: ReturnType<typeof readPersistedWorkflowModel> | null,\n): ReadonlyMap<string, Readonly<Record<string, ExpressionType>>> {\n return new Map(\n (model?.jobs ?? []).flatMap((job) =>\n job.outputTypes === undefined ? [] : [[job.key, job.outputTypes] as const],\n ),\n );\n}\n\nexport async function getJobsByWorkflowRunAttemptId(workflowRunAttemptId: string): Promise<Job[]> {\n const rows = await db()\n .select()\n .from(jobs)\n .where(eq(jobs.workflowRunAttemptId, workflowRunAttemptId))\n .orderBy(asc(jobs.position));\n return rows.map(toJob);\n}\n\nexport async function getJobsByWorkflowRunId(workflowRunId: string): Promise<Job[]> {\n const run = await getWorkflowRunById(workflowRunId);\n if (!run) return [];\n const [attempt] = await db()\n .select()\n .from(workflowRunAttempts)\n .where(\n and(\n eq(workflowRunAttempts.workflowRunId, run.id),\n eq(workflowRunAttempts.attempt, run.currentAttempt),\n ),\n )\n .limit(1);\n return attempt ? getJobsByWorkflowRunAttemptId(attempt.id) : [];\n}\n\nexport async function getJobById(id: string): Promise<Job | undefined> {\n const rows = await db().select().from(jobs).where(eq(jobs.id, id)).limit(1);\n const row = rows[0];\n if (!row) return undefined;\n return toJob(row);\n}\n\nexport interface JobScope {\n workspaceId: string;\n projectId: string;\n triggerReference: WorkflowRunTriggerReference | null;\n}\n\nexport async function getJobScope(jobId: string): Promise<JobScope | undefined> {\n const rows = await db()\n .select({\n workspaceId: workflowRuns.workspaceId,\n projectId: workflowRuns.projectId,\n triggerReference: workflowRuns.triggerReference,\n })\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(eq(jobs.id, jobId))\n .limit(1);\n return rows[0];\n}\n\nexport async function getDirectDependencyJobContexts(\n jobId: string,\n tx?: Tx,\n): Promise<JobContextInput[]> {\n const targetRows = await (tx ?? db())\n .select({job: jobs, attempt: workflowRunAttempts})\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .where(eq(jobs.id, jobId))\n .limit(1);\n const target = targetRows[0];\n if (!target || target.job.dependencies.length === 0) return [];\n const model =\n target.attempt.model === null ? null : readPersistedWorkflowModel(target.attempt.model);\n const outputTypes = outputTypesByJobKey(model);\n\n const rows = await (tx ?? db())\n .select({job: jobs, execution: jobExecutions})\n .from(jobs)\n .leftJoin(jobExecutions, eq(jobExecutions.jobId, jobs.id))\n .where(\n and(\n eq(jobs.workflowRunAttemptId, target.job.workflowRunAttemptId),\n inArray(jobs.key, target.job.dependencies),\n ),\n )\n .orderBy(asc(jobs.position), asc(jobs.id), asc(jobExecutions.sequence), asc(jobExecutions.id));\n\n const contextsByJobId = new Map<string, JobContextInput & {executions: JobExecution[]}>();\n for (const row of rows) {\n let context = contextsByJobId.get(row.job.id);\n if (!context) {\n const jobOutputTypes = outputTypes.get(row.job.key);\n context = {\n job: toJob(row.job),\n ...(jobOutputTypes === undefined ? {} : {outputTypes: jobOutputTypes}),\n executions: [],\n };\n contextsByJobId.set(row.job.id, context);\n }\n if (row.execution)\n context.executions.push(toJobExecution(row.execution, row.job.name ?? row.job.key));\n }\n\n return [...contextsByJobId.values()];\n}\n\nexport interface EvaluateJobActivationsParams {\n runAttemptId: string;\n jobs: readonly {\n jobId: string;\n expectedVersion: number;\n }[];\n}\n\nexport type JobActivationDecision =\n | {\n kind: 'start-job';\n jobId: string;\n }\n | {\n kind: 'terminal-job';\n jobId: string;\n status: RuntimeCompletionStatus;\n jobVersion: number;\n };\n\ntype InternalJobActivationDecision = JobActivationDecision & {changed?: boolean};\n\nexport async function evaluateJobActivations(\n params: EvaluateJobActivationsParams,\n): Promise<JobActivationDecision[]> {\n if (params.jobs.length === 0) return [];\n\n const result = await db().transaction(async (tx) => {\n const expectedVersions = new Map(\n params.jobs.map((job) => [job.jobId, job.expectedVersion] as const),\n );\n const jobIds = params.jobs.map((job) => job.jobId);\n const targets = await tx\n .select({job: jobs, attempt: workflowRunAttempts, run: workflowRuns})\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(and(eq(jobs.workflowRunAttemptId, params.runAttemptId), inArray(jobs.id, jobIds)))\n .for('update');\n\n if (targets.length !== jobIds.length) {\n const found = new Set(targets.map((target) => target.job.id));\n const missing = jobIds.filter((jobId) => !found.has(jobId));\n throw new Error(`Cannot evaluate missing activation jobs: ${missing.join(', ')}`);\n }\n\n const contextsByJobKey = await directDependencyContextsByJobKey(\n tx,\n params.runAttemptId,\n targets.map((target) => toJob(target.job)),\n );\n const targetsByJobId = new Map(targets.map((target) => [target.job.id, target]));\n const decisions: InternalJobActivationDecision[] = [];\n\n for (const input of params.jobs) {\n const target = targetsByJobId.get(input.jobId);\n if (!target) throw new Error(`Cannot evaluate missing activation job: ${input.jobId}`);\n const job = toJob(target.job);\n const model =\n target.attempt.model === null ? null : readPersistedWorkflowModel(target.attempt.model);\n const modelJob = model?.jobs.find((item) => item.key === target.job.key);\n const decision = decideJobActivation({\n run: toWorkflowRun(target.run),\n job,\n condition: modelJob?.if,\n vars: target.attempt.vars ?? undefined,\n dependencies: job.dependencies.flatMap((key) => {\n const dependency = contextsByJobKey.get(key);\n return dependency === undefined ? [] : [dependency];\n }),\n });\n\n if (decision.kind === 'terminal-job' || decision.kind === 'start-job') {\n decisions.push(decision);\n continue;\n }\n\n const expectedVersion = expectedVersions.get(job.id);\n if (expectedVersion === undefined) {\n throw new Error(`Missing expected version for activation job ${job.id}`);\n }\n const updated = await updateJobStatusAtVersion(tx, {\n jobId: job.id,\n status: decision.status,\n expectedVersion,\n statusReason: decision.statusReason,\n evaluationTrace: decision.evaluationTrace,\n });\n if (updated) {\n decisions.push({\n kind: 'terminal-job',\n jobId: job.id,\n status: 'skipped',\n jobVersion: updated.job.version,\n changed: updated.changed,\n });\n continue;\n }\n\n const [existing] = await tx.select().from(jobs).where(eq(jobs.id, job.id)).limit(1);\n if (existing && isJobTerminal(existing.status)) {\n decisions.push({\n kind: 'terminal-job',\n jobId: job.id,\n status: runtimeCompletionStatusForJob(existing.status),\n jobVersion: existing.version,\n });\n continue;\n }\n throw new Error(`Optimistic lock failure evaluating activation for job ${job.id}`);\n }\n\n return decisions;\n });\n\n for (const decision of result) {\n if (decision.kind === 'terminal-job' && decision.changed) {\n recordWorkflowJobStatusChanged(decision.status);\n }\n }\n\n return result.map(({changed: _changed, ...decision}) => decision);\n}\n\nasync function directDependencyContextsByJobKey(\n tx: Tx,\n runAttemptId: string,\n targetJobs: readonly Job[],\n): Promise<ReadonlyMap<string, JobContextInput>> {\n const dependencyKeys = new Set(targetJobs.flatMap((job) => job.dependencies));\n if (dependencyKeys.size === 0) return new Map();\n\n const [attempt] = await tx\n .select({model: workflowRunAttempts.model})\n .from(workflowRunAttempts)\n .where(eq(workflowRunAttempts.id, runAttemptId))\n .limit(1);\n const model =\n attempt === undefined || attempt.model === null\n ? null\n : readPersistedWorkflowModel(attempt.model);\n const outputTypes = outputTypesByJobKey(model);\n\n const rows = await tx\n .select({job: jobs, execution: jobExecutions})\n .from(jobs)\n .leftJoin(jobExecutions, eq(jobExecutions.jobId, jobs.id))\n .where(and(eq(jobs.workflowRunAttemptId, runAttemptId), inArray(jobs.key, [...dependencyKeys])))\n .orderBy(asc(jobs.position), asc(jobs.id), asc(jobExecutions.sequence), asc(jobExecutions.id));\n\n const contextsByJobKey = new Map<string, JobContextInput & {executions: JobExecution[]}>();\n for (const row of rows) {\n let context = contextsByJobKey.get(row.job.key);\n if (!context) {\n const jobOutputTypes = outputTypes.get(row.job.key);\n context = {\n job: toJob(row.job),\n ...(jobOutputTypes === undefined ? {} : {outputTypes: jobOutputTypes}),\n executions: [],\n };\n contextsByJobKey.set(row.job.key, context);\n }\n if (row.execution)\n context.executions.push(toJobExecution(row.execution, row.job.name ?? row.job.key));\n }\n\n return contextsByJobKey;\n}\n\nexport interface UpdateJobStatusAtVersionParams {\n jobId: string;\n status: JobStatus;\n expectedVersion: number;\n statusReason?: JobStatusReason | null | undefined;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null | undefined;\n}\n\n// Returns null on version mismatch so callers can choose throw vs treat-as-success.\nexport async function updateJobStatusAtVersion(\n tx: Tx,\n params: UpdateJobStatusAtVersionParams,\n): Promise<{job: Job; changed: boolean} | null> {\n const outputs = isJobTerminal(params.status)\n ? await reduceJobOutputs(tx, {jobId: params.jobId, status: params.status})\n : undefined;\n const rows = await tx\n .update(jobs)\n .set({\n status: params.status,\n statusReason: params.statusReason ?? null,\n ...(outputs === undefined ? {} : {outputs}),\n ...(params.evaluationTrace === undefined ? {} : {evaluationTrace: params.evaluationTrace}),\n version: sql`${jobs.version} + 1`,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(jobs.id, params.jobId),\n eq(jobs.version, params.expectedVersion),\n notInArray(jobs.status, TERMINAL_JOB_STATUSES),\n ),\n )\n .returning();\n\n const row = rows[0];\n if (!row) return null;\n const job = toJob(row);\n\n // Every terminal job-status write funnels through this one guarded UPDATE, where the\n // version match lets a single caller win. Emitting here, in the same transaction,\n // makes the terminal fact fire exactly once across all paths.\n if (isJobTerminal(job.status)) {\n const identity = await getWorkflowContextForJob(job.id, tx);\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_JOB_TERMINATED,\n payload: {\n jobId: job.id,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n status: job.status,\n statusReason: job.statusReason,\n },\n });\n }\n\n return {job, changed: true};\n}\n\nasync function reduceJobOutputs(\n tx: Tx,\n params: {jobId: string; status: JobStatus},\n): Promise<Record<string, unknown> | null> {\n if (params.status !== 'succeeded') return null;\n\n const [row] = await tx\n .select({outputs: jobExecutions.outputs})\n .from(jobExecutions)\n .where(and(eq(jobExecutions.jobId, params.jobId), eq(jobExecutions.status, 'succeeded')))\n .orderBy(desc(jobExecutions.sequence), desc(jobExecutions.id))\n .limit(1);\n\n return row?.outputs ? {...row.outputs} : null;\n}\n\nexport interface UpdateJobStatusParams {\n jobId: string;\n status: JobStatus;\n expectedVersion: number;\n statusReason?: JobStatusReason | null | undefined;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null | undefined;\n}\n\nexport async function updateJobStatus(params: UpdateJobStatusParams): Promise<Job> {\n const statusReason = params.statusReason ?? null;\n const result = await db().transaction(async (tx) => {\n return await optimisticLockRetry({\n updateFn: () =>\n updateJobStatusAtVersion(tx, {\n jobId: params.jobId,\n status: params.status,\n expectedVersion: params.expectedVersion,\n statusReason,\n evaluationTrace: params.evaluationTrace,\n }),\n fetchFn: async () => {\n const row = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n return row ? toJob(row) : undefined;\n },\n matchFn: (job) =>\n (job.status === params.status && job.statusReason === statusReason) ||\n isJobTerminal(job.status)\n ? {job, changed: false}\n : null,\n failureMessage: `Optimistic lock failure: job ${params.jobId} version ${params.expectedVersion}`,\n });\n });\n\n if (result.changed) recordWorkflowJobStatusChanged(result.job.status);\n\n return result.job;\n}\n\nexport type EvaluateJobSuccessResult = DeriveJobSuccessResult;\nexport const evaluateJobSuccess = deriveJobSuccess;\n\nexport async function resolveJobStatusFromJobExecutions(params: {\n jobId: string;\n}): Promise<{status: RuntimeCompletionStatus; jobVersion: number}> {\n const result = await db().transaction(async (tx) => {\n const jobRow = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n if (!jobRow) throw new JobNotFoundError(params.jobId);\n\n const jobExecutionRows = await tx\n .select()\n .from(jobExecutions)\n .where(eq(jobExecutions.jobId, params.jobId))\n .orderBy(asc(jobExecutions.sequence), asc(jobExecutions.id));\n const workflowContext = await getWorkflowContextForJob(params.jobId, tx);\n\n if (jobExecutionRows.length === 0) {\n throw new Error(`Cannot resolve job ${params.jobId}: no job executions found`);\n }\n\n const {status, statusReason, trace} = evaluateJobSuccess({\n success: jobRow.success,\n executions: jobExecutionRows.map((execution) =>\n toJobExecution(execution, jobRow.name ?? jobRow.key),\n ),\n jobs: await getDirectDependencyJobContexts(params.jobId, tx),\n vars: workflowContext.vars ?? undefined,\n });\n\n return optimisticLockRetry({\n updateFn: () =>\n updateJobStatusAtVersion(tx, {\n jobId: params.jobId,\n status,\n expectedVersion: jobRow.version,\n statusReason,\n evaluationTrace: trace,\n }),\n fetchFn: async () => {\n const row = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n if (!row) throw new JobNotFoundError(params.jobId);\n return toJob(row);\n },\n matchFn: (job) => ({job, changed: false}),\n failureMessage: `Optimistic lock failure: job ${params.jobId} version ${jobRow.version}`,\n });\n });\n\n if (result.changed) recordWorkflowJobStatusChanged(result.job.status);\n return {\n status: result.job.status === 'succeeded' ? 'succeeded' : 'failed',\n jobVersion: result.job.version,\n };\n}\n"],"names":["readPersistedWorkflowModel","WORKFLOWS_JOB_TERMINATED","and","asc","desc","eq","inArray","notInArray","sql","isJobTerminal","JobNotFoundError","decideJobActivation","deriveJobSuccess","runtimeCompletionStatusForJob","recordWorkflowJobStatusChanged","db","writeWorkflowsOutboxEvent","jobExecutions","toJobExecution","jobs","toJob","workflowRunAttempts","toWorkflowRun","workflowRuns","getWorkflowRunById","getWorkflowContextForJob","optimisticLockRetry","TERMINAL_JOB_STATUSES","outputTypesByJobKey","model","Map","flatMap","job","outputTypes","undefined","key","getJobsByWorkflowRunAttemptId","workflowRunAttemptId","rows","select","from","where","orderBy","position","map","getJobsByWorkflowRunId","workflowRunId","run","attempt","id","currentAttempt","limit","getJobById","row","getJobScope","jobId","workspaceId","projectId","triggerReference","innerJoin","getDirectDependencyJobContexts","tx","targetRows","target","dependencies","length","execution","leftJoin","sequence","contextsByJobId","context","get","jobOutputTypes","executions","set","push","name","values","evaluateJobActivations","params","result","transaction","expectedVersions","expectedVersion","jobIds","targets","runAttemptId","for","found","Set","missing","filter","has","Error","join","contextsByJobKey","directDependencyContextsByJobKey","targetsByJobId","decisions","input","modelJob","find","item","decision","condition","if","vars","dependency","kind","updated","updateJobStatusAtVersion","status","statusReason","evaluationTrace","jobVersion","version","changed","existing","_changed","targetJobs","dependencyKeys","size","outputs","reduceJobOutputs","update","updatedAt","Date","returning","identity","type","payload","updateJobStatus","updateFn","fetchFn","matchFn","failureMessage","evaluateJobSuccess","resolveJobStatusFromJobExecutions","jobRow","jobExecutionRows","workflowContext","trace","success"],"mappings":"AAAA,SAAQA,0BAA0B,QAAO,+BAA+B;AACxE,SAAQC,wBAAwB,QAAO,6BAA6B;AAEpE,SAAQC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAEC,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEC,GAAG,QAAO,cAAc;AACzE,SAAQC,aAAa,QAAuD,wBAAwB;AAIpG,SAAQC,gBAAgB,QAAO,kBAAkB;AACjD,SAEEC,mBAAmB,EACnBC,gBAAgB,EAChBC,6BAA6B,QACxB,gCAAgC;AAGvC,SAAQC,8BAA8B,QAAO,uBAAuB;AACpE,SAAQC,EAAE,QAAgB,WAAW;AACrC,SAAQC,yBAAyB,QAAO,sBAAsB;AAC9D,SAAQC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s.ts"],"sourcesContent":["import {readPersistedWorkflowModel} from '@shipfox/api-definitions-dto';\nimport {WORKFLOWS_JOB_TERMINATED} from '@shipfox/api-workflows-dto';\nimport type {ExpressionType} from '@shipfox/expression';\nimport {and, asc, desc, eq, inArray, notInArray, sql} from 'drizzle-orm';\nimport {isJobTerminal, type Job, type JobStatus, type JobStatusReason} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\nimport type {WorkflowRunTriggerReference} from '#core/entities/workflow-run.js';\nimport {JobNotFoundError} from '#core/errors.js';\nimport {\n type DeriveJobSuccessResult,\n decideJobActivation,\n deriveJobSuccess,\n runtimeCompletionStatusForJob,\n} from '#core/job-transition/index.js';\nimport type {JobContextInput} from '#core/step-config/assemble-run-context.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\nimport {recordWorkflowJobStatusChanged} from '#metrics/instance.js';\nimport {db, type Tx} from '../db.js';\nimport {writeWorkflowsOutboxEvent} from '../outbox-writes.js';\nimport {jobExecutions, toJobExecution} from '../schema/job-executions.js';\nimport {jobs, toJob} from '../schema/jobs.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {toWorkflowRun, workflowRuns} from '../schema/workflow-runs.js';\nimport {getWorkflowRunById} from './queries.js';\nimport {getWorkflowContextForJob, optimisticLockRetry, TERMINAL_JOB_STATUSES} from './shared.js';\n\nfunction outputTypesByJobKey(\n model: ReturnType<typeof readPersistedWorkflowModel> | null,\n): ReadonlyMap<string, Readonly<Record<string, ExpressionType>>> {\n return new Map(\n (model?.jobs ?? []).flatMap((job) =>\n job.outputTypes === undefined ? [] : [[job.key, job.outputTypes] as const],\n ),\n );\n}\n\nexport async function getJobsByWorkflowRunAttemptId(workflowRunAttemptId: string): Promise<Job[]> {\n const rows = await db()\n .select()\n .from(jobs)\n .where(eq(jobs.workflowRunAttemptId, workflowRunAttemptId))\n .orderBy(asc(jobs.position));\n return rows.map(toJob);\n}\n\nexport async function getJobsByWorkflowRunId(workflowRunId: string): Promise<Job[]> {\n const run = await getWorkflowRunById(workflowRunId);\n if (!run) return [];\n const [attempt] = await db()\n .select()\n .from(workflowRunAttempts)\n .where(\n and(\n eq(workflowRunAttempts.workflowRunId, run.id),\n eq(workflowRunAttempts.attempt, run.currentAttempt),\n ),\n )\n .limit(1);\n return attempt ? getJobsByWorkflowRunAttemptId(attempt.id) : [];\n}\n\nexport async function getJobById(id: string): Promise<Job | undefined> {\n const rows = await db().select().from(jobs).where(eq(jobs.id, id)).limit(1);\n const row = rows[0];\n if (!row) return undefined;\n return toJob(row);\n}\n\nexport interface JobScope {\n workspaceId: string;\n projectId: string;\n triggerReference: WorkflowRunTriggerReference | null;\n}\n\nexport async function getJobScope(jobId: string): Promise<JobScope | undefined> {\n const rows = await db()\n .select({\n workspaceId: workflowRuns.workspaceId,\n projectId: workflowRuns.projectId,\n triggerReference: workflowRuns.triggerReference,\n })\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(eq(jobs.id, jobId))\n .limit(1);\n return rows[0];\n}\n\nexport async function getDirectDependencyJobContexts(\n jobId: string,\n tx?: Tx,\n): Promise<JobContextInput[]> {\n const targetRows = await (tx ?? db())\n .select({job: jobs, attempt: workflowRunAttempts})\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .where(eq(jobs.id, jobId))\n .limit(1);\n const target = targetRows[0];\n if (!target || target.job.dependencies.length === 0) return [];\n const model =\n target.attempt.model === null ? null : readPersistedWorkflowModel(target.attempt.model);\n const outputTypes = outputTypesByJobKey(model);\n\n const rows = await (tx ?? db())\n .select({job: jobs, execution: jobExecutions})\n .from(jobs)\n .leftJoin(jobExecutions, eq(jobExecutions.jobId, jobs.id))\n .where(\n and(\n eq(jobs.workflowRunAttemptId, target.job.workflowRunAttemptId),\n inArray(jobs.key, target.job.dependencies),\n ),\n )\n .orderBy(asc(jobs.position), asc(jobs.id), asc(jobExecutions.sequence), asc(jobExecutions.id));\n\n const contextsByJobId = new Map<string, JobContextInput & {executions: JobExecution[]}>();\n for (const row of rows) {\n let context = contextsByJobId.get(row.job.id);\n if (!context) {\n const jobOutputTypes = outputTypes.get(row.job.key);\n context = {\n job: toJob(row.job),\n ...(jobOutputTypes === undefined ? {} : {outputTypes: jobOutputTypes}),\n executions: [],\n };\n contextsByJobId.set(row.job.id, context);\n }\n if (row.execution)\n context.executions.push(toJobExecution(row.execution, row.job.name ?? row.job.key));\n }\n\n return [...contextsByJobId.values()];\n}\n\nexport interface EvaluateJobActivationsParams {\n runAttemptId: string;\n jobs: readonly {\n jobId: string;\n expectedVersion: number;\n }[];\n}\n\nexport type JobActivationDecision =\n | {\n kind: 'start-job';\n jobId: string;\n }\n | {\n kind: 'terminal-job';\n jobId: string;\n status: RuntimeCompletionStatus;\n jobVersion: number;\n };\n\ntype InternalJobActivationDecision = JobActivationDecision & {changed?: boolean};\n\nexport async function evaluateJobActivations(\n params: EvaluateJobActivationsParams,\n): Promise<JobActivationDecision[]> {\n if (params.jobs.length === 0) return [];\n\n const result = await db().transaction(async (tx) => {\n const expectedVersions = new Map(\n params.jobs.map((job) => [job.jobId, job.expectedVersion] as const),\n );\n const jobIds = params.jobs.map((job) => job.jobId);\n const targets = await tx\n .select({job: jobs, attempt: workflowRunAttempts, run: workflowRuns})\n .from(jobs)\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(and(eq(jobs.workflowRunAttemptId, params.runAttemptId), inArray(jobs.id, jobIds)))\n .for('update');\n\n if (targets.length !== jobIds.length) {\n const found = new Set(targets.map((target) => target.job.id));\n const missing = jobIds.filter((jobId) => !found.has(jobId));\n throw new Error(`Cannot evaluate missing activation jobs: ${missing.join(', ')}`);\n }\n\n const contextsByJobKey = await directDependencyContextsByJobKey(\n tx,\n params.runAttemptId,\n targets.map((target) => toJob(target.job)),\n );\n const targetsByJobId = new Map(targets.map((target) => [target.job.id, target]));\n const decisions: InternalJobActivationDecision[] = [];\n\n for (const input of params.jobs) {\n const target = targetsByJobId.get(input.jobId);\n if (!target) throw new Error(`Cannot evaluate missing activation job: ${input.jobId}`);\n const job = toJob(target.job);\n const model =\n target.attempt.model === null ? null : readPersistedWorkflowModel(target.attempt.model);\n const modelJob = model?.jobs.find((item) => item.key === target.job.key);\n const decision = decideJobActivation({\n run: toWorkflowRun(target.run),\n job,\n condition: modelJob?.if,\n vars: target.attempt.vars ?? undefined,\n dependencies: job.dependencies.flatMap((key) => {\n const dependency = contextsByJobKey.get(key);\n return dependency === undefined ? [] : [dependency];\n }),\n });\n\n if (decision.kind === 'terminal-job' || decision.kind === 'start-job') {\n decisions.push(decision);\n continue;\n }\n\n const expectedVersion = expectedVersions.get(job.id);\n if (expectedVersion === undefined) {\n throw new Error(`Missing expected version for activation job ${job.id}`);\n }\n const updated = await updateJobStatusAtVersion(tx, {\n jobId: job.id,\n status: decision.status,\n expectedVersion,\n statusReason: decision.statusReason,\n evaluationTrace: decision.evaluationTrace,\n });\n if (updated) {\n decisions.push({\n kind: 'terminal-job',\n jobId: job.id,\n status: 'skipped',\n jobVersion: updated.job.version,\n changed: updated.changed,\n });\n continue;\n }\n\n const [existing] = await tx.select().from(jobs).where(eq(jobs.id, job.id)).limit(1);\n if (existing && isJobTerminal(existing.status)) {\n decisions.push({\n kind: 'terminal-job',\n jobId: job.id,\n status: runtimeCompletionStatusForJob(existing.status),\n jobVersion: existing.version,\n });\n continue;\n }\n throw new Error(`Optimistic lock failure evaluating activation for job ${job.id}`);\n }\n\n return decisions;\n });\n\n for (const decision of result) {\n if (decision.kind === 'terminal-job' && decision.changed) {\n recordWorkflowJobStatusChanged(decision.status);\n }\n }\n\n return result.map(({changed: _changed, ...decision}) => decision);\n}\n\nasync function directDependencyContextsByJobKey(\n tx: Tx,\n runAttemptId: string,\n targetJobs: readonly Job[],\n): Promise<ReadonlyMap<string, JobContextInput>> {\n const dependencyKeys = new Set(targetJobs.flatMap((job) => job.dependencies));\n if (dependencyKeys.size === 0) return new Map();\n\n const [attempt] = await tx\n .select({model: workflowRunAttempts.model})\n .from(workflowRunAttempts)\n .where(eq(workflowRunAttempts.id, runAttemptId))\n .limit(1);\n const model =\n attempt === undefined || attempt.model === null\n ? null\n : readPersistedWorkflowModel(attempt.model);\n const outputTypes = outputTypesByJobKey(model);\n\n const rows = await tx\n .select({job: jobs, execution: jobExecutions})\n .from(jobs)\n .leftJoin(jobExecutions, eq(jobExecutions.jobId, jobs.id))\n .where(and(eq(jobs.workflowRunAttemptId, runAttemptId), inArray(jobs.key, [...dependencyKeys])))\n .orderBy(asc(jobs.position), asc(jobs.id), asc(jobExecutions.sequence), asc(jobExecutions.id));\n\n const contextsByJobKey = new Map<string, JobContextInput & {executions: JobExecution[]}>();\n for (const row of rows) {\n let context = contextsByJobKey.get(row.job.key);\n if (!context) {\n const jobOutputTypes = outputTypes.get(row.job.key);\n context = {\n job: toJob(row.job),\n ...(jobOutputTypes === undefined ? {} : {outputTypes: jobOutputTypes}),\n executions: [],\n };\n contextsByJobKey.set(row.job.key, context);\n }\n if (row.execution)\n context.executions.push(toJobExecution(row.execution, row.job.name ?? row.job.key));\n }\n\n return contextsByJobKey;\n}\n\nexport interface UpdateJobStatusAtVersionParams {\n jobId: string;\n status: JobStatus;\n expectedVersion: number;\n statusReason?: JobStatusReason | null | undefined;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null | undefined;\n}\n\n// Returns null on version mismatch so callers can choose throw vs treat-as-success.\nexport async function updateJobStatusAtVersion(\n tx: Tx,\n params: UpdateJobStatusAtVersionParams,\n): Promise<{job: Job; changed: boolean} | null> {\n const outputs = isJobTerminal(params.status)\n ? await reduceJobOutputs(tx, {jobId: params.jobId, status: params.status})\n : undefined;\n const rows = await tx\n .update(jobs)\n .set({\n status: params.status,\n statusReason: params.statusReason ?? null,\n ...(outputs === undefined ? {} : {outputs}),\n ...(params.evaluationTrace === undefined ? {} : {evaluationTrace: params.evaluationTrace}),\n version: sql`${jobs.version} + 1`,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(jobs.id, params.jobId),\n eq(jobs.version, params.expectedVersion),\n notInArray(jobs.status, TERMINAL_JOB_STATUSES),\n ),\n )\n .returning();\n\n const row = rows[0];\n if (!row) return null;\n const job = toJob(row);\n\n // Every terminal job-status write funnels through this one guarded UPDATE, where the\n // version match lets a single caller win. Emitting here, in the same transaction,\n // makes the terminal fact fire exactly once across all paths.\n if (isJobTerminal(job.status)) {\n const [currentExecution] = await tx\n .select({id: jobExecutions.id})\n .from(jobExecutions)\n .where(eq(jobExecutions.jobId, job.id))\n .orderBy(desc(jobExecutions.sequence), desc(jobExecutions.id))\n .limit(1);\n const identity = await getWorkflowContextForJob(job.id, tx);\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_JOB_TERMINATED,\n payload: {\n jobId: job.id,\n jobExecutionId: currentExecution?.id ?? null,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n status: job.status,\n statusReason: job.statusReason,\n },\n });\n }\n\n return {job, changed: true};\n}\n\nasync function reduceJobOutputs(\n tx: Tx,\n params: {jobId: string; status: JobStatus},\n): Promise<Record<string, unknown> | null> {\n if (params.status !== 'succeeded') return null;\n\n const [row] = await tx\n .select({outputs: jobExecutions.outputs})\n .from(jobExecutions)\n .where(and(eq(jobExecutions.jobId, params.jobId), eq(jobExecutions.status, 'succeeded')))\n .orderBy(desc(jobExecutions.sequence), desc(jobExecutions.id))\n .limit(1);\n\n return row?.outputs ? {...row.outputs} : null;\n}\n\nexport interface UpdateJobStatusParams {\n jobId: string;\n status: JobStatus;\n expectedVersion: number;\n statusReason?: JobStatusReason | null | undefined;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null | undefined;\n}\n\nexport async function updateJobStatus(params: UpdateJobStatusParams): Promise<Job> {\n const statusReason = params.statusReason ?? null;\n const result = await db().transaction(async (tx) => {\n return await optimisticLockRetry({\n updateFn: () =>\n updateJobStatusAtVersion(tx, {\n jobId: params.jobId,\n status: params.status,\n expectedVersion: params.expectedVersion,\n statusReason,\n evaluationTrace: params.evaluationTrace,\n }),\n fetchFn: async () => {\n const row = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n return row ? toJob(row) : undefined;\n },\n matchFn: (job) =>\n (job.status === params.status && job.statusReason === statusReason) ||\n isJobTerminal(job.status)\n ? {job, changed: false}\n : null,\n failureMessage: `Optimistic lock failure: job ${params.jobId} version ${params.expectedVersion}`,\n });\n });\n\n if (result.changed) recordWorkflowJobStatusChanged(result.job.status);\n\n return result.job;\n}\n\nexport type EvaluateJobSuccessResult = DeriveJobSuccessResult;\nexport const evaluateJobSuccess = deriveJobSuccess;\n\nexport async function resolveJobStatusFromJobExecutions(params: {\n jobId: string;\n}): Promise<{status: RuntimeCompletionStatus; jobVersion: number}> {\n const result = await db().transaction(async (tx) => {\n const jobRow = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n if (!jobRow) throw new JobNotFoundError(params.jobId);\n\n const jobExecutionRows = await tx\n .select()\n .from(jobExecutions)\n .where(eq(jobExecutions.jobId, params.jobId))\n .orderBy(asc(jobExecutions.sequence), asc(jobExecutions.id));\n const workflowContext = await getWorkflowContextForJob(params.jobId, tx);\n\n if (jobExecutionRows.length === 0) {\n throw new Error(`Cannot resolve job ${params.jobId}: no job executions found`);\n }\n\n const {status, statusReason, trace} = evaluateJobSuccess({\n success: jobRow.success,\n executions: jobExecutionRows.map((execution) =>\n toJobExecution(execution, jobRow.name ?? jobRow.key),\n ),\n jobs: await getDirectDependencyJobContexts(params.jobId, tx),\n vars: workflowContext.vars ?? undefined,\n });\n\n return optimisticLockRetry({\n updateFn: () =>\n updateJobStatusAtVersion(tx, {\n jobId: params.jobId,\n status,\n expectedVersion: jobRow.version,\n statusReason,\n evaluationTrace: trace,\n }),\n fetchFn: async () => {\n const row = (await tx.select().from(jobs).where(eq(jobs.id, params.jobId)).limit(1))[0];\n if (!row) throw new JobNotFoundError(params.jobId);\n return toJob(row);\n },\n matchFn: (job) => ({job, changed: false}),\n failureMessage: `Optimistic lock failure: job ${params.jobId} version ${jobRow.version}`,\n });\n });\n\n if (result.changed) recordWorkflowJobStatusChanged(result.job.status);\n return {\n status: result.job.status === 'succeeded' ? 'succeeded' : 'failed',\n jobVersion: result.job.version,\n };\n}\n"],"names":["readPersistedWorkflowModel","WORKFLOWS_JOB_TERMINATED","and","asc","desc","eq","inArray","notInArray","sql","isJobTerminal","JobNotFoundError","decideJobActivation","deriveJobSuccess","runtimeCompletionStatusForJob","recordWorkflowJobStatusChanged","db","writeWorkflowsOutboxEvent","jobExecutions","toJobExecution","jobs","toJob","workflowRunAttempts","toWorkflowRun","workflowRuns","getWorkflowRunById","getWorkflowContextForJob","optimisticLockRetry","TERMINAL_JOB_STATUSES","outputTypesByJobKey","model","Map","flatMap","job","outputTypes","undefined","key","getJobsByWorkflowRunAttemptId","workflowRunAttemptId","rows","select","from","where","orderBy","position","map","getJobsByWorkflowRunId","workflowRunId","run","attempt","id","currentAttempt","limit","getJobById","row","getJobScope","jobId","workspaceId","projectId","triggerReference","innerJoin","getDirectDependencyJobContexts","tx","targetRows","target","dependencies","length","execution","leftJoin","sequence","contextsByJobId","context","get","jobOutputTypes","executions","set","push","name","values","evaluateJobActivations","params","result","transaction","expectedVersions","expectedVersion","jobIds","targets","runAttemptId","for","found","Set","missing","filter","has","Error","join","contextsByJobKey","directDependencyContextsByJobKey","targetsByJobId","decisions","input","modelJob","find","item","decision","condition","if","vars","dependency","kind","updated","updateJobStatusAtVersion","status","statusReason","evaluationTrace","jobVersion","version","changed","existing","_changed","targetJobs","dependencyKeys","size","outputs","reduceJobOutputs","update","updatedAt","Date","returning","currentExecution","identity","type","payload","jobExecutionId","updateJobStatus","updateFn","fetchFn","matchFn","failureMessage","evaluateJobSuccess","resolveJobStatusFromJobExecutions","jobRow","jobExecutionRows","workflowContext","trace","success"],"mappings":"AAAA,SAAQA,0BAA0B,QAAO,+BAA+B;AACxE,SAAQC,wBAAwB,QAAO,6BAA6B;AAEpE,SAAQC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAEC,EAAE,EAAEC,OAAO,EAAEC,UAAU,EAAEC,GAAG,QAAO,cAAc;AACzE,SAAQC,aAAa,QAAuD,wBAAwB;AAIpG,SAAQC,gBAAgB,QAAO,kBAAkB;AACjD,SAEEC,mBAAmB,EACnBC,gBAAgB,EAChBC,6BAA6B,QACxB,gCAAgC;AAGvC,SAAQC,8BAA8B,QAAO,uBAAuB;AACpE,SAAQC,EAAE,QAAgB,WAAW;AACrC,SAAQC,yBAAyB,QAAO,sBAAsB;AAC9D,SAAQC,aAAa,EAAEC,cAAc,QAAO,8BAA8B;AAC1E,SAAQC,IAAI,EAAEC,KAAK,QAAO,oBAAoB;AAC9C,SAAQC,mBAAmB,QAAO,qCAAqC;AACvE,SAAQC,aAAa,EAAEC,YAAY,QAAO,6BAA6B;AACvE,SAAQC,kBAAkB,QAAO,eAAe;AAChD,SAAQC,wBAAwB,EAAEC,mBAAmB,EAAEC,qBAAqB,QAAO,cAAc;AAEjG,SAASC,oBACPC,KAA2D;IAE3D,OAAO,IAAIC,IACT,AAACD,CAAAA,OAAOV,QAAQ,EAAE,AAAD,EAAGY,OAAO,CAAC,CAACC,MAC3BA,IAAIC,WAAW,KAAKC,YAAY,EAAE,GAAG;YAAC;gBAACF,IAAIG,GAAG;gBAAEH,IAAIC,WAAW;aAAC;SAAU;AAGhF;AAEA,OAAO,eAAeG,8BAA8BC,oBAA4B;IAC9E,MAAMC,OAAO,MAAMvB,KAChBwB,MAAM,GACNC,IAAI,CAACrB,MACLsB,KAAK,CAACpC,GAAGc,KA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BAAgBpC,IAAI,IAAIxE;QAChC;QAEA,OAAOR,oBAAoB;YACzB4G,UAAU,IACRxB,yBAAyBjD,IAAI;oBAC3BN,OAAOwB,OAAOxB,KAAK;oBACnBwD;oBACA5B,iBAAiByD,OAAOzB,OAAO;oBAC/BH;oBACAC,iBAAiB8B;gBACnB;YACFR,SAAS;gBACP,MAAMlF,MAAM,AAAC,CAAA,MAAMQ,GAAGtB,MAAM,GAAGC,IAAI,CAACrB,MAAMsB,KAAK,CAACpC,GAAGc,KAAK8B,EAAE,EAAE8B,OAAOxB,KAAK,GAAGJ,KAAK,CAAC,EAAC,CAAE,CAAC,EAAE;gBACvF,IAAI,CAACE,KAAK,MAAM,IAAI3C,iBAAiBqE,OAAOxB,KAAK;gBACjD,OAAOnC,MAAMiC;YACf;YACAmF,SAAS,CAACxG,MAAS,CAAA;oBAACA;oBAAKoF,SAAS;gBAAK,CAAA;YACvCqB,gBAAgB,CAAC,6BAA6B,EAAE1D,OAAOxB,KAAK,CAAC,SAAS,EAAEqF,OAAOzB,OAAO,EAAE;QAC1F;IACF;IAEA,IAAInC,OAAOoC,OAAO,EAAEtG,+BAA+BkE,OAAOhD,GAAG,CAAC+E,MAAM;IACpE,OAAO;QACLA,QAAQ/B,OAAOhD,GAAG,CAAC+E,MAAM,KAAK,cAAc,cAAc;QAC1DG,YAAYlC,OAAOhD,GAAG,CAACmF,OAAO;IAChC;AACF"}
|
|
@@ -8,6 +8,7 @@ export declare function writeJobStepsSettledOutbox(tx: Tx, params: {
|
|
|
8
8
|
export declare function writeStepAttemptTerminatedOutbox(tx: Tx, params: {
|
|
9
9
|
stepId: string;
|
|
10
10
|
attempt: number;
|
|
11
|
+
status: 'succeeded' | 'failed' | 'cancelled';
|
|
11
12
|
logOutcome: LogOutcomeDto;
|
|
12
13
|
}): Promise<void>;
|
|
13
14
|
export declare function writeStepRestartEnqueuedOutbox(tx: Tx, params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/outbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,UAAU,CAAC;AAUjC,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,EAAE,EACN,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAA;CAAC,GAC9E,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,gCAAgC,CACpD,EAAE,EAAE,EAAE,EACN,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"outbox.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/outbox.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAC,EAAE,EAAC,MAAM,UAAU,CAAC;AAUjC,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,EAAE,EACN,MAAM,EAAE;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAA;CAAC,GAC9E,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAsB,gCAAgC,CACpD,EAAE,EAAE,EAAE,EACN,MAAM,EAAE;IACN,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC7C,UAAU,EAAE,aAAa,CAAC;CAC3B,GACA,OAAO,CAAC,IAAI,CAAC,CAiBf;AA8BD,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,EAAE,EACN,MAAM,EAAE;IACN,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB,GACA,OAAO,CAAC,IAAI,CAAC,CAef"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/db/workflow-runs/outbox.ts"],"sourcesContent":["import {\n type LogOutcomeDto,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_STEP_RESTART_ENQUEUED,\n} from '@shipfox/api-workflows-dto';\nimport {eq} from 'drizzle-orm';\nimport type {Tx} from '../db.js';\nimport {writeWorkflowsOutboxEvent} from '../outbox-writes.js';\nimport {jobExecutions} from '../schema/job-executions.js';\nimport {steps} from '../schema/steps.js';\nimport {getWorkflowContextForJob} from './shared.js';\n\n// Enqueue the steps-settled signal in the same transaction as the final per-step\n// result, so per-step execution observes it exactly once (the outbox is at-least-once;\n// the job workflow dedupes the signal). Drives the Temporal JOB_FINISHED_SIGNAL; the\n// job's terminal fact is emitted separately by updateJobStatusAtVersion.\nexport async function writeJobStepsSettledOutbox(\n tx: Tx,\n params: {jobId: string; jobExecutionId: string; status: 'succeeded' | 'failed'},\n): Promise<void> {\n const identity = await getWorkflowContextForJob(params.jobId, tx);\n\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_JOB_STEPS_SETTLED,\n payload: {\n jobId: params.jobId,\n jobExecutionId: params.jobExecutionId,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n status: params.status,\n },\n });\n}\n\nexport async function writeStepAttemptTerminatedOutbox(\n tx: Tx,\n params: {stepId: string
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/outbox.ts"],"sourcesContent":["import {\n type LogOutcomeDto,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_STEP_RESTART_ENQUEUED,\n} from '@shipfox/api-workflows-dto';\nimport {eq} from 'drizzle-orm';\nimport type {Tx} from '../db.js';\nimport {writeWorkflowsOutboxEvent} from '../outbox-writes.js';\nimport {jobExecutions} from '../schema/job-executions.js';\nimport {steps} from '../schema/steps.js';\nimport {getWorkflowContextForJob} from './shared.js';\n\n// Enqueue the steps-settled signal in the same transaction as the final per-step\n// result, so per-step execution observes it exactly once (the outbox is at-least-once;\n// the job workflow dedupes the signal). Drives the Temporal JOB_FINISHED_SIGNAL; the\n// job's terminal fact is emitted separately by updateJobStatusAtVersion.\nexport async function writeJobStepsSettledOutbox(\n tx: Tx,\n params: {jobId: string; jobExecutionId: string; status: 'succeeded' | 'failed'},\n): Promise<void> {\n const identity = await getWorkflowContextForJob(params.jobId, tx);\n\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_JOB_STEPS_SETTLED,\n payload: {\n jobId: params.jobId,\n jobExecutionId: params.jobExecutionId,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n status: params.status,\n },\n });\n}\n\nexport async function writeStepAttemptTerminatedOutbox(\n tx: Tx,\n params: {\n stepId: string;\n attempt: number;\n status: 'succeeded' | 'failed' | 'cancelled';\n logOutcome: LogOutcomeDto;\n },\n): Promise<void> {\n const identity = await getStepAttemptTerminatedOutboxIdentity(tx, params.stepId);\n\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n payload: {\n jobId: identity.jobId,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n workspaceId: identity.workspaceId,\n projectId: identity.projectId,\n stepId: params.stepId,\n attempt: params.attempt,\n status: params.status,\n logOutcome: params.logOutcome,\n },\n });\n}\n\nasync function getStepAttemptTerminatedOutboxIdentity(\n tx: Tx,\n stepId: string,\n): Promise<{\n jobId: string;\n workflowRunId: string;\n workflowRunAttemptId: string;\n workspaceId: string;\n projectId: string;\n}> {\n const rows = await tx\n .select({\n jobId: jobExecutions.jobId,\n })\n .from(steps)\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(eq(steps.id, stepId))\n .limit(1);\n const step = rows[0];\n if (!step) {\n throw new Error(`Cannot enqueue step-attempt-terminated event: step ${stepId} not found`);\n }\n\n return getWorkflowContextForJob(step.jobId, tx);\n}\n\n// Enqueue the durable audit record of a restart, in the same transaction as the\n// rewind. Looks up the workflow run id like writeJobStepsSettledOutbox.\nexport async function writeStepRestartEnqueuedOutbox(\n tx: Tx,\n params: {\n jobId: string;\n failedStepId: string;\n failedStepAttempt: number;\n restartFromStepId: string;\n feedback: string;\n },\n): Promise<void> {\n const identity = await getWorkflowContextForJob(params.jobId, tx);\n\n await writeWorkflowsOutboxEvent(tx, {\n type: WORKFLOWS_STEP_RESTART_ENQUEUED,\n payload: {\n jobId: params.jobId,\n workflowRunId: identity.workflowRunId,\n workflowRunAttemptId: identity.workflowRunAttemptId,\n failedStepId: params.failedStepId,\n failedStepAttempt: params.failedStepAttempt,\n restartFromStepId: params.restartFromStepId,\n feedback: params.feedback,\n },\n });\n}\n"],"names":["WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_STEP_ATTEMPT_TERMINATED","WORKFLOWS_STEP_RESTART_ENQUEUED","eq","writeWorkflowsOutboxEvent","jobExecutions","steps","getWorkflowContextForJob","writeJobStepsSettledOutbox","tx","params","identity","jobId","type","payload","jobExecutionId","workflowRunId","workflowRunAttemptId","status","writeStepAttemptTerminatedOutbox","getStepAttemptTerminatedOutboxIdentity","stepId","workspaceId","projectId","attempt","logOutcome","rows","select","from","innerJoin","id","where","limit","step","Error","writeStepRestartEnqueuedOutbox","failedStepId","failedStepAttempt","restartFromStepId","feedback"],"mappings":"AAAA,SAEEA,2BAA2B,EAC3BC,iCAAiC,EACjCC,+BAA+B,QAC1B,6BAA6B;AACpC,SAAQC,EAAE,QAAO,cAAc;AAE/B,SAAQC,yBAAyB,QAAO,sBA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B,IAAI,CAACO,MAAM;QACT,MAAM,IAAIC,MAAM,CAAC,mDAAmD,EAAEb,OAAO,UAAU,CAAC;IAC1F;IAEA,OAAOd,yBAAyB0B,KAAKrB,KAAK,EAAEH;AAC9C;AAEA,gFAAgF;AAChF,wEAAwE;AACxE,OAAO,eAAe0B,+BACpB1B,EAAM,EACNC,MAMC;IAED,MAAMC,WAAW,MAAMJ,yBAAyBG,OAAOE,KAAK,EAAEH;IAE9D,MAAML,0BAA0BK,IAAI;QAClCI,MAAMX;QACNY,SAAS;YACPF,OAAOF,OAAOE,KAAK;YACnBI,eAAeL,SAASK,aAAa;YACrCC,sBAAsBN,SAASM,oBAAoB;YACnDmB,cAAc1B,OAAO0B,YAAY;YACjCC,mBAAmB3B,OAAO2B,iBAAiB;YAC3CC,mBAAmB5B,OAAO4B,iBAAiB;YAC3CC,UAAU7B,OAAO6B,QAAQ;QAC3B;IACF;AACF"}
|
|
@@ -6,6 +6,34 @@ export declare function getStepByIdForJobExecution(params: {
|
|
|
6
6
|
jobExecutionId: string;
|
|
7
7
|
}): Promise<Step | undefined>;
|
|
8
8
|
export declare function getStepById(stepId: string): Promise<Step | undefined>;
|
|
9
|
+
export interface StepAttemptDetail {
|
|
10
|
+
workflowRunId: string;
|
|
11
|
+
workflowRunAttemptId: string;
|
|
12
|
+
step: Step;
|
|
13
|
+
attempt: StepAttempt;
|
|
14
|
+
}
|
|
15
|
+
export interface JobExecutionFailureOrigin {
|
|
16
|
+
jobExecutionId: string;
|
|
17
|
+
stepId: string;
|
|
18
|
+
stepName: string;
|
|
19
|
+
stepStatus: StepStatus;
|
|
20
|
+
stepAttempt: number;
|
|
21
|
+
stepError: Record<string, unknown> | null;
|
|
22
|
+
attemptStatus: StepAttemptStatus | null;
|
|
23
|
+
attemptError: Record<string, unknown> | null;
|
|
24
|
+
attemptExitCode: number | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Read only the current attempt for the most relevant step. The terminal job event identifies
|
|
28
|
+
* the execution, so this intentionally avoids hydrating the execution's complete attempt
|
|
29
|
+
* history. If no attempt was dispatched, the first step still gives the projection a stable
|
|
30
|
+
* troubleshooting origin for failures that happened before step work started.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getJobExecutionFailureOrigin(jobExecutionId: string): Promise<JobExecutionFailureOrigin | undefined>;
|
|
33
|
+
export declare function getStepAttemptDetail(params: {
|
|
34
|
+
stepId: string;
|
|
35
|
+
attempt: number;
|
|
36
|
+
}): Promise<StepAttemptDetail | undefined>;
|
|
9
37
|
export declare function getStepsByJobId(jobId: string): Promise<Step[]>;
|
|
10
38
|
export declare function getStepsByJobExecutionId(jobExecutionId: string): Promise<Step[]>;
|
|
11
39
|
export interface BulkUpdateStepStatusesParams {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EACV,6BAA6B,EAC7B,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAK,KAAK,EAAE,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../src/db/workflow-runs/steps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EACV,6BAA6B,EAC7B,IAAI,EACJ,WAAW,EACX,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAK,KAAK,EAAE,EAAC,MAAM,UAAU,CAAC;AAUrC,wBAAsB,0BAA0B,CAAC,MAAM,EAAE;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAA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import { deriveCompletion, isTerminal } from '#core/step-transition/decide-step-transition.js';
|
|
3
3
|
import { db } from '../db.js';
|
|
4
4
|
import { jobExecutions } from '../schema/job-executions.js';
|
|
5
|
+
import { jobs } from '../schema/jobs.js';
|
|
5
6
|
import { stepAttempts, toStepAttempt } from '../schema/step-attempts.js';
|
|
6
7
|
import { steps, toStep } from '../schema/steps.js';
|
|
8
|
+
import { workflowRunAttempts } from '../schema/workflow-run-attempts.js';
|
|
9
|
+
import { workflowRuns } from '../schema/workflow-runs.js';
|
|
7
10
|
import { writeJobStepsSettledOutbox, writeStepAttemptTerminatedOutbox } from './outbox.js';
|
|
8
11
|
import { NON_TERMINAL_STEP_STATUS_FILTER } from './shared.js';
|
|
9
12
|
export async function getStepByIdForJobExecution(params) {
|
|
@@ -18,6 +21,49 @@ export async function getStepById(stepId) {
|
|
|
18
21
|
if (!row) return undefined;
|
|
19
22
|
return toStep(row);
|
|
20
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Read only the current attempt for the most relevant step. The terminal job event identifies
|
|
26
|
+
* the execution, so this intentionally avoids hydrating the execution's complete attempt
|
|
27
|
+
* history. If no attempt was dispatched, the first step still gives the projection a stable
|
|
28
|
+
* troubleshooting origin for failures that happened before step work started.
|
|
29
|
+
*/ export async function getJobExecutionFailureOrigin(jobExecutionId) {
|
|
30
|
+
const rows = await db().select({
|
|
31
|
+
jobExecutionId: jobExecutions.id,
|
|
32
|
+
stepId: steps.id,
|
|
33
|
+
stepName: steps.name,
|
|
34
|
+
stepStatus: steps.status,
|
|
35
|
+
stepAttempt: steps.currentAttempt,
|
|
36
|
+
stepError: steps.error,
|
|
37
|
+
attemptStatus: stepAttempts.status,
|
|
38
|
+
attemptError: stepAttempts.error,
|
|
39
|
+
attemptExitCode: stepAttempts.exitCode
|
|
40
|
+
}).from(jobExecutions).innerJoin(steps, eq(steps.jobExecutionId, jobExecutions.id)).leftJoin(stepAttempts, and(eq(stepAttempts.stepId, steps.id), eq(stepAttempts.attempt, steps.currentAttempt))).where(eq(jobExecutions.id, jobExecutionId)).orderBy(desc(sql`case when ${steps.status} = 'failed' or ${stepAttempts.status} = 'failed' or ${steps.statusReason} = 'condition_errored' then 1 else 0 end`), asc(steps.position), asc(steps.id)).limit(1);
|
|
41
|
+
const row = rows[0];
|
|
42
|
+
if (!row) return undefined;
|
|
43
|
+
return {
|
|
44
|
+
...row,
|
|
45
|
+
stepError: row.stepError ?? null,
|
|
46
|
+
attemptError: row.attemptError ?? null,
|
|
47
|
+
attemptStatus: row.attemptStatus === null ? null : row.attemptStatus,
|
|
48
|
+
attemptExitCode: row.attemptExitCode ?? null
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export async function getStepAttemptDetail(params) {
|
|
52
|
+
const rows = await db().select({
|
|
53
|
+
workflowRunId: workflowRuns.id,
|
|
54
|
+
workflowRunAttemptId: workflowRunAttempts.id,
|
|
55
|
+
step: steps,
|
|
56
|
+
stepAttempt: stepAttempts
|
|
57
|
+
}).from(stepAttempts).innerJoin(steps, eq(stepAttempts.stepId, steps.id)).innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id)).innerJoin(jobs, eq(jobExecutions.jobId, jobs.id)).innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id)).innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id)).where(and(eq(stepAttempts.stepId, params.stepId), eq(stepAttempts.attempt, params.attempt))).limit(1);
|
|
58
|
+
const row = rows[0];
|
|
59
|
+
if (!row) return undefined;
|
|
60
|
+
return {
|
|
61
|
+
workflowRunId: row.workflowRunId,
|
|
62
|
+
workflowRunAttemptId: row.workflowRunAttemptId,
|
|
63
|
+
step: toStep(row.step),
|
|
64
|
+
attempt: toStepAttempt(row.stepAttempt)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
21
67
|
export async function getStepsByJobId(jobId) {
|
|
22
68
|
const rows = await db().select({
|
|
23
69
|
step: steps
|
|
@@ -54,6 +100,7 @@ export async function bulkUpdateStepStatuses(params, tx) {
|
|
|
54
100
|
await writeStepAttemptTerminatedOutbox(tx, {
|
|
55
101
|
stepId: attempt.stepId,
|
|
56
102
|
attempt: attempt.attempt,
|
|
103
|
+
status: params.status,
|
|
57
104
|
logOutcome: attempt.logOutcome ?? 'abandoned'
|
|
58
105
|
});
|
|
59
106
|
}
|
|
@@ -185,6 +232,7 @@ export async function finishStepAttempt(params, tx) {
|
|
|
185
232
|
await writeStepAttemptTerminatedOutbox(tx, {
|
|
186
233
|
stepId: row.stepId,
|
|
187
234
|
attempt: row.attempt,
|
|
235
|
+
status: params.status,
|
|
188
236
|
logOutcome: row.logOutcome ?? params.logOutcome
|
|
189
237
|
});
|
|
190
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/db/workflow-runs/steps.ts"],"sourcesContent":["import type {LogOutcomeDto} from '@shipfox/api-workflows-dto';\nimport {and, asc, count, eq, gte, inArray, sql} from 'drizzle-orm';\nimport type {\n PersistedEvaluationTraceEntry,\n Step,\n StepAttempt,\n StepAttemptStatus,\n StepStatus,\n StepStatusReason,\n} from '#core/entities/step.js';\nimport {deriveCompletion, isTerminal} from '#core/step-transition/decide-step-transition.js';\nimport {db, type Tx} from '../db.js';\nimport {jobExecutions} from '../schema/job-executions.js';\nimport {stepAttempts, toStepAttempt} from '../schema/step-attempts.js';\nimport {steps, toStep} from '../schema/steps.js';\nimport {writeJobStepsSettledOutbox, writeStepAttemptTerminatedOutbox} from './outbox.js';\nimport {NON_TERMINAL_STEP_STATUS_FILTER} from './shared.js';\n\nexport async function getStepByIdForJobExecution(params: {\n stepId: string;\n jobExecutionId: string;\n}): Promise<Step | undefined> {\n const rows = await db()\n .select()\n .from(steps)\n .where(and(eq(steps.id, params.stepId), eq(steps.jobExecutionId, params.jobExecutionId)))\n .limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n return toStep(row);\n}\n\nexport async function getStepById(stepId: string): Promise<Step | undefined> {\n const rows = await db().select().from(steps).where(eq(steps.id, stepId)).limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n return toStep(row);\n}\n\nexport async function getStepsByJobId(jobId: string): Promise<Step[]> {\n const rows = await db()\n .select({step: steps})\n .from(steps)\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(eq(jobExecutions.jobId, jobId))\n .orderBy(asc(steps.position));\n return rows.map((row) => toStep(row.step));\n}\n\nexport async function getStepsByJobExecutionId(jobExecutionId: string): Promise<Step[]> {\n const rows = await db()\n .select()\n .from(steps)\n .where(eq(steps.jobExecutionId, jobExecutionId))\n .orderBy(asc(steps.position));\n return rows.map(toStep);\n}\n\nexport interface BulkUpdateStepStatusesParams {\n jobExecutionId: string;\n status: Extract<StepStatus, 'failed' | 'cancelled'>;\n}\n\nexport async function bulkUpdateStepStatuses(\n params: BulkUpdateStepStatusesParams,\n tx?: Tx,\n): Promise<void> {\n if (!tx) {\n await db().transaction((transaction) => bulkUpdateStepStatuses(params, transaction));\n return;\n }\n\n await tx\n .update(steps)\n .set({\n status: params.status,\n statusReason: null,\n updatedAt: new Date(),\n })\n .where(and(eq(steps.jobExecutionId, params.jobExecutionId), NON_TERMINAL_STEP_STATUS_FILTER));\n\n // Finalize open attempt rows so a timed-out/cancelled sweep does not leave\n // phantom in-flight work for gate and restart logic.\n const finalizedAttempts = await tx\n .update(stepAttempts)\n .set({status: params.status, logOutcome: 'abandoned', finishedAt: new Date()})\n .from(steps)\n .where(\n and(\n eq(stepAttempts.stepId, steps.id),\n eq(steps.jobExecutionId, params.jobExecutionId),\n eq(stepAttempts.status, 'running'),\n ),\n )\n .returning({\n stepId: stepAttempts.stepId,\n attempt: stepAttempts.attempt,\n logOutcome: stepAttempts.logOutcome,\n });\n\n if (finalizedAttempts.length > 0) {\n for (const attempt of finalizedAttempts) {\n await writeStepAttemptTerminatedOutbox(tx, {\n stepId: attempt.stepId,\n attempt: attempt.attempt,\n logOutcome: attempt.logOutcome ?? 'abandoned',\n });\n }\n }\n}\n\n// Per-step progression primitives. They take a mandatory `tx` because they only\n// run inside the job-execution service's transaction, and every write guards on\n// the never-downgrade predicate so a late or duplicate write cannot overwrite an\n// already-terminal row.\n\nexport async function getStepsByJobExecutionIdForUpdate(\n jobExecutionId: string,\n tx: Tx,\n): Promise<Step[]> {\n const rows = await tx\n .select()\n .from(steps)\n .where(eq(steps.jobExecutionId, jobExecutionId))\n .orderBy(asc(steps.position))\n .for('update');\n return rows.map(toStep);\n}\n\nexport async function getStepAttemptsByJobExecutionId(\n jobExecutionId: string,\n tx: Tx,\n): Promise<StepAttempt[]> {\n const rows = await tx\n .select()\n .from(stepAttempts)\n .where(eq(stepAttempts.jobExecutionId, jobExecutionId))\n .orderBy(asc(stepAttempts.executionOrder), asc(stepAttempts.id));\n return rows.map(toStepAttempt);\n}\n\nexport interface MarkStepRunningParams {\n jobExecutionId: string;\n stepId: string;\n}\n\nexport async function markStepRunning(params: MarkStepRunningParams, tx: Tx): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'running',\n statusReason: null,\n evaluationTrace: null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n )\n .returning();\n const row = rows[0];\n if (!row) return null;\n const step = toStep(row);\n // Open the attempt this dispatch runs. onConflictDoNothing makes a racing\n // re-dispatch a no-op against the unique (step_id, attempt) anchor; normal\n // re-delivery returns the already-running step without calling this.\n await insertRunningStepAttempt(\n {\n jobExecutionId: step.jobExecutionId,\n stepId: step.id,\n attempt: step.currentAttempt,\n config: step.config,\n },\n tx,\n );\n return step;\n}\n\nexport interface DispatchStepWithCompletedConfigParams {\n jobExecutionId: string;\n stepId: string;\n config: Record<string, unknown>;\n evaluationTrace: readonly PersistedEvaluationTraceEntry[] | null;\n}\n\nexport async function dispatchStepWithCompletedConfig(\n params: DispatchStepWithCompletedConfigParams,\n tx: Tx,\n): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'running',\n statusReason: null,\n evaluationTrace: null,\n config: params.config,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n )\n .returning();\n const row = rows[0];\n if (!row) return null;\n const step = toStep(row);\n await insertRunningStepAttempt(\n {\n jobExecutionId: step.jobExecutionId,\n stepId: step.id,\n attempt: step.currentAttempt,\n config: params.config,\n evaluationTrace: params.evaluationTrace,\n },\n tx,\n );\n return step;\n}\n\nexport interface MarkStepSkippedParams {\n jobExecutionId: string;\n stepId: string;\n statusReason: StepStatusReason;\n evaluationTrace: readonly PersistedEvaluationTraceEntry[];\n}\n\nexport async function markStepSkipped(params: MarkStepSkippedParams, tx: Tx): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'skipped',\n statusReason: params.statusReason,\n evaluationTrace: params.evaluationTrace,\n error: null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n eq(steps.status, 'pending'),\n ),\n )\n .returning();\n const row = rows[0];\n return row ? toStep(row) : null;\n}\n\nexport async function settleJobFailed(\n tx: Tx,\n params: {\n jobId: string;\n jobExecutionId: string;\n failedStepId: string;\n error: Record<string, unknown>;\n },\n): Promise<'succeeded' | 'failed' | null> {\n await applyStepResult(\n {\n jobExecutionId: params.jobExecutionId,\n stepId: params.failedStepId,\n status: 'failed',\n error: params.error,\n },\n tx,\n );\n\n const after = await getStepsByJobExecutionIdForUpdate(params.jobExecutionId, tx);\n if (!after.every((step) => isTerminal(step.status))) return null;\n\n const status = deriveCompletion(after);\n await writeJobStepsSettledOutbox(tx, {\n jobId: params.jobId,\n jobExecutionId: params.jobExecutionId,\n status,\n });\n return status;\n}\n\nexport interface InsertRunningStepAttemptParams {\n jobExecutionId: string;\n stepId: string;\n attempt: number;\n config?: Record<string, unknown> | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n}\n\nexport async function insertRunningStepAttempt(\n params: InsertRunningStepAttemptParams,\n tx: Tx,\n): Promise<void> {\n const [{nextExecutionOrder} = {nextExecutionOrder: 1}] = await tx\n .select({\n nextExecutionOrder: sql<number>`coalesce(max(${stepAttempts.executionOrder}), 0) + 1`,\n })\n .from(stepAttempts)\n .where(eq(stepAttempts.jobExecutionId, params.jobExecutionId));\n\n await tx\n .insert(stepAttempts)\n .values({\n jobExecutionId: params.jobExecutionId,\n stepId: params.stepId,\n attempt: params.attempt,\n executionOrder: nextExecutionOrder,\n status: 'running',\n config: params.config ?? null,\n evaluationTrace: params.evaluationTrace ?? null,\n })\n .onConflictDoNothing({target: [stepAttempts.stepId, stepAttempts.attempt]});\n}\n\nexport interface FinishStepAttemptParams {\n stepId: string;\n attempt: number;\n status: Exclude<StepAttemptStatus, 'running'>;\n error?: Record<string, unknown> | null;\n output?: Record<string, unknown> | null;\n response?: string | null;\n exitCode?: number | null;\n logOutcome: LogOutcomeDto;\n gateResult?: Record<string, unknown> | null;\n restartFeedback?: string | null;\n}\n\n// Finalize the running attempt to a terminal state. The `status='running'` guard\n// makes this idempotent: a duplicate report finds the attempt already terminal\n// and updates nothing (never-downgrade for the audit row).\nexport async function finishStepAttempt(params: FinishStepAttemptParams, tx: Tx): Promise<void> {\n const rows = await tx\n .update(stepAttempts)\n .set({\n status: params.status,\n output: params.output ?? null,\n response: params.response ?? null,\n error: params.error ?? null,\n exitCode: params.exitCode ?? null,\n logOutcome: params.logOutcome,\n gateResult: params.gateResult ?? null,\n restartFeedback: params.restartFeedback ?? null,\n finishedAt: new Date(),\n })\n .where(\n and(\n eq(stepAttempts.stepId, params.stepId),\n eq(stepAttempts.attempt, params.attempt),\n eq(stepAttempts.status, 'running'),\n ),\n )\n .returning({\n stepId: stepAttempts.stepId,\n attempt: stepAttempts.attempt,\n logOutcome: stepAttempts.logOutcome,\n });\n\n const row = rows[0];\n if (!row) return;\n\n await writeStepAttemptTerminatedOutbox(tx, {\n stepId: row.stepId,\n attempt: row.attempt,\n logOutcome: row.logOutcome ?? params.logOutcome,\n });\n}\n\nexport interface RewindStepsToPendingParams {\n jobExecutionId: string;\n fromPosition: number;\n}\n\n// Restart-only: rewind every step at or after `fromPosition` back to pending,\n// clearing its result and bumping both `version` and `current_attempt` so the next\n// dispatch opens a fresh attempt. This DELIBERATELY bypasses the never-downgrade\n// guard used everywhere else. It is the one place that resurrects terminal steps,\n// so it must only be called from the durable-restart path, never the ordinary\n// report path. It must run in the same transaction as the failed-attempt write.\nexport async function rewindStepsToPending(\n params: RewindStepsToPendingParams,\n tx: Tx,\n): Promise<void> {\n await tx\n .update(steps)\n .set({\n status: 'pending',\n statusReason: null,\n error: null,\n version: sql`${steps.version} + 1`,\n currentAttempt: sql`${steps.currentAttempt} + 1`,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.jobExecutionId, params.jobExecutionId),\n gte(steps.position, params.fromPosition),\n ),\n );\n}\n\n// Count a single step's own attempts. Used to bound the restart cap on the\n// gating step's actual executions: `steps.current_attempt` can't be used for\n// the cap because a rewind also bumps it for downstream steps swept into the\n// rewind range (which would inflate a later gate's cap in a multi-gate job).\nexport async function countStepAttempts(stepId: string, tx: Tx): Promise<number> {\n const rows = await tx\n .select({total: count()})\n .from(stepAttempts)\n .where(eq(stepAttempts.stepId, stepId));\n return Number(rows[0]?.total ?? 0);\n}\n\nexport async function getStepAttempts(jobId: string): Promise<StepAttempt[]> {\n const rows = await db()\n .select({stepAttempt: stepAttempts})\n .from(stepAttempts)\n .innerJoin(steps, eq(stepAttempts.stepId, steps.id))\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(eq(jobExecutions.jobId, jobId))\n .orderBy(asc(stepAttempts.executionOrder));\n return rows.map((row) => toStepAttempt(row.stepAttempt));\n}\n\nexport async function getStepAttemptsByJobIds(jobIds: string[]): Promise<StepAttempt[]> {\n if (jobIds.length === 0) return [];\n const rows = await db()\n .select({stepAttempt: stepAttempts, jobId: jobExecutions.jobId})\n .from(stepAttempts)\n .innerJoin(steps, eq(stepAttempts.stepId, steps.id))\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(inArray(jobExecutions.jobId, jobIds))\n .orderBy(asc(jobExecutions.jobId), asc(stepAttempts.executionOrder));\n return rows.map((row) => toStepAttempt(row.stepAttempt));\n}\n\nexport interface ApplyStepResultParams {\n jobExecutionId: string;\n stepId: string;\n status: 'succeeded' | 'failed';\n error: Record<string, unknown> | null;\n}\n\nexport async function applyStepResult(params: ApplyStepResultParams, tx: Tx): Promise<void> {\n await tx\n .update(steps)\n .set({\n status: params.status,\n statusReason: null,\n error: params.error ?? null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n );\n}\n\nexport interface CancelRemainingStepsParams {\n jobExecutionId: string;\n}\n\nexport async function cancelRemainingSteps(\n params: CancelRemainingStepsParams,\n tx: Tx,\n): Promise<void> {\n await bulkUpdateStepStatuses({jobExecutionId: params.jobExecutionId, status: 'cancelled'}, tx);\n}\n"],"names":["and","asc","count","eq","gte","inArray","sql","deriveCompletion","isTerminal","db","jobExecutions","stepAttempts","toStepAttempt","steps","toStep","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","NON_TERMINAL_STEP_STATUS_FILTER","getStepByIdForJobExecution","params","rows","select","from","where","id","stepId","jobExecutionId","limit","row","undefined","getStepById","getStepsByJobId","jobId","step","innerJoin","orderBy","position","map","getStepsByJobExecutionId","bulkUpdateStepStatuses","tx","transaction","update","set","status","statusReason","updatedAt","Date","finalizedAttempts","logOutcome","finishedAt","returning","attempt","length","getStepsByJobExecutionIdForUpdate","for","getStepAttemptsByJobExecutionId","executionOrder","markStepRunning","evaluationTrace","insertRunningStepAttempt","currentAttempt","config","dispatchStepWithCompletedConfig","markStepSkipped","error","settleJobFailed","applyStepResult","failedStepId","after","every","nextExecutionOrder","insert","values","onConflictDoNothing","target","finishStepAttempt","output","response","exitCode","gateResult","restartFeedback","rewindStepsToPending","version","fromPosition","countStepAttempts","total","Number","getStepAttempts","stepAttempt","getStepAttemptsByJobIds","jobIds","cancelRemainingSteps"],"mappings":"AACA,SAAQA,GAAG,EAAEC,GAAG,EAAEC,KAAK,EAAEC,EAAE,EAAEC,GAAG,EAAEC,OAAO,EAAEC,GAAG,QAAO,cAAc;AASnE,SAAQC,gBAAgB,EAAEC,UAAU,QAAO,kDAAkD;AAC7F,SAAQC,EAAE,QAAgB,WAAW;AACrC,SAAQC,aAAa,QAAO,8BAA8B;AAC1D,SAAQC,YAAY,EAAEC,aAAa,QAAO,6BAA6B;AACvE,SAAQC,KAAK,EAAEC,MAAM,QAAO,qBAAqB;AACjD,SAAQC,0BAA0B,EAAEC,gCAAgC,QAAO,cAAc;AACzF,SAAQC,+BAA+B,QAAO,cAAc;AAE5D,OAAO,eAAeC,2BAA2BC,MAGhD;IACC,MAAMC,OAAO,MAAMX,KAChBY,MAAM,GACNC,IAAI,CAACT,OACLU,KAAK,CAACvB,IAAIG,GAAGU,MAAMW,EAAE,EAAEL,OAAOM,MAAM,GAAGtB,GAAGU,MAAMa,cAAc,EAAEP,OAAOO,cAAc,IACrFC,KAAK,CAAC;IAET,MAAMC,MAAMR,IAAI,CAAC,EAAE;IACnB,IAAI,CAACQ,KAAK,OAAOC;IACjB,OAAOf,OAAOc;AAChB;AAEA,OAAO,eAAeE,YAAYL,MAAc;IAC9C,MAAML,OAAO,MAAMX,KAAKY,MAAM,GAAGC,IAAI,CAACT,OAAOU,KAAK,CAACpB,GAAGU,MAAMW,EAAE,EAAEC,SAASE,KAAK,CAAC;IAE/E,MAAMC,MAAMR,IAAI,CAAC,EAAE;IACnB,IAAI,CAACQ,KAAK,OAAOC;IACjB,OAAOf,OAAOc;AAChB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AAG,CAAC,CAACT,MAAQhB,cAAcgB,IAAI6D,WAAW;AACxD;AAEA,OAAO,eAAeC,wBAAwBC,MAAgB;IAC5D,IAAIA,OAAOtC,MAAM,KAAK,GAAG,OAAO,EAAE;IAClC,MAAMjC,OAAO,MAAMX,KAChBY,MAAM,CAAC;QAACoE,aAAa9E;QAAcqB,OAAOtB,cAAcsB,KAAK;IAAA,GAC7DV,IAAI,CAACX,cACLuB,SAAS,CAACrB,OAAOV,GAAGQ,aAAac,MAAM,EAAEZ,MAAMW,EAAE,GACjDU,SAAS,CAACxB,eAAeP,GAAGU,MAAMa,cAAc,EAAEhB,cAAcc,EAAE,GAClED,KAAK,CAAClB,QAAQK,cAAcsB,KAAK,EAAE2D,SACnCxD,OAAO,CAAClC,IAAIS,cAAcsB,KAAK,GAAG/B,IAAIU,aAAa8C,cAAc;IACpE,OAAOrC,KAAKiB,GAAG,CAAC,CAACT,MAAQhB,cAAcgB,IAAI6D,WAAW;AACxD;AASA,OAAO,eAAetB,gBAAgBhD,MAA6B,EAAEqB,EAAM;IACzE,MAAMA,GACHE,MAAM,CAAC7B,OACP8B,GAAG,CAAC;QACHC,QAAQzB,OAAOyB,MAAM;QACrBC,cAAc;QACdoB,OAAO9C,OAAO8C,KAAK,IAAI;QACvBnB,WAAW,IAAIC;IACjB,GACCxB,KAAK,CACJvB,IACEG,GAAGU,MAAMW,EAAE,EAAEL,OAAOM,MAAM,GAC1BtB,GAAGU,MAAMa,cAAc,EAAEP,OAAOO,cAAc,GAC9CT;AAGR;AAMA,OAAO,eAAe2E,qBACpBzE,MAAkC,EAClCqB,EAAM;IAEN,MAAMD,uBAAuB;QAACb,gBAAgBP,OAAOO,cAAc;QAAEkB,QAAQ;IAAW,GAAGJ;AAC7F"}
|
|
1
|
+
{"version":3,"sources":["../../../src/db/workflow-runs/steps.ts"],"sourcesContent":["import type {LogOutcomeDto} from '@shipfox/api-workflows-dto';\nimport {and, asc, count, desc, eq, gte, inArray, sql} from 'drizzle-orm';\nimport type {\n PersistedEvaluationTraceEntry,\n Step,\n StepAttempt,\n StepAttemptStatus,\n StepStatus,\n StepStatusReason,\n} from '#core/entities/step.js';\nimport {deriveCompletion, isTerminal} from '#core/step-transition/decide-step-transition.js';\nimport {db, type Tx} from '../db.js';\nimport {jobExecutions} from '../schema/job-executions.js';\nimport {jobs} from '../schema/jobs.js';\nimport {stepAttempts, toStepAttempt} from '../schema/step-attempts.js';\nimport {steps, toStep} from '../schema/steps.js';\nimport {workflowRunAttempts} from '../schema/workflow-run-attempts.js';\nimport {workflowRuns} from '../schema/workflow-runs.js';\nimport {writeJobStepsSettledOutbox, writeStepAttemptTerminatedOutbox} from './outbox.js';\nimport {NON_TERMINAL_STEP_STATUS_FILTER} from './shared.js';\n\nexport async function getStepByIdForJobExecution(params: {\n stepId: string;\n jobExecutionId: string;\n}): Promise<Step | undefined> {\n const rows = await db()\n .select()\n .from(steps)\n .where(and(eq(steps.id, params.stepId), eq(steps.jobExecutionId, params.jobExecutionId)))\n .limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n return toStep(row);\n}\n\nexport async function getStepById(stepId: string): Promise<Step | undefined> {\n const rows = await db().select().from(steps).where(eq(steps.id, stepId)).limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n return toStep(row);\n}\n\nexport interface StepAttemptDetail {\n workflowRunId: string;\n workflowRunAttemptId: string;\n step: Step;\n attempt: StepAttempt;\n}\n\nexport interface JobExecutionFailureOrigin {\n jobExecutionId: string;\n stepId: string;\n stepName: string;\n stepStatus: StepStatus;\n stepAttempt: number;\n stepError: Record<string, unknown> | null;\n attemptStatus: StepAttemptStatus | null;\n attemptError: Record<string, unknown> | null;\n attemptExitCode: number | null;\n}\n\n/**\n * Read only the current attempt for the most relevant step. The terminal job event identifies\n * the execution, so this intentionally avoids hydrating the execution's complete attempt\n * history. If no attempt was dispatched, the first step still gives the projection a stable\n * troubleshooting origin for failures that happened before step work started.\n */\nexport async function getJobExecutionFailureOrigin(\n jobExecutionId: string,\n): Promise<JobExecutionFailureOrigin | undefined> {\n const rows = await db()\n .select({\n jobExecutionId: jobExecutions.id,\n stepId: steps.id,\n stepName: steps.name,\n stepStatus: steps.status,\n stepAttempt: steps.currentAttempt,\n stepError: steps.error,\n attemptStatus: stepAttempts.status,\n attemptError: stepAttempts.error,\n attemptExitCode: stepAttempts.exitCode,\n })\n .from(jobExecutions)\n .innerJoin(steps, eq(steps.jobExecutionId, jobExecutions.id))\n .leftJoin(\n stepAttempts,\n and(eq(stepAttempts.stepId, steps.id), eq(stepAttempts.attempt, steps.currentAttempt)),\n )\n .where(eq(jobExecutions.id, jobExecutionId))\n .orderBy(\n desc(\n sql<number>`case when ${steps.status} = 'failed' or ${stepAttempts.status} = 'failed' or ${steps.statusReason} = 'condition_errored' then 1 else 0 end`,\n ),\n asc(steps.position),\n asc(steps.id),\n )\n .limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n\n return {\n ...row,\n stepError: (row.stepError as Record<string, unknown> | null) ?? null,\n attemptError: (row.attemptError as Record<string, unknown> | null) ?? null,\n attemptStatus: row.attemptStatus === null ? null : (row.attemptStatus as StepAttemptStatus),\n attemptExitCode: row.attemptExitCode ?? null,\n };\n}\n\nexport async function getStepAttemptDetail(params: {\n stepId: string;\n attempt: number;\n}): Promise<StepAttemptDetail | undefined> {\n const rows = await db()\n .select({\n workflowRunId: workflowRuns.id,\n workflowRunAttemptId: workflowRunAttempts.id,\n step: steps,\n stepAttempt: stepAttempts,\n })\n .from(stepAttempts)\n .innerJoin(steps, eq(stepAttempts.stepId, steps.id))\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .innerJoin(jobs, eq(jobExecutions.jobId, jobs.id))\n .innerJoin(workflowRunAttempts, eq(jobs.workflowRunAttemptId, workflowRunAttempts.id))\n .innerJoin(workflowRuns, eq(workflowRunAttempts.workflowRunId, workflowRuns.id))\n .where(and(eq(stepAttempts.stepId, params.stepId), eq(stepAttempts.attempt, params.attempt)))\n .limit(1);\n\n const row = rows[0];\n if (!row) return undefined;\n\n return {\n workflowRunId: row.workflowRunId,\n workflowRunAttemptId: row.workflowRunAttemptId,\n step: toStep(row.step),\n attempt: toStepAttempt(row.stepAttempt),\n };\n}\n\nexport async function getStepsByJobId(jobId: string): Promise<Step[]> {\n const rows = await db()\n .select({step: steps})\n .from(steps)\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(eq(jobExecutions.jobId, jobId))\n .orderBy(asc(steps.position));\n return rows.map((row) => toStep(row.step));\n}\n\nexport async function getStepsByJobExecutionId(jobExecutionId: string): Promise<Step[]> {\n const rows = await db()\n .select()\n .from(steps)\n .where(eq(steps.jobExecutionId, jobExecutionId))\n .orderBy(asc(steps.position));\n return rows.map(toStep);\n}\n\nexport interface BulkUpdateStepStatusesParams {\n jobExecutionId: string;\n status: Extract<StepStatus, 'failed' | 'cancelled'>;\n}\n\nexport async function bulkUpdateStepStatuses(\n params: BulkUpdateStepStatusesParams,\n tx?: Tx,\n): Promise<void> {\n if (!tx) {\n await db().transaction((transaction) => bulkUpdateStepStatuses(params, transaction));\n return;\n }\n\n await tx\n .update(steps)\n .set({\n status: params.status,\n statusReason: null,\n updatedAt: new Date(),\n })\n .where(and(eq(steps.jobExecutionId, params.jobExecutionId), NON_TERMINAL_STEP_STATUS_FILTER));\n\n // Finalize open attempt rows so a timed-out/cancelled sweep does not leave\n // phantom in-flight work for gate and restart logic.\n const finalizedAttempts = await tx\n .update(stepAttempts)\n .set({status: params.status, logOutcome: 'abandoned', finishedAt: new Date()})\n .from(steps)\n .where(\n and(\n eq(stepAttempts.stepId, steps.id),\n eq(steps.jobExecutionId, params.jobExecutionId),\n eq(stepAttempts.status, 'running'),\n ),\n )\n .returning({\n stepId: stepAttempts.stepId,\n attempt: stepAttempts.attempt,\n logOutcome: stepAttempts.logOutcome,\n });\n\n if (finalizedAttempts.length > 0) {\n for (const attempt of finalizedAttempts) {\n await writeStepAttemptTerminatedOutbox(tx, {\n stepId: attempt.stepId,\n attempt: attempt.attempt,\n status: params.status,\n logOutcome: attempt.logOutcome ?? 'abandoned',\n });\n }\n }\n}\n\n// Per-step progression primitives. They take a mandatory `tx` because they only\n// run inside the job-execution service's transaction, and every write guards on\n// the never-downgrade predicate so a late or duplicate write cannot overwrite an\n// already-terminal row.\n\nexport async function getStepsByJobExecutionIdForUpdate(\n jobExecutionId: string,\n tx: Tx,\n): Promise<Step[]> {\n const rows = await tx\n .select()\n .from(steps)\n .where(eq(steps.jobExecutionId, jobExecutionId))\n .orderBy(asc(steps.position))\n .for('update');\n return rows.map(toStep);\n}\n\nexport async function getStepAttemptsByJobExecutionId(\n jobExecutionId: string,\n tx: Tx,\n): Promise<StepAttempt[]> {\n const rows = await tx\n .select()\n .from(stepAttempts)\n .where(eq(stepAttempts.jobExecutionId, jobExecutionId))\n .orderBy(asc(stepAttempts.executionOrder), asc(stepAttempts.id));\n return rows.map(toStepAttempt);\n}\n\nexport interface MarkStepRunningParams {\n jobExecutionId: string;\n stepId: string;\n}\n\nexport async function markStepRunning(params: MarkStepRunningParams, tx: Tx): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'running',\n statusReason: null,\n evaluationTrace: null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n )\n .returning();\n const row = rows[0];\n if (!row) return null;\n const step = toStep(row);\n // Open the attempt this dispatch runs. onConflictDoNothing makes a racing\n // re-dispatch a no-op against the unique (step_id, attempt) anchor; normal\n // re-delivery returns the already-running step without calling this.\n await insertRunningStepAttempt(\n {\n jobExecutionId: step.jobExecutionId,\n stepId: step.id,\n attempt: step.currentAttempt,\n config: step.config,\n },\n tx,\n );\n return step;\n}\n\nexport interface DispatchStepWithCompletedConfigParams {\n jobExecutionId: string;\n stepId: string;\n config: Record<string, unknown>;\n evaluationTrace: readonly PersistedEvaluationTraceEntry[] | null;\n}\n\nexport async function dispatchStepWithCompletedConfig(\n params: DispatchStepWithCompletedConfigParams,\n tx: Tx,\n): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'running',\n statusReason: null,\n evaluationTrace: null,\n config: params.config,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n )\n .returning();\n const row = rows[0];\n if (!row) return null;\n const step = toStep(row);\n await insertRunningStepAttempt(\n {\n jobExecutionId: step.jobExecutionId,\n stepId: step.id,\n attempt: step.currentAttempt,\n config: params.config,\n evaluationTrace: params.evaluationTrace,\n },\n tx,\n );\n return step;\n}\n\nexport interface MarkStepSkippedParams {\n jobExecutionId: string;\n stepId: string;\n statusReason: StepStatusReason;\n evaluationTrace: readonly PersistedEvaluationTraceEntry[];\n}\n\nexport async function markStepSkipped(params: MarkStepSkippedParams, tx: Tx): Promise<Step | null> {\n const rows = await tx\n .update(steps)\n .set({\n status: 'skipped',\n statusReason: params.statusReason,\n evaluationTrace: params.evaluationTrace,\n error: null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n eq(steps.status, 'pending'),\n ),\n )\n .returning();\n const row = rows[0];\n return row ? toStep(row) : null;\n}\n\nexport async function settleJobFailed(\n tx: Tx,\n params: {\n jobId: string;\n jobExecutionId: string;\n failedStepId: string;\n error: Record<string, unknown>;\n },\n): Promise<'succeeded' | 'failed' | null> {\n await applyStepResult(\n {\n jobExecutionId: params.jobExecutionId,\n stepId: params.failedStepId,\n status: 'failed',\n error: params.error,\n },\n tx,\n );\n\n const after = await getStepsByJobExecutionIdForUpdate(params.jobExecutionId, tx);\n if (!after.every((step) => isTerminal(step.status))) return null;\n\n const status = deriveCompletion(after);\n await writeJobStepsSettledOutbox(tx, {\n jobId: params.jobId,\n jobExecutionId: params.jobExecutionId,\n status,\n });\n return status;\n}\n\nexport interface InsertRunningStepAttemptParams {\n jobExecutionId: string;\n stepId: string;\n attempt: number;\n config?: Record<string, unknown> | null;\n evaluationTrace?: readonly PersistedEvaluationTraceEntry[] | null;\n}\n\nexport async function insertRunningStepAttempt(\n params: InsertRunningStepAttemptParams,\n tx: Tx,\n): Promise<void> {\n const [{nextExecutionOrder} = {nextExecutionOrder: 1}] = await tx\n .select({\n nextExecutionOrder: sql<number>`coalesce(max(${stepAttempts.executionOrder}), 0) + 1`,\n })\n .from(stepAttempts)\n .where(eq(stepAttempts.jobExecutionId, params.jobExecutionId));\n\n await tx\n .insert(stepAttempts)\n .values({\n jobExecutionId: params.jobExecutionId,\n stepId: params.stepId,\n attempt: params.attempt,\n executionOrder: nextExecutionOrder,\n status: 'running',\n config: params.config ?? null,\n evaluationTrace: params.evaluationTrace ?? null,\n })\n .onConflictDoNothing({target: [stepAttempts.stepId, stepAttempts.attempt]});\n}\n\nexport interface FinishStepAttemptParams {\n stepId: string;\n attempt: number;\n status: Exclude<StepAttemptStatus, 'running'>;\n error?: Record<string, unknown> | null;\n output?: Record<string, unknown> | null;\n response?: string | null;\n exitCode?: number | null;\n logOutcome: LogOutcomeDto;\n gateResult?: Record<string, unknown> | null;\n restartFeedback?: string | null;\n}\n\n// Finalize the running attempt to a terminal state. The `status='running'` guard\n// makes this idempotent: a duplicate report finds the attempt already terminal\n// and updates nothing (never-downgrade for the audit row).\nexport async function finishStepAttempt(params: FinishStepAttemptParams, tx: Tx): Promise<void> {\n const rows = await tx\n .update(stepAttempts)\n .set({\n status: params.status,\n output: params.output ?? null,\n response: params.response ?? null,\n error: params.error ?? null,\n exitCode: params.exitCode ?? null,\n logOutcome: params.logOutcome,\n gateResult: params.gateResult ?? null,\n restartFeedback: params.restartFeedback ?? null,\n finishedAt: new Date(),\n })\n .where(\n and(\n eq(stepAttempts.stepId, params.stepId),\n eq(stepAttempts.attempt, params.attempt),\n eq(stepAttempts.status, 'running'),\n ),\n )\n .returning({\n stepId: stepAttempts.stepId,\n attempt: stepAttempts.attempt,\n logOutcome: stepAttempts.logOutcome,\n });\n\n const row = rows[0];\n if (!row) return;\n\n await writeStepAttemptTerminatedOutbox(tx, {\n stepId: row.stepId,\n attempt: row.attempt,\n status: params.status,\n logOutcome: row.logOutcome ?? params.logOutcome,\n });\n}\n\nexport interface RewindStepsToPendingParams {\n jobExecutionId: string;\n fromPosition: number;\n}\n\n// Restart-only: rewind every step at or after `fromPosition` back to pending,\n// clearing its result and bumping both `version` and `current_attempt` so the next\n// dispatch opens a fresh attempt. This DELIBERATELY bypasses the never-downgrade\n// guard used everywhere else. It is the one place that resurrects terminal steps,\n// so it must only be called from the durable-restart path, never the ordinary\n// report path. It must run in the same transaction as the failed-attempt write.\nexport async function rewindStepsToPending(\n params: RewindStepsToPendingParams,\n tx: Tx,\n): Promise<void> {\n await tx\n .update(steps)\n .set({\n status: 'pending',\n statusReason: null,\n error: null,\n version: sql`${steps.version} + 1`,\n currentAttempt: sql`${steps.currentAttempt} + 1`,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.jobExecutionId, params.jobExecutionId),\n gte(steps.position, params.fromPosition),\n ),\n );\n}\n\n// Count a single step's own attempts. Used to bound the restart cap on the\n// gating step's actual executions: `steps.current_attempt` can't be used for\n// the cap because a rewind also bumps it for downstream steps swept into the\n// rewind range (which would inflate a later gate's cap in a multi-gate job).\nexport async function countStepAttempts(stepId: string, tx: Tx): Promise<number> {\n const rows = await tx\n .select({total: count()})\n .from(stepAttempts)\n .where(eq(stepAttempts.stepId, stepId));\n return Number(rows[0]?.total ?? 0);\n}\n\nexport async function getStepAttempts(jobId: string): Promise<StepAttempt[]> {\n const rows = await db()\n .select({stepAttempt: stepAttempts})\n .from(stepAttempts)\n .innerJoin(steps, eq(stepAttempts.stepId, steps.id))\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(eq(jobExecutions.jobId, jobId))\n .orderBy(asc(stepAttempts.executionOrder));\n return rows.map((row) => toStepAttempt(row.stepAttempt));\n}\n\nexport async function getStepAttemptsByJobIds(jobIds: string[]): Promise<StepAttempt[]> {\n if (jobIds.length === 0) return [];\n const rows = await db()\n .select({stepAttempt: stepAttempts, jobId: jobExecutions.jobId})\n .from(stepAttempts)\n .innerJoin(steps, eq(stepAttempts.stepId, steps.id))\n .innerJoin(jobExecutions, eq(steps.jobExecutionId, jobExecutions.id))\n .where(inArray(jobExecutions.jobId, jobIds))\n .orderBy(asc(jobExecutions.jobId), asc(stepAttempts.executionOrder));\n return rows.map((row) => toStepAttempt(row.stepAttempt));\n}\n\nexport interface ApplyStepResultParams {\n jobExecutionId: string;\n stepId: string;\n status: 'succeeded' | 'failed';\n error: Record<string, unknown> | null;\n}\n\nexport async function applyStepResult(params: ApplyStepResultParams, tx: Tx): Promise<void> {\n await tx\n .update(steps)\n .set({\n status: params.status,\n statusReason: null,\n error: params.error ?? null,\n updatedAt: new Date(),\n })\n .where(\n and(\n eq(steps.id, params.stepId),\n eq(steps.jobExecutionId, params.jobExecutionId),\n NON_TERMINAL_STEP_STATUS_FILTER,\n ),\n );\n}\n\nexport interface CancelRemainingStepsParams {\n jobExecutionId: string;\n}\n\nexport async function cancelRemainingSteps(\n params: CancelRemainingStepsParams,\n tx: Tx,\n): Promise<void> {\n await bulkUpdateStepStatuses({jobExecutionId: params.jobExecutionId, status: 'cancelled'}, tx);\n}\n"],"names":["and","asc","count","desc","eq","gte","inArray","sql","deriveCompletion","isTerminal","db","jobExecutions","jobs","stepAttempts","toStepAttempt","steps","toStep","workflowRunAttempts","workflowRuns","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","NON_TERMINAL_STEP_STATUS_FILTER","getStepByIdForJobExecution","params","rows","select","from","where","id","stepId","jobExecutionId","limit","row","undefined","getStepById","getJobExecutionFailureOrigin","stepName","name","stepStatus","status","stepAttempt","currentAttempt","stepError","error","attemptStatus","attemptError","attemptExitCode","exitCode","innerJoin","leftJoin","attempt","orderBy","statusReason","position","getStepAttemptDetail","workflowRunId","workflowRunAttemptId","step","jobId","getStepsByJobId","map","getStepsByJobExecutionId","bulkUpdateStepStatuses","tx","transaction","update","set","updatedAt","Date","finalizedAttempts","logOutcome","finishedAt","returning","length","getStepsByJobExecutionIdForUpdate","for","getStepAttemptsByJobExecutionId","executionOrder","markStepRunning","evaluationTrace","insertRunningStepAttempt","config","dispatchStepWithCompletedConfig","markStepSkipped","settleJobFailed","applyStepResult","failedStepId","after","every","nextExecutionOrder","insert","values","onConflictDoNothing","target","finishStepAttempt","output","response","gateResult","restartFeedback","rewindStepsToPending","version","fromPosition","countStepAttempts","total","Number","getStepAttempts","getStepAttemptsByJobIds","jobIds","cancelRemainingSteps"],"mappings":"AACA,SAAQA,GAAG,EAAEC,GAAG,EAAEC,KAAK,EAAEC,IAAI,EAAEC,EAAE,EAAEC,GAAG,EAAEC,OAAO,EAAEC,GAAG,QAAO,cAAc;AASzE,SAAQC,gBAAgB,EAAEC,UAAU,QAAO,kDAAkD;AAC7F,SAAQC,EAAE,QAAgB,WAAW;AACrC,SAAQC,aAAa,QAAO,8BAA8B;AAC1D,SAAQC,IAAI,QAAO,oBAAoB;AACvC,SAAQC,YAAY,EAAEC,aAAa,QAAO,6BAA6B;AACvE,SAAQC,KAAK,EAAEC,MAAM,QAAO,qBAAqB;AACjD,SAAQC,mBAAmB,QAAO,qCAAqC;AACvE,SAAQC,YAAY,QAAO,6BAA6B;AACxD,SAAQC,0BAA0B,EAAEC,gCAAgC,QAAO,cAAc;AACzF,SAAQC,+BAA+B,QAAO,cAAc;AAE5D,OAAO,eAAeC,2BAA2BC,MAGhD;IACC,MAAMC,OAAO,MAAMd,KAChBe,MAAM,GACNC,IAAI,CAACX,OACLY,KAAK,CAAC3B,IAAII,GAAGW,MAAMa,EAAE,EAAEL,OAAOM,MAAM,GAAGzB,GAAGW,MAAMe,cAAc,EAAEP,OAAOO,cAAc,IACrFC,KAAK,CAAC;IAET,MAAMC,MAAMR,IAAI,CAA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buildWorkflowRunListConditions, getJobExecutionDetail, getLatestAttempt
|
|
|
8
8
|
export type { CancelWorkflowRunParams, CreateRerunWorkflowRunParams, CreateWorkflowRunParams, FailWorkflowRunAsTimedOutParams, UpdateWorkflowRunStatusParams, } from './workflow-runs/runs.js';
|
|
9
9
|
export { cancelWorkflowRun, createRerunWorkflowRun, createWorkflowRun, failWorkflowRunAsTimedOut, loadReferencedVariables, updateWorkflowRunStatus, } from './workflow-runs/runs.js';
|
|
10
10
|
export { getWorkflowContextForJob } from './workflow-runs/shared.js';
|
|
11
|
-
export type { ApplyStepResultParams, BulkUpdateStepStatusesParams, CancelRemainingStepsParams, DispatchStepWithCompletedConfigParams, FinishStepAttemptParams, InsertRunningStepAttemptParams, MarkStepRunningParams, MarkStepSkippedParams, RewindStepsToPendingParams, } from './workflow-runs/steps.js';
|
|
12
|
-
export { applyStepResult, bulkUpdateStepStatuses, cancelRemainingSteps, countStepAttempts, dispatchStepWithCompletedConfig, finishStepAttempt, getStepAttempts, getStepAttemptsByJobExecutionId, getStepAttemptsByJobIds, getStepById, getStepByIdForJobExecution, getStepsByJobExecutionId, getStepsByJobExecutionIdForUpdate, getStepsByJobId, insertRunningStepAttempt, markStepRunning, markStepSkipped, rewindStepsToPending, settleJobFailed, } from './workflow-runs/steps.js';
|
|
11
|
+
export type { ApplyStepResultParams, BulkUpdateStepStatusesParams, CancelRemainingStepsParams, DispatchStepWithCompletedConfigParams, FinishStepAttemptParams, InsertRunningStepAttemptParams, JobExecutionFailureOrigin, MarkStepRunningParams, MarkStepSkippedParams, RewindStepsToPendingParams, StepAttemptDetail, } from './workflow-runs/steps.js';
|
|
12
|
+
export { applyStepResult, bulkUpdateStepStatuses, cancelRemainingSteps, countStepAttempts, dispatchStepWithCompletedConfig, finishStepAttempt, getJobExecutionFailureOrigin, getStepAttemptDetail, getStepAttempts, getStepAttemptsByJobExecutionId, getStepAttemptsByJobIds, getStepById, getStepByIdForJobExecution, getStepsByJobExecutionId, getStepsByJobExecutionIdForUpdate, getStepsByJobId, insertRunningStepAttempt, markStepRunning, markStepSkipped, rewindStepsToPending, settleJobFailed, } from './workflow-runs/steps.js';
|
|
13
13
|
//# sourceMappingURL=workflow-runs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-runs.d.ts","sourceRoot":"","sources":["../../src/db/workflow-runs.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uCAAuC,EACvC,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,EACvB,sCAAsC,EACtC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,mCAAmC,EACnC,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,QAAQ,EACR,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,8BAA8B,EAC9B,UAAU,EACV,WAAW,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,iCAAiC,EACjC,eAAe,EACf,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,+BAA+B,EAC/B,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,uBAAuB,EACvB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,wBAAwB,EAAC,MAAM,2BAA2B,CAAC;AACnE,YAAY,EACV,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,qCAAqC,EACrC,uBAAuB,EACvB,8BAA8B,EAC9B,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"workflow-runs.d.ts","sourceRoot":"","sources":["../../src/db/workflow-runs.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,uCAAuC,EACvC,8BAA8B,GAC/B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,uBAAuB,EACvB,sCAAsC,EACtC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,mCAAmC,EACnC,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,QAAQ,EACR,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,8BAA8B,EAC9B,UAAU,EACV,WAAW,EACX,6BAA6B,EAC7B,sBAAsB,EACtB,iCAAiC,EACjC,eAAe,EACf,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,gCAAgC,EAChC,8BAA8B,GAC/B,MAAM,2BAA2B,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A0B,CAAC"}
|
package/dist/db/workflow-runs.js
CHANGED
|
@@ -4,6 +4,6 @@ export { writeJobStepsSettledOutbox, writeStepAttemptTerminatedOutbox, writeStep
|
|
|
4
4
|
export { buildWorkflowRunListConditions, getJobExecutionDetail, getLatestAttempt, getWorkflowJobExecutionDepth, getWorkflowRunAggregates, getWorkflowRunAttemptById, getWorkflowRunByAttemptId, getWorkflowRunById, getWorkflowRunDetail, listRunAttempts, listWorkflowRunJobSummaries, listWorkflowRuns, listWorkflowRunsByProject } from './workflow-runs/queries.js';
|
|
5
5
|
export { cancelWorkflowRun, createRerunWorkflowRun, createWorkflowRun, failWorkflowRunAsTimedOut, loadReferencedVariables, updateWorkflowRunStatus } from './workflow-runs/runs.js';
|
|
6
6
|
export { getWorkflowContextForJob } from './workflow-runs/shared.js';
|
|
7
|
-
export { applyStepResult, bulkUpdateStepStatuses, cancelRemainingSteps, countStepAttempts, dispatchStepWithCompletedConfig, finishStepAttempt, getStepAttempts, getStepAttemptsByJobExecutionId, getStepAttemptsByJobIds, getStepById, getStepByIdForJobExecution, getStepsByJobExecutionId, getStepsByJobExecutionIdForUpdate, getStepsByJobId, insertRunningStepAttempt, markStepRunning, markStepSkipped, rewindStepsToPending, settleJobFailed } from './workflow-runs/steps.js';
|
|
7
|
+
export { applyStepResult, bulkUpdateStepStatuses, cancelRemainingSteps, countStepAttempts, dispatchStepWithCompletedConfig, finishStepAttempt, getJobExecutionFailureOrigin, getStepAttemptDetail, getStepAttempts, getStepAttemptsByJobExecutionId, getStepAttemptsByJobIds, getStepById, getStepByIdForJobExecution, getStepsByJobExecutionId, getStepsByJobExecutionIdForUpdate, getStepsByJobId, insertRunningStepAttempt, markStepRunning, markStepSkipped, rewindStepsToPending, settleJobFailed } from './workflow-runs/steps.js';
|
|
8
8
|
|
|
9
9
|
//# sourceMappingURL=workflow-runs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/db/workflow-runs.ts"],"sourcesContent":["export type {\n UpdateJobExecutionStatusAtVersionParams,\n UpdateJobExecutionStatusParams,\n} from './workflow-runs/job-executions.js';\nexport {\n failJobExecutionAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobExecutionById,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getLatestJobExecutionByJobId,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n updateJobExecutionStatus,\n} from './workflow-runs/job-executions.js';\nexport type {\n EvaluateJobActivationsParams,\n EvaluateJobSuccessResult,\n JobActivationDecision,\n JobScope,\n UpdateJobStatusAtVersionParams,\n UpdateJobStatusParams,\n} from './workflow-runs/jobs.js';\nexport {\n evaluateJobActivations,\n evaluateJobSuccess,\n getDirectDependencyJobContexts,\n getJobById,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n resolveJobStatusFromJobExecutions,\n updateJobStatus,\n updateJobStatusAtVersion,\n} from './workflow-runs/jobs.js';\nexport {\n writeJobStepsSettledOutbox,\n writeStepAttemptTerminatedOutbox,\n writeStepRestartEnqueuedOutbox,\n} from './workflow-runs/outbox.js';\nexport type {\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunCursor,\n WorkflowRunFilters,\n WorkflowRunJobStatusCount,\n WorkflowRunJobSummary,\n WorkflowRunJobSummaryTarget,\n WorkflowRunJobsSummary,\n} from './workflow-runs/queries.js';\nexport {\n buildWorkflowRunListConditions,\n getJobExecutionDetail,\n getLatestAttempt,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRunJobSummaries,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n} from './workflow-runs/queries.js';\nexport type {\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n FailWorkflowRunAsTimedOutParams,\n UpdateWorkflowRunStatusParams,\n} from './workflow-runs/runs.js';\nexport {\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n failWorkflowRunAsTimedOut,\n loadReferencedVariables,\n updateWorkflowRunStatus,\n} from './workflow-runs/runs.js';\nexport {getWorkflowContextForJob} from './workflow-runs/shared.js';\nexport type {\n ApplyStepResultParams,\n BulkUpdateStepStatusesParams,\n CancelRemainingStepsParams,\n DispatchStepWithCompletedConfigParams,\n FinishStepAttemptParams,\n InsertRunningStepAttemptParams,\n MarkStepRunningParams,\n MarkStepSkippedParams,\n RewindStepsToPendingParams,\n} from './workflow-runs/steps.js';\nexport {\n applyStepResult,\n bulkUpdateStepStatuses,\n cancelRemainingSteps,\n countStepAttempts,\n dispatchStepWithCompletedConfig,\n finishStepAttempt,\n getStepAttempts,\n getStepAttemptsByJobExecutionId,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getStepsByJobId,\n insertRunningStepAttempt,\n markStepRunning,\n markStepSkipped,\n rewindStepsToPending,\n settleJobFailed,\n} from './workflow-runs/steps.js';\n"],"names":["failJobExecutionAsTimedOut","getFirstJobExecutionByJobId","getJobExecutionById","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getLatestJobExecutionByJobId","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","updateJobExecutionStatus","evaluateJobActivations","evaluateJobSuccess","getDirectDependencyJobContexts","getJobById","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","resolveJobStatusFromJobExecutions","updateJobStatus","updateJobStatusAtVersion","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","writeStepRestartEnqueuedOutbox","buildWorkflowRunListConditions","getJobExecutionDetail","getLatestAttempt","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRunJobSummaries","listWorkflowRuns","listWorkflowRunsByProject","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","failWorkflowRunAsTimedOut","loadReferencedVariables","updateWorkflowRunStatus","getWorkflowContextForJob","applyStepResult","bulkUpdateStepStatuses","cancelRemainingSteps","countStepAttempts","dispatchStepWithCompletedConfig","finishStepAttempt","getStepAttempts","getStepAttemptsByJobExecutionId","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getStepsByJobId","insertRunningStepAttempt","markStepRunning","markStepSkipped","rewindStepsToPending","settleJobFailed"],"mappings":"AAIA,SACEA,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,uBAAuB,EACvBC,sCAAsC,EACtCC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mCAAmC,EACnCC,wBAAwB,QACnB,oCAAoC;AAS3C,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,UAAU,EACVC,WAAW,EACXC,6BAA6B,EAC7BC,sBAAsB,EACtBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,QACnB,0BAA0B;AACjC,SACEC,0BAA0B,EAC1BC,gCAAgC,EAChCC,8BAA8B,QACzB,4BAA4B;AAcnC,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,eAAe,EACfC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,6BAA6B;AAQpC,SACEC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,uBAAuB,EACvBC,uBAAuB,QAClB,0BAA0B;AACjC,SAAQC,wBAAwB,QAAO,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../../src/db/workflow-runs.ts"],"sourcesContent":["export type {\n UpdateJobExecutionStatusAtVersionParams,\n UpdateJobExecutionStatusParams,\n} from './workflow-runs/job-executions.js';\nexport {\n failJobExecutionAsTimedOut,\n getFirstJobExecutionByJobId,\n getJobExecutionById,\n getJobExecutionsByJobId,\n getJobExecutionsByWorkflowRunAttemptId,\n getLatestJobExecutionByJobId,\n recordJobExecutionQueuedAt,\n recordJobExecutionStartedAt,\n resolveJobExecutionAfterLeaseExpiry,\n updateJobExecutionStatus,\n} from './workflow-runs/job-executions.js';\nexport type {\n EvaluateJobActivationsParams,\n EvaluateJobSuccessResult,\n JobActivationDecision,\n JobScope,\n UpdateJobStatusAtVersionParams,\n UpdateJobStatusParams,\n} from './workflow-runs/jobs.js';\nexport {\n evaluateJobActivations,\n evaluateJobSuccess,\n getDirectDependencyJobContexts,\n getJobById,\n getJobScope,\n getJobsByWorkflowRunAttemptId,\n getJobsByWorkflowRunId,\n resolveJobStatusFromJobExecutions,\n updateJobStatus,\n updateJobStatusAtVersion,\n} from './workflow-runs/jobs.js';\nexport {\n writeJobStepsSettledOutbox,\n writeStepAttemptTerminatedOutbox,\n writeStepRestartEnqueuedOutbox,\n} from './workflow-runs/outbox.js';\nexport type {\n ListWorkflowRunsParams,\n ListWorkflowRunsResult,\n WorkflowJobExecutionDepth,\n WorkflowJobExecutionDepthParams,\n WorkflowRunAggregates,\n WorkflowRunCursor,\n WorkflowRunFilters,\n WorkflowRunJobStatusCount,\n WorkflowRunJobSummary,\n WorkflowRunJobSummaryTarget,\n WorkflowRunJobsSummary,\n} from './workflow-runs/queries.js';\nexport {\n buildWorkflowRunListConditions,\n getJobExecutionDetail,\n getLatestAttempt,\n getWorkflowJobExecutionDepth,\n getWorkflowRunAggregates,\n getWorkflowRunAttemptById,\n getWorkflowRunByAttemptId,\n getWorkflowRunById,\n getWorkflowRunDetail,\n listRunAttempts,\n listWorkflowRunJobSummaries,\n listWorkflowRuns,\n listWorkflowRunsByProject,\n} from './workflow-runs/queries.js';\nexport type {\n CancelWorkflowRunParams,\n CreateRerunWorkflowRunParams,\n CreateWorkflowRunParams,\n FailWorkflowRunAsTimedOutParams,\n UpdateWorkflowRunStatusParams,\n} from './workflow-runs/runs.js';\nexport {\n cancelWorkflowRun,\n createRerunWorkflowRun,\n createWorkflowRun,\n failWorkflowRunAsTimedOut,\n loadReferencedVariables,\n updateWorkflowRunStatus,\n} from './workflow-runs/runs.js';\nexport {getWorkflowContextForJob} from './workflow-runs/shared.js';\nexport type {\n ApplyStepResultParams,\n BulkUpdateStepStatusesParams,\n CancelRemainingStepsParams,\n DispatchStepWithCompletedConfigParams,\n FinishStepAttemptParams,\n InsertRunningStepAttemptParams,\n JobExecutionFailureOrigin,\n MarkStepRunningParams,\n MarkStepSkippedParams,\n RewindStepsToPendingParams,\n StepAttemptDetail,\n} from './workflow-runs/steps.js';\nexport {\n applyStepResult,\n bulkUpdateStepStatuses,\n cancelRemainingSteps,\n countStepAttempts,\n dispatchStepWithCompletedConfig,\n finishStepAttempt,\n getJobExecutionFailureOrigin,\n getStepAttemptDetail,\n getStepAttempts,\n getStepAttemptsByJobExecutionId,\n getStepAttemptsByJobIds,\n getStepById,\n getStepByIdForJobExecution,\n getStepsByJobExecutionId,\n getStepsByJobExecutionIdForUpdate,\n getStepsByJobId,\n insertRunningStepAttempt,\n markStepRunning,\n markStepSkipped,\n rewindStepsToPending,\n settleJobFailed,\n} from './workflow-runs/steps.js';\n"],"names":["failJobExecutionAsTimedOut","getFirstJobExecutionByJobId","getJobExecutionById","getJobExecutionsByJobId","getJobExecutionsByWorkflowRunAttemptId","getLatestJobExecutionByJobId","recordJobExecutionQueuedAt","recordJobExecutionStartedAt","resolveJobExecutionAfterLeaseExpiry","updateJobExecutionStatus","evaluateJobActivations","evaluateJobSuccess","getDirectDependencyJobContexts","getJobById","getJobScope","getJobsByWorkflowRunAttemptId","getJobsByWorkflowRunId","resolveJobStatusFromJobExecutions","updateJobStatus","updateJobStatusAtVersion","writeJobStepsSettledOutbox","writeStepAttemptTerminatedOutbox","writeStepRestartEnqueuedOutbox","buildWorkflowRunListConditions","getJobExecutionDetail","getLatestAttempt","getWorkflowJobExecutionDepth","getWorkflowRunAggregates","getWorkflowRunAttemptById","getWorkflowRunByAttemptId","getWorkflowRunById","getWorkflowRunDetail","listRunAttempts","listWorkflowRunJobSummaries","listWorkflowRuns","listWorkflowRunsByProject","cancelWorkflowRun","createRerunWorkflowRun","createWorkflowRun","failWorkflowRunAsTimedOut","loadReferencedVariables","updateWorkflowRunStatus","getWorkflowContextForJob","applyStepResult","bulkUpdateStepStatuses","cancelRemainingSteps","countStepAttempts","dispatchStepWithCompletedConfig","finishStepAttempt","getJobExecutionFailureOrigin","getStepAttemptDetail","getStepAttempts","getStepAttemptsByJobExecutionId","getStepAttemptsByJobIds","getStepById","getStepByIdForJobExecution","getStepsByJobExecutionId","getStepsByJobExecutionIdForUpdate","getStepsByJobId","insertRunningStepAttempt","markStepRunning","markStepSkipped","rewindStepsToPending","settleJobFailed"],"mappings":"AAIA,SACEA,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mBAAmB,EACnBC,uBAAuB,EACvBC,sCAAsC,EACtCC,4BAA4B,EAC5BC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,mCAAmC,EACnCC,wBAAwB,QACnB,oCAAoC;AAS3C,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,8BAA8B,EAC9BC,UAAU,EACVC,WAAW,EACXC,6BAA6B,EAC7BC,sBAAsB,EACtBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,QACnB,0BAA0B;AACjC,SACEC,0BAA0B,EAC1BC,gCAAgC,EAChCC,8BAA8B,QACzB,4BAA4B;AAcnC,SACEC,8BAA8B,EAC9BC,qBAAqB,EACrBC,gBAAgB,EAChBC,4BAA4B,EAC5BC,wBAAwB,EACxBC,yBAAyB,EACzBC,yBAAyB,EACzBC,kBAAkB,EAClBC,oBAAoB,EACpBC,eAAe,EACfC,2BAA2B,EAC3BC,gBAAgB,EAChBC,yBAAyB,QACpB,6BAA6B;AAQpC,SACEC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,uBAAuB,EACvBC,uBAAuB,QAClB,0BAA0B;AACjC,SAAQC,wBAAwB,QAAO,4BAA4B;AAcnE,SACEC,eAAe,EACfC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,+BAA+B,EAC/BC,iBAAiB,EACjBC,4BAA4B,EAC5BC,oBAAoB,EACpBC,eAAe,EACfC,+BAA+B,EAC/BC,uBAAuB,EACvBC,WAAW,EACXC,0BAA0B,EAC1BC,wBAAwB,EACxBC,iCAAiC,EACjCC,eAAe,EACfC,wBAAwB,EACxBC,eAAe,EACfC,eAAe,EACfC,oBAAoB,EACpBC,eAAe,QACV,2BAA2B"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,uCAAuC,CAAC;AACxF,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAC,4BAA4B,EAAC,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,gDAAgD,CAAC;AAC7F,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wCAAwC,CAAC;AAOjF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AACpF,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":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