tubeless 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/child-execution.d.ts +0 -23
- package/dist/core/child-execution.js +10 -12
- package/dist/core/child-execution.js.map +1 -1
- package/dist/core/child-progress.js +7 -2
- package/dist/core/child-progress.js.map +1 -1
- package/dist/core/iteration.d.ts +27 -0
- package/dist/core/iteration.js +111 -0
- package/dist/core/iteration.js.map +1 -0
- package/dist/core/lifecycle.d.ts +7 -5
- package/dist/core/lifecycle.js +36 -4
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core/pipeline-artifacts.d.ts +11 -0
- package/dist/core/pipeline-artifacts.js +2 -0
- package/dist/core/pipeline-artifacts.js.map +1 -0
- package/dist/core/pipeline-compiler.d.ts +1 -0
- package/dist/core/pipeline-compiler.js +1 -0
- package/dist/core/pipeline-compiler.js.map +1 -1
- package/dist/core/pipeline-definition-identity.d.ts +2 -2
- package/dist/core/pipeline-definition-identity.js +28 -5
- package/dist/core/pipeline-definition-identity.js.map +1 -1
- package/dist/core/pipeline-execute.d.ts +1 -6
- package/dist/core/pipeline-execute.js +28 -215
- package/dist/core/pipeline-execute.js.map +1 -1
- package/dist/core/pipeline-execution-error.d.ts +35 -0
- package/dist/core/pipeline-execution-error.js +195 -0
- package/dist/core/pipeline-execution-error.js.map +1 -0
- package/dist/core/pipeline-identity.d.ts +1 -0
- package/dist/core/pipeline-identity.js +1 -0
- package/dist/core/pipeline-identity.js.map +1 -1
- package/dist/core/pipeline-mermaid.js +4 -1
- package/dist/core/pipeline-mermaid.js.map +1 -1
- package/dist/core/pipeline-run-state.d.ts +4 -4
- package/dist/core/pipeline-run-state.js +10 -16
- package/dist/core/pipeline-run-state.js.map +1 -1
- package/dist/core/pipeline-step-executor.d.ts +2 -0
- package/dist/core/pipeline-step-executor.js +11 -3
- package/dist/core/pipeline-step-executor.js.map +1 -1
- package/dist/core/pipeline-steps.d.ts +20 -0
- package/dist/core/pipeline-steps.js +62 -0
- package/dist/core/pipeline-steps.js.map +1 -1
- package/dist/core/pipeline-types.d.ts +15 -2
- package/dist/core/pipeline-types.js.map +1 -1
- package/dist/core/pipeline.d.ts +4 -1
- package/dist/core/pipeline.js +18 -3
- package/dist/core/pipeline.js.map +1 -1
- package/dist/project/project-compiler.d.ts +3 -31
- package/dist/project/project-compiler.js +11 -180
- package/dist/project/project-compiler.js.map +1 -1
- package/dist/project/project-registry.d.ts +44 -0
- package/dist/project/project-registry.js +107 -0
- package/dist/project/project-registry.js.map +1 -0
- package/dist/project/project-step-graph.d.ts +9 -0
- package/dist/project/project-step-graph.js +99 -0
- package/dist/project/project-step-graph.js.map +1 -0
- package/dist/render/render.js +1 -1
- package/dist/render/render.js.map +1 -1
- package/dist/reporter/interactive-reporter.js +6 -3
- package/dist/reporter/interactive-reporter.js.map +1 -1
- package/dist/reporter/live-ticker-frame.d.ts +21 -0
- package/dist/reporter/live-ticker-frame.js +196 -0
- package/dist/reporter/live-ticker-frame.js.map +1 -0
- package/dist/reporter/live-ticker-protocol.d.ts +41 -0
- package/dist/reporter/live-ticker-protocol.js +59 -0
- package/dist/reporter/live-ticker-protocol.js.map +1 -0
- package/dist/reporter/live-ticker-worker.js +11 -25
- package/dist/reporter/live-ticker-worker.js.map +1 -1
- package/dist/reporter/live-ticker.d.ts +0 -15
- package/dist/reporter/live-ticker.js +11 -216
- package/dist/reporter/live-ticker.js.map +1 -1
- package/dist/reporter/reporter.js +7 -6
- package/dist/reporter/reporter.js.map +1 -1
- package/dist/run-store/definition-projection.d.ts +8 -0
- package/dist/run-store/definition-projection.js +89 -0
- package/dist/run-store/definition-projection.js.map +1 -0
- package/dist/run-store/run-projection.d.ts +15 -0
- package/dist/run-store/run-projection.js +203 -0
- package/dist/run-store/run-projection.js.map +1 -0
- package/dist/run-store/run-store-codec.d.ts +2 -0
- package/dist/run-store/run-store-codec.js +11 -0
- package/dist/run-store/run-store-codec.js.map +1 -1
- package/dist/run-store/run-store-event-decoder.js +3 -0
- package/dist/run-store/run-store-event-decoder.js.map +1 -1
- package/dist/run-store/run-store-reader.d.ts +7 -0
- package/dist/run-store/run-store-reader.js +31 -0
- package/dist/run-store/run-store-reader.js.map +1 -0
- package/dist/run-store/run-store-sqlite.js +23 -7
- package/dist/run-store/run-store-sqlite.js.map +1 -1
- package/dist/run-store/run-store.d.ts +16 -4
- package/dist/run-store/run-store.js +14 -263
- package/dist/run-store/run-store.js.map +1 -1
- package/dist/studio/run-store-ui-api.d.ts +13 -0
- package/dist/studio/run-store-ui-api.js +163 -0
- package/dist/studio/run-store-ui-api.js.map +1 -0
- package/dist/studio/run-store-ui-client-browser.js +2 -2
- package/dist/studio/run-store-ui-client-transport.js +28 -3
- package/dist/studio/run-store-ui-client-transport.js.map +1 -1
- package/dist/studio/run-store-ui-client.d.ts +2 -1
- package/dist/studio/run-store-ui-client.js +15 -9
- package/dist/studio/run-store-ui-client.js.map +1 -1
- package/dist/studio/run-store-ui-http.d.ts +11 -0
- package/dist/studio/run-store-ui-http.js +52 -0
- package/dist/studio/run-store-ui-http.js.map +1 -1
- package/dist/studio/run-store-ui-state.d.ts +1 -1
- package/dist/studio/run-store-ui-state.js +10 -28
- package/dist/studio/run-store-ui-state.js.map +1 -1
- package/dist/studio/run-store-ui.d.ts +5 -11
- package/dist/studio/run-store-ui.js +5 -203
- package/dist/studio/run-store-ui.js.map +1 -1
- package/dist/testing/testing.d.ts +18 -2
- package/dist/testing/testing.js +35 -2
- package/dist/testing/testing.js.map +1 -1
- package/dist/tracing/artifact-metadata.d.ts +28 -0
- package/dist/tracing/artifact-metadata.js +105 -0
- package/dist/tracing/artifact-metadata.js.map +1 -0
- package/dist/tracing/tracing-codec.d.ts +1 -1
- package/dist/tracing/tracing-codec.js +1 -1
- package/dist/tracing/tracing-codec.js.map +1 -1
- package/dist/tracing/tracing-constants.d.ts +1 -1
- package/dist/tracing/tracing-constants.js +1 -1
- package/dist/tracing/tracing-constants.js.map +1 -1
- package/dist/tracing/tracing-contracts.d.ts +3 -1
- package/dist/tracing/tracing-contracts.js.map +1 -1
- package/dist/tracing/tracing-internal.d.ts +2 -0
- package/dist/tracing/tracing-internal.js +36 -13
- package/dist/tracing/tracing-internal.js.map +1 -1
- package/dist/tracing/tracing-schema.d.ts +330 -49
- package/dist/tracing/tracing-schema.js +102 -10
- package/dist/tracing/tracing-schema.js.map +1 -1
- package/dist/workbench/workbench-command-execution.d.ts +6 -0
- package/dist/workbench/workbench-command-execution.js +48 -0
- package/dist/workbench/workbench-command-execution.js.map +1 -0
- package/dist/workbench/workbench-history.js +11 -18
- package/dist/workbench/workbench-history.js.map +1 -1
- package/dist/workbench/workbench-launch-session.d.ts +2 -2
- package/dist/workbench/workbench-launch-session.js.map +1 -1
- package/dist/workbench/workbench-run.d.ts +0 -4
- package/dist/workbench/workbench-run.js +3 -47
- package/dist/workbench/workbench-run.js.map +1 -1
- package/dist/workbench/workbench-studio-launcher.d.ts +27 -0
- package/dist/workbench/workbench-studio-launcher.js +95 -0
- package/dist/workbench/workbench-studio-launcher.js.map +1 -0
- package/dist/workbench/workbench-ui.js +10 -83
- package/dist/workbench/workbench-ui.js.map +1 -1
- package/docs/README.md +13 -7
- package/docs/agent-guide.md +69 -6
- package/docs/airflow.md +187 -0
- package/docs/api-reference.md +87 -76
- package/docs/api-report.json +17 -6
- package/docs/artifacts.md +173 -0
- package/docs/child-pipeline-composition.md +65 -2
- package/docs/comparison.md +20 -0
- package/docs/concepts.md +70 -2
- package/docs/dagster.md +161 -0
- package/docs/inngest.md +163 -0
- package/docs/llms.txt +30 -1
- package/docs/recipes.md +82 -33
- package/docs/remote-step-composition.md +6 -0
- package/docs/step-functions.md +190 -0
- package/docs/studio.md +31 -12
- package/docs/temporal.md +183 -0
- package/examples/airflow/contract.ts +46 -0
- package/examples/airflow/hosted.ts +70 -0
- package/examples/airflow/remote.ts +175 -0
- package/examples/airflow/tubeless_example.py +49 -0
- package/examples/airflow/worker.ts +24 -0
- package/examples/artifact-lineage.ts +70 -0
- package/examples/dagster/definitions.py +59 -0
- package/examples/dagster/hosted.ts +78 -0
- package/examples/dagster/pipeline.ts +62 -0
- package/examples/dagster/test_definitions.py +47 -0
- package/examples/dagster/tsconfig.build.json +10 -0
- package/examples/dagster/worker.ts +22 -0
- package/examples/inngest/client.ts +4 -0
- package/examples/inngest/functions.ts +65 -0
- package/examples/inngest/pipeline.ts +41 -0
- package/examples/inngest/send.ts +11 -0
- package/examples/inngest/server.ts +17 -0
- package/examples/inngest/tsconfig.build.json +10 -0
- package/examples/iteration.ts +52 -0
- package/examples/parameterized-steps.ts +96 -0
- package/examples/project/tubeless.project.ts +46 -0
- package/examples/step-functions/handler.ts +110 -0
- package/examples/step-functions/input.json +1 -0
- package/examples/step-functions/pipeline.ts +41 -0
- package/examples/step-functions/state-machine.asl.json +41 -0
- package/examples/step-functions/template.json +42 -0
- package/examples/step-output-overrides.ts +41 -0
- package/examples/temporal/activities.ts +94 -0
- package/examples/temporal/client.ts +19 -0
- package/examples/temporal/pipeline.ts +41 -0
- package/examples/temporal/tsconfig.build.json +10 -0
- package/examples/temporal/worker.ts +21 -0
- package/examples/temporal/workflows.ts +16 -0
- package/package.json +13 -4
- package/skills/tubeless/SKILL.md +30 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-execute.js","sourceRoot":"","sources":["../../src/core/pipeline-execute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,cAAc,IAAI,oBAAoB,GACvC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB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,sBAAsB,CAAC,OAAO,GAA6B,EAAE;IAC3E,MAAM,QAAQ,GAAG,sBAAsB,EAAE,CAAC;IAC1C,OAAO;QACL,GAAG,QAAQ;QACX,GAAG,OAAO;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,IAAI,WAAW;QAC/C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,IAAI,aAAa;KACxD,CAAC;AACJ,CAAC","sourcesContent":["import {\n abortableSleep,\n isAbortError,\n throwIfAborted as throwIfSignalAborted,\n} from \"../utilities/abort.js\";\nimport { PipelineChildError } from \"./child-execution.js\";\nimport { brandTubelessError } from \"../utilities/tubeless-error.js\";\nimport { createPipelineLifecycleObserver } from \"./lifecycle.js\";\nimport { formatPipelineError } from \"./pipeline-diagnostics.js\";\nimport { createRunId } from \"./pipeline-ids.js\";\nimport type { CompiledPipeline } from \"./pipeline-compiler.js\";\nimport type { StepsOptions } from \"./pipeline-definition.js\";\nimport { decideStepDisposition } from \"./pipeline-disposition.js\";\nimport { schedulePipelineSteps } from \"./pipeline-scheduler.js\";\nimport { compiledStepGraph } from \"./pipeline-graph.js\";\nimport { planStepById, stepToPlanStep } from \"./pipeline-plan.js\";\nimport {\n PipelineRunState,\n isCancellationOnly,\n type PipelineStepAttempt,\n} from \"./pipeline-run-state.js\";\nimport type { AnyStep } from \"./pipeline-steps.js\";\nimport { PIPELINE_FINALIZE_STEP_ID } from \"./pipeline-step-metadata.js\";\nimport {\n evaluateStepSkip,\n executeStepAttempt,\n validateStepOutput,\n} from \"./pipeline-step-executor.js\";\nimport type {\n InferSchemaOutput,\n PipelineContext,\n PipelineError,\n PipelineErrorCause,\n PipelineExecutionContext,\n PipelineLogger,\n PipelinePlan,\n PipelinePlanStep,\n PipelineRun,\n PipelineRunControls,\n PipelineRuntime,\n StandardSchemaV1,\n} from \"./pipeline-types.js\";\nimport { PipelineBoundaryValidationError, validateStandardSchema } from \"./pipeline-validation.js\";\nimport { createPipelineTraceEmitter } from \"../tracing/tracing-internal.js\";\n\nconst PIPELINE_LOGGER_BASE = Symbol(\"pipelineLoggerBase\");\n\ntype TracedPipelineLogger = PipelineLogger & { [PIPELINE_LOGGER_BASE]?: PipelineLogger };\n\nfunction basePipelineLogger(log: PipelineLogger): PipelineLogger {\n // SAFETY: `TracedPipelineLogger` only adds the optional symbol-keyed base\n // property; reading it off any `PipelineLogger` is safe because the property\n // is absent unless a tracing wrapper installed it.\n return (log as TracedPipelineLogger)[PIPELINE_LOGGER_BASE] ?? log;\n}\n\nconst originalPipelineErrors = new WeakMap<PipelineError, unknown>();\n\nfunction defaultExecutionErrorMessage(result: PipelineRun<unknown>): string {\n const firstError = result.errors[0];\n const disposition = isCancellationOnly(result.errors) ? \"cancelled\" : \"failed\";\n return firstError\n ? `Pipeline ${result.pipelineId} ${disposition}: ${formatPipelineError(firstError)}`\n : `Pipeline ${result.pipelineId} ${disposition}`;\n}\n\nfunction firstOriginalPipelineError(errors: readonly PipelineError[]): unknown {\n for (const error of errors) {\n if (originalPipelineErrors.has(error)) return originalPipelineErrors.get(error);\n }\n return undefined;\n}\n\n/** Error thrown by `runOrThrow` when a pipeline run does not complete successfully. */\nexport class PipelineExecutionError extends Error {\n constructor(\n readonly result: PipelineRun<unknown>,\n message = defaultExecutionErrorMessage(result)\n ) {\n const cause = firstOriginalPipelineError(result.errors);\n super(message, cause === undefined ? undefined : { cause });\n this.name = \"PipelineExecutionError\";\n brandTubelessError(this, \"pipeline-execution\");\n }\n}\n\nconst MAX_PIPELINE_CAUSE_DEPTH = 8;\n\nfunction readErrorField(value: object, field: \"cause\" | \"code\" | \"message\" | \"name\"): unknown {\n try {\n // SAFETY: any object may be probed for an optional string-keyed field; a\n // getter that throws is caught below, so the cast only enables the lookup.\n return (value as Record<string, unknown>)[field];\n } catch {\n return undefined;\n }\n}\n\nfunction safeErrorMessage(value: unknown): string {\n try {\n return String(value);\n } catch {\n return \"Unknown thrown value\";\n }\n}\n\nfunction normalizePipelineCause(\n value: unknown,\n seen: WeakSet<object>,\n depth = 0\n): PipelineErrorCause {\n if (depth >= MAX_PIPELINE_CAUSE_DEPTH) {\n return { message: \"Cause chain truncated\" };\n }\n if (typeof value !== \"object\" || value === null) {\n return { message: safeErrorMessage(value) };\n }\n if (seen.has(value)) {\n return { message: \"Circular cause\" };\n }\n seen.add(value);\n\n const message = readErrorField(value, \"message\");\n const name = readErrorField(value, \"name\");\n const sourceCode = readErrorField(value, \"code\");\n const nested = readErrorField(value, \"cause\");\n const cause: PipelineErrorCause = {\n message: typeof message === \"string\" ? message : safeErrorMessage(value),\n };\n if (typeof name === \"string\") cause.name = name;\n if (typeof sourceCode === \"string\") cause.sourceCode = sourceCode;\n if (nested !== undefined) cause.cause = normalizePipelineCause(nested, seen, depth + 1);\n return cause;\n}\n\n// Fan-out snapshots bound every string as well as cause depth and item count.\nfunction fanOutCause(error: unknown): PipelineErrorCause {\n const cause = normalizePipelineCause(error, new WeakSet<object>());\n let current: PipelineErrorCause | undefined = cause;\n while (current) {\n current.message = current.message.slice(0, 1024);\n if (current.name) current.name = current.name.slice(0, 1024);\n if (current.sourceCode) current.sourceCode = current.sourceCode.slice(0, 1024);\n current = current.cause;\n }\n return cause;\n}\n\nfunction normalizedNestedCause(error: unknown): PipelineErrorCause | undefined {\n if (typeof error !== \"object\" || error === null) return undefined;\n const cause = readErrorField(error, \"cause\");\n if (cause === undefined) return undefined;\n const seen = new WeakSet<object>();\n seen.add(error);\n return normalizePipelineCause(cause, seen);\n}\n\nfunction toPipelineError(\n error: unknown,\n classification: Omit<PipelineError, \"cause\" | \"message\" | \"sourceCode\" | \"stack\">\n): PipelineError {\n const sourceCode =\n typeof error === \"object\" && error !== null ? readErrorField(error, \"code\") : undefined;\n const cause = normalizedNestedCause(error);\n const pipelineError: PipelineError = {\n ...classification,\n message: error instanceof Error ? error.message : safeErrorMessage(error),\n };\n if (error instanceof Error && error.stack) pipelineError.stack = error.stack;\n if (typeof sourceCode === \"string\") pipelineError.sourceCode = sourceCode;\n if (cause) pipelineError.cause = cause;\n if (error instanceof PipelineBoundaryValidationError) pipelineError.issues = error.issues;\n if (error instanceof PipelineChildError && error.fanOut) {\n const { failures, failureCount, schedulerError } = error.fanOut;\n pipelineError.fanOut = {\n failures: failures.map(({ error: itemError, key, index, cancelled }) => ({\n index,\n key: key.slice(0, 1024),\n keyTruncated: key.length > 1024,\n cancelled,\n error: fanOutCause(itemError),\n })),\n failureCount,\n omittedFailureCount: failureCount - failures.length,\n };\n if (schedulerError !== undefined)\n pipelineError.fanOut.schedulerError = fanOutCause(schedulerError);\n }\n originalPipelineErrors.set(pipelineError, error);\n return pipelineError;\n}\n\nexport function isPipelineCancellation(error: unknown, runtime: PipelineRuntime): boolean {\n if (isAbortError(error)) return true;\n if (runtime.signal?.aborted === true && error === runtime.signal.reason) return true;\n if (error instanceof PipelineChildError) return error.cancelled;\n return error instanceof PipelineExecutionError && isCancelledResult(error.result);\n}\n\nfunction isCancelledResult(result: PipelineRun<unknown>): boolean {\n return result.status === \"cancelled\";\n}\n\ntype PipelineRunIdentity = { correlationId?: string; parentRunId?: string; runId: string };\n\nfunction throwIfAborted(runtime: PipelineRuntime): void {\n throwIfSignalAborted(runtime.signal, \"Pipeline run\");\n}\n\nexport async function executePlannedRun<\n TSteps extends readonly AnyStep[],\n TResult,\n TTargets extends readonly TSteps[number][],\n TResultSchema extends StandardSchemaV1 | undefined,\n>(input: {\n compiled: CompiledPipeline<TSteps, TResult, TTargets, TResultSchema>;\n controls: PipelineRunControls;\n domainOptions: object;\n plan: PipelinePlan;\n runtime: PipelineRuntime;\n}): Promise<\n PipelineRun<TResultSchema extends StandardSchemaV1 ? InferSchemaOutput<TResultSchema> : TResult>\n> {\n type TPipelineResult = TResultSchema extends StandardSchemaV1\n ? InferSchemaOutput<TResultSchema>\n : TResult;\n type TOptions = StepsOptions<TSteps>;\n const { compiled, controls, runtime } = input;\n const startedAtMs = runtime.now();\n const runId = createRunId(compiled.id);\n const correlationId = runtime.correlationId;\n const identity: PipelineRunIdentity = { runId };\n if (correlationId !== undefined) identity.correlationId = correlationId;\n if (runtime.parentRunId) identity.parentRunId = runtime.parentRunId;\n const dryRun = controls.dryRun === true;\n const trace = createPipelineTraceEmitter(\n compiled.id,\n runtime.tracing,\n basePipelineLogger(runtime.log),\n { ...identity, itemKey: runtime.tracing?.itemKey },\n runtime.now\n );\n const lifecycle = createPipelineLifecycleObserver(compiled.id, runtime, trace);\n const tracedLogger = (stepId?: string, attemptId?: string): PipelineLogger => {\n if (!trace) return runtime.log;\n const base = basePipelineLogger(runtime.log);\n const log: TracedPipelineLogger = {\n error: (message, ...params) => {\n lifecycle.log(\"error\", message, params, stepId, attemptId);\n base.error(message, ...params);\n },\n log: (message, ...params) => {\n lifecycle.log(\"log\", message, params, stepId, attemptId);\n base.log(message, ...params);\n },\n warn: (message, ...params) => {\n lifecycle.log(\"warn\", message, params, stepId, attemptId);\n base.warn(message, ...params);\n },\n };\n log[PIPELINE_LOGGER_BASE] = base;\n return log;\n };\n const state = new PipelineRunState<TPipelineResult>(\n compiled.id,\n dryRun,\n startedAtMs,\n identity,\n runtime.now,\n lifecycle\n );\n state.start(input.plan, compiled.targetIds);\n\n if (!input.plan.ok) {\n state.recordRunErrors(input.plan.errors);\n return state.finish();\n }\n\n const maxConcurrency = controls.maxConcurrency ?? 1;\n\n // SAFETY: `domainOptions` is the user-supplied options object; if a schema\n // is present it is re-validated below before assignment to `pipelineOptions`.\n let pipelineOptions = input.domainOptions as TOptions;\n if (compiled.optionsSchema) {\n try {\n const validated = await validateStandardSchema(\n compiled.optionsSchema,\n input.domainOptions,\n `Pipeline ${compiled.id} options`\n );\n if (typeof validated !== \"object\" || validated === null || Array.isArray(validated)) {\n throw new PipelineBoundaryValidationError(\n `Pipeline ${compiled.id} options schema returned a non-object value`,\n [{ message: \"Expected the validated options value to be an object\" }]\n );\n }\n // SAFETY: the schema validated the value against `TOptions` and the\n // object-shape check above passed, so the value is a `TOptions`.\n pipelineOptions = validated as TOptions;\n } catch (error) {\n state.recordRunErrors([\n toPipelineError(error, {\n code: \"TUBELESS_OPTIONS_VALIDATION_FAILED\",\n kind: \"validation\",\n phase: \"execution\",\n }),\n ]);\n return state.finish();\n }\n }\n\n for (const step of input.plan.steps) state.planStep(step);\n\n const executionContext: PipelineExecutionContext<TOptions> = {\n ...runtime,\n dryRun,\n log: tracedLogger(),\n options: pipelineOptions,\n runId,\n trace: trace?.context,\n };\n\n const plannedSteps = planStepById(input.plan);\n const stepsById = new Map(compiled.orderedSteps.map((step) => [step.id, step]));\n // `input.plan.steps` is already topologically ordered. Rehydrate from the original step\n // objects so callers still get the typed handlers rather than plan metadata.\n // SAFETY: every planned step id originates from `compiled.orderedSteps`, so the\n // map lookup always finds the matching `AnyStep<TOptions>`.\n const orderedSteps = input.plan.steps.map((step) => stepsById.get(step.id) as AnyStep<TOptions>);\n const plannedStepFor = (step: AnyStep<TOptions>): PipelinePlanStep =>\n plannedSteps.get(step.id) ??\n stepToPlanStep(step, true, undefined, undefined, compiledStepGraph(compiled, step));\n\n let stopError: PipelineError | undefined;\n let externalCancellationError: PipelineError | undefined;\n\n const recordUnstartedStep = (step: AnyStep<TOptions>, error: PipelineError): void => {\n const plannedStep = plannedStepFor(step);\n // Only the external signal can override a selected step's planned skip.\n if (plannedStep.skipReason && (!plannedStep.selected || error !== externalCancellationError)) {\n const dependencyId =\n plannedStep.skipReason === \"unmet-dependency\"\n ? plannedStep.dependencies.find((id) => plannedSteps.get(id)?.skipReason !== undefined)\n : undefined;\n state.skipStep(plannedStep, { reason: plannedStep.skipReason, dependencyId });\n } else if (error.kind === \"cancellation\") {\n state.cancelStep(plannedStep, { ...error, stepId: step.id }, false);\n } else {\n state.skipStep(plannedStep, {\n reason: \"fail-fast\",\n message: `Not run because fail-fast stopped after ${error.stepId} failed.`,\n dependencyId: error.stepId,\n });\n }\n };\n\n const recordExternalCancellation = (stepId: string): PipelineError | undefined => {\n if (externalCancellationError) return externalCancellationError;\n try {\n throwIfAborted(runtime);\n return undefined;\n } catch (error) {\n externalCancellationError = toPipelineError(error, {\n code: \"TUBELESS_RUN_CANCELLED\",\n kind: \"cancellation\",\n phase: \"execution\",\n stepId,\n });\n state.recordRunErrors([externalCancellationError]);\n return externalCancellationError;\n }\n };\n\n const cancelBeforeStepStart = (step: AnyStep<TOptions>): boolean => {\n const pipelineError = recordExternalCancellation(step.id);\n if (!pipelineError) return false;\n stopError ??= pipelineError;\n recordUnstartedStep(step, pipelineError);\n return true;\n };\n\n const recordStepExecutionFailure = (\n error: unknown,\n plannedStep: PipelinePlanStep,\n attempt: PipelineStepAttempt\n ): void => {\n const cancelled = isPipelineCancellation(error, runtime);\n const childFailure =\n error instanceof PipelineExecutionError || error instanceof PipelineChildError;\n const validationFailure = error instanceof PipelineBoundaryValidationError;\n const pipelineError = toPipelineError(error, {\n code: cancelled\n ? \"TUBELESS_RUN_CANCELLED\"\n : validationFailure\n ? \"TUBELESS_STEP_OUTPUT_VALIDATION_FAILED\"\n : childFailure\n ? \"TUBELESS_CHILD_FAILED\"\n : \"TUBELESS_STEP_FAILED\",\n kind: cancelled\n ? \"cancellation\"\n : validationFailure\n ? \"validation\"\n : childFailure\n ? \"child\"\n : \"step\",\n phase: \"execution\",\n stepId: plannedStep.id,\n });\n state.failStep(plannedStep, attempt, pipelineError);\n if (!controls.continueOnError) stopError ??= pipelineError;\n };\n\n const recordPolicySkip = async (\n plannedStep: PipelinePlanStep,\n step: AnyStep<TOptions>,\n reason: string,\n value: unknown\n ): Promise<void> => {\n let attempt: PipelineStepAttempt | undefined;\n let published = value;\n if (step.outputSchema) {\n attempt = state.beginAttempt(plannedStep);\n try {\n published = await validateStepOutput(\n step,\n value,\n `Pipeline ${compiled.id} step ${step.id} output`\n );\n } catch (error) {\n return recordStepExecutionFailure(error, plannedStep, attempt);\n }\n }\n state.skipStep(plannedStep, {\n attempt,\n message: reason,\n output: { value: published },\n reason: \"policy\",\n });\n };\n\n const executeOneStep = async (step: AnyStep<TOptions>): Promise<void> => {\n const plannedStep = plannedStepFor(step);\n if (cancelBeforeStepStart(step)) return;\n\n const graph = compiledStepGraph(compiled, step);\n const disposition = decideStepDisposition({\n dryRun,\n graph,\n planned: plannedStep,\n reportsByStepId: state.reportsByStepId,\n step,\n });\n if (disposition.kind === \"skip\") {\n state.skipStep(plannedStep, disposition);\n return;\n }\n\n const inputEntries: Array<[string, unknown]> = [];\n for (const dep of graph.dependsOn) inputEntries.push([dep.id, state.outputs.get(dep.id)]);\n for (const dep of graph.optionalDependsOn) {\n if (state.outputs.has(dep.id)) inputEntries.push([dep.id, state.outputs.get(dep.id)]);\n }\n const stepInputs = Object.fromEntries(inputEntries);\n\n if (typeof step.skip === \"function\") {\n let skipDecision;\n try {\n skipDecision = await evaluateStepSkip(step, stepInputs, {\n ...executionContext,\n log: tracedLogger(step.id),\n });\n } catch (error) {\n const attempt = state.beginAttempt(plannedStep);\n recordStepExecutionFailure(error, plannedStep, attempt);\n return;\n }\n if (cancelBeforeStepStart(step)) return;\n if (skipDecision) {\n await recordPolicySkip(plannedStep, step, skipDecision.reason, skipDecision.value);\n return;\n }\n }\n\n const attempt = state.beginAttempt(plannedStep);\n try {\n const output = await executeStepAttempt({\n attemptId: attempt.attemptId,\n context: executionContext,\n dryRun,\n inputs: stepInputs,\n log: tracedLogger(step.id, attempt.attemptId),\n onProgress: (progress) => state.reportProgress(plannedStep, attempt, progress),\n onReportAttempt: (number, attributes) =>\n lifecycle.reportAttempt(step.id, number, attributes, attempt.attemptId),\n outputBoundary: `Pipeline ${compiled.id} step ${step.id} output`,\n step,\n });\n state.completeStep(plannedStep, attempt, output);\n } catch (error) {\n recordStepExecutionFailure(error, plannedStep, attempt);\n }\n };\n\n const unstarted = await schedulePipelineSteps({\n orderedSteps,\n stepGraph: compiled.stepGraph,\n maxConcurrency,\n executeOneStep,\n shouldStop: () => stopError !== undefined || runtime.signal?.aborted === true,\n });\n if (unstarted.length > 0 && runtime.signal?.aborted) {\n // An external abort takes precedence for work that never started, even\n // when an earlier failure stopped dispatch. Keep every active step's outcome.\n // Only reuse diagnostics created from this signal, never a step-local AbortError.\n stopError = recordExternalCancellation(unstarted[0]!.id)!;\n }\n for (const step of unstarted) recordUnstartedStep(step, stopError!);\n\n if (state.errors.length === 0 || controls.continueOnError) {\n const finalizeStartedAt = runtime.now();\n state.beginFinalization();\n try {\n throwIfAborted(runtime);\n // SAFETY: `state.outputs` maps step ids to their produced values, which is\n // exactly the shape the finalizer's outputs parameter describes.\n const finalOutputs = Object.fromEntries(state.outputs) as Parameters<\n CompiledPipeline<TSteps, TResult, TTargets, TResultSchema>[\"finalize\"]\n >[0];\n const finalizedValue = await compiled.finalize(finalOutputs, {\n ...executionContext,\n log: tracedLogger(PIPELINE_FINALIZE_STEP_ID),\n });\n // SAFETY: with a result schema the value is validated against\n // `TPipelineResult`; without one the finalizer's declared return type\n // is `TPipelineResult`, so the cast only restores that type.\n const value = compiled.resultSchema\n ? ((await validateStandardSchema(\n compiled.resultSchema,\n finalizedValue,\n `Pipeline ${compiled.id} final result`\n )) as TPipelineResult)\n : (finalizedValue as TPipelineResult);\n state.completeFinalization(value, runtime.now() - finalizeStartedAt);\n } catch (error) {\n const cancelled = isPipelineCancellation(error, runtime);\n const validationFailure = error instanceof PipelineBoundaryValidationError;\n const pipelineError = toPipelineError(error, {\n code: cancelled\n ? \"TUBELESS_FINALIZATION_CANCELLED\"\n : validationFailure\n ? \"TUBELESS_FINAL_RESULT_VALIDATION_FAILED\"\n : \"TUBELESS_FINALIZATION_FAILED\",\n kind: cancelled ? \"cancellation\" : validationFailure ? \"validation\" : \"finalization\",\n phase: \"finalization\",\n stepId: PIPELINE_FINALIZE_STEP_ID,\n });\n state.failFinalization(pipelineError, runtime.now() - finalizeStartedAt);\n }\n }\n\n return state.finish();\n}\n\nconst fallbackNow = (): number => Date.now();\n\nconst fallbackSleep = (durationMs: number, signal?: AbortSignal): Promise<void> =>\n abortableSleep(durationMs, signal, \"Pipeline sleep\");\n\nexport function defaultPipelineContext(): PipelineContext {\n return { cwd: process.cwd(), log: console, now: fallbackNow, sleep: fallbackSleep };\n}\n\nexport function resolvePipelineRuntime(context: Partial<PipelineContext> = {}): PipelineRuntime {\n const defaults = defaultPipelineContext();\n return {\n ...defaults,\n ...context,\n cwd: context.cwd ?? defaults.cwd,\n log: context.log ?? defaults.log,\n now: context.now ?? defaults.now ?? fallbackNow,\n sleep: context.sleep ?? defaults.sleep ?? fallbackSleep,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pipeline-execute.js","sourceRoot":"","sources":["../../src/core/pipeline-execute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAA4B,MAAM,yBAAyB,CAAC;AAErF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAarC,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACnG,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,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EAAE,CAAC;YACf,MAAM,aAAa,GAAG,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YACxD,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,iBAAiB,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC;AAED,MAAM,WAAW,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AAE7C,MAAM,aAAa,GAAG,CAAC,UAAkB,EAAE,MAAoB,EAAiB,EAAE,CAChF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAEvD,MAAM,UAAU,sBAAsB;IACpC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,OAAO,GAA6B,EAAE;IAC3E,MAAM,QAAQ,GAAG,sBAAsB,EAAE,CAAC;IAC1C,OAAO;QACL,GAAG,QAAQ;QACX,GAAG,OAAO;QACV,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG;QAChC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,IAAI,WAAW;QAC/C,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,IAAI,aAAa;KACxD,CAAC;AACJ,CAAC","sourcesContent":["import { abortableSleep, throwIfAborted as throwIfSignalAborted } from \"../utilities/abort.js\";\nimport { createPipelineLifecycleObserver } from \"./lifecycle.js\";\nimport { createRunId } from \"./pipeline-ids.js\";\nimport type { CompiledPipeline } from \"./pipeline-compiler.js\";\nimport type { StepsOptions } from \"./pipeline-definition.js\";\nimport { decideStepDisposition } from \"./pipeline-disposition.js\";\nimport { schedulePipelineSteps } from \"./pipeline-scheduler.js\";\nimport { compiledStepGraph } from \"./pipeline-graph.js\";\nimport { planStepById, stepToPlanStep } from \"./pipeline-plan.js\";\nimport { PipelineRunState, type PipelineStepAttempt } from \"./pipeline-run-state.js\";\nimport type { AnyStep } from \"./pipeline-steps.js\";\nimport { PIPELINE_FINALIZE_STEP_ID } from \"./pipeline-step-metadata.js\";\nimport {\n evaluateStepSkip,\n executeStepAttempt,\n validateStepOutput,\n} from \"./pipeline-step-executor.js\";\nimport type {\n InferSchemaOutput,\n PipelineContext,\n PipelineError,\n PipelineExecutionContext,\n PipelinePlan,\n PipelinePlanStep,\n PipelineRun,\n PipelineRunControls,\n PipelineRuntime,\n StandardSchemaV1,\n} from \"./pipeline-types.js\";\nimport { PipelineBoundaryValidationError, validateStandardSchema } from \"./pipeline-validation.js\";\nimport {\n finalizationError,\n stepExecutionError,\n toPipelineError,\n} from \"./pipeline-execution-error.js\";\n\ntype PipelineRunIdentity = { correlationId?: string; parentRunId?: string; runId: string };\n\nfunction throwIfAborted(runtime: PipelineRuntime): void {\n throwIfSignalAborted(runtime.signal, \"Pipeline run\");\n}\n\nexport async function executePlannedRun<\n TSteps extends readonly AnyStep[],\n TResult,\n TTargets extends readonly TSteps[number][],\n TResultSchema extends StandardSchemaV1 | undefined,\n>(input: {\n compiled: CompiledPipeline<TSteps, TResult, TTargets, TResultSchema>;\n controls: PipelineRunControls;\n domainOptions: object;\n plan: PipelinePlan;\n runtime: PipelineRuntime;\n overrides?: ReadonlyMap<AnyStep, unknown>;\n}): Promise<\n PipelineRun<TResultSchema extends StandardSchemaV1 ? InferSchemaOutput<TResultSchema> : TResult>\n> {\n type TPipelineResult = TResultSchema extends StandardSchemaV1\n ? InferSchemaOutput<TResultSchema>\n : TResult;\n type TOptions = StepsOptions<TSteps>;\n const { compiled, controls, runtime } = input;\n const startedAtMs = runtime.now();\n const runId = createRunId(compiled.id);\n const correlationId = runtime.correlationId;\n const identity: PipelineRunIdentity = { runId };\n if (correlationId !== undefined) identity.correlationId = correlationId;\n if (runtime.parentRunId) identity.parentRunId = runtime.parentRunId;\n const dryRun = controls.dryRun === true;\n const lifecycle = createPipelineLifecycleObserver(compiled.id, runtime, {\n ...identity,\n itemKey: runtime.tracing?.itemKey,\n iteration: runtime.tracing?.iteration,\n });\n const state = new PipelineRunState<TPipelineResult>(\n compiled.id,\n dryRun,\n startedAtMs,\n identity,\n runtime.now,\n lifecycle\n );\n state.start(input.plan, compiled.targetIds);\n\n if (!input.plan.ok) {\n state.recordRunErrors(input.plan.errors);\n return state.finish();\n }\n\n const maxConcurrency = controls.maxConcurrency ?? 1;\n\n // SAFETY: `domainOptions` is the user-supplied options object; if a schema\n // is present it is re-validated below before assignment to `pipelineOptions`.\n let pipelineOptions = input.domainOptions as TOptions;\n if (compiled.optionsSchema) {\n try {\n const validated = await validateStandardSchema(\n compiled.optionsSchema,\n input.domainOptions,\n `Pipeline ${compiled.id} options`\n );\n if (typeof validated !== \"object\" || validated === null || Array.isArray(validated)) {\n throw new PipelineBoundaryValidationError(\n `Pipeline ${compiled.id} options schema returned a non-object value`,\n [{ message: \"Expected the validated options value to be an object\" }]\n );\n }\n // SAFETY: the schema validated the value against `TOptions` and the\n // object-shape check above passed, so the value is a `TOptions`.\n pipelineOptions = validated as TOptions;\n } catch (error) {\n state.recordRunErrors([\n toPipelineError(error, {\n code: \"TUBELESS_OPTIONS_VALIDATION_FAILED\",\n kind: \"validation\",\n phase: \"execution\",\n }),\n ]);\n return state.finish();\n }\n }\n\n for (const step of input.plan.steps) state.planStep(step);\n\n const executionContext: PipelineExecutionContext<TOptions> = {\n ...runtime,\n dryRun,\n log: lifecycle.logger(),\n options: pipelineOptions,\n runId,\n trace: lifecycle.traceContext,\n };\n\n const plannedSteps = planStepById(input.plan);\n const stepsById = new Map(compiled.orderedSteps.map((step) => [step.id, step]));\n // `input.plan.steps` is already topologically ordered. Rehydrate from the original step\n // objects so callers still get the typed handlers rather than plan metadata.\n // SAFETY: every planned step id originates from `compiled.orderedSteps`, so the\n // map lookup always finds the matching `AnyStep<TOptions>`.\n const orderedSteps = input.plan.steps.map((step) => stepsById.get(step.id) as AnyStep<TOptions>);\n const plannedStepFor = (step: AnyStep<TOptions>): PipelinePlanStep =>\n plannedSteps.get(step.id) ??\n stepToPlanStep(step, true, undefined, undefined, compiledStepGraph(compiled, step));\n\n let stopError: PipelineError | undefined;\n let externalCancellationError: PipelineError | undefined;\n\n const recordUnstartedStep = (step: AnyStep<TOptions>, error: PipelineError): void => {\n const plannedStep = plannedStepFor(step);\n // Only the external signal can override a selected step's planned skip.\n if (plannedStep.skipReason && (!plannedStep.selected || error !== externalCancellationError)) {\n const dependencyId =\n plannedStep.skipReason === \"unmet-dependency\"\n ? plannedStep.dependencies.find((id) => plannedSteps.get(id)?.skipReason !== undefined)\n : undefined;\n state.skipStep(plannedStep, { reason: plannedStep.skipReason, dependencyId });\n } else if (error.kind === \"cancellation\") {\n state.cancelStep(plannedStep, { ...error, stepId: step.id }, false);\n } else {\n state.skipStep(plannedStep, {\n reason: \"fail-fast\",\n message: `Not run because fail-fast stopped after ${error.stepId} failed.`,\n dependencyId: error.stepId,\n });\n }\n };\n\n const recordExternalCancellation = (stepId: string): PipelineError | undefined => {\n if (externalCancellationError) return externalCancellationError;\n try {\n throwIfAborted(runtime);\n return undefined;\n } catch (error) {\n externalCancellationError = toPipelineError(error, {\n code: \"TUBELESS_RUN_CANCELLED\",\n kind: \"cancellation\",\n phase: \"execution\",\n stepId,\n });\n state.recordRunErrors([externalCancellationError]);\n return externalCancellationError;\n }\n };\n\n const cancelBeforeStepStart = (step: AnyStep<TOptions>): boolean => {\n const pipelineError = recordExternalCancellation(step.id);\n if (!pipelineError) return false;\n stopError ??= pipelineError;\n recordUnstartedStep(step, pipelineError);\n return true;\n };\n\n const recordStepExecutionFailure = (\n error: unknown,\n plannedStep: PipelinePlanStep,\n attempt: PipelineStepAttempt\n ): void => {\n const pipelineError = stepExecutionError(error, runtime, plannedStep.id);\n state.failStep(plannedStep, attempt, pipelineError);\n if (!controls.continueOnError) stopError ??= pipelineError;\n };\n\n const recordPolicySkip = async (\n plannedStep: PipelinePlanStep,\n step: AnyStep<TOptions>,\n reason: string,\n value: unknown\n ): Promise<void> => {\n let attempt: PipelineStepAttempt | undefined;\n let published = value;\n if (step.outputSchema) {\n attempt = state.beginAttempt(plannedStep);\n try {\n published = await validateStepOutput(\n step,\n value,\n `Pipeline ${compiled.id} step ${step.id} output`\n );\n } catch (error) {\n return recordStepExecutionFailure(error, plannedStep, attempt);\n }\n }\n state.skipStep(plannedStep, {\n attempt,\n message: reason,\n output: { value: published },\n reason: \"policy\",\n });\n };\n\n const executeOneStep = async (step: AnyStep<TOptions>): Promise<void> => {\n const plannedStep = plannedStepFor(step);\n if (cancelBeforeStepStart(step)) return;\n\n if (plannedStep.selected && input.overrides?.has(step)) {\n const attempt = state.beginAttempt(plannedStep, runtime.now(), \"override\");\n try {\n const output = await validateStepOutput(\n step,\n input.overrides.get(step),\n `Pipeline ${compiled.id} step ${step.id} override output`\n );\n throwIfAborted(runtime);\n state.completeStep(plannedStep, attempt, output);\n } catch (error) {\n recordStepExecutionFailure(error, plannedStep, attempt);\n }\n return;\n }\n\n const graph = compiledStepGraph(compiled, step);\n const disposition = decideStepDisposition({\n dryRun,\n graph,\n planned: plannedStep,\n reportsByStepId: state.reportsByStepId,\n step,\n });\n if (disposition.kind === \"skip\") {\n state.skipStep(plannedStep, disposition);\n return;\n }\n\n const inputEntries: Array<[string, unknown]> = [];\n for (const dep of graph.dependsOn) inputEntries.push([dep.id, state.outputs.get(dep.id)]);\n for (const dep of graph.optionalDependsOn) {\n if (state.outputs.has(dep.id)) inputEntries.push([dep.id, state.outputs.get(dep.id)]);\n }\n const stepInputs = Object.fromEntries(inputEntries);\n\n if (typeof step.skip === \"function\") {\n let skipDecision;\n try {\n skipDecision = await evaluateStepSkip(step, stepInputs, {\n ...executionContext,\n log: lifecycle.logger(step.id),\n });\n } catch (error) {\n const attempt = state.beginAttempt(plannedStep);\n recordStepExecutionFailure(error, plannedStep, attempt);\n return;\n }\n if (cancelBeforeStepStart(step)) return;\n if (skipDecision) {\n await recordPolicySkip(plannedStep, step, skipDecision.reason, skipDecision.value);\n return;\n }\n }\n\n const attempt = state.beginAttempt(plannedStep);\n try {\n const output = await executeStepAttempt({\n attemptId: attempt.attemptId,\n context: executionContext,\n dryRun,\n inputs: stepInputs,\n log: lifecycle.logger(step.id, attempt.attemptId),\n onArtifact: (record, preview) =>\n lifecycle.recordArtifact(step.id, attempt.attemptId, record, preview),\n onProgress: (progress) => state.reportProgress(plannedStep, attempt, progress),\n onReportAttempt: (number, attributes) =>\n lifecycle.reportAttempt(step.id, number, attributes, attempt.attemptId),\n outputBoundary: `Pipeline ${compiled.id} step ${step.id} output`,\n step,\n });\n state.completeStep(plannedStep, attempt, output);\n } catch (error) {\n recordStepExecutionFailure(error, plannedStep, attempt);\n }\n };\n\n const unstarted = await schedulePipelineSteps({\n orderedSteps,\n stepGraph: compiled.stepGraph,\n maxConcurrency,\n executeOneStep,\n shouldStop: () => stopError !== undefined || runtime.signal?.aborted === true,\n });\n if (unstarted.length > 0 && runtime.signal?.aborted) {\n // An external abort takes precedence for work that never started, even\n // when an earlier failure stopped dispatch. Keep every active step's outcome.\n // Only reuse diagnostics created from this signal, never a step-local AbortError.\n stopError = recordExternalCancellation(unstarted[0]!.id)!;\n }\n for (const step of unstarted) recordUnstartedStep(step, stopError!);\n\n if (state.errors.length === 0 || controls.continueOnError) {\n const finalizeStartedAt = runtime.now();\n state.beginFinalization();\n try {\n throwIfAborted(runtime);\n // SAFETY: `state.outputs` maps step ids to their produced values, which is\n // exactly the shape the finalizer's outputs parameter describes.\n const finalOutputs = Object.fromEntries(state.outputs) as Parameters<\n CompiledPipeline<TSteps, TResult, TTargets, TResultSchema>[\"finalize\"]\n >[0];\n const finalizedValue = await compiled.finalize(finalOutputs, {\n ...executionContext,\n log: lifecycle.logger(PIPELINE_FINALIZE_STEP_ID),\n });\n // SAFETY: with a result schema the value is validated against\n // `TPipelineResult`; without one the finalizer's declared return type\n // is `TPipelineResult`, so the cast only restores that type.\n const value = compiled.resultSchema\n ? ((await validateStandardSchema(\n compiled.resultSchema,\n finalizedValue,\n `Pipeline ${compiled.id} final result`\n )) as TPipelineResult)\n : (finalizedValue as TPipelineResult);\n state.completeFinalization(value, runtime.now() - finalizeStartedAt);\n } catch (error) {\n const pipelineError = finalizationError(error, runtime);\n state.failFinalization(pipelineError, runtime.now() - finalizeStartedAt);\n }\n }\n\n return state.finish();\n}\n\nconst fallbackNow = (): number => Date.now();\n\nconst fallbackSleep = (durationMs: number, signal?: AbortSignal): Promise<void> =>\n abortableSleep(durationMs, signal, \"Pipeline sleep\");\n\nexport function defaultPipelineContext(): PipelineContext {\n return { cwd: process.cwd(), log: console, now: fallbackNow, sleep: fallbackSleep };\n}\n\nexport function resolvePipelineRuntime(context: Partial<PipelineContext> = {}): PipelineRuntime {\n const defaults = defaultPipelineContext();\n return {\n ...defaults,\n ...context,\n cwd: context.cwd ?? defaults.cwd,\n log: context.log ?? defaults.log,\n now: context.now ?? defaults.now ?? fallbackNow,\n sleep: context.sleep ?? defaults.sleep ?? fallbackSleep,\n };\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PipelineError, PipelineRun, PipelineRuntime } from "./pipeline-types.js";
|
|
2
|
+
export declare function isCancellationOnly(errors: readonly PipelineError[]): boolean;
|
|
3
|
+
export declare class PipelineChildError extends Error {
|
|
4
|
+
readonly cancelled: boolean;
|
|
5
|
+
readonly fanOut?: {
|
|
6
|
+
failures: readonly {
|
|
7
|
+
error: Error;
|
|
8
|
+
key: string;
|
|
9
|
+
index: number;
|
|
10
|
+
cancelled: boolean;
|
|
11
|
+
}[];
|
|
12
|
+
failureCount: number;
|
|
13
|
+
schedulerError?: Error;
|
|
14
|
+
} | undefined;
|
|
15
|
+
constructor(message: string, cancelled?: boolean, cause?: unknown, fanOut?: {
|
|
16
|
+
failures: readonly {
|
|
17
|
+
error: Error;
|
|
18
|
+
key: string;
|
|
19
|
+
index: number;
|
|
20
|
+
cancelled: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
failureCount: number;
|
|
23
|
+
schedulerError?: Error;
|
|
24
|
+
} | undefined);
|
|
25
|
+
}
|
|
26
|
+
/** Error thrown by `runOrThrow` when a pipeline run does not complete successfully. */
|
|
27
|
+
export declare class PipelineExecutionError extends Error {
|
|
28
|
+
readonly result: PipelineRun<unknown>;
|
|
29
|
+
constructor(result: PipelineRun<unknown>, message?: string);
|
|
30
|
+
}
|
|
31
|
+
export declare function toPipelineError(error: unknown, classification: Omit<PipelineError, "cause" | "message" | "sourceCode" | "stack">): PipelineError;
|
|
32
|
+
export declare function isPipelineCancellation(error: unknown, runtime: Pick<PipelineRuntime, "signal">): boolean;
|
|
33
|
+
/** Classify a failed attempt without exposing error subclasses to execution. */
|
|
34
|
+
export declare function stepExecutionError(error: unknown, runtime: Pick<PipelineRuntime, "signal">, stepId: string): PipelineError;
|
|
35
|
+
export declare function finalizationError(error: unknown, runtime: Pick<PipelineRuntime, "signal">): PipelineError;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { isAbortError } from "../utilities/abort.js";
|
|
2
|
+
import { brandTubelessError } from "../utilities/tubeless-error.js";
|
|
3
|
+
import { formatPipelineError } from "./pipeline-diagnostics.js";
|
|
4
|
+
import { PIPELINE_FINALIZE_STEP_ID } from "./pipeline-step-metadata.js";
|
|
5
|
+
import { PipelineBoundaryValidationError } from "./pipeline-validation.js";
|
|
6
|
+
export function isCancellationOnly(errors) {
|
|
7
|
+
return errors.length > 0 && errors.every(({ kind }) => kind === "cancellation");
|
|
8
|
+
}
|
|
9
|
+
export class PipelineChildError extends Error {
|
|
10
|
+
cancelled;
|
|
11
|
+
fanOut;
|
|
12
|
+
constructor(message, cancelled = false, cause, fanOut) {
|
|
13
|
+
super(message, cause === undefined ? undefined : { cause });
|
|
14
|
+
this.cancelled = cancelled;
|
|
15
|
+
this.fanOut = fanOut;
|
|
16
|
+
this.name = "PipelineChildError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const originalPipelineErrors = new WeakMap();
|
|
20
|
+
function defaultExecutionErrorMessage(result) {
|
|
21
|
+
const firstError = result.errors[0];
|
|
22
|
+
const disposition = isCancellationOnly(result.errors) ? "cancelled" : "failed";
|
|
23
|
+
return firstError
|
|
24
|
+
? `Pipeline ${result.pipelineId} ${disposition}: ${formatPipelineError(firstError)}`
|
|
25
|
+
: `Pipeline ${result.pipelineId} ${disposition}`;
|
|
26
|
+
}
|
|
27
|
+
function firstOriginalPipelineError(errors) {
|
|
28
|
+
for (const error of errors) {
|
|
29
|
+
if (originalPipelineErrors.has(error))
|
|
30
|
+
return originalPipelineErrors.get(error);
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
/** Error thrown by `runOrThrow` when a pipeline run does not complete successfully. */
|
|
35
|
+
export class PipelineExecutionError extends Error {
|
|
36
|
+
result;
|
|
37
|
+
constructor(result, message = defaultExecutionErrorMessage(result)) {
|
|
38
|
+
const cause = firstOriginalPipelineError(result.errors);
|
|
39
|
+
super(message, cause === undefined ? undefined : { cause });
|
|
40
|
+
this.result = result;
|
|
41
|
+
this.name = "PipelineExecutionError";
|
|
42
|
+
brandTubelessError(this, "pipeline-execution");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const MAX_PIPELINE_CAUSE_DEPTH = 8;
|
|
46
|
+
function readErrorField(value, field) {
|
|
47
|
+
try {
|
|
48
|
+
// SAFETY: any object may be probed for an optional string-keyed field; a
|
|
49
|
+
// getter that throws is caught below, so the cast only enables the lookup.
|
|
50
|
+
return value[field];
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function safeErrorMessage(value) {
|
|
57
|
+
try {
|
|
58
|
+
return String(value);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return "Unknown thrown value";
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function normalizePipelineCause(value, seen, depth = 0) {
|
|
65
|
+
if (depth >= MAX_PIPELINE_CAUSE_DEPTH) {
|
|
66
|
+
return { message: "Cause chain truncated" };
|
|
67
|
+
}
|
|
68
|
+
if (typeof value !== "object" || value === null) {
|
|
69
|
+
return { message: safeErrorMessage(value) };
|
|
70
|
+
}
|
|
71
|
+
if (seen.has(value)) {
|
|
72
|
+
return { message: "Circular cause" };
|
|
73
|
+
}
|
|
74
|
+
seen.add(value);
|
|
75
|
+
const message = readErrorField(value, "message");
|
|
76
|
+
const name = readErrorField(value, "name");
|
|
77
|
+
const sourceCode = readErrorField(value, "code");
|
|
78
|
+
const nested = readErrorField(value, "cause");
|
|
79
|
+
const cause = {
|
|
80
|
+
message: typeof message === "string" ? message : safeErrorMessage(value),
|
|
81
|
+
};
|
|
82
|
+
if (typeof name === "string")
|
|
83
|
+
cause.name = name;
|
|
84
|
+
if (typeof sourceCode === "string")
|
|
85
|
+
cause.sourceCode = sourceCode;
|
|
86
|
+
if (nested !== undefined)
|
|
87
|
+
cause.cause = normalizePipelineCause(nested, seen, depth + 1);
|
|
88
|
+
return cause;
|
|
89
|
+
}
|
|
90
|
+
// Fan-out snapshots bound every string as well as cause depth and item count.
|
|
91
|
+
function fanOutCause(error) {
|
|
92
|
+
const cause = normalizePipelineCause(error, new WeakSet());
|
|
93
|
+
let current = cause;
|
|
94
|
+
while (current) {
|
|
95
|
+
current.message = current.message.slice(0, 1024);
|
|
96
|
+
if (current.name)
|
|
97
|
+
current.name = current.name.slice(0, 1024);
|
|
98
|
+
if (current.sourceCode)
|
|
99
|
+
current.sourceCode = current.sourceCode.slice(0, 1024);
|
|
100
|
+
current = current.cause;
|
|
101
|
+
}
|
|
102
|
+
return cause;
|
|
103
|
+
}
|
|
104
|
+
function normalizedNestedCause(error) {
|
|
105
|
+
if (typeof error !== "object" || error === null)
|
|
106
|
+
return undefined;
|
|
107
|
+
const cause = readErrorField(error, "cause");
|
|
108
|
+
if (cause === undefined)
|
|
109
|
+
return undefined;
|
|
110
|
+
const seen = new WeakSet();
|
|
111
|
+
seen.add(error);
|
|
112
|
+
return normalizePipelineCause(cause, seen);
|
|
113
|
+
}
|
|
114
|
+
export function toPipelineError(error, classification) {
|
|
115
|
+
const sourceCode = typeof error === "object" && error !== null ? readErrorField(error, "code") : undefined;
|
|
116
|
+
const cause = normalizedNestedCause(error);
|
|
117
|
+
const pipelineError = {
|
|
118
|
+
...classification,
|
|
119
|
+
message: error instanceof Error ? error.message : safeErrorMessage(error),
|
|
120
|
+
};
|
|
121
|
+
if (error instanceof Error && error.stack)
|
|
122
|
+
pipelineError.stack = error.stack;
|
|
123
|
+
if (typeof sourceCode === "string")
|
|
124
|
+
pipelineError.sourceCode = sourceCode;
|
|
125
|
+
if (cause)
|
|
126
|
+
pipelineError.cause = cause;
|
|
127
|
+
if (error instanceof PipelineBoundaryValidationError)
|
|
128
|
+
pipelineError.issues = error.issues;
|
|
129
|
+
if (error instanceof PipelineChildError && error.fanOut) {
|
|
130
|
+
const { failures, failureCount, schedulerError } = error.fanOut;
|
|
131
|
+
pipelineError.fanOut = {
|
|
132
|
+
failures: failures.map(({ error: itemError, key, index, cancelled }) => ({
|
|
133
|
+
index,
|
|
134
|
+
key: key.slice(0, 1024),
|
|
135
|
+
keyTruncated: key.length > 1024,
|
|
136
|
+
cancelled,
|
|
137
|
+
error: fanOutCause(itemError),
|
|
138
|
+
})),
|
|
139
|
+
failureCount,
|
|
140
|
+
omittedFailureCount: failureCount - failures.length,
|
|
141
|
+
};
|
|
142
|
+
if (schedulerError !== undefined)
|
|
143
|
+
pipelineError.fanOut.schedulerError = fanOutCause(schedulerError);
|
|
144
|
+
}
|
|
145
|
+
originalPipelineErrors.set(pipelineError, error);
|
|
146
|
+
return pipelineError;
|
|
147
|
+
}
|
|
148
|
+
export function isPipelineCancellation(error, runtime) {
|
|
149
|
+
if (isAbortError(error))
|
|
150
|
+
return true;
|
|
151
|
+
if (runtime.signal?.aborted === true && error === runtime.signal.reason)
|
|
152
|
+
return true;
|
|
153
|
+
if (error instanceof PipelineChildError)
|
|
154
|
+
return error.cancelled;
|
|
155
|
+
return error instanceof PipelineExecutionError && error.result.status === "cancelled";
|
|
156
|
+
}
|
|
157
|
+
/** Classify a failed attempt without exposing error subclasses to execution. */
|
|
158
|
+
export function stepExecutionError(error, runtime, stepId) {
|
|
159
|
+
const cancelled = isPipelineCancellation(error, runtime);
|
|
160
|
+
const childFailure = error instanceof PipelineExecutionError || error instanceof PipelineChildError;
|
|
161
|
+
const validationFailure = error instanceof PipelineBoundaryValidationError;
|
|
162
|
+
return toPipelineError(error, {
|
|
163
|
+
code: cancelled
|
|
164
|
+
? "TUBELESS_RUN_CANCELLED"
|
|
165
|
+
: validationFailure
|
|
166
|
+
? "TUBELESS_STEP_OUTPUT_VALIDATION_FAILED"
|
|
167
|
+
: childFailure
|
|
168
|
+
? "TUBELESS_CHILD_FAILED"
|
|
169
|
+
: "TUBELESS_STEP_FAILED",
|
|
170
|
+
kind: cancelled
|
|
171
|
+
? "cancellation"
|
|
172
|
+
: validationFailure
|
|
173
|
+
? "validation"
|
|
174
|
+
: childFailure
|
|
175
|
+
? "child"
|
|
176
|
+
: "step",
|
|
177
|
+
phase: "execution",
|
|
178
|
+
stepId: stepId,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
export function finalizationError(error, runtime) {
|
|
182
|
+
const cancelled = isPipelineCancellation(error, runtime);
|
|
183
|
+
const validationFailure = error instanceof PipelineBoundaryValidationError;
|
|
184
|
+
return toPipelineError(error, {
|
|
185
|
+
code: cancelled
|
|
186
|
+
? "TUBELESS_FINALIZATION_CANCELLED"
|
|
187
|
+
: validationFailure
|
|
188
|
+
? "TUBELESS_FINAL_RESULT_VALIDATION_FAILED"
|
|
189
|
+
: "TUBELESS_FINALIZATION_FAILED",
|
|
190
|
+
kind: cancelled ? "cancellation" : validationFailure ? "validation" : "finalization",
|
|
191
|
+
phase: "finalization",
|
|
192
|
+
stepId: PIPELINE_FINALIZE_STEP_ID,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=pipeline-execution-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-execution-error.js","sourceRoot":"","sources":["../../src/core/pipeline-execution-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAOxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,MAAM,UAAU,kBAAkB,CAAC,MAAgC;IACjE,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAGhC,SAAS;IAET,MAAM;IAJjB,YACE,OAAe,EACN,SAAS,GAAG,KAAK,EAC1B,KAAe,EACN,MAIR;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;yBARnD,SAAS;sBAET,MAAM;QAOf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED,MAAM,sBAAsB,GAAG,IAAI,OAAO,EAA0B,CAAC;AAErE,SAAS,4BAA4B,CAAC,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CAAwC;gBAC1C,CAAC,CAAC,YAAY;oBACZ,CAAC,CAAC,uBAAuB;oBACzB,CAAC,CAAC,sBAAsB;QAC9B,IAAI,EAAE,SAAS;YACb,CAAC,CAAC,cAAc;YAChB,CAAC,CAAC,iBAAiB;gBACjB,CAAC,CAAC,YAAY;gBACd,CAAC,CAAC,YAAY;oBACZ,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,MAAM;QACd,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,MAAM;KACf,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAc,EACd,OAAwC;IAExC,MAAM,SAAS,GAAG,sBAAsB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,iBAAiB,GAAG,KAAK,YAAY,+BAA+B,CAAC;IAC3E,OAAO,eAAe,CAAC,KAAK,EAAE;QAC5B,IAAI,EAAE,SAAS;YACb,CAAC,CAAC,iCAAiC;YACnC,CAAC,CAAC,iBAAiB;gBACjB,CAAC,CAAC,yCAAyC;gBAC3C,CAAC,CAAC,8BAA8B;QACpC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc;QACpF,KAAK,EAAE,cAAc;QACrB,MAAM,EAAE,yBAAyB;KAClC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isAbortError } from \"../utilities/abort.js\";\nimport { brandTubelessError } from \"../utilities/tubeless-error.js\";\nimport { formatPipelineError } from \"./pipeline-diagnostics.js\";\nimport { PIPELINE_FINALIZE_STEP_ID } from \"./pipeline-step-metadata.js\";\nimport type {\n PipelineError,\n PipelineErrorCause,\n PipelineRun,\n PipelineRuntime,\n} from \"./pipeline-types.js\";\nimport { PipelineBoundaryValidationError } from \"./pipeline-validation.js\";\n\nexport function isCancellationOnly(errors: readonly PipelineError[]): boolean {\n return errors.length > 0 && errors.every(({ kind }) => kind === \"cancellation\");\n}\n\nexport class PipelineChildError extends Error {\n constructor(\n message: string,\n readonly cancelled = false,\n cause?: unknown,\n readonly fanOut?: {\n failures: readonly { error: Error; key: string; index: number; cancelled: boolean }[];\n failureCount: number;\n schedulerError?: Error;\n }\n ) {\n super(message, cause === undefined ? undefined : { cause });\n this.name = \"PipelineChildError\";\n }\n}\n\nconst originalPipelineErrors = new WeakMap<PipelineError, unknown>();\n\nfunction defaultExecutionErrorMessage(result: PipelineRun<unknown>): string {\n const firstError = result.errors[0];\n const disposition = isCancellationOnly(result.errors) ? \"cancelled\" : \"failed\";\n return firstError\n ? `Pipeline ${result.pipelineId} ${disposition}: ${formatPipelineError(firstError)}`\n : `Pipeline ${result.pipelineId} ${disposition}`;\n}\n\nfunction firstOriginalPipelineError(errors: readonly PipelineError[]): unknown {\n for (const error of errors) {\n if (originalPipelineErrors.has(error)) return originalPipelineErrors.get(error);\n }\n return undefined;\n}\n\n/** Error thrown by `runOrThrow` when a pipeline run does not complete successfully. */\nexport class PipelineExecutionError extends Error {\n constructor(\n readonly result: PipelineRun<unknown>,\n message = defaultExecutionErrorMessage(result)\n ) {\n const cause = firstOriginalPipelineError(result.errors);\n super(message, cause === undefined ? undefined : { cause });\n this.name = \"PipelineExecutionError\";\n brandTubelessError(this, \"pipeline-execution\");\n }\n}\n\nconst MAX_PIPELINE_CAUSE_DEPTH = 8;\n\nfunction readErrorField(value: object, field: \"cause\" | \"code\" | \"message\" | \"name\"): unknown {\n try {\n // SAFETY: any object may be probed for an optional string-keyed field; a\n // getter that throws is caught below, so the cast only enables the lookup.\n return (value as Record<string, unknown>)[field];\n } catch {\n return undefined;\n }\n}\n\nfunction safeErrorMessage(value: unknown): string {\n try {\n return String(value);\n } catch {\n return \"Unknown thrown value\";\n }\n}\n\nfunction normalizePipelineCause(\n value: unknown,\n seen: WeakSet<object>,\n depth = 0\n): PipelineErrorCause {\n if (depth >= MAX_PIPELINE_CAUSE_DEPTH) {\n return { message: \"Cause chain truncated\" };\n }\n if (typeof value !== \"object\" || value === null) {\n return { message: safeErrorMessage(value) };\n }\n if (seen.has(value)) {\n return { message: \"Circular cause\" };\n }\n seen.add(value);\n\n const message = readErrorField(value, \"message\");\n const name = readErrorField(value, \"name\");\n const sourceCode = readErrorField(value, \"code\");\n const nested = readErrorField(value, \"cause\");\n const cause: PipelineErrorCause = {\n message: typeof message === \"string\" ? message : safeErrorMessage(value),\n };\n if (typeof name === \"string\") cause.name = name;\n if (typeof sourceCode === \"string\") cause.sourceCode = sourceCode;\n if (nested !== undefined) cause.cause = normalizePipelineCause(nested, seen, depth + 1);\n return cause;\n}\n\n// Fan-out snapshots bound every string as well as cause depth and item count.\nfunction fanOutCause(error: unknown): PipelineErrorCause {\n const cause = normalizePipelineCause(error, new WeakSet<object>());\n let current: PipelineErrorCause | undefined = cause;\n while (current) {\n current.message = current.message.slice(0, 1024);\n if (current.name) current.name = current.name.slice(0, 1024);\n if (current.sourceCode) current.sourceCode = current.sourceCode.slice(0, 1024);\n current = current.cause;\n }\n return cause;\n}\n\nfunction normalizedNestedCause(error: unknown): PipelineErrorCause | undefined {\n if (typeof error !== \"object\" || error === null) return undefined;\n const cause = readErrorField(error, \"cause\");\n if (cause === undefined) return undefined;\n const seen = new WeakSet<object>();\n seen.add(error);\n return normalizePipelineCause(cause, seen);\n}\n\nexport function toPipelineError(\n error: unknown,\n classification: Omit<PipelineError, \"cause\" | \"message\" | \"sourceCode\" | \"stack\">\n): PipelineError {\n const sourceCode =\n typeof error === \"object\" && error !== null ? readErrorField(error, \"code\") : undefined;\n const cause = normalizedNestedCause(error);\n const pipelineError: PipelineError = {\n ...classification,\n message: error instanceof Error ? error.message : safeErrorMessage(error),\n };\n if (error instanceof Error && error.stack) pipelineError.stack = error.stack;\n if (typeof sourceCode === \"string\") pipelineError.sourceCode = sourceCode;\n if (cause) pipelineError.cause = cause;\n if (error instanceof PipelineBoundaryValidationError) pipelineError.issues = error.issues;\n if (error instanceof PipelineChildError && error.fanOut) {\n const { failures, failureCount, schedulerError } = error.fanOut;\n pipelineError.fanOut = {\n failures: failures.map(({ error: itemError, key, index, cancelled }) => ({\n index,\n key: key.slice(0, 1024),\n keyTruncated: key.length > 1024,\n cancelled,\n error: fanOutCause(itemError),\n })),\n failureCount,\n omittedFailureCount: failureCount - failures.length,\n };\n if (schedulerError !== undefined)\n pipelineError.fanOut.schedulerError = fanOutCause(schedulerError);\n }\n originalPipelineErrors.set(pipelineError, error);\n return pipelineError;\n}\n\nexport function isPipelineCancellation(\n error: unknown,\n runtime: Pick<PipelineRuntime, \"signal\">\n): boolean {\n if (isAbortError(error)) return true;\n if (runtime.signal?.aborted === true && error === runtime.signal.reason) return true;\n if (error instanceof PipelineChildError) return error.cancelled;\n return error instanceof PipelineExecutionError && error.result.status === \"cancelled\";\n}\n\n/** Classify a failed attempt without exposing error subclasses to execution. */\nexport function stepExecutionError(\n error: unknown,\n runtime: Pick<PipelineRuntime, \"signal\">,\n stepId: string\n): PipelineError {\n const cancelled = isPipelineCancellation(error, runtime);\n const childFailure =\n error instanceof PipelineExecutionError || error instanceof PipelineChildError;\n const validationFailure = error instanceof PipelineBoundaryValidationError;\n return toPipelineError(error, {\n code: cancelled\n ? \"TUBELESS_RUN_CANCELLED\"\n : validationFailure\n ? \"TUBELESS_STEP_OUTPUT_VALIDATION_FAILED\"\n : childFailure\n ? \"TUBELESS_CHILD_FAILED\"\n : \"TUBELESS_STEP_FAILED\",\n kind: cancelled\n ? \"cancellation\"\n : validationFailure\n ? \"validation\"\n : childFailure\n ? \"child\"\n : \"step\",\n phase: \"execution\",\n stepId: stepId,\n });\n}\n\nexport function finalizationError(\n error: unknown,\n runtime: Pick<PipelineRuntime, \"signal\">\n): PipelineError {\n const cancelled = isPipelineCancellation(error, runtime);\n const validationFailure = error instanceof PipelineBoundaryValidationError;\n return toPipelineError(error, {\n code: cancelled\n ? \"TUBELESS_FINALIZATION_CANCELLED\"\n : validationFailure\n ? \"TUBELESS_FINAL_RESULT_VALIDATION_FAILED\"\n : \"TUBELESS_FINALIZATION_FAILED\",\n kind: cancelled ? \"cancellation\" : validationFailure ? \"validation\" : \"finalization\",\n phase: \"finalization\",\n stepId: PIPELINE_FINALIZE_STEP_ID,\n });\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const EXECUTE_COMPILED_RUN: unique symbol;
|
|
2
|
+
export declare const EXECUTE_TEST_RUN: unique symbol;
|
|
2
3
|
/** Marks the exact object returned by `definePipeline` as a compiled pipeline. */
|
|
3
4
|
export declare function brandCompiledPipeline(pipeline: object): void;
|
|
4
5
|
/** True only for the object `definePipeline` returned, not `Object.create` wrappers. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export const EXECUTE_COMPILED_RUN = Symbol("tubeless.executeCompiledRun");
|
|
2
|
+
export const EXECUTE_TEST_RUN = Symbol("tubeless.executeTestRun");
|
|
2
3
|
const compiledPipelines = new WeakSet();
|
|
3
4
|
/** Marks the exact object returned by `definePipeline` as a compiled pipeline. */
|
|
4
5
|
export function brandCompiledPipeline(pipeline) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-identity.js","sourceRoot":"","sources":["../../src/core/pipeline-identity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAkB,MAAM,CAAC,6BAA6B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline-identity.js","sourceRoot":"","sources":["../../src/core/pipeline-identity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAkB,MAAM,CAAC,6BAA6B,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,gBAAgB,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAEjF,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAU,CAAC;AAEhD,kFAAkF;AAClF,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC","sourcesContent":["export const EXECUTE_COMPILED_RUN: unique symbol = Symbol(\"tubeless.executeCompiledRun\");\nexport const EXECUTE_TEST_RUN: unique symbol = Symbol(\"tubeless.executeTestRun\");\n\nconst compiledPipelines = new WeakSet<object>();\n\n/** Marks the exact object returned by `definePipeline` as a compiled pipeline. */\nexport function brandCompiledPipeline(pipeline: object): void {\n compiledPipelines.add(pipeline);\n}\n\n/** True only for the object `definePipeline` returned, not `Object.create` wrappers. */\nexport function isCompiledPipeline(pipeline: object): boolean {\n return compiledPipelines.has(pipeline);\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { liveStepGraph, stepEdges } from "./pipeline-graph.js";
|
|
2
|
+
import { STEP_NESTED_PIPELINE } from "./pipeline-step-metadata.js";
|
|
2
3
|
import { PIPELINE_MERMAID_DIRECTIONS } from "./pipeline-types.js";
|
|
3
4
|
function escapeMermaidLabel(value) {
|
|
4
5
|
return value
|
|
@@ -23,7 +24,9 @@ export function renderPipelineMermaid(steps, options, stepGraph) {
|
|
|
23
24
|
const label = options.includeDescriptions && step.description
|
|
24
25
|
? `${displayName} — ${step.description}`
|
|
25
26
|
: displayName;
|
|
26
|
-
|
|
27
|
+
const nested = step[STEP_NESTED_PIPELINE];
|
|
28
|
+
const iteration = nested?.mode === "iterate" ? ` (at most ${nested.maxIterations} iterations)` : "";
|
|
29
|
+
lines.push(` ${nodeId}["${escapeMermaidLabel(label + iteration)}"]`);
|
|
27
30
|
}
|
|
28
31
|
const edgeLines = [];
|
|
29
32
|
for (const step of steps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-mermaid.js","sourceRoot":"","sources":["../../src/core/pipeline-mermaid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAA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I,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;YAChD,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;YAC/C,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7B,SAAS,CAAC,IAAI,CAAC,KAAK,QAAQ,QAAQ,QAAQ,EAAE,CAAC,CAAC;gBAChD,SAAS;YACX,CAAC;YACD,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7D,SAAS,CAAC,IAAI,CAAC,KAAK,QAAQ,yCAAyC,QAAQ,EAAE,CAAC,CAAC;gBACjF,SAAS;YACX,CAAC;YACD,IAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAC7B,SAAS,CAAC,IAAI,CAAC,KAAK,QAAQ,0BAA0B,QAAQ,EAAE,CAAC,CAAC;gBAClE,SAAS;YACX,CAAC;YACD,SAAS,CAAC,IAAI,CAAC,KAAK,QAAQ,wBAAwB,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,CAAC;IACvD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC","sourcesContent":["import { liveStepGraph, stepEdges, type CompiledStepGraph } from \"./pipeline-graph.js\";\nimport type { AnyStep } from \"./pipeline-steps.js\";\nimport { STEP_NESTED_PIPELINE } from \"./pipeline-step-metadata.js\";\nimport { PIPELINE_MERMAID_DIRECTIONS, type PipelineMermaidOptions } from \"./pipeline-types.js\";\n\nfunction escapeMermaidLabel(value: string): string {\n return value\n .replace(/\\r\\n?|\\n/g, \" \")\n .replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \" \")\n .replace(/#/g, \"#35;\")\n .replace(/&/g, \"#38;\")\n .replace(/\"/g, \"#quot;\")\n .replace(/</g, \"#60;\")\n .replace(/>/g, \"#62;\");\n}\n\nexport function renderPipelineMermaid<TOptions extends object>(\n steps: readonly AnyStep<TOptions>[],\n options: PipelineMermaidOptions,\n stepGraph?: ReadonlyMap<AnyStep, CompiledStepGraph>\n): string {\n const direction = options.direction ?? \"TD\";\n if (!PIPELINE_MERMAID_DIRECTIONS.includes(direction)) {\n throw new Error(`Invalid Mermaid flowchart direction: ${direction}`);\n }\n const nodeIdByStep = new Map(steps.map((step, index) => [step, `step${index}`]));\n const lines = [`flowchart ${direction}`];\n\n for (const step of steps) {\n const nodeId = nodeIdByStep.get(step)!;\n const displayName = step.name ?? step.id;\n const label =\n options.includeDescriptions && step.description\n ? `${displayName} — ${step.description}`\n : displayName;\n const nested = step[STEP_NESTED_PIPELINE];\n const iteration =\n nested?.mode === \"iterate\" ? ` (at most ${nested.maxIterations} iterations)` : \"\";\n lines.push(` ${nodeId}[\"${escapeMermaidLabel(label + iteration)}\"]`);\n }\n\n const edgeLines: string[] = [];\n for (const step of steps) {\n const graph = stepGraph?.get(step) ?? liveStepGraph(step);\n const targetId = nodeIdByStep.get(step)!;\n const required = new Set(graph.dependsOn);\n const optional = new Set(graph.optionalDependsOn);\n const failureGates = new Set(graph.skipAfterFailureOf);\n\n for (const dependency of stepEdges(step, graph)) {\n const sourceId = nodeIdByStep.get(dependency)!;\n if (required.has(dependency)) {\n edgeLines.push(` ${sourceId} --> ${targetId}`);\n continue;\n }\n if (optional.has(dependency) && failureGates.has(dependency)) {\n edgeLines.push(` ${sourceId} -. optional input + failure gate .-> ${targetId}`);\n continue;\n }\n if (optional.has(dependency)) {\n edgeLines.push(` ${sourceId} -. optional input .-> ${targetId}`);\n continue;\n }\n edgeLines.push(` ${sourceId} -. failure gate .-> ${targetId}`);\n }\n }\n\n if (edgeLines.length > 0) lines.push(\"\", ...edgeLines);\n return `${lines.join(\"\\n\")}\\n`;\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { PipelineLifecycleObserver } from "./lifecycle.js";
|
|
2
2
|
import type { PipelineError, PipelinePlan, PipelinePlanStep, PipelineRun, PipelineStepProgress, PipelineStepReport, PipelineStepSkipReason } from "./pipeline-types.js";
|
|
3
3
|
export interface PipelineStepAttempt {
|
|
4
|
+
outputSource?: "override";
|
|
4
5
|
attemptId: string;
|
|
5
6
|
startedAtMs: number;
|
|
6
7
|
}
|
|
7
|
-
export declare function isCancellationOnly(errors: readonly PipelineError[]): boolean;
|
|
8
8
|
export declare class PipelineRunState<TResult> {
|
|
9
9
|
#private;
|
|
10
10
|
readonly pipelineId: string;
|
|
@@ -16,18 +16,18 @@ export declare class PipelineRunState<TResult> {
|
|
|
16
16
|
runId: string;
|
|
17
17
|
};
|
|
18
18
|
readonly now: () => number;
|
|
19
|
-
readonly lifecycle: PipelineLifecycleObserver
|
|
19
|
+
readonly lifecycle: Pick<PipelineLifecycleObserver, "pipelineStart" | "stepStatus" | "finalizeStart" | "finalizeComplete" | "finalizeError" | "pipelineComplete" | "flush">;
|
|
20
20
|
constructor(pipelineId: string, dryRun: boolean, startedAtMs: number, identity: {
|
|
21
21
|
correlationId?: string;
|
|
22
22
|
parentRunId?: string;
|
|
23
23
|
runId: string;
|
|
24
|
-
}, now: () => number, lifecycle: PipelineLifecycleObserver);
|
|
24
|
+
}, now: () => number, lifecycle: Pick<PipelineLifecycleObserver, "pipelineStart" | "stepStatus" | "finalizeStart" | "finalizeComplete" | "finalizeError" | "pipelineComplete" | "flush">);
|
|
25
25
|
get errors(): readonly PipelineError[];
|
|
26
26
|
get outputs(): ReadonlyMap<string, unknown>;
|
|
27
27
|
get reportsByStepId(): ReadonlyMap<string, PipelineStepReport>;
|
|
28
28
|
start(plan: PipelinePlan, targetIds: readonly string[]): void;
|
|
29
29
|
planStep(step: PipelinePlanStep): void;
|
|
30
|
-
beginAttempt(step: PipelinePlanStep, startedAtMs?: number): PipelineStepAttempt;
|
|
30
|
+
beginAttempt(step: PipelinePlanStep, startedAtMs?: number, outputSource?: "override"): PipelineStepAttempt;
|
|
31
31
|
reportProgress(step: PipelinePlanStep, attempt: PipelineStepAttempt, progress: PipelineStepProgress): void;
|
|
32
32
|
completeStep(step: PipelinePlanStep, attempt: PipelineStepAttempt, value: unknown): void;
|
|
33
33
|
skipStep(step: PipelinePlanStep, input: {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { isCancellationOnly } from "./pipeline-execution-error.js";
|
|
1
2
|
import { RUN_MODEL_VERSION } from "./pipeline-ids.js";
|
|
2
|
-
export function isCancellationOnly(errors) {
|
|
3
|
-
return errors.length > 0 && errors.every(({ kind }) => kind === "cancellation");
|
|
4
|
-
}
|
|
5
3
|
function terminalRunStatus(errors) {
|
|
6
4
|
if (errors.length === 0)
|
|
7
5
|
return "completed";
|
|
@@ -13,6 +11,7 @@ function stepReportFromStatus(event) {
|
|
|
13
11
|
name: event.name,
|
|
14
12
|
description: event.description,
|
|
15
13
|
finishedAtMs: event.finishedAtMs,
|
|
14
|
+
...(event.outputSource ? { outputSource: event.outputSource } : {}),
|
|
16
15
|
};
|
|
17
16
|
switch (event.status) {
|
|
18
17
|
case "completed":
|
|
@@ -105,13 +104,15 @@ export class PipelineRunState {
|
|
|
105
104
|
planStep(step) {
|
|
106
105
|
this.#applyStepStatus({ pipelineId: this.pipelineId, status: "planned", step });
|
|
107
106
|
}
|
|
108
|
-
beginAttempt(step, startedAtMs = this.now()) {
|
|
107
|
+
beginAttempt(step, startedAtMs = this.now(), outputSource) {
|
|
109
108
|
const attempt = {
|
|
110
109
|
attemptId: `${this.identity.runId}:attempt:${(this.#nextAttemptSequence += 1).toString(36)}`,
|
|
111
110
|
startedAtMs,
|
|
111
|
+
...(outputSource ? { outputSource } : {}),
|
|
112
112
|
};
|
|
113
113
|
this.#applyStepStatus({
|
|
114
114
|
attemptId: attempt.attemptId,
|
|
115
|
+
...(attempt.outputSource ? { outputSource: attempt.outputSource } : {}),
|
|
115
116
|
pipelineId: this.pipelineId,
|
|
116
117
|
status: "running",
|
|
117
118
|
step,
|
|
@@ -121,6 +122,7 @@ export class PipelineRunState {
|
|
|
121
122
|
reportProgress(step, attempt, progress) {
|
|
122
123
|
this.#applyStepStatus({
|
|
123
124
|
attemptId: attempt.attemptId,
|
|
125
|
+
...(attempt.outputSource ? { outputSource: attempt.outputSource } : {}),
|
|
124
126
|
pipelineId: this.pipelineId,
|
|
125
127
|
progress,
|
|
126
128
|
status: "running",
|
|
@@ -129,18 +131,18 @@ export class PipelineRunState {
|
|
|
129
131
|
}
|
|
130
132
|
completeStep(step, attempt, value) {
|
|
131
133
|
const report = {
|
|
132
|
-
|
|
134
|
+
...attempt,
|
|
133
135
|
id: step.id,
|
|
134
136
|
name: step.name,
|
|
135
137
|
description: step.description,
|
|
136
138
|
finishedAtMs: this.now(),
|
|
137
|
-
startedAtMs: attempt.startedAtMs,
|
|
138
139
|
status: "completed",
|
|
139
140
|
};
|
|
140
141
|
this.#applyStepStatus({ ...report, pipelineId: this.pipelineId, step }, { output: { value } });
|
|
141
142
|
}
|
|
142
143
|
skipStep(step, input) {
|
|
143
144
|
const report = {
|
|
145
|
+
...input.attempt,
|
|
144
146
|
id: step.id,
|
|
145
147
|
name: step.name,
|
|
146
148
|
description: step.description,
|
|
@@ -148,10 +150,6 @@ export class PipelineRunState {
|
|
|
148
150
|
reason: input.reason,
|
|
149
151
|
status: "skipped",
|
|
150
152
|
};
|
|
151
|
-
if (input.attempt) {
|
|
152
|
-
report.attemptId = input.attempt.attemptId;
|
|
153
|
-
report.startedAtMs = input.attempt.startedAtMs;
|
|
154
|
-
}
|
|
155
153
|
if (input.dependencyId)
|
|
156
154
|
report.dependencyId = input.dependencyId;
|
|
157
155
|
if (input.message)
|
|
@@ -164,19 +162,19 @@ export class PipelineRunState {
|
|
|
164
162
|
return;
|
|
165
163
|
}
|
|
166
164
|
const report = {
|
|
167
|
-
|
|
165
|
+
...attempt,
|
|
168
166
|
id: step.id,
|
|
169
167
|
name: step.name,
|
|
170
168
|
description: step.description,
|
|
171
169
|
error,
|
|
172
170
|
finishedAtMs: this.now(),
|
|
173
|
-
startedAtMs: attempt.startedAtMs,
|
|
174
171
|
status: "failed",
|
|
175
172
|
};
|
|
176
173
|
this.#applyStepStatus({ ...report, pipelineId: this.pipelineId, step }, { error: { record: true, value: error } });
|
|
177
174
|
}
|
|
178
175
|
cancelStep(step, error, recordError, attempt) {
|
|
179
176
|
const report = {
|
|
177
|
+
...attempt,
|
|
180
178
|
id: step.id,
|
|
181
179
|
name: step.name,
|
|
182
180
|
description: step.description,
|
|
@@ -184,10 +182,6 @@ export class PipelineRunState {
|
|
|
184
182
|
finishedAtMs: this.now(),
|
|
185
183
|
status: "cancelled",
|
|
186
184
|
};
|
|
187
|
-
if (attempt) {
|
|
188
|
-
report.attemptId = attempt.attemptId;
|
|
189
|
-
report.startedAtMs = attempt.startedAtMs;
|
|
190
|
-
}
|
|
191
185
|
this.#applyStepStatus({ ...report, pipelineId: this.pipelineId, step }, { error: { record: recordError, value: error } });
|
|
192
186
|
}
|
|
193
187
|
recordRunErrors(errors) {
|