@shipfox/api-workflows 12.1.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.
Files changed (159) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +45 -0
  3. package/README.md +20 -0
  4. package/dist/config.d.ts +11 -0
  5. package/dist/config.d.ts.map +1 -0
  6. package/dist/config.js +56 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/core/entities/job.d.ts +1 -1
  9. package/dist/core/entities/job.d.ts.map +1 -1
  10. package/dist/core/entities/step.d.ts +2 -2
  11. package/dist/core/entities/step.d.ts.map +1 -1
  12. package/dist/core/errors.d.ts +18 -1
  13. package/dist/core/errors.d.ts.map +1 -1
  14. package/dist/core/errors.js +21 -2
  15. package/dist/core/errors.js.map +1 -1
  16. package/dist/core/step-config/assemble-run-context.d.ts +15 -5
  17. package/dist/core/step-config/assemble-run-context.d.ts.map +1 -1
  18. package/dist/core/step-config/assemble-run-context.js +77 -27
  19. package/dist/core/step-config/assemble-run-context.js.map +1 -1
  20. package/dist/core/step-config/fields.d.ts +5 -0
  21. package/dist/core/step-config/fields.d.ts.map +1 -1
  22. package/dist/core/step-config/fields.js +21 -3
  23. package/dist/core/step-config/fields.js.map +1 -1
  24. package/dist/core/step-config/index.d.ts +1 -1
  25. package/dist/core/step-config/index.d.ts.map +1 -1
  26. package/dist/core/step-config/index.js +1 -1
  27. package/dist/core/step-config/index.js.map +1 -1
  28. package/dist/core/step-config/job-output-limits.d.ts +11 -0
  29. package/dist/core/step-config/job-output-limits.d.ts.map +1 -0
  30. package/dist/core/step-config/job-output-limits.js +88 -0
  31. package/dist/core/step-config/job-output-limits.js.map +1 -0
  32. package/dist/core/step-config/materialize-workflow-model.d.ts +1 -1
  33. package/dist/core/step-config/materialize-workflow-model.d.ts.map +1 -1
  34. package/dist/core/step-config/materialize-workflow-model.js +47 -18
  35. package/dist/core/step-config/materialize-workflow-model.js.map +1 -1
  36. package/dist/db/db.d.ts +50 -50
  37. package/dist/db/index.d.ts +2 -2
  38. package/dist/db/index.d.ts.map +1 -1
  39. package/dist/db/index.js +1 -1
  40. package/dist/db/index.js.map +1 -1
  41. package/dist/db/job-listeners.d.ts.map +1 -1
  42. package/dist/db/job-listeners.js +6 -5
  43. package/dist/db/job-listeners.js.map +1 -1
  44. package/dist/db/schema/job-executions.d.ts +3 -3
  45. package/dist/db/schema/job-listener-events.d.ts +1 -1
  46. package/dist/db/schema/jobs.d.ts +7 -7
  47. package/dist/db/schema/outbox.d.ts +1 -1
  48. package/dist/db/schema/step-attempts.d.ts +2 -2
  49. package/dist/db/schema/steps.d.ts +5 -5
  50. package/dist/db/schema/workflow-run-attempts.d.ts +3 -3
  51. package/dist/db/schema/workflow-run-counters.d.ts +1 -1
  52. package/dist/db/schema/workflow-runs.d.ts +2 -2
  53. package/dist/db/workflow-runs/job-executions.d.ts.map +1 -1
  54. package/dist/db/workflow-runs/job-executions.js +4 -2
  55. package/dist/db/workflow-runs/job-executions.js.map +1 -1
  56. package/dist/db/workflow-runs/jobs.d.ts.map +1 -1
  57. package/dist/db/workflow-runs/jobs.js +33 -3
  58. package/dist/db/workflow-runs/jobs.js.map +1 -1
  59. package/dist/db/workflow-runs/outbox.d.ts +1 -0
  60. package/dist/db/workflow-runs/outbox.d.ts.map +1 -1
  61. package/dist/db/workflow-runs/outbox.js +1 -0
  62. package/dist/db/workflow-runs/outbox.js.map +1 -1
  63. package/dist/db/workflow-runs/steps.d.ts +28 -0
  64. package/dist/db/workflow-runs/steps.d.ts.map +1 -1
  65. package/dist/db/workflow-runs/steps.js +49 -1
  66. package/dist/db/workflow-runs/steps.js.map +1 -1
  67. package/dist/db/workflow-runs.d.ts +2 -2
  68. package/dist/db/workflow-runs.d.ts.map +1 -1
  69. package/dist/db/workflow-runs.js +1 -1
  70. package/dist/db/workflow-runs.js.map +1 -1
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +4 -2
  73. package/dist/index.js.map +1 -1
  74. package/dist/metrics/instance.d.ts +1 -0
  75. package/dist/metrics/instance.d.ts.map +1 -1
  76. package/dist/metrics/instance.js +8 -0
  77. package/dist/metrics/instance.js.map +1 -1
  78. package/dist/presentation/dto/evaluation-trace.d.ts +4 -0
  79. package/dist/presentation/dto/evaluation-trace.d.ts.map +1 -0
  80. package/dist/presentation/dto/evaluation-trace.js +39 -0
  81. package/dist/presentation/dto/evaluation-trace.js.map +1 -0
  82. package/dist/presentation/dto/index.d.ts +2 -1
  83. package/dist/presentation/dto/index.d.ts.map +1 -1
  84. package/dist/presentation/dto/index.js +2 -1
  85. package/dist/presentation/dto/index.js.map +1 -1
  86. package/dist/presentation/dto/job.d.ts.map +1 -1
  87. package/dist/presentation/dto/job.js +6 -0
  88. package/dist/presentation/dto/job.js.map +1 -1
  89. package/dist/presentation/dto/step.d.ts +2 -1
  90. package/dist/presentation/dto/step.d.ts.map +1 -1
  91. package/dist/presentation/dto/step.js +12 -0
  92. package/dist/presentation/dto/step.js.map +1 -1
  93. package/dist/presentation/index.d.ts +1 -1
  94. package/dist/presentation/index.d.ts.map +1 -1
  95. package/dist/presentation/index.js +1 -1
  96. package/dist/presentation/index.js.map +1 -1
  97. package/dist/presentation/routes/get-step-attempt-detail.d.ts +3 -0
  98. package/dist/presentation/routes/get-step-attempt-detail.d.ts.map +1 -0
  99. package/dist/presentation/routes/get-step-attempt-detail.js +38 -0
  100. package/dist/presentation/routes/get-step-attempt-detail.js.map +1 -0
  101. package/dist/presentation/routes/index.d.ts.map +1 -1
  102. package/dist/presentation/routes/index.js +2 -0
  103. package/dist/presentation/routes/index.js.map +1 -1
  104. package/dist/presentation/routes/project-access.d.ts +1 -1
  105. package/dist/presentation/subscribers/index.d.ts +1 -0
  106. package/dist/presentation/subscribers/index.d.ts.map +1 -1
  107. package/dist/presentation/subscribers/index.js +1 -0
  108. package/dist/presentation/subscribers/index.js.map +1 -1
  109. package/dist/presentation/subscribers/on-failure-annotations.d.ts +5 -0
  110. package/dist/presentation/subscribers/on-failure-annotations.d.ts.map +1 -0
  111. package/dist/presentation/subscribers/on-failure-annotations.js +160 -0
  112. package/dist/presentation/subscribers/on-failure-annotations.js.map +1 -0
  113. package/dist/temporal/activities/index.d.ts +1 -1
  114. package/dist/temporal/activities/index.d.ts.map +1 -1
  115. package/dist/temporal/activities/orchestration-activities.d.ts +1 -1
  116. package/dist/temporal/activities/orchestration-activities.d.ts.map +1 -1
  117. package/dist/temporal/workflows/test-env.d.ts +2 -2
  118. package/dist/tsconfig.test.tsbuildinfo +1 -1
  119. package/package.json +18 -16
  120. package/src/config.test.ts +85 -0
  121. package/src/config.ts +71 -0
  122. package/src/core/errors.ts +44 -2
  123. package/src/core/job-execution.test.ts +1 -0
  124. package/src/core/step-config/assemble-run-context.test.ts +232 -20
  125. package/src/core/step-config/assemble-run-context.ts +126 -28
  126. package/src/core/step-config/fields.ts +42 -3
  127. package/src/core/step-config/index.ts +2 -0
  128. package/src/core/step-config/job-output-limits.ts +130 -0
  129. package/src/core/step-config/materialize-workflow-model.catalog.test.ts +117 -0
  130. package/src/core/step-config/materialize-workflow-model.test.ts +306 -1
  131. package/src/core/step-config/materialize-workflow-model.ts +65 -18
  132. package/src/db/index.ts +4 -0
  133. package/src/db/job-listeners.ts +14 -3
  134. package/src/db/workflow-runs/job-executions.test.ts +207 -1
  135. package/src/db/workflow-runs/job-executions.ts +15 -2
  136. package/src/db/workflow-runs/job-status.test.ts +10 -3
  137. package/src/db/workflow-runs/jobs.test.ts +49 -0
  138. package/src/db/workflow-runs/jobs.ts +53 -6
  139. package/src/db/workflow-runs/outbox.ts +7 -1
  140. package/src/db/workflow-runs/run-create.test.ts +56 -0
  141. package/src/db/workflow-runs/steps.test.ts +148 -0
  142. package/src/db/workflow-runs/steps.ts +105 -1
  143. package/src/db/workflow-runs.ts +4 -0
  144. package/src/index.ts +9 -0
  145. package/src/metrics/instance.ts +10 -0
  146. package/src/presentation/dto/evaluation-trace.ts +27 -0
  147. package/src/presentation/dto/index.ts +2 -1
  148. package/src/presentation/dto/job.ts +6 -0
  149. package/src/presentation/dto/step.test.ts +96 -1
  150. package/src/presentation/dto/step.ts +17 -0
  151. package/src/presentation/index.ts +2 -0
  152. package/src/presentation/routes/get-step-attempt-detail.test.ts +159 -0
  153. package/src/presentation/routes/get-step-attempt-detail.ts +33 -0
  154. package/src/presentation/routes/index.ts +2 -0
  155. package/src/presentation/subscribers/index.ts +4 -0
  156. package/src/presentation/subscribers/on-failure-annotations.test.ts +510 -0
  157. package/src/presentation/subscribers/on-failure-annotations.ts +237 -0
  158. package/test/factories/workflow-model.ts +2 -0
  159. package/tsconfig.build.tsbuildinfo +1 -1
@@ -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;AAEA,OAAO,eAAeG,gBAAgBC,KAAa;IACjD,MAAMZ,OAA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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,CAAC,EAAE;IACnB,IAAI,CAACQ,KAAK,OAAOC;IACjB,OAAOjB,OAAOg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O,CAAClD,IAAIY,aAAagE,cAAc;IAC1C,OAAOrD,KAAKoC,GAAG,CAAC,CAAC5B,MAAQlB,cAAckB,IAAIQ,WAAW;AACxD;AAEA,OAAO,eAAekE,wBAAwBC,MAAgB;IAC5D,IAAIA,OAAOlC,MAAM,KAAK,GAAG,OAAO,EAAE;IAClC,MAAMjD,OAAO,MAAMd,KAChBe,MAAM,CAAC;QAACe,aAAa3B;QAAc6C,OAAO/C,cAAc+C,KAAK;IAAA,GAC7DhC,IAAI,CAACb,cACLmC,SAAS,CAACjC,OAAOX,GAAGS,aAAagB,MAAM,EAAEd,MAAMa,EAAE,GACjDoB,SAAS,CAACrC,eAAeP,GAAGW,MAAMe,cAAc,EAAEnB,cAAciB,EAAE,GAClED,KAAK,CAACrB,QAAQK,cAAc+C,KAAK,EAAEiD,SACnCxD,OAAO,CAAClD,IAAIU,cAAc+C,KAAK,GAAGzD,IAAIY,aAAagE,cAAc;IACpE,OAAOrD,KAAKoC,GAAG,CAAC,CAAC5B,MAAQlB,cAAckB,IAAIQ,WAAW;AACxD;AASA,OAAO,eAAe6C,gBAAgB9D,MAA6B,EAAEwC,EAAM;IACzE,MAAMA,GACHE,MAAM,CAAClD,OACPmD,GAAG,CAAC;QACH3B,QAAQhB,OAAOgB,MAAM;QACrBa,cAAc;QACdT,OAAOpB,OAAOoB,KAAK,IAAI;QACvBwB,WAAW,IAAIC;IACjB,GACCzC,KAAK,CACJ3B,IACEI,GAAGW,MAAMa,EAAE,EAAEL,OAAOM,MAAM,GAC1BzB,GAAGW,MAAMe,cAAc,EAAEP,OAAOO,cAAc,GAC9CT;AAGR;AAMA,OAAO,eAAeuF,qBACpBrF,MAAkC,EAClCwC,EAAM;IAEN,MAAMD,uBAAuB;QAAChC,gBAAgBP,OAAOO,cAAc;QAAES,QAAQ;IAAW,GAAGwB;AAC7F"}
@@ -8,6 +8,6 @@ export { 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,GAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,+BAA+B,EAC/B,iBAAiB,EACjB,eAAe,EACf,+BAA+B,EAC/B,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EACjC,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,0BAA0B,CAAC"}
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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EACf,+BAA+B,EAC/B,uBAAuB,EACvB,WAAW,EACX,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EACjC,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,0BAA0B,CAAC"}
@@ -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;AAYnE,SACEC,eAAe,EACfC,sBAAsB,EACtBC,oBAAoB,EACpBC,iBAAiB,EACjBC,+BAA+B,EAC/BC,iBAAiB,EACjBC,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"}
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"}
@@ -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,oC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CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,qCAAqC,CAAC;AAO1E,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,WAAW,EACX,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,GACX,EAAE;IACD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,WAAW,EAAE,4BAA4B,CAAC;IAC1C,WAAW,EAAE,4BAA4B,CAAC;IAC1C,IAAI,EAAE,qBAAqB,CAAC;IAC5B,YAAY,EAAE,wBAAwB,CAAC;IACvC,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAClC,UAAU,EAAE,2BAA2B,CAAC;CACzC,GAAG,aAAa,CAqDhB"}
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { dirname, resolve } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { RUNNER_JOB_CLAIMED, RUNNER_JOB_LEASE_EXPIRED, RUNNER_JOB_QUEUED } from '@shipfox/api-runners-dto';
4
- import { WORKFLOWS_JOB_EVENT_DELIVERED, WORKFLOWS_JOB_STEPS_SETTLED, WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, WORKFLOWS_WORKFLOW_RUN_CANCELLED, workflowsEventSchemas } from '@shipfox/api-workflows-dto';
4
+ import { WORKFLOWS_JOB_EVENT_DELIVERED, WORKFLOWS_JOB_STEPS_SETTLED, WORKFLOWS_JOB_TERMINATED, WORKFLOWS_STEP_ATTEMPT_TERMINATED, WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, WORKFLOWS_WORKFLOW_RUN_CANCELLED, workflowsEventSchemas } from '@shipfox/api-workflows-dto';
5
5
  import { subscriberFactory } from '@shipfox/node-module';
6
6
  import { db, migrationsPath, workflowsOutbox } from '#db/index.js';
7
7
  import { registerWorkflowsServiceMetrics } from '#metrics/index.js';
8
- import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
8
+ import { createWorkflowRoutes, onJobEventDelivered, onJobStepsSettled, onJobTerminatedFailureAnnotation, onRunnerJobClaimed, onRunnerJobLeaseExpired, onRunnerJobQueued, onStepAttemptTerminatedFailureAnnotation, onWorkflowRunAttemptCreated, onWorkflowRunCancelled } from '#presentation/index.js';
9
9
  import { createWorkflowsInterModulePresentation } from '#presentation/inter-module.js';
10
10
  import { createOrchestrationActivities, WORKFLOWS_TASK_QUEUE } from '#temporal/index.js';
11
11
  export { DefinitionNotFoundError, InterpolationUnresolvableError, isPermanentRunWorkflowError, ProjectMismatchError, runWorkflow, WorkflowRunNotCancellableError } from '#core/index.js';
@@ -46,6 +46,8 @@ export function createWorkflowsModule({ agent, definitions, annotations, auth, i
46
46
  subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),
47
47
  subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),
48
48
  subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),
49
+ subscriber(WORKFLOWS_STEP_ATTEMPT_TERMINATED, onStepAttemptTerminatedFailureAnnotation(annotations)),
50
+ subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),
49
51
  subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),
50
52
  subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),
51
53
  subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n RUNNER_JOB_QUEUED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () =>\n createOrchestrationActivities({agent, integrations, projects, runners, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","RUNNER_JOB_QUEUED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,QAEZ,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,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QACDkD,aAAa;YACXnB,WAAWjC,wCAAwCc;YACnDmB,WAAWhC,kCAAkCc;YAC7CkB,WAAWnC,+BAA+BW;YAC1CwB,WAAWlC,6BAA6BW;YACxCuB,WAAWrC,0BAA0BgB;YACrCqB,WAAWpC,mBAAmBgB;YAC9BoB,WAAWtC,oBAAoBgB;SAChC;QACD0C,SAAS;YACP;gBACEC,WAAWpC;gBACXc;gBACAuB,YAAY,IACVtC,8BAA8B;wBAACkB;wBAAOI;wBAAcC;wBAAUC;wBAASC;oBAAO;gBAChFc,WAAW,EAAE;YACf;SACD;QACDC,0BAA0B;YACxBzC,uCAAuC;gBACrCmB;gBACAC;gBACAG;gBACAC;gBACAC;gBACAC;gBACAC;YACF;SACD;IACH;AACF"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {AnnotationsInterModuleClient} from '@shipfox/annotations-dto/inter-module';\nimport type {AgentInterModuleClient} from '@shipfox/api-agent-dto/inter-module';\nimport type {AuthInterModuleClient} from '@shipfox/api-auth-dto/inter-module';\nimport type {DefinitionsInterModuleClient} from '@shipfox/api-definitions-dto/inter-module';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto/inter-module';\nimport type {ProjectsModuleClient} from '@shipfox/api-projects-dto/inter-module';\nimport {\n RUNNER_JOB_CLAIMED,\n RUNNER_JOB_LEASE_EXPIRED,\n RUNNER_JOB_QUEUED,\n type RunnersEventMap,\n} from '@shipfox/api-runners-dto';\nimport type {RunnersInterModuleClient} from '@shipfox/api-runners-dto/inter-module';\nimport type {SecretsInterModuleClient} from '@shipfox/api-secrets-dto/inter-module';\nimport {\n WORKFLOWS_JOB_EVENT_DELIVERED,\n WORKFLOWS_JOB_STEPS_SETTLED,\n WORKFLOWS_JOB_TERMINATED,\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED,\n WORKFLOWS_WORKFLOW_RUN_CANCELLED,\n type WorkflowsEventMapDto,\n workflowsEventSchemas,\n} from '@shipfox/api-workflows-dto';\nimport type {WorkspacesInterModuleClient} from '@shipfox/api-workspaces-dto/inter-module';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, workflowsOutbox} from '#db/index.js';\nimport {registerWorkflowsServiceMetrics} from '#metrics/index.js';\nimport {\n createWorkflowRoutes,\n onJobEventDelivered,\n onJobStepsSettled,\n onJobTerminatedFailureAnnotation,\n onRunnerJobClaimed,\n onRunnerJobLeaseExpired,\n onRunnerJobQueued,\n onStepAttemptTerminatedFailureAnnotation,\n onWorkflowRunAttemptCreated,\n onWorkflowRunCancelled,\n} from '#presentation/index.js';\nimport {createWorkflowsInterModulePresentation} from '#presentation/inter-module.js';\nimport {createOrchestrationActivities, WORKFLOWS_TASK_QUEUE} from '#temporal/index.js';\n\nexport type {\n Job,\n JobListenerEvent,\n JobListenerEventDisposition,\n RunWorkflowParams,\n Step,\n TriggerPayload,\n WorkflowRun,\n WorkflowSourceSnapshot,\n} from '#core/index.js';\nexport {\n DefinitionNotFoundError,\n InterpolationUnresolvableError,\n isPermanentRunWorkflowError,\n ProjectMismatchError,\n runWorkflow,\n WorkflowRunNotCancellableError,\n} from '#core/index.js';\nexport {\n closeDb,\n type DeliverEventToListenerParams,\n type DeliverEventToListenerResult,\n db,\n deliverEventToListener,\n getStepById,\n getStepByIdForJobExecution,\n migrationsPath,\n workflowsOutbox,\n} from '#db/index.js';\nexport {loadRunningLeasedStep} from '#presentation/routes/leased-step.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst workflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<WorkflowsEventMapDto & RunnersEventMap>();\n\nexport function createWorkflowsModule({\n agent,\n definitions,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n}: {\n agent: AgentInterModuleClient;\n definitions: DefinitionsInterModuleClient;\n annotations: AnnotationsInterModuleClient;\n auth: AuthInterModuleClient;\n integrations: IntegrationsModuleClient;\n projects: ProjectsModuleClient;\n runners: RunnersInterModuleClient;\n secrets: SecretsInterModuleClient;\n workspaces: WorkspacesInterModuleClient;\n}): ShipfoxModule {\n return {\n name: 'workflows',\n database: {db, migrationsPath, databaseNamespace: 'workflows'},\n routes: createWorkflowRoutes({\n agent,\n annotations,\n auth,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n metrics: registerWorkflowsServiceMetrics,\n publishers: [\n {name: 'workflows', table: workflowsOutbox, db, eventSchemas: workflowsEventSchemas},\n ],\n subscribers: [\n subscriber(WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED, onWorkflowRunAttemptCreated),\n subscriber(WORKFLOWS_WORKFLOW_RUN_CANCELLED, onWorkflowRunCancelled),\n subscriber(WORKFLOWS_JOB_EVENT_DELIVERED, onJobEventDelivered),\n subscriber(WORKFLOWS_JOB_STEPS_SETTLED, onJobStepsSettled),\n subscriber(\n WORKFLOWS_STEP_ATTEMPT_TERMINATED,\n onStepAttemptTerminatedFailureAnnotation(annotations),\n ),\n subscriber(WORKFLOWS_JOB_TERMINATED, onJobTerminatedFailureAnnotation(annotations)),\n subscriber(RUNNER_JOB_LEASE_EXPIRED, onRunnerJobLeaseExpired),\n subscriber(RUNNER_JOB_QUEUED, onRunnerJobQueued),\n subscriber(RUNNER_JOB_CLAIMED, onRunnerJobClaimed),\n ],\n workers: [\n {\n taskQueue: WORKFLOWS_TASK_QUEUE,\n workflowsPath,\n activities: () =>\n createOrchestrationActivities({agent, integrations, projects, runners, secrets}),\n workflows: [],\n },\n ],\n interModulePresentations: [\n createWorkflowsInterModulePresentation({\n agent,\n definitions,\n integrations,\n projects,\n runners,\n secrets,\n workspaces,\n }),\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","RUNNER_JOB_CLAIMED","RUNNER_JOB_LEASE_EXPIRED","RUNNER_JOB_QUEUED","WORKFLOWS_JOB_EVENT_DELIVERED","WORKFLOWS_JOB_STEPS_SETTLED","WORKFLOWS_JOB_TERMINATED","WORKFLOWS_STEP_ATTEMPT_TERMINATED","WORKFLOWS_WORKFLOW_RUN_ATTEMPT_CREATED","WORKFLOWS_WORKFLOW_RUN_CANCELLED","workflowsEventSchemas","subscriberFactory","db","migrationsPath","workflowsOutbox","registerWorkflowsServiceMetrics","createWorkflowRoutes","onJobEventDelivered","onJobStepsSettled","onJobTerminatedFailureAnnotation","onRunnerJobClaimed","onRunnerJobLeaseExpired","onRunnerJobQueued","onStepAttemptTerminatedFailureAnnotation","onWorkflowRunAttemptCreated","onWorkflowRunCancelled","createWorkflowsInterModulePresentation","createOrchestrationActivities","WORKFLOWS_TASK_QUEUE","DefinitionNotFoundError","InterpolationUnresolvableError","isPermanentRunWorkflowError","ProjectMismatchError","runWorkflow","WorkflowRunNotCancellableError","closeDb","deliverEventToListener","getStepById","getStepByIdForJobExecution","loadRunningLeasedStep","packageRoot","url","workflowsPath","subscriber","createWorkflowsModule","agent","definitions","annotations","auth","integrations","projects","runners","secrets","workspaces","name","database","databaseNamespace","routes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","activities","workflows","interModulePresentations"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAOvC,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,iBAAiB,QAEZ,2BAA2B;AAGlC,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,wBAAwB,EACxBC,iCAAiC,EACjCC,sCAAsC,EACtCC,gCAAgC,EAEhCC,qBAAqB,QAChB,6BAA6B;AAEpC,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,eAAe,QAAO,eAAe;AACjE,SAAQC,+BAA+B,QAAO,oBAAoB;AAClE,SACEC,oBAAoB,EACpBC,mBAAm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WAAWzC,0BAA0BmB;YACrCsB,WAAWxC,mBAAmBmB;YAC9BqB,WAAW1C,oBAAoBmB;SAChC;QACD2C,SAAS;YACP;gBACEC,WAAWpC;gBACXc;gBACAuB,YAAY,IACVtC,8BAA8B;wBAACkB;wBAAOI;wBAAcC;wBAAUC;wBAASC;oBAAO;gBAChFc,WAAW,EAAE;YACf;SACD;QACDC,0BAA0B;YACxBzC,uCAAuC;gBACrCmB;gBACAC;gBACAG;gBACAC;gBACAC;gBACAC;gBACAC;YACF;SACD;IACH;AACF"}
@@ -18,4 +18,5 @@ export declare function recordWorkflowListenerExecution(outcome: 'succeeded' | '
18
18
  export declare function recordWorkflowListenerResolved(reason: ResolutionReason): void;
19
19
  export declare function recordListenerEventsCoalesced(batchSize: number): void;
20
20
  export declare function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void;
21
+ export declare function recordWorkflowFailureAnnotationFailed(reason: 'lookup' | 'budget' | 'write'): void;
21
22
  //# sourceMappingURL=instance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/metrics/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,0CAA0C,CAAC;AAkGtF,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,EACjD,KAAK,EAAE,eAAe,GAAG,kBAAkB,GAAG,aAAa,GAAG,cAAc,GAC3E,IAAI,CAEN;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,iBAAiB,GA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ener_resolved',
45
45
  const agentToolWarningFailedCount = meter.createCounter('workflows_agent_tool_warning_failed', {
46
46
  description: 'Agent tool capability warning failures by bounded reason'
47
47
  });
48
+ const failureAnnotationFailedCount = meter.createCounter('workflows_failure_annotation_failed', {
49
+ description: 'Failure annotation projection failures by bounded reason'
50
+ });
48
51
  const listenerEventsCoalesced = meter.createHistogram('workflows_listener_events_coalesced', {
49
52
  description: 'Listener firing batch sizes',
50
53
  unit: '1',
@@ -132,5 +135,10 @@ export function recordWorkflowAgentToolWarningFailed(reason) {
132
135
  reason
133
136
  });
134
137
  }
138
+ export function recordWorkflowFailureAnnotationFailed(reason) {
139
+ failureAnnotationFailedCount.add(1, {
140
+ reason
141
+ });
142
+ }
135
143
 
136
144
  //# sourceMappingURL=instance.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/metrics/instance.ts"],"sourcesContent":["import {instanceMetrics} from '@shipfox/node-opentelemetry';\nimport type {JobStatus, ResolutionReason} from '#core/entities/job.js';\nimport type {JobExecutionStatus} from '#core/entities/job-execution.js';\nimport type {WorkflowRunStatus} from '#core/entities/workflow-run.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\n\nconst meter = instanceMetrics.getMeter('workflows');\n\nconst runCreatedCount = meter.createCounter<{provider: string}>('workflows_run_created', {\n description: 'Workflow runs created by bounded trigger provider',\n});\n\nconst displayNameResolutionDegradedCount = meter.createCounter<{\n field: 'workflow.run_name' | 'job.execution_name';\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization';\n}>('workflows_display_name_resolution_degraded', {\n description: 'Display-name resolution degradations by field and bounded cause',\n});\n\nconst runStatusChangedCount = meter.createCounter<{status: WorkflowRunStatus}>(\n 'workflows_run_status_changed',\n {description: 'Workflow run status transitions by resulting status'},\n);\n\nconst jobStatusChangedCount = meter.createCounter<{status: JobStatus}>(\n 'workflows_job_status_changed',\n {description: 'Workflow job status transitions by resulting status'},\n);\n\nconst jobExecutionStatusChangedCount = meter.createCounter<{status: JobExecutionStatus}>(\n 'workflows_job_execution_status_changed',\n {description: 'Workflow job execution status transitions by resulting status'},\n);\n\nconst jobExecutionQueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_queued',\n {\n description: 'Workflow job executions first marked as queued from runner queue events',\n },\n);\n\nconst jobExecutionStartedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_started',\n {\n description: 'Workflow job executions first marked as started from runner claim events',\n },\n);\n\nconst jobExecutionStepsSettledCount = meter.createCounter<{\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>;\n}>('workflows_job_execution_steps_settled', {\n description: 'Job execution steps-settled events enqueued by resulting completion status',\n});\n\nconst jobExecutionTimedOutCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_timed_out',\n {\n description: 'Workflow job executions failed by the execution orchestration timeout path',\n },\n);\n\nconst jobExecutionLeaseExpiryResolvedCount = meter.createCounter<{status: RuntimeCompletionStatus}>(\n 'workflows_job_execution_lease_expiry_resolved',\n {description: 'Runner lease-expiry resolutions by resulting runtime status'},\n);\n\nconst stepRestartEnqueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_step_restart_enqueued',\n {description: 'Durable step restart events enqueued after a restartable gate failure'},\n);\n\nconst listenerEventsReceivedCount = meter.createCounter<{provider: string}>(\n 'workflows_listener_events_received',\n {description: 'Listener integration events buffered by bounded trigger provider'},\n);\n\nconst listenerExecutionsCount = meter.createCounter<{\n outcome: 'succeeded' | 'failed' | 'cancelled';\n}>('workflows_listener_executions', {\n description: 'Listener job execution firings by terminal outcome',\n});\n\nconst listenerResolvedCount = meter.createCounter<{reason: ResolutionReason}>(\n 'workflows_listener_resolved',\n {description: 'Listener resolutions by bounded reason'},\n);\n\nconst agentToolWarningFailedCount = meter.createCounter<{\n reason: 'budget' | 'lookup' | 'write';\n}>('workflows_agent_tool_warning_failed', {\n description: 'Agent tool capability warning failures by bounded reason',\n});\n\nconst listenerEventsCoalesced = meter.createHistogram<Record<string, never>>(\n 'workflows_listener_events_coalesced',\n {\n description: 'Listener firing batch sizes',\n unit: '1',\n advice: {explicitBucketBoundaries: [1, 2, 5, 10, 25, 50, 100, 250]},\n },\n);\n\nexport function recordWorkflowRunCreated(provider: string): void {\n runCreatedCount.add(1, {provider});\n}\n\nexport function recordWorkflowDisplayNameResolutionDegraded(\n field: 'workflow.run_name' | 'job.execution_name',\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization',\n): void {\n displayNameResolutionDegradedCount.add(1, {field, cause});\n}\n\nexport function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void {\n runStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobStatusChanged(status: JobStatus): void {\n jobStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void {\n jobExecutionStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionQueued(): void {\n jobExecutionQueuedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStarted(): void {\n jobExecutionStartedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStepsSettled(\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>,\n): void {\n jobExecutionStepsSettledCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionTimedOut(): void {\n jobExecutionTimedOutCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionLeaseExpiryResolved(\n status: RuntimeCompletionStatus,\n): void {\n jobExecutionLeaseExpiryResolvedCount.add(1, {status});\n}\n\nexport function recordWorkflowStepRestartEnqueued(): void {\n stepRestartEnqueuedCount.add(1);\n}\n\nexport function recordListenerEventReceived(provider: string): void {\n listenerEventsReceivedCount.add(1, {provider});\n}\n\nexport function recordWorkflowListenerExecution(\n outcome: 'succeeded' | 'failed' | 'cancelled',\n): void {\n listenerExecutionsCount.add(1, {outcome});\n}\n\nexport function recordWorkflowListenerResolved(reason: ResolutionReason): void {\n listenerResolvedCount.add(1, {reason});\n}\n\nexport function recordListenerEventsCoalesced(batchSize: number): void {\n listenerEventsCoalesced.record(batchSize);\n}\n\nexport function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void {\n agentToolWarningFailedCount.add(1, {reason});\n}\n"],"names":["instanceMetrics","meter","getMeter","runCreatedCount","createCounter","description","displayNameResolutionDegradedCount","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowDisplayNameResolutionDegraded","field","cause","recordWorkflowRunStatusChanged","status","recordWorkflowJobStatusChanged","recordWorkflowJobExecutionStatusChanged","recordWorkflowJobExecutionQueued","recordWorkflowJobExecutionStarted","recordWorkflowJobExecutionStepsSettled","recordWorkflowJobExecutionTimedOut","recordWorkflowJobExecutionLeaseExpiryResolved","recordWorkflowStepRestartEnqueued","recordListenerEventReceived","recordWorkflowListenerExecution","outcome","recordWorkflowListenerResolved","reason","recordListenerEventsCoalesced","batchSize","record","recordWorkflowAgentToolWarningFailed"],"mappings":"AAAA,SAAQA,eAAe,QAAO,8BAA8B;AAM5D,MAAMC,QAAQD,gBAAgBE,QAAQ,CAAC;AAEvC,MAAMC,kBAAkBF,MAAMG,aAAa,CAAqB,yBAAyB;IACvFC,aAAa;AACf;AAEA,MAAMC,qCAAqCL,MAAMG,aAAa,CAG3D,8CAA8C;IAC/CC,aAAa;AACf;AAEA,MAAME,wBAAwBN,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMG,wBAAwBP,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMI,iCAA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MAAiB;IAC9DxB,sBAAsBmB,GAAG,CAAC,GAAG;QAACK;IAAM;AACtC;AAEA,OAAO,SAASE,wCAAwCF,MAA0B;IAChFvB,+BAA+BkB,GAAG,CAAC,GAAG;QAACK;IAAM;AAC/C;AAEA,OAAO,SAASG;IACdzB,wBAAwBiB,GAAG,CAAC;AAC9B;AAEA,OAAO,SAASS;IACdzB,yBAAyBgB,GAAG,CAAC;AAC/B;AAEA,OAAO,SAASU,uCACdL,MAAgE;IAEhEpB,8BAA8Be,GAAG,CAAC,GAAG;QAACK;IAAM;AAC9C;AAEA,OAAO,SAASM;IACdzB,0BAA0Bc,GAAG,CAAC;AAChC;AAEA,OAAO,SAASY,8CACdP,MAA+B;IAE/BlB,qCAAqCa,GAAG,CAAC,GAAG;QAACK;IAAM;AACrD;AAEA,OAAO,SAASQ;IACdzB,yBAAyBY,GAAG,CAAC;AAC/B;AAEA,OAAO,SAASc,4BAA4Bf,QAAgB;IAC1DV,4BAA4BW,GAAG,CAAC,GAAG;QAACD;IAAQ;AAC9C;AAEA,OAAO,SAASgB,gCACdC,OAA6C;IAE7C1B,wBAAwBU,GAAG,CAAC,GAAG;QAACgB;IAAO;AACzC;AAEA,OAAO,SAASC,+BAA+BC,MAAwB;IACrE3B,sBAAsBS,GAAG,CAAC,GAAG;QAACkB;IAAM;AACtC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7D3B,wBAAwB4B,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxF1B,4BAA4BQ,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC5C"}
1
+ {"version":3,"sources":["../../src/metrics/instance.ts"],"sourcesContent":["import {instanceMetrics} from '@shipfox/node-opentelemetry';\nimport type {JobStatus, ResolutionReason} from '#core/entities/job.js';\nimport type {JobExecutionStatus} from '#core/entities/job-execution.js';\nimport type {WorkflowRunStatus} from '#core/entities/workflow-run.js';\nimport type {RuntimeCompletionStatus} from '#core/workflow-scheduling/runtime-dag.js';\n\nconst meter = instanceMetrics.getMeter('workflows');\n\nconst runCreatedCount = meter.createCounter<{provider: string}>('workflows_run_created', {\n description: 'Workflow runs created by bounded trigger provider',\n});\n\nconst displayNameResolutionDegradedCount = meter.createCounter<{\n field: 'workflow.run_name' | 'job.execution_name';\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization';\n}>('workflows_display_name_resolution_degraded', {\n description: 'Display-name resolution degradations by field and bounded cause',\n});\n\nconst runStatusChangedCount = meter.createCounter<{status: WorkflowRunStatus}>(\n 'workflows_run_status_changed',\n {description: 'Workflow run status transitions by resulting status'},\n);\n\nconst jobStatusChangedCount = meter.createCounter<{status: JobStatus}>(\n 'workflows_job_status_changed',\n {description: 'Workflow job status transitions by resulting status'},\n);\n\nconst jobExecutionStatusChangedCount = meter.createCounter<{status: JobExecutionStatus}>(\n 'workflows_job_execution_status_changed',\n {description: 'Workflow job execution status transitions by resulting status'},\n);\n\nconst jobExecutionQueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_queued',\n {\n description: 'Workflow job executions first marked as queued from runner queue events',\n },\n);\n\nconst jobExecutionStartedCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_started',\n {\n description: 'Workflow job executions first marked as started from runner claim events',\n },\n);\n\nconst jobExecutionStepsSettledCount = meter.createCounter<{\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>;\n}>('workflows_job_execution_steps_settled', {\n description: 'Job execution steps-settled events enqueued by resulting completion status',\n});\n\nconst jobExecutionTimedOutCount = meter.createCounter<Record<string, never>>(\n 'workflows_job_execution_timed_out',\n {\n description: 'Workflow job executions failed by the execution orchestration timeout path',\n },\n);\n\nconst jobExecutionLeaseExpiryResolvedCount = meter.createCounter<{status: RuntimeCompletionStatus}>(\n 'workflows_job_execution_lease_expiry_resolved',\n {description: 'Runner lease-expiry resolutions by resulting runtime status'},\n);\n\nconst stepRestartEnqueuedCount = meter.createCounter<Record<string, never>>(\n 'workflows_step_restart_enqueued',\n {description: 'Durable step restart events enqueued after a restartable gate failure'},\n);\n\nconst listenerEventsReceivedCount = meter.createCounter<{provider: string}>(\n 'workflows_listener_events_received',\n {description: 'Listener integration events buffered by bounded trigger provider'},\n);\n\nconst listenerExecutionsCount = meter.createCounter<{\n outcome: 'succeeded' | 'failed' | 'cancelled';\n}>('workflows_listener_executions', {\n description: 'Listener job execution firings by terminal outcome',\n});\n\nconst listenerResolvedCount = meter.createCounter<{reason: ResolutionReason}>(\n 'workflows_listener_resolved',\n {description: 'Listener resolutions by bounded reason'},\n);\n\nconst agentToolWarningFailedCount = meter.createCounter<{\n reason: 'budget' | 'lookup' | 'write';\n}>('workflows_agent_tool_warning_failed', {\n description: 'Agent tool capability warning failures by bounded reason',\n});\n\nconst failureAnnotationFailedCount = meter.createCounter<{\n reason: 'lookup' | 'budget' | 'write';\n}>('workflows_failure_annotation_failed', {\n description: 'Failure annotation projection failures by bounded reason',\n});\n\nconst listenerEventsCoalesced = meter.createHistogram<Record<string, never>>(\n 'workflows_listener_events_coalesced',\n {\n description: 'Listener firing batch sizes',\n unit: '1',\n advice: {explicitBucketBoundaries: [1, 2, 5, 10, 25, 50, 100, 250]},\n },\n);\n\nexport function recordWorkflowRunCreated(provider: string): void {\n runCreatedCount.add(1, {provider});\n}\n\nexport function recordWorkflowDisplayNameResolutionDegraded(\n field: 'workflow.run_name' | 'job.execution_name',\n cause: 'missing_value' | 'evaluation_error' | 'empty_value' | 'sanitization',\n): void {\n displayNameResolutionDegradedCount.add(1, {field, cause});\n}\n\nexport function recordWorkflowRunStatusChanged(status: WorkflowRunStatus): void {\n runStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobStatusChanged(status: JobStatus): void {\n jobStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionStatusChanged(status: JobExecutionStatus): void {\n jobExecutionStatusChangedCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionQueued(): void {\n jobExecutionQueuedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStarted(): void {\n jobExecutionStartedCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionStepsSettled(\n status: Extract<RuntimeCompletionStatus, 'failed' | 'succeeded'>,\n): void {\n jobExecutionStepsSettledCount.add(1, {status});\n}\n\nexport function recordWorkflowJobExecutionTimedOut(): void {\n jobExecutionTimedOutCount.add(1);\n}\n\nexport function recordWorkflowJobExecutionLeaseExpiryResolved(\n status: RuntimeCompletionStatus,\n): void {\n jobExecutionLeaseExpiryResolvedCount.add(1, {status});\n}\n\nexport function recordWorkflowStepRestartEnqueued(): void {\n stepRestartEnqueuedCount.add(1);\n}\n\nexport function recordListenerEventReceived(provider: string): void {\n listenerEventsReceivedCount.add(1, {provider});\n}\n\nexport function recordWorkflowListenerExecution(\n outcome: 'succeeded' | 'failed' | 'cancelled',\n): void {\n listenerExecutionsCount.add(1, {outcome});\n}\n\nexport function recordWorkflowListenerResolved(reason: ResolutionReason): void {\n listenerResolvedCount.add(1, {reason});\n}\n\nexport function recordListenerEventsCoalesced(batchSize: number): void {\n listenerEventsCoalesced.record(batchSize);\n}\n\nexport function recordWorkflowAgentToolWarningFailed(reason: 'budget' | 'lookup' | 'write'): void {\n agentToolWarningFailedCount.add(1, {reason});\n}\n\nexport function recordWorkflowFailureAnnotationFailed(reason: 'lookup' | 'budget' | 'write'): void {\n failureAnnotationFailedCount.add(1, {reason});\n}\n"],"names":["instanceMetrics","meter","getMeter","runCreatedCount","createCounter","description","displayNameResolutionDegradedCount","runStatusChangedCount","jobStatusChangedCount","jobExecutionStatusChangedCount","jobExecutionQueuedCount","jobExecutionStartedCount","jobExecutionStepsSettledCount","jobExecutionTimedOutCount","jobExecutionLeaseExpiryResolvedCount","stepRestartEnqueuedCount","listenerEventsReceivedCount","listenerExecutionsCount","listenerResolvedCount","agentToolWarningFailedCount","failureAnnotationFailedCount","listenerEventsCoalesced","createHistogram","unit","advice","explicitBucketBoundaries","recordWorkflowRunCreated","provider","add","recordWorkflowDisplayNameResolutionDegraded","field","cause","recordWorkflowRunStatusChanged","status","recordWorkflowJobStatusChanged","recordWorkflowJobExecutionStatusChanged","recordWorkflowJobExecutionQueued","recordWorkflowJobExecutionStarted","recordWorkflowJobExecutionStepsSettled","recordWorkflowJobExecutionTimedOut","recordWorkflowJobExecutionLeaseExpiryResolved","recordWorkflowStepRestartEnqueued","recordListenerEventReceived","recordWorkflowListenerExecution","outcome","recordWorkflowListenerResolved","reason","recordListenerEventsCoalesced","batchSize","record","recordWorkflowAgentToolWarningFailed","recordWorkflowFailureAnnotationFailed"],"mappings":"AAAA,SAAQA,eAAe,QAAO,8BAA8B;AAM5D,MAAMC,QAAQD,gBAAgBE,QAAQ,CAAC;AAEvC,MAAMC,kBAAkBF,MAAMG,aAAa,CAAqB,yBAAyB;IACvFC,aAAa;AACf;AAEA,MAAMC,qCAAqCL,MAAMG,aAAa,CAG3D,8CAA8C;IAC/CC,aAAa;AACf;AAEA,MAAME,wBAAwBN,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMG,wBAAwBP,MAAMG,aAAa,CAC/C,gCACA;IAACC,aAAa;AAAqD;AAGrE,MAAMI,iCAAiCR,MAAMG,aAAa,CACxD,0CACA;IAACC,aAAa;AAA+D;AAG/E,MAAMK,0BAA0BT,MAAMG,aAAa,CACjD,kCACA;IACEC,aAAa;AACf;AAGF,MAAMM,2BAA2BV,MAAMG,aAAa,CAClD,mCACA;IACEC,aAAa;AACf;AAGF,MAAMO,gCAAgCX,MAAMG,aAAa,CAEtD,yCAAyC;IAC1CC,aAAa;AACf;AAEA,MAAMQ,4BAA4BZ,MAAMG,aAAa,CACnD,qCACA;IACEC,aAAa;AACf;AAGF,MAAMS,uCAAuCb,MAAMG,aAAa,CAC9D,iDACA;IAACC,aAAa;AAA6D;AAG7E,MAAMU,2BAA2Bd,MAAMG,aAAa,CAClD,mCACA;IAACC,aAAa;AAAuE;AAGvF,MAAMW,8BAA8Bf,MAAMG,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SAASY,8CACdP,MAA+B;IAE/BnB,qCAAqCc,GAAG,CAAC,GAAG;QAACK;IAAM;AACrD;AAEA,OAAO,SAASQ;IACd1B,yBAAyBa,GAAG,CAAC;AAC/B;AAEA,OAAO,SAASc,4BAA4Bf,QAAgB;IAC1DX,4BAA4BY,GAAG,CAAC,GAAG;QAACD;IAAQ;AAC9C;AAEA,OAAO,SAASgB,gCACdC,OAA6C;IAE7C3B,wBAAwBW,GAAG,CAAC,GAAG;QAACgB;IAAO;AACzC;AAEA,OAAO,SAASC,+BAA+BC,MAAwB;IACrE5B,sBAAsBU,GAAG,CAAC,GAAG;QAACkB;IAAM;AACtC;AAEA,OAAO,SAASC,8BAA8BC,SAAiB;IAC7D3B,wBAAwB4B,MAAM,CAACD;AACjC;AAEA,OAAO,SAASE,qCAAqCJ,MAAqC;IACxF3B,4BAA4BS,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC5C;AAEA,OAAO,SAASK,sCAAsCL,MAAqC;IACzF1B,6BAA6BQ,GAAG,CAAC,GAAG;QAACkB;IAAM;AAC7C"}
@@ -0,0 +1,4 @@
1
+ import type { EvaluationTraceDto } from '@shipfox/api-workflows-dto';
2
+ import type { PersistedEvaluationTraceEntry } from '#core/entities/step.js';
3
+ export declare function toEvaluationTraceDto(trace: readonly PersistedEvaluationTraceEntry[] | null | undefined): EvaluationTraceDto | null;
4
+ //# sourceMappingURL=evaluation-trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluation-trace.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/evaluation-trace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAA0B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,KAAK,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAE1E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,6BAA6B,EAAE,GAAG,IAAI,GAAG,SAAS,GACjE,kBAAkB,GAAG,IAAI,CAG3B"}
@@ -0,0 +1,39 @@
1
+ export function toEvaluationTraceDto(trace) {
2
+ if (trace === null || trace === undefined) return null;
3
+ return trace.map(toEvaluationTraceEntryDto);
4
+ }
5
+ function toEvaluationTraceEntryDto(entry) {
6
+ if ('dropped' in entry) return {
7
+ truncated: true,
8
+ dropped: entry.dropped
9
+ };
10
+ return {
11
+ expression: entry.expression,
12
+ roots: [
13
+ ...entry.roots
14
+ ],
15
+ fill_target: entry.fillTarget,
16
+ evaluated_at: entry.evaluatedAt,
17
+ field: entry.field,
18
+ ...entry.value === undefined ? {} : {
19
+ value: entry.value
20
+ },
21
+ ...entry.truncated === undefined ? {} : {
22
+ truncated: entry.truncated
23
+ },
24
+ ...entry.exprTruncated === undefined ? {} : {
25
+ expr_truncated: entry.exprTruncated
26
+ },
27
+ ...entry.reference === undefined ? {} : {
28
+ reference: entry.reference
29
+ },
30
+ ...entry.degraded === undefined ? {} : {
31
+ degraded: entry.degraded
32
+ },
33
+ ...entry.envKey === undefined ? {} : {
34
+ env_key: entry.envKey
35
+ }
36
+ };
37
+ }
38
+
39
+ //# sourceMappingURL=evaluation-trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/presentation/dto/evaluation-trace.ts"],"sourcesContent":["import type {EvaluationTraceDto, EvaluationTraceEntryDto} from '@shipfox/api-workflows-dto';\nimport type {PersistedEvaluationTraceEntry} from '#core/entities/step.js';\n\nexport function toEvaluationTraceDto(\n trace: readonly PersistedEvaluationTraceEntry[] | null | undefined,\n): EvaluationTraceDto | null {\n if (trace === null || trace === undefined) return null;\n return trace.map(toEvaluationTraceEntryDto);\n}\n\nfunction toEvaluationTraceEntryDto(entry: PersistedEvaluationTraceEntry): EvaluationTraceEntryDto {\n if ('dropped' in entry) return {truncated: true, dropped: entry.dropped};\n\n return {\n expression: entry.expression,\n roots: [...entry.roots],\n fill_target: entry.fillTarget,\n evaluated_at: entry.evaluatedAt,\n field: entry.field,\n ...(entry.value === undefined ? {} : {value: entry.value}),\n ...(entry.truncated === undefined ? {} : {truncated: entry.truncated}),\n ...(entry.exprTruncated === undefined ? {} : {expr_truncated: entry.exprTruncated}),\n ...(entry.reference === undefined ? {} : {reference: entry.reference}),\n ...(entry.degraded === undefined ? {} : {degraded: entry.degraded}),\n ...(entry.envKey === undefined ? {} : {env_key: entry.envKey}),\n };\n}\n"],"names":["toEvaluationTraceDto","trace","undefined","map","toEvaluationTraceEntryDto","entry","truncated","dropped","expression","roots","fill_target","fillTarget","evaluated_at","evaluatedAt","field","value","exprTruncated","expr_truncated","reference","degraded","envKey","env_key"],"mappings":"AAGA,OAAO,SAASA,qBACdC,KAAkE;IAElE,IAAIA,UAAU,QAAQA,UAAUC,WAAW,OAAO;IAClD,OAAOD,MAAME,GAAG,CAACC;AACnB;AAEA,SAASA,0BAA0BC,KAAoC;IACrE,IAAI,aAAaA,OAAO,OAAO;QAACC,WAAW;QAAMC,SAASF,MAAME,OAAO;IAAA;IAEvE,OAAO;QACLC,YAAYH,MAAMG,UAAU;QAC5BC,OAAO;eAAIJ,MAAMI,KAAK;SAAC;QACvBC,aAAaL,MAAMM,UAAU;QAC7BC,cAAcP,MAAMQ,WAAW;QAC/BC,OAAOT,MAAMS,KAAK;QAClB,GAAIT,MAAMU,KAAK,KAAKb,YAAY,CAAC,IAAI;YAACa,OAAOV,MAAMU,KAAK;QAAA,CAAC;QACzD,GAAIV,MAAMC,SAAS,KAAKJ,YAAY,CAAC,IAAI;YAACI,WAAWD,MAAMC,SAAS;QAAA,CAAC;QACrE,GAAID,MAAMW,aAAa,KAAKd,YAAY,CAAC,IAAI;YAACe,gBAAgBZ,MAAMW,aAAa;QAAA,CAAC;QAClF,GAAIX,MAAMa,SAAS,KAAKhB,YAAY,CAAC,IAAI;YAACgB,WAAWb,MAAMa,SAAS;QAAA,CAAC;QACrE,GAAIb,MAAMc,QAAQ,KAAKjB,YAAY,CAAC,IAAI;YAACiB,UAAUd,MAAMc,QAAQ;QAAA,CAAC;QAClE,GAAId,MAAMe,MAAM,KAAKlB,YAAY,CAAC,IAAI;YAACmB,SAAShB,MAAMe,MAAM;QAAA,CAAC;IAC/D;AACF"}
@@ -1,4 +1,5 @@
1
+ export { toEvaluationTraceDto } from './evaluation-trace.js';
1
2
  export { toJobDto, toJobExecutionDto } from './job.js';
2
- export { toStepAttemptDto, toStepDto } from './step.js';
3
+ export { toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto } from './step.js';
3
4
  export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AACtD,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,8BAA8B,EAAE,gBAAgB,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AACtF,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
@@ -1,5 +1,6 @@
1
+ export { toEvaluationTraceDto } from './evaluation-trace.js';
1
2
  export { toJobDto, toJobExecutionDto } from './job.js';
2
- export { toStepAttemptDto, toStepDto } from './step.js';
3
+ export { toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto } from './step.js';
3
4
  export { toRunAttemptDto, toRunDto, toRunListItemDto } from './workflow-run.js';
4
5
 
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/dto/index.ts"],"sourcesContent":["export {toJobDto, toJobExecutionDto} from './job.js';\nexport {toStepAttemptDto, toStepDto} from './step.js';\nexport {toRunAttemptDto, toRunDto, toRunListItemDto} from './workflow-run.js';\n"],"names":["toJobDto","toJobExecutionDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto","toRunListItemDto"],"mappings":"AAAA,SAAQA,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;AACtD,SAAQC,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAO,oBAAoB"}
1
+ {"version":3,"sources":["../../../src/presentation/dto/index.ts"],"sourcesContent":["export {toEvaluationTraceDto} from './evaluation-trace.js';\nexport {toJobDto, toJobExecutionDto} from './job.js';\nexport {toStepAttemptDetailResponseDto, toStepAttemptDto, toStepDto} from './step.js';\nexport {toRunAttemptDto, toRunDto, toRunListItemDto} from './workflow-run.js';\n"],"names":["toEvaluationTraceDto","toJobDto","toJobExecutionDto","toStepAttemptDetailResponseDto","toStepAttemptDto","toStepDto","toRunAttemptDto","toRunDto","toRunListItemDto"],"mappings":"AAAA,SAAQA,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,QAAQ,EAAEC,iBAAiB,QAAO,WAAW;AACrD,SAAQC,8BAA8B,EAAEC,gBAAgB,EAAEC,SAAS,QAAO,YAAY;AACtF,SAAQC,eAAe,EAAEC,QAAQ,EAAEC,gBAAgB,QAAO,oBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAElE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAwCzC;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe,CAiB7E"}
1
+ {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/job.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,eAAe,EAAC,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAGlE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CA2CzC;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,eAAe,CAmB7E"}
@@ -1,3 +1,4 @@
1
+ import { toEvaluationTraceDto } from './evaluation-trace.js';
1
2
  export function toJobDto(job) {
2
3
  return {
3
4
  id: job.id,
@@ -8,6 +9,9 @@ export function toJobDto(job) {
8
9
  status: job.status,
9
10
  status_reason: job.statusReason,
10
11
  carried_over: job.carriedOver,
12
+ success: job.success ?? null,
13
+ runner: job.runner,
14
+ evaluation_trace: toEvaluationTraceDto(job.evaluationTrace),
11
15
  listening: job.listeningOn === null ? null : {
12
16
  on: job.listeningOn,
13
17
  until: job.listeningUntil,
@@ -45,8 +49,10 @@ export function toJobExecutionDto(jobExecution) {
45
49
  name: jobExecution.name,
46
50
  status: jobExecution.status,
47
51
  status_reason: jobExecution.statusReason,
52
+ runner: jobExecution.runner,
48
53
  trigger_events: jobExecution.triggerEvents,
49
54
  outputs: jobExecution.outputs,
55
+ evaluation_trace: toEvaluationTraceDto(jobExecution.evaluationTrace),
50
56
  queued_at: jobExecution.queuedAt?.toISOString() ?? null,
51
57
  started_at: jobExecution.startedAt?.toISOString() ?? null,
52
58
  finished_at: jobExecution.finishedAt?.toISOString() ?? null,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/dto/job.ts"],"sourcesContent":["import type {JobDto, JobExecutionDto} from '@shipfox/api-workflows-dto';\nimport type {Job} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\n\nexport function toJobDto(job: Job): JobDto {\n return {\n id: job.id,\n run_attempt_id: job.workflowRunAttemptId,\n key: job.key,\n name: job.name,\n mode: job.mode,\n status: job.status,\n status_reason: job.statusReason,\n carried_over: job.carriedOver,\n listening:\n job.listeningOn === null\n ? null\n : {\n on: job.listeningOn,\n until: job.listeningUntil,\n timeout_ms: job.listeningTimeoutMs,\n max_executions: job.maxExecutions,\n batch:\n job.batchDebounceMs === null &&\n job.batchMaxSize === null &&\n job.batchMaxWaitMs === null\n ? null\n : {\n ...(job.batchDebounceMs === null ? {} : {debounce_ms: job.batchDebounceMs}),\n ...(job.batchMaxSize === null ? {} : {max_size: job.batchMaxSize}),\n ...(job.batchMaxWaitMs === null ? {} : {max_wait_ms: job.batchMaxWaitMs}),\n },\n on_resolve: job.onResolve ?? 'finish',\n execution_timeout_ms: job.executionTimeoutMs ?? null,\n name: job.name,\n },\n listener_status: job.listenerStatus,\n resolution_reason: job.resolutionReason,\n outputs: job.outputs,\n dependencies: job.dependencies,\n position: job.position,\n created_at: job.createdAt.toISOString(),\n updated_at: job.updatedAt.toISOString(),\n };\n}\n\nexport function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto {\n return {\n id: jobExecution.id,\n job_id: jobExecution.jobId,\n sequence: jobExecution.sequence,\n name: jobExecution.name,\n status: jobExecution.status,\n status_reason: jobExecution.statusReason,\n trigger_events: jobExecution.triggerEvents,\n outputs: jobExecution.outputs,\n queued_at: jobExecution.queuedAt?.toISOString() ?? null,\n started_at: jobExecution.startedAt?.toISOString() ?? null,\n finished_at: jobExecution.finishedAt?.toISOString() ?? null,\n timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,\n created_at: jobExecution.createdAt.toISOString(),\n updated_at: jobExecution.updatedAt.toISOString(),\n };\n}\n"],"names":["toJobDto","job","id","run_attempt_id","workflowRunAttemptId","key","name","mode","status","status_reason","statusReason","carried_over","carriedOver","listening","listeningOn","on","until","listeningUntil","timeout_ms","listeningTimeoutMs","max_executions","maxExecutions","batch","batchDebounceMs","batchMaxSize","batchMaxWaitMs","debounce_ms","max_size","max_wait_ms","on_resolve","onResolve","execution_timeout_ms","executionTimeoutMs","listener_status","listenerStatus","resolution_reason","resolutionReason","outputs","dependencies","position","created_at","createdAt","toISOString","updated_at","updatedAt","toJobExecutionDto","jobExecution","job_id","jobId","sequence","trigger_events","triggerEvents","queued_at","queuedAt","started_at","startedAt","finished_at","finishedAt","timed_out_at","timedOutAt"],"mappings":"AAIA,OAAO,SAASA,SAASC,GAAQ;IAC/B,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,gBAAgBF,IAAIG,oBAAoB;QACxCC,KAAKJ,IAAII,GAAG;QACZC,MAAML,IAAIK,IAAI;QACdC,MAAMN,IAAIM,IAAI;QACdC,QAAQP,IAAIO,MAAM;QAClBC,eAAeR,IAAIS,YAAY;QAC/BC,cAAcV,IAAIW,WAAW;QAC7BC,WACEZ,IAAIa,WAAW,KAAK,OAChB,OACA;YACEC,IAAId,IAAIa,WAAW;YACnBE,OAAOf,IAAIgB,cAAc;YACzBC,YAAYjB,IAAIkB,kBAAkB;YAClCC,gBAAgBnB,IAAIoB,aAAa;YACjCC,OACErB,IAAIsB,eAAe,KAAK,QACxBtB,IAAIuB,YAAY,KAAK,QACrBvB,IAAIwB,cAAc,KAAK,OACnB,OACA;gBACE,GAAIxB,IAAIsB,eAAe,KAAK,OAAO,CAAC,IAAI;oBAACG,aAAazB,IAAIsB,eAAe;gBAAA,CAAC;gBAC1E,GAAItB,IAAIuB,YAAY,KAAK,OAAO,CAAC,IAAI;oBAACG,UAAU1B,IAAIuB,YAAY;gBAAA,CAAC;gBACjE,GAAIvB,IAAIwB,cAAc,KAAK,OAAO,CAAC,IAAI;oBAACG,aAAa3B,IAAIwB,cAAc;gBAAA,CAAC;YAC1E;YACNI,YAAY5B,IAAI6B,SAAS,IAAI;YAC7BC,sBAAsB9B,IAAI+B,kBAAkB,IAAI;YAChD1B,MAAML,IAAIK,IAAI;QAChB;QACN2B,iBAAiBhC,IAAIiC,cAAc;QACnCC,mBAAmBlC,IAAImC,gBAAgB;QACvCC,SAASpC,IAAIoC,OAAO;QACpBC,cAAcrC,IAAIqC,YAAY;QAC9BC,UAAUtC,IAAIsC,QAAQ;QACtBC,YAAYvC,IAAIwC,SAAS,CAACC,WAAW;QACrCC,YAAY1C,IAAI2C,SAAS,CAACF,WAAW;IACvC;AACF;AAEA,OAAO,SAASG,kBAAkBC,YAA0B;IAC1D,OAAO;QACL5C,IAAI4C,aAAa5C,EAAE;QACnB6C,QAAQD,aAAaE,KAAK;QAC1BC,UAAUH,aAAaG,QAAQ;QAC/B3C,MAAMwC,aAAaxC,IAAI;QACvBE,QAAQsC,aAAatC,MAAM;QAC3BC,eAAeqC,aAAapC,YAAY;QACxCwC,gBAAgBJ,aAAaK,aAAa;QAC1Cd,SAASS,aAAaT,OAAO;QAC7Be,WAAWN,aAAaO,QAAQ,EAAEX,iBAAiB;QACnDY,YAAYR,aAAaS,SAAS,EAAEb,iBAAiB;QACrDc,aAAaV,aAAaW,UAAU,EAAEf,iBAAiB;QACvDgB,cAAcZ,aAAaa,UAAU,EAAEjB,iBAAiB;QACxDF,YAAYM,aAAaL,SAAS,CAACC,WAAW;QAC9CC,YAAYG,aAAaF,SAAS,CAACF,WAAW;IAChD;AACF"}
1
+ {"version":3,"sources":["../../../src/presentation/dto/job.ts"],"sourcesContent":["import type {JobDto, JobExecutionDto} from '@shipfox/api-workflows-dto';\nimport type {Job} from '#core/entities/job.js';\nimport type {JobExecution} from '#core/entities/job-execution.js';\nimport {toEvaluationTraceDto} from './evaluation-trace.js';\n\nexport function toJobDto(job: Job): JobDto {\n return {\n id: job.id,\n run_attempt_id: job.workflowRunAttemptId,\n key: job.key,\n name: job.name,\n mode: job.mode,\n status: job.status,\n status_reason: job.statusReason,\n carried_over: job.carriedOver,\n success: job.success ?? null,\n runner: job.runner,\n evaluation_trace: toEvaluationTraceDto(job.evaluationTrace),\n listening:\n job.listeningOn === null\n ? null\n : {\n on: job.listeningOn,\n until: job.listeningUntil,\n timeout_ms: job.listeningTimeoutMs,\n max_executions: job.maxExecutions,\n batch:\n job.batchDebounceMs === null &&\n job.batchMaxSize === null &&\n job.batchMaxWaitMs === null\n ? null\n : {\n ...(job.batchDebounceMs === null ? {} : {debounce_ms: job.batchDebounceMs}),\n ...(job.batchMaxSize === null ? {} : {max_size: job.batchMaxSize}),\n ...(job.batchMaxWaitMs === null ? {} : {max_wait_ms: job.batchMaxWaitMs}),\n },\n on_resolve: job.onResolve ?? 'finish',\n execution_timeout_ms: job.executionTimeoutMs ?? null,\n name: job.name,\n },\n listener_status: job.listenerStatus,\n resolution_reason: job.resolutionReason,\n outputs: job.outputs,\n dependencies: job.dependencies,\n position: job.position,\n created_at: job.createdAt.toISOString(),\n updated_at: job.updatedAt.toISOString(),\n };\n}\n\nexport function toJobExecutionDto(jobExecution: JobExecution): JobExecutionDto {\n return {\n id: jobExecution.id,\n job_id: jobExecution.jobId,\n sequence: jobExecution.sequence,\n name: jobExecution.name,\n status: jobExecution.status,\n status_reason: jobExecution.statusReason,\n runner: jobExecution.runner,\n trigger_events: jobExecution.triggerEvents,\n outputs: jobExecution.outputs,\n evaluation_trace: toEvaluationTraceDto(jobExecution.evaluationTrace),\n queued_at: jobExecution.queuedAt?.toISOString() ?? null,\n started_at: jobExecution.startedAt?.toISOString() ?? null,\n finished_at: jobExecution.finishedAt?.toISOString() ?? null,\n timed_out_at: jobExecution.timedOutAt?.toISOString() ?? null,\n created_at: jobExecution.createdAt.toISOString(),\n updated_at: jobExecution.updatedAt.toISOString(),\n };\n}\n"],"names":["toEvaluationTraceDto","toJobDto","job","id","run_attempt_id","workflowRunAttemptId","key","name","mode","status","status_reason","statusReason","carried_over","carriedOver","success","runner","evaluation_trace","evaluationTrace","listening","listeningOn","on","until","listeningUntil","timeout_ms","listeningTimeoutMs","max_executions","maxExecutions","batch","batchDebounceMs","batchMaxSize","batchMaxWaitMs","debounce_ms","max_size","max_wait_ms","on_resolve","onResolve","execution_timeout_ms","executionTimeoutMs","listener_status","listenerStatus","resolution_reason","resolutionReason","outputs","dependencies","position","created_at","createdAt","toISOString","updated_at","updatedAt","toJobExecutionDto","jobExecution","job_id","jobId","sequence","trigger_events","triggerEvents","queued_at","queuedAt","started_at","startedAt","finished_at","finishedAt","timed_out_at","timedOutAt"],"mappings":"AAGA,SAAQA,oBAAoB,QAAO,wBAAwB;AAE3D,OAAO,SAASC,SAASC,GAAQ;IAC/B,OAAO;QACLC,IAAID,IAAIC,EAAE;QACVC,gBAAgBF,IAAIG,oBAAoB;QACxCC,KAAKJ,IAAII,GAAG;QACZC,MAAML,IAAIK,IAAI;QACdC,MAAMN,IAAIM,IAAI;QACdC,QAAQP,IAAIO,MAAM;QAClBC,eAAeR,IAAIS,YAAY;QAC/BC,cAAcV,IAAIW,WAAW;QAC7BC,SAASZ,IAAIY,OAAO,IAAI;QACxBC,QAAQb,IAAIa,MAAM;QAClBC,kBAAkBhB,qBAAqBE,IAAIe,eAAe;QAC1DC,WACEhB,IAAIiB,WAAW,KAAK,OAChB,OACA;YACEC,IAAIlB,IAAIiB,WAAW;YACnBE,OAAOnB,IAAIoB,cAAc;YACzBC,YAAYrB,IAAIsB,kBAAkB;YAClCC,gBAAgBvB,IAAIwB,aAAa;YACjCC,OACEzB,IAAI0B,eAAe,KAAK,QACxB1B,IAAI2B,YAAY,KAAK,QACrB3B,IAAI4B,cAAc,KAAK,OACnB,OACA;gBACE,GAAI5B,IAAI0B,eAAe,KAAK,OAAO,CAAC,IAAI;oBAACG,aAAa7B,IAAI0B,eAAe;gBAAA,CAAC;gBAC1E,GAAI1B,IAAI2B,YAAY,KAAK,OAAO,CAA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to';
1
+ import { type StepAttemptDetailResponseDto, type StepAttemptDto, type StepDto, type StepErrorDto } from '@shipfox/api-workflows-dto';
2
2
  import type { Step, StepAttempt } from '#core/entities/step.js';
3
3
  export declare function fromStepErrorDto(error: StepErrorDto | undefined): Record<string, unknown> | null;
4
4
  export declare function toStepDto(step: Step): StepDto;
5
5
  export declare function toStepAttemptDto(attempt: StepAttempt): StepAttemptDto;
6
+ export declare function toStepAttemptDetailResponseDto(step: Step, attempt: StepAttempt): StepAttemptDetailResponseDto;
6
7
  //# sourceMappingURL=step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAmC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAmB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE"}
1
+ {"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../src/presentation/dto/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,OAAO,EAEZ,KAAK,YAAY,EAGlB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAC,IAAI,EAAE,WAAW,EAAC,MAAM,wBAAwB,CAAC;AAoC9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahG;AA0CD,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAqB7C;AAYD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,cAAc,CAiBrE;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,GACnB,4BAA4B,CAQ9B"}
@@ -1,5 +1,6 @@
1
1
  import { agentConfigIssueSchema, stepErrorReasonSchema } from '@shipfox/api-workflows-dto';
2
2
  import { GATE_EVALUATION_ERROR_REASON } from '#core/step-transition/evaluate-gate.js';
3
+ import { toEvaluationTraceDto } from './evaluation-trace.js';
3
4
  // Domain `error` is loosely typed (jsonb), so narrow it to the fixed runner
4
5
  // contract rather than trusting whatever shape the row happens to hold. `category`
5
6
  // is not stored on the row; the caller derives it from the step type and passes it
@@ -124,8 +125,10 @@ export function toStepDto(step) {
124
125
  name: step.name,
125
126
  source_location: toStepSourceLocationDto(step.sourceLocation),
126
127
  status: step.status,
128
+ status_reason: step.statusReason,
127
129
  type: step.type,
128
130
  config: step.config,
131
+ evaluation_trace: toEvaluationTraceDto(step.evaluationTrace),
129
132
  error: toStepErrorDto(step.error, step.type === 'setup' || step.type === 'checkout' ? 'setup' : 'user'),
130
133
  position: step.position,
131
134
  current_attempt: step.currentAttempt,
@@ -158,5 +161,14 @@ export function toStepAttemptDto(attempt) {
158
161
  finished_at: attempt.finishedAt ? attempt.finishedAt.toISOString() : null
159
162
  };
160
163
  }
164
+ export function toStepAttemptDetailResponseDto(step, attempt) {
165
+ return {
166
+ step_id: step.id,
167
+ attempt: attempt.attempt,
168
+ authored_config: step.authoredConfig,
169
+ config: attempt.config,
170
+ evaluation_trace: toEvaluationTraceDto(attempt.evaluationTrace)
171
+ };
172
+ }
161
173
 
162
174
  //# sourceMappingURL=step.js.map