@shipfox/client-workflows 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +1 -0
- package/.storybook/preview.css +10 -0
- package/.storybook/preview.tsx +97 -0
- package/.swcrc +42 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +162 -0
- package/LICENSE +21 -0
- package/dist/components/identifier/identifier.d.ts +6 -0
- package/dist/components/identifier/identifier.d.ts.map +1 -0
- package/dist/components/identifier/identifier.js +144 -0
- package/dist/components/identifier/identifier.js.map +1 -0
- package/dist/components/identifier/index.d.ts +2 -0
- package/dist/components/identifier/index.d.ts.map +1 -0
- package/dist/components/identifier/index.js +3 -0
- package/dist/components/identifier/index.js.map +1 -0
- package/dist/components/job-graph/graph-model.d.ts +27 -0
- package/dist/components/job-graph/graph-model.d.ts.map +1 -0
- package/dist/components/job-graph/graph-model.js +107 -0
- package/dist/components/job-graph/graph-model.js.map +1 -0
- package/dist/components/job-graph/index.d.ts +3 -0
- package/dist/components/job-graph/index.d.ts.map +1 -0
- package/dist/components/job-graph/index.js +3 -0
- package/dist/components/job-graph/index.js.map +1 -0
- package/dist/components/job-graph/job-duration-format.d.ts +4 -0
- package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-format.js +41 -0
- package/dist/components/job-graph/job-duration-format.js.map +1 -0
- package/dist/components/job-graph/job-duration-label.d.ts +5 -0
- package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
- package/dist/components/job-graph/job-duration-label.js +33 -0
- package/dist/components/job-graph/job-duration-label.js.map +1 -0
- package/dist/components/job-graph/job-graph-content.d.ts +9 -0
- package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-content.js +181 -0
- package/dist/components/job-graph/job-graph-content.js.map +1 -0
- package/dist/components/job-graph/job-graph-view.d.ts +11 -0
- package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph-view.js +24 -0
- package/dist/components/job-graph/job-graph-view.js.map +1 -0
- package/dist/components/job-graph/job-graph.d.ts +3 -0
- package/dist/components/job-graph/job-graph.d.ts.map +1 -0
- package/dist/components/job-graph/job-graph.js +21 -0
- package/dist/components/job-graph/job-graph.js.map +1 -0
- package/dist/components/job-graph/job-node.d.ts +16 -0
- package/dist/components/job-graph/job-node.d.ts.map +1 -0
- package/dist/components/job-graph/job-node.js +196 -0
- package/dist/components/job-graph/job-node.js.map +1 -0
- package/dist/components/job-graph/types.d.ts +9 -0
- package/dist/components/job-graph/types.d.ts.map +1 -0
- package/dist/components/job-graph/types.js +3 -0
- package/dist/components/job-graph/types.js.map +1 -0
- package/dist/components/step-list/index.d.ts +3 -0
- package/dist/components/step-list/index.d.ts.map +1 -0
- package/dist/components/step-list/index.js +3 -0
- package/dist/components/step-list/index.js.map +1 -0
- package/dist/components/step-list/step-list-model.d.ts +36 -0
- package/dist/components/step-list/step-list-model.d.ts.map +1 -0
- package/dist/components/step-list/step-list-model.js +135 -0
- package/dist/components/step-list/step-list-model.js.map +1 -0
- package/dist/components/step-list/step-list.d.ts +32 -0
- package/dist/components/step-list/step-list.d.ts.map +1 -0
- package/dist/components/step-list/step-list.js +409 -0
- package/dist/components/step-list/step-list.js.map +1 -0
- package/dist/components/workflow-run-duration-label.d.ts +8 -0
- package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
- package/dist/components/workflow-run-duration-label.js +84 -0
- package/dist/components/workflow-run-duration-label.js.map +1 -0
- package/dist/components/workflow-run-list/index.d.ts +2 -0
- package/dist/components/workflow-run-list/index.d.ts.map +1 -0
- package/dist/components/workflow-run-list/index.js +3 -0
- package/dist/components/workflow-run-list/index.js.map +1 -0
- package/dist/components/workflow-run-list/run-display.d.ts +5 -0
- package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
- package/dist/components/workflow-run-list/run-display.js +19 -0
- package/dist/components/workflow-run-list/run-display.js.map +1 -0
- package/dist/components/workflow-run-list/types.d.ts +21 -0
- package/dist/components/workflow-run-list/types.d.ts.map +1 -0
- package/dist/components/workflow-run-list/types.js +3 -0
- package/dist/components/workflow-run-list/types.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
- package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
- package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
- package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
- package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
- package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
- package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
- package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
- package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
- package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
- package/dist/components/workflow-run-summary/index.d.ts +2 -0
- package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/index.js +3 -0
- package/dist/components/workflow-run-summary/index.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
- package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
- package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
- package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
- package/dist/components/workflow-run-view/index.d.ts +3 -0
- package/dist/components/workflow-run-view/index.d.ts.map +1 -0
- package/dist/components/workflow-run-view/index.js +4 -0
- package/dist/components/workflow-run-view/index.js.map +1 -0
- package/dist/components/workflow-run-view/job-card.d.ts +17 -0
- package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-card.js +476 -0
- package/dist/components/workflow-run-view/job-card.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
- package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
- package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
- package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
- package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
- package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
- package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
- package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
- package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
- package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
- package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
- package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
- package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
- package/dist/components/workflow-source-panel/index.d.ts +2 -0
- package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/index.js +3 -0
- package/dist/components/workflow-source-panel/index.js.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
- package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
- package/dist/components/workflow-status/status-visuals.d.ts +12 -0
- package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
- package/dist/components/workflow-status/status-visuals.js +54 -0
- package/dist/components/workflow-status/status-visuals.js.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
- package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
- package/dist/components/workflow-status/workflow-status-icon.js +100 -0
- package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
- package/dist/core/entities/job-execution.d.ts +69 -0
- package/dist/core/entities/job-execution.d.ts.map +1 -0
- package/dist/core/entities/job-execution.js +83 -0
- package/dist/core/entities/job-execution.js.map +1 -0
- package/dist/core/entities/job.d.ts +56 -0
- package/dist/core/entities/job.d.ts.map +1 -0
- package/dist/core/entities/job.js +71 -0
- package/dist/core/entities/job.js.map +1 -0
- package/dist/core/entities/step-attempt.d.ts +49 -0
- package/dist/core/entities/step-attempt.d.ts.map +1 -0
- package/dist/core/entities/step-attempt.js +48 -0
- package/dist/core/entities/step-attempt.js.map +1 -0
- package/dist/core/entities/step.d.ts +41 -0
- package/dist/core/entities/step.d.ts.map +1 -0
- package/dist/core/entities/step.js +51 -0
- package/dist/core/entities/step.js.map +1 -0
- package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
- package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
- package/dist/core/entities/workflow-run-attempt.js +51 -0
- package/dist/core/entities/workflow-run-attempt.js.map +1 -0
- package/dist/core/entities/workflow-run.d.ts +61 -0
- package/dist/core/entities/workflow-run.d.ts.map +1 -0
- package/dist/core/entities/workflow-run.js +104 -0
- package/dist/core/entities/workflow-run.js.map +1 -0
- package/dist/core/workflow-run-url-state.d.ts +13 -0
- package/dist/core/workflow-run-url-state.d.ts.map +1 -0
- package/dist/core/workflow-run-url-state.js +43 -0
- package/dist/core/workflow-run-url-state.js.map +1 -0
- package/dist/core/workflow-run.d.ts +13 -0
- package/dist/core/workflow-run.d.ts.map +1 -0
- package/dist/core/workflow-run.js +8 -0
- package/dist/core/workflow-run.js.map +1 -0
- package/dist/env.d.js +2 -0
- package/dist/env.d.js.map +1 -0
- package/dist/feature.d.ts +20 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +27 -0
- package/dist/feature.js.map +1 -0
- package/dist/hooks/api/workflow-runs.d.ts +109 -0
- package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
- package/dist/hooks/api/workflow-runs.js +394 -0
- package/dist/hooks/api/workflow-runs.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
- package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
- package/dist/pages/workflow-run-first-time-use.js +17 -0
- package/dist/pages/workflow-run-first-time-use.js.map +1 -0
- package/dist/pages/workflow-run-page.d.ts +8 -0
- package/dist/pages/workflow-run-page.d.ts.map +1 -0
- package/dist/pages/workflow-run-page.js +83 -0
- package/dist/pages/workflow-run-page.js.map +1 -0
- package/dist/routes/run-detail.d.ts +8 -0
- package/dist/routes/run-detail.d.ts.map +1 -0
- package/dist/routes/run-detail.js +21 -0
- package/dist/routes/run-detail.js.map +1 -0
- package/dist/routes/runs.d.ts +8 -0
- package/dist/routes/runs.d.ts.map +1 -0
- package/dist/routes/runs.js +20 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +114 -0
- package/src/components/identifier/identifier.tsx +178 -0
- package/src/components/identifier/index.ts +1 -0
- package/src/components/job-graph/graph-model.test.ts +189 -0
- package/src/components/job-graph/graph-model.ts +178 -0
- package/src/components/job-graph/index.ts +2 -0
- package/src/components/job-graph/job-duration-format.ts +54 -0
- package/src/components/job-graph/job-duration-label.tsx +29 -0
- package/src/components/job-graph/job-graph-content.tsx +225 -0
- package/src/components/job-graph/job-graph-view.test.tsx +298 -0
- package/src/components/job-graph/job-graph-view.tsx +45 -0
- package/src/components/job-graph/job-graph.stories.tsx +182 -0
- package/src/components/job-graph/job-graph.tsx +24 -0
- package/src/components/job-graph/job-node.stories.tsx +364 -0
- package/src/components/job-graph/job-node.test.tsx +347 -0
- package/src/components/job-graph/job-node.tsx +202 -0
- package/src/components/job-graph/types.ts +9 -0
- package/src/components/step-list/index.ts +6 -0
- package/src/components/step-list/step-list-model.test.ts +369 -0
- package/src/components/step-list/step-list-model.ts +205 -0
- package/src/components/step-list/step-list.stories.tsx +419 -0
- package/src/components/step-list/step-list.test.tsx +566 -0
- package/src/components/step-list/step-list.tsx +494 -0
- package/src/components/workflow-run-duration-label.tsx +118 -0
- package/src/components/workflow-run-list/index.ts +1 -0
- package/src/components/workflow-run-list/run-display.test.ts +53 -0
- package/src/components/workflow-run-list/run-display.ts +22 -0
- package/src/components/workflow-run-list/types.ts +22 -0
- package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
- package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
- package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
- package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
- package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
- package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
- package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
- package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
- package/src/components/workflow-run-summary/index.ts +1 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
- package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
- package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
- package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
- package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
- package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
- package/src/components/workflow-run-view/index.ts +2 -0
- package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
- package/src/components/workflow-run-view/job-card.tsx +566 -0
- package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
- package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
- package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
- package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
- package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
- package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
- package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
- package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
- package/src/components/workflow-source-panel/index.ts +1 -0
- package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
- package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
- package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
- package/src/components/workflow-status/status-visuals.test.ts +38 -0
- package/src/components/workflow-status/status-visuals.ts +36 -0
- package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
- package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
- package/src/core/entities/job-execution.ts +139 -0
- package/src/core/entities/job.ts +149 -0
- package/src/core/entities/step-attempt.ts +89 -0
- package/src/core/entities/step.ts +105 -0
- package/src/core/entities/workflow-run-attempt.ts +87 -0
- package/src/core/entities/workflow-run.ts +183 -0
- package/src/core/workflow-run-url-state.ts +61 -0
- package/src/core/workflow-run.test.ts +640 -0
- package/src/core/workflow-run.ts +66 -0
- package/src/env.d.ts +8 -0
- package/src/feature.ts +26 -0
- package/src/hooks/api/workflow-runs.test.tsx +410 -0
- package/src/hooks/api/workflow-runs.ts +485 -0
- package/src/index.ts +45 -0
- package/src/page-harness-budget.test.ts +33 -0
- package/src/pages/workflow-run-first-time-use.tsx +17 -0
- package/src/pages/workflow-run-page.test.tsx +517 -0
- package/src/pages/workflow-run-page.tsx +89 -0
- package/src/routes/run-detail.tsx +15 -0
- package/src/routes/runs.tsx +11 -0
- package/test/fixtures/logs.ts +13 -0
- package/test/fixtures/workflow-run.ts +311 -0
- package/test/pages.tsx +79 -0
- package/test/render.tsx +40 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +70 -0
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
import {
|
|
2
|
+
workflowJobDto,
|
|
3
|
+
workflowJobExecutionDto,
|
|
4
|
+
workflowRunAttemptDto,
|
|
5
|
+
workflowRunDetailDto,
|
|
6
|
+
workflowRunDto,
|
|
7
|
+
workflowRunListResponseDto,
|
|
8
|
+
workflowStepAttemptDto,
|
|
9
|
+
workflowStepDto,
|
|
10
|
+
} from '#test/fixtures/workflow-run.js';
|
|
11
|
+
import {
|
|
12
|
+
isWorkflowRunTerminal,
|
|
13
|
+
isWorkflowStatus,
|
|
14
|
+
toWorkflowRun,
|
|
15
|
+
toWorkflowRunAttempt,
|
|
16
|
+
toWorkflowRunDetail,
|
|
17
|
+
toWorkflowRunListItem,
|
|
18
|
+
toWorkflowRunListPage,
|
|
19
|
+
workflowRunShortId,
|
|
20
|
+
workflowRunTriggerDisplayLabel,
|
|
21
|
+
workflowRunTriggerLabel,
|
|
22
|
+
} from './workflow-run.js';
|
|
23
|
+
|
|
24
|
+
describe('workflow run model mapping', () => {
|
|
25
|
+
test('maps a run DTO into the central camelCase model', () => {
|
|
26
|
+
const dto = workflowRunDto({
|
|
27
|
+
id: '66666666-6666-4666-8666-666666666666',
|
|
28
|
+
project_id: '44444444-4444-4444-8444-444444444444',
|
|
29
|
+
definition_id: '55555555-5555-4555-8555-555555555555',
|
|
30
|
+
name: 'deploy-web',
|
|
31
|
+
status: 'running',
|
|
32
|
+
current_attempt: 3,
|
|
33
|
+
latest_attempt: 4,
|
|
34
|
+
trigger_provider: 'github',
|
|
35
|
+
trigger_source: 'github_acme',
|
|
36
|
+
trigger_event: 'push',
|
|
37
|
+
trigger_payload: {ref: 'refs/heads/main'},
|
|
38
|
+
inputs: {environment: 'production'},
|
|
39
|
+
source_snapshot: {format: 'yaml', content: 'jobs: {}'},
|
|
40
|
+
created_at: '2026-05-07T01:01:00.000Z',
|
|
41
|
+
updated_at: '2026-05-07T01:02:00.000Z',
|
|
42
|
+
started_at: '2026-05-07T01:01:10.000Z',
|
|
43
|
+
finished_at: null,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const run = toWorkflowRun(dto as Parameters<typeof toWorkflowRun>[0]);
|
|
47
|
+
|
|
48
|
+
expect(run).toMatchObject({
|
|
49
|
+
id: '66666666-6666-4666-8666-666666666666',
|
|
50
|
+
projectId: '44444444-4444-4444-8444-444444444444',
|
|
51
|
+
definitionId: '55555555-5555-4555-8555-555555555555',
|
|
52
|
+
name: 'deploy-web',
|
|
53
|
+
currentAttempt: 3,
|
|
54
|
+
triggerProvider: 'github',
|
|
55
|
+
triggerSource: 'github_acme',
|
|
56
|
+
triggerEvent: 'push',
|
|
57
|
+
triggerDisplayLabel: 'push',
|
|
58
|
+
triggerLabel: 'github_acme · push',
|
|
59
|
+
triggerPayload: {ref: 'refs/heads/main'},
|
|
60
|
+
inputs: {environment: 'production'},
|
|
61
|
+
sourceSnapshot: {format: 'yaml', content: 'jobs: {}'},
|
|
62
|
+
createdAt: '2026-05-07T01:01:00.000Z',
|
|
63
|
+
updatedAt: '2026-05-07T01:02:00.000Z',
|
|
64
|
+
shortId: '66666666',
|
|
65
|
+
isTemporary: false,
|
|
66
|
+
});
|
|
67
|
+
expect(run).not.toHaveProperty('status');
|
|
68
|
+
expect(run).not.toHaveProperty('startedAt');
|
|
69
|
+
expect(run).not.toHaveProperty('finishedAt');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('normalizes missing nullable fields and marks temporary optimistic runs', () => {
|
|
73
|
+
const dto = {
|
|
74
|
+
...workflowRunDto({
|
|
75
|
+
id: 'temp-1234',
|
|
76
|
+
trigger_source: '',
|
|
77
|
+
trigger_event: '',
|
|
78
|
+
}),
|
|
79
|
+
inputs: undefined,
|
|
80
|
+
source_snapshot: undefined,
|
|
81
|
+
started_at: undefined,
|
|
82
|
+
finished_at: undefined,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const run = toWorkflowRun(dto as unknown as Parameters<typeof toWorkflowRun>[0]);
|
|
86
|
+
|
|
87
|
+
expect(run).toMatchObject({
|
|
88
|
+
triggerDisplayLabel: '',
|
|
89
|
+
triggerLabel: '',
|
|
90
|
+
inputs: null,
|
|
91
|
+
sourceSnapshot: null,
|
|
92
|
+
shortId: 'temp-123',
|
|
93
|
+
isTemporary: true,
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('maps run list projection fields from the current attempt mirror', () => {
|
|
98
|
+
const dto = workflowRunDto({
|
|
99
|
+
status: 'running',
|
|
100
|
+
latest_attempt: 4,
|
|
101
|
+
started_at: '2026-05-07T01:01:10.000Z',
|
|
102
|
+
finished_at: null,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const run = toWorkflowRunListItem(dto);
|
|
106
|
+
|
|
107
|
+
expect(run).toMatchObject({
|
|
108
|
+
status: 'running',
|
|
109
|
+
latestAttempt: 4,
|
|
110
|
+
runAttempt: {
|
|
111
|
+
workflowRunId: dto.id,
|
|
112
|
+
attempt: 1,
|
|
113
|
+
status: 'running',
|
|
114
|
+
createdAt: dto.created_at,
|
|
115
|
+
startedAt: '2026-05-07T01:01:10.000Z',
|
|
116
|
+
finishedAt: null,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
expect(run).not.toHaveProperty('startedAt');
|
|
120
|
+
expect(run).not.toHaveProperty('finishedAt');
|
|
121
|
+
expect(run).not.toHaveProperty('displayDuration');
|
|
122
|
+
expect(run.runAttempt.displayDuration).toEqual({
|
|
123
|
+
state: 'live',
|
|
124
|
+
fromIso: '2026-05-07T01:01:10.000Z',
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('maps run list pagination fields', () => {
|
|
129
|
+
const dto = workflowRunListResponseDto({
|
|
130
|
+
runs: [
|
|
131
|
+
workflowRunDto({id: '66666666-6666-4666-8666-000000000001'}),
|
|
132
|
+
workflowRunDto({id: '66666666-6666-4666-8666-000000000002'}),
|
|
133
|
+
],
|
|
134
|
+
next_cursor: 'cursor-2',
|
|
135
|
+
filtered_total_count: 12,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const page = toWorkflowRunListPage(dto);
|
|
139
|
+
|
|
140
|
+
expect(page.runs.map((run) => run.id)).toEqual([
|
|
141
|
+
'66666666-6666-4666-8666-000000000001',
|
|
142
|
+
'66666666-6666-4666-8666-000000000002',
|
|
143
|
+
]);
|
|
144
|
+
expect(page.nextCursor).toBe('cursor-2');
|
|
145
|
+
expect(page.filteredTotalCount).toBe(12);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('maps detail jobs, steps, attempts, errors, and source locations', () => {
|
|
149
|
+
const attempt = workflowStepAttemptDto({
|
|
150
|
+
id: '66666666-6666-4666-8666-000000000001',
|
|
151
|
+
attempt: 2,
|
|
152
|
+
execution_order: 4,
|
|
153
|
+
status: 'failed',
|
|
154
|
+
exit_code: 1,
|
|
155
|
+
output: {tail: 'stderr'},
|
|
156
|
+
error: {exitCode: 1},
|
|
157
|
+
gate_result: {kind: 'failed', passed: false, source: 'script', exit_code: 1},
|
|
158
|
+
restart_feedback: 'retry',
|
|
159
|
+
started_at: '2026-05-07T01:01:10.000Z',
|
|
160
|
+
finished_at: '2026-05-07T01:01:20.000Z',
|
|
161
|
+
});
|
|
162
|
+
const step = workflowStepDto({
|
|
163
|
+
id: '55555555-5555-4555-8555-000000000001',
|
|
164
|
+
key: null,
|
|
165
|
+
name: 'Run tests',
|
|
166
|
+
source_location: {start_line: 3, end_line: 5},
|
|
167
|
+
status: 'failed',
|
|
168
|
+
type: 'run',
|
|
169
|
+
error: {
|
|
170
|
+
message: 'Tests failed',
|
|
171
|
+
exit_code: 1,
|
|
172
|
+
signal: 'SIGTERM',
|
|
173
|
+
reason: 'agent_invocation_failed',
|
|
174
|
+
category: 'user',
|
|
175
|
+
},
|
|
176
|
+
position: 7,
|
|
177
|
+
current_attempt: 2,
|
|
178
|
+
attempts: [attempt],
|
|
179
|
+
});
|
|
180
|
+
const jobId = '44444444-4444-4444-8444-000000000001';
|
|
181
|
+
const job = workflowJobDto({
|
|
182
|
+
id: jobId,
|
|
183
|
+
name: 'test',
|
|
184
|
+
status: 'failed',
|
|
185
|
+
status_reason: 'step_failed',
|
|
186
|
+
dependencies: ['build'],
|
|
187
|
+
position: 2,
|
|
188
|
+
job_executions: [
|
|
189
|
+
workflowJobExecutionDto({
|
|
190
|
+
job_id: jobId,
|
|
191
|
+
status: 'failed',
|
|
192
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
193
|
+
started_at: '2026-05-07T01:00:05.000Z',
|
|
194
|
+
finished_at: '2026-05-07T01:02:00.000Z',
|
|
195
|
+
steps: [step],
|
|
196
|
+
}),
|
|
197
|
+
],
|
|
198
|
+
});
|
|
199
|
+
const dto = workflowRunDetailDto({latest_attempt: 4, jobs: [job]});
|
|
200
|
+
|
|
201
|
+
const detail = toWorkflowRunDetail(dto);
|
|
202
|
+
|
|
203
|
+
expect(detail.latestAttempt).toBe(4);
|
|
204
|
+
expect(detail.jobs[0]).toMatchObject({
|
|
205
|
+
id: '44444444-4444-4444-8444-000000000001',
|
|
206
|
+
runAttemptId: '11111111-1111-4111-8111-111111111111',
|
|
207
|
+
key: 'test',
|
|
208
|
+
name: 'test',
|
|
209
|
+
mode: 'one_shot',
|
|
210
|
+
status: 'failed',
|
|
211
|
+
statusReason: 'step_failed',
|
|
212
|
+
listening: null,
|
|
213
|
+
listenerStatus: 'inactive',
|
|
214
|
+
resolutionReason: null,
|
|
215
|
+
dependencies: ['build'],
|
|
216
|
+
});
|
|
217
|
+
expect(detail.jobs[0]?.displayDuration).toMatchObject({
|
|
218
|
+
kind: 'run',
|
|
219
|
+
state: 'fixed',
|
|
220
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
221
|
+
});
|
|
222
|
+
expect(detail.jobs[0]?.jobExecutions[0]).toMatchObject({
|
|
223
|
+
sequence: 1,
|
|
224
|
+
status: 'failed',
|
|
225
|
+
queuedAt: '2026-05-07T01:00:00.000Z',
|
|
226
|
+
startedAt: '2026-05-07T01:00:05.000Z',
|
|
227
|
+
finishedAt: '2026-05-07T01:02:00.000Z',
|
|
228
|
+
timedOutAt: null,
|
|
229
|
+
});
|
|
230
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.queueTime).toMatchObject({
|
|
231
|
+
state: 'fixed',
|
|
232
|
+
elapsed: {seconds: 5},
|
|
233
|
+
});
|
|
234
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.runTime).toMatchObject({
|
|
235
|
+
state: 'fixed',
|
|
236
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
237
|
+
});
|
|
238
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.displayDuration).toMatchObject({
|
|
239
|
+
kind: 'run',
|
|
240
|
+
state: 'fixed',
|
|
241
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
242
|
+
});
|
|
243
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]).toMatchObject({
|
|
244
|
+
id: '55555555-5555-4555-8555-000000000001',
|
|
245
|
+
jobExecutionId: detail.jobs[0]?.jobExecutions[0]?.id,
|
|
246
|
+
key: null,
|
|
247
|
+
name: 'Run tests',
|
|
248
|
+
sourceLocation: {startLine: 3, endLine: 5},
|
|
249
|
+
currentAttempt: 2,
|
|
250
|
+
error: {
|
|
251
|
+
message: 'Tests failed',
|
|
252
|
+
exitCode: 1,
|
|
253
|
+
signal: 'SIGTERM',
|
|
254
|
+
reason: 'agent_invocation_failed',
|
|
255
|
+
category: 'user',
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.attempts[0]).toMatchObject({
|
|
259
|
+
id: '66666666-6666-4666-8666-000000000001',
|
|
260
|
+
jobExecutionId: detail.jobs[0]?.jobExecutions[0]?.id,
|
|
261
|
+
executionOrder: 4,
|
|
262
|
+
exitCode: 1,
|
|
263
|
+
output: {tail: 'stderr'},
|
|
264
|
+
error: {exitCode: 1},
|
|
265
|
+
gateResult: {kind: 'failed', passed: false, source: 'script', exit_code: 1},
|
|
266
|
+
restartFeedback: 'retry',
|
|
267
|
+
startedAt: '2026-05-07T01:01:10.000Z',
|
|
268
|
+
finishedAt: '2026-05-07T01:01:20.000Z',
|
|
269
|
+
});
|
|
270
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.attempts[0]?.displayDuration).toMatchObject({
|
|
271
|
+
state: 'fixed',
|
|
272
|
+
elapsed: {seconds: 10},
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
test('maps listening job state', () => {
|
|
277
|
+
const job = workflowJobDto({
|
|
278
|
+
mode: 'listening',
|
|
279
|
+
status: 'running',
|
|
280
|
+
listening: {
|
|
281
|
+
on: [{source: 'github', event: 'deployment_status'}],
|
|
282
|
+
until: [{source: 'slack', event: 'approval'}],
|
|
283
|
+
timeout_ms: 1_800_000,
|
|
284
|
+
max_executions: 10,
|
|
285
|
+
batch: null,
|
|
286
|
+
on_resolve: 'finish',
|
|
287
|
+
execution_timeout_ms: null,
|
|
288
|
+
name: null,
|
|
289
|
+
},
|
|
290
|
+
listener_status: 'listening',
|
|
291
|
+
resolution_reason: null,
|
|
292
|
+
job_executions: [
|
|
293
|
+
workflowJobExecutionDto({
|
|
294
|
+
trigger_events: [
|
|
295
|
+
{
|
|
296
|
+
source: 'github',
|
|
297
|
+
event: 'deployment_status',
|
|
298
|
+
delivery_id: 'delivery-1',
|
|
299
|
+
received_at: '2026-05-07T01:00:00.000Z',
|
|
300
|
+
data: {state: 'success'},
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
}),
|
|
304
|
+
],
|
|
305
|
+
});
|
|
306
|
+
const dto = workflowRunDetailDto({jobs: [job]});
|
|
307
|
+
|
|
308
|
+
const detail = toWorkflowRunDetail(dto);
|
|
309
|
+
|
|
310
|
+
expect(detail.jobs[0]).toMatchObject({
|
|
311
|
+
mode: 'listening',
|
|
312
|
+
status: 'running',
|
|
313
|
+
listening: {
|
|
314
|
+
on: [{source: 'github', event: 'deployment_status'}],
|
|
315
|
+
until: [{source: 'slack', event: 'approval'}],
|
|
316
|
+
timeout_ms: 1_800_000,
|
|
317
|
+
max_executions: 10,
|
|
318
|
+
batch: null,
|
|
319
|
+
on_resolve: 'finish',
|
|
320
|
+
execution_timeout_ms: null,
|
|
321
|
+
name: null,
|
|
322
|
+
},
|
|
323
|
+
listenerStatus: 'listening',
|
|
324
|
+
resolutionReason: null,
|
|
325
|
+
});
|
|
326
|
+
expect(detail.jobs[0]?.jobExecutions[0]).toMatchObject({
|
|
327
|
+
triggerEvents: [
|
|
328
|
+
{
|
|
329
|
+
source: 'github',
|
|
330
|
+
event: 'deployment_status',
|
|
331
|
+
delivery_id: 'delivery-1',
|
|
332
|
+
received_at: '2026-05-07T01:00:00.000Z',
|
|
333
|
+
data: {state: 'success'},
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
});
|
|
337
|
+
expect(detail.jobs[0]?.displayDuration).toBeNull();
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
test('maps job display names and execution durations as model getters', () => {
|
|
341
|
+
const job = workflowJobDto({
|
|
342
|
+
key: 'deploy-prod',
|
|
343
|
+
name: null,
|
|
344
|
+
job_executions: [
|
|
345
|
+
workflowJobExecutionDto({
|
|
346
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
347
|
+
started_at: '2026-05-07T01:00:05.000Z',
|
|
348
|
+
finished_at: '2026-05-07T01:02:00.000Z',
|
|
349
|
+
}),
|
|
350
|
+
],
|
|
351
|
+
});
|
|
352
|
+
const dto = workflowRunDetailDto({jobs: [job]});
|
|
353
|
+
|
|
354
|
+
const detail = toWorkflowRunDetail(dto);
|
|
355
|
+
|
|
356
|
+
expect(detail.jobs[0]?.displayName).toBe('deploy-prod');
|
|
357
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.queueTime).toMatchObject({
|
|
358
|
+
state: 'fixed',
|
|
359
|
+
elapsed: {seconds: 5},
|
|
360
|
+
});
|
|
361
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.runTime).toMatchObject({
|
|
362
|
+
state: 'fixed',
|
|
363
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
364
|
+
});
|
|
365
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.displayDuration).toMatchObject({
|
|
366
|
+
kind: 'run',
|
|
367
|
+
state: 'fixed',
|
|
368
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
369
|
+
});
|
|
370
|
+
expect(detail.jobs[0]?.displayDuration).toMatchObject({
|
|
371
|
+
kind: 'run',
|
|
372
|
+
state: 'fixed',
|
|
373
|
+
elapsed: {minutes: 1, seconds: 55},
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test('returns no job display duration when a job has multiple executions', () => {
|
|
378
|
+
const job = workflowJobDto({
|
|
379
|
+
job_executions: [
|
|
380
|
+
workflowJobExecutionDto({
|
|
381
|
+
sequence: 1,
|
|
382
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
383
|
+
started_at: '2026-05-07T01:00:05.000Z',
|
|
384
|
+
finished_at: '2026-05-07T01:02:00.000Z',
|
|
385
|
+
}),
|
|
386
|
+
workflowJobExecutionDto({
|
|
387
|
+
sequence: 2,
|
|
388
|
+
queued_at: '2026-05-07T02:00:00.000Z',
|
|
389
|
+
started_at: '2026-05-07T02:00:05.000Z',
|
|
390
|
+
finished_at: '2026-05-07T02:02:00.000Z',
|
|
391
|
+
}),
|
|
392
|
+
],
|
|
393
|
+
});
|
|
394
|
+
const dto = workflowRunDetailDto({jobs: [job]});
|
|
395
|
+
|
|
396
|
+
const detail = toWorkflowRunDetail(dto);
|
|
397
|
+
|
|
398
|
+
expect(detail.jobs[0]?.displayDuration).toBeNull();
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
test('maps live queue and run durations as anchored model getters', () => {
|
|
402
|
+
const queuedExecution = workflowJobExecutionDto({
|
|
403
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
404
|
+
started_at: null,
|
|
405
|
+
finished_at: null,
|
|
406
|
+
});
|
|
407
|
+
const runningExecution = workflowJobExecutionDto({
|
|
408
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
409
|
+
started_at: '2026-05-07T01:00:05.000Z',
|
|
410
|
+
finished_at: null,
|
|
411
|
+
});
|
|
412
|
+
const dto = workflowRunDetailDto({
|
|
413
|
+
jobs: [
|
|
414
|
+
workflowJobDto({job_executions: [queuedExecution]}),
|
|
415
|
+
workflowJobDto({job_executions: [runningExecution]}),
|
|
416
|
+
],
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
const detail = toWorkflowRunDetail(dto);
|
|
420
|
+
|
|
421
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.queueTime).toEqual({
|
|
422
|
+
state: 'live',
|
|
423
|
+
fromIso: '2026-05-07T01:00:00.000Z',
|
|
424
|
+
});
|
|
425
|
+
expect(detail.jobs[0]?.displayDuration).toEqual({
|
|
426
|
+
kind: 'queue',
|
|
427
|
+
state: 'live',
|
|
428
|
+
fromIso: '2026-05-07T01:00:00.000Z',
|
|
429
|
+
});
|
|
430
|
+
expect(detail.jobs[1]?.jobExecutions[0]?.runTime).toEqual({
|
|
431
|
+
state: 'live',
|
|
432
|
+
fromIso: '2026-05-07T01:00:05.000Z',
|
|
433
|
+
});
|
|
434
|
+
expect(detail.jobs[1]?.displayDuration).toEqual({
|
|
435
|
+
kind: 'run',
|
|
436
|
+
state: 'live',
|
|
437
|
+
fromIso: '2026-05-07T01:00:05.000Z',
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
test('maps live step attempt duration as an anchored model getter', () => {
|
|
442
|
+
const attempt = workflowStepAttemptDto({
|
|
443
|
+
started_at: '2026-06-21T12:00:00.000Z',
|
|
444
|
+
finished_at: null,
|
|
445
|
+
});
|
|
446
|
+
const step = workflowStepDto({attempts: [attempt]});
|
|
447
|
+
const dto = workflowRunDetailDto({jobs: [workflowJobDto({steps: [step]})]});
|
|
448
|
+
|
|
449
|
+
const detail = toWorkflowRunDetail(dto);
|
|
450
|
+
|
|
451
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.attempts[0]?.displayDuration).toEqual({
|
|
452
|
+
state: 'live',
|
|
453
|
+
fromIso: '2026-06-21T12:00:00.000Z',
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
test('preserves null source, error, execution timing, and attempt fields', () => {
|
|
458
|
+
const attempt = workflowStepAttemptDto({
|
|
459
|
+
exit_code: null,
|
|
460
|
+
output: null,
|
|
461
|
+
error: null,
|
|
462
|
+
gate_result: null,
|
|
463
|
+
restart_feedback: null,
|
|
464
|
+
finished_at: null,
|
|
465
|
+
});
|
|
466
|
+
const step = workflowStepDto({
|
|
467
|
+
source_location: null,
|
|
468
|
+
error: null,
|
|
469
|
+
attempts: [attempt],
|
|
470
|
+
});
|
|
471
|
+
const job = workflowJobDto({steps: [step]});
|
|
472
|
+
const dto = workflowRunDetailDto({
|
|
473
|
+
inputs: null,
|
|
474
|
+
source_snapshot: null,
|
|
475
|
+
started_at: null,
|
|
476
|
+
finished_at: null,
|
|
477
|
+
jobs: [job],
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
const detail = toWorkflowRunDetail(dto);
|
|
481
|
+
|
|
482
|
+
expect(detail).toMatchObject({
|
|
483
|
+
inputs: null,
|
|
484
|
+
sourceSnapshot: null,
|
|
485
|
+
});
|
|
486
|
+
expect(detail.jobs[0]?.displayDuration).toBeNull();
|
|
487
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]).toMatchObject({
|
|
488
|
+
sourceLocation: null,
|
|
489
|
+
error: null,
|
|
490
|
+
});
|
|
491
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.attempts[0]).toMatchObject({
|
|
492
|
+
exitCode: null,
|
|
493
|
+
output: null,
|
|
494
|
+
error: null,
|
|
495
|
+
gateResult: null,
|
|
496
|
+
restartFeedback: null,
|
|
497
|
+
finishedAt: null,
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
test('maps queued jobs cancelled before start to no duration', () => {
|
|
502
|
+
const job = workflowJobDto({
|
|
503
|
+
status: 'cancelled',
|
|
504
|
+
job_executions: [
|
|
505
|
+
workflowJobExecutionDto({
|
|
506
|
+
status: 'cancelled',
|
|
507
|
+
queued_at: '2026-05-07T01:00:00.000Z',
|
|
508
|
+
started_at: null,
|
|
509
|
+
finished_at: '2026-05-07T01:01:00.000Z',
|
|
510
|
+
}),
|
|
511
|
+
],
|
|
512
|
+
});
|
|
513
|
+
const dto = workflowRunDetailDto({jobs: [job]});
|
|
514
|
+
|
|
515
|
+
const detail = toWorkflowRunDetail(dto);
|
|
516
|
+
|
|
517
|
+
expect(detail.jobs[0]).toMatchObject({
|
|
518
|
+
status: 'cancelled',
|
|
519
|
+
});
|
|
520
|
+
expect(detail.jobs[0]?.jobExecutions[0]).toMatchObject({
|
|
521
|
+
status: 'cancelled',
|
|
522
|
+
queuedAt: '2026-05-07T01:00:00.000Z',
|
|
523
|
+
startedAt: null,
|
|
524
|
+
finishedAt: '2026-05-07T01:01:00.000Z',
|
|
525
|
+
});
|
|
526
|
+
expect(detail.jobs[0]?.displayDuration).toBeNull();
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
test('maps resolved agent step configuration from the opaque step config', () => {
|
|
530
|
+
const step = workflowStepDto({
|
|
531
|
+
type: 'agent',
|
|
532
|
+
config: {
|
|
533
|
+
provider: 'anthropic',
|
|
534
|
+
model: 'claude-opus-4-8',
|
|
535
|
+
thinking: 'high',
|
|
536
|
+
prompt: 'Fix the failing tests.',
|
|
537
|
+
},
|
|
538
|
+
});
|
|
539
|
+
const missingConfigStep = workflowStepDto({
|
|
540
|
+
type: 'agent',
|
|
541
|
+
config: {provider: '', model: 42},
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
const detail = toWorkflowRunDetail(
|
|
545
|
+
workflowRunDetailDto({
|
|
546
|
+
jobs: [workflowJobDto({steps: [step, missingConfigStep]})],
|
|
547
|
+
}),
|
|
548
|
+
);
|
|
549
|
+
|
|
550
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.agentConfig).toEqual({
|
|
551
|
+
provider: 'anthropic',
|
|
552
|
+
model: 'claude-opus-4-8',
|
|
553
|
+
thinking: 'high',
|
|
554
|
+
});
|
|
555
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[1]?.agentConfig).toEqual({
|
|
556
|
+
provider: null,
|
|
557
|
+
model: null,
|
|
558
|
+
thinking: null,
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
test('leaves non-agent steps without agent configuration', () => {
|
|
563
|
+
const step = workflowStepDto({
|
|
564
|
+
type: 'run',
|
|
565
|
+
config: {provider: 'anthropic', model: 'claude-opus-4-8', thinking: 'high'},
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
const detail = toWorkflowRunDetail(
|
|
569
|
+
workflowRunDetailDto({
|
|
570
|
+
jobs: [workflowJobDto({steps: [step]})],
|
|
571
|
+
}),
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
expect(detail.jobs[0]?.jobExecutions[0]?.steps[0]?.agentConfig).toBeNull();
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
test('maps run attempt summaries', () => {
|
|
578
|
+
const dto = workflowRunAttemptDto({
|
|
579
|
+
id: '77777777-7777-4777-8777-777777777777',
|
|
580
|
+
workflow_run_id: '11111111-1111-4111-8111-111111111111',
|
|
581
|
+
attempt: 2,
|
|
582
|
+
status: 'failed',
|
|
583
|
+
created_at: '2026-05-07T01:02:00.000Z',
|
|
584
|
+
started_at: '2026-05-07T01:02:10.000Z',
|
|
585
|
+
finished_at: '2026-05-07T01:03:00.000Z',
|
|
586
|
+
rerun_mode: 'all',
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
const attempt = toWorkflowRunAttempt(dto);
|
|
590
|
+
|
|
591
|
+
expect(attempt).toMatchObject({
|
|
592
|
+
id: '77777777-7777-4777-8777-777777777777',
|
|
593
|
+
workflowRunId: '11111111-1111-4111-8111-111111111111',
|
|
594
|
+
attempt: 2,
|
|
595
|
+
status: 'failed',
|
|
596
|
+
createdAt: '2026-05-07T01:02:00.000Z',
|
|
597
|
+
startedAt: '2026-05-07T01:02:10.000Z',
|
|
598
|
+
finishedAt: '2026-05-07T01:03:00.000Z',
|
|
599
|
+
rerunMode: 'all',
|
|
600
|
+
});
|
|
601
|
+
expect(attempt.displayDuration).toMatchObject({state: 'fixed', elapsed: {seconds: 50}});
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
describe('workflow run helpers', () => {
|
|
606
|
+
test('formats trigger labels without dangling separators', () => {
|
|
607
|
+
const withBoth = workflowRunTriggerLabel({triggerSource: 'github', triggerEvent: 'push'});
|
|
608
|
+
const sourceOnly = workflowRunTriggerLabel({triggerSource: 'manual', triggerEvent: ''});
|
|
609
|
+
const neither = workflowRunTriggerLabel({triggerSource: '', triggerEvent: ''});
|
|
610
|
+
|
|
611
|
+
expect(withBoth).toBe('github · push');
|
|
612
|
+
expect(sourceOnly).toBe('manual');
|
|
613
|
+
expect(neither).toBe('');
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
test('formats visible trigger labels as the event name', () => {
|
|
617
|
+
const withBoth = workflowRunTriggerDisplayLabel({
|
|
618
|
+
triggerSource: 'github',
|
|
619
|
+
triggerEvent: 'push',
|
|
620
|
+
});
|
|
621
|
+
const sourceOnly = workflowRunTriggerDisplayLabel({triggerSource: 'manual', triggerEvent: ''});
|
|
622
|
+
const neither = workflowRunTriggerDisplayLabel({triggerSource: '', triggerEvent: ''});
|
|
623
|
+
|
|
624
|
+
expect(withBoth).toBe('push');
|
|
625
|
+
expect(sourceOnly).toBe('manual');
|
|
626
|
+
expect(neither).toBe('');
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
test('formats short ids and classifies workflow statuses', () => {
|
|
630
|
+
const short = workflowRunShortId('abc123');
|
|
631
|
+
const long = workflowRunShortId('66666666-6666-4666-8666-666666666666');
|
|
632
|
+
|
|
633
|
+
expect(short).toBe('abc123');
|
|
634
|
+
expect(long).toBe('66666666');
|
|
635
|
+
expect(isWorkflowRunTerminal('succeeded')).toBe(true);
|
|
636
|
+
expect(isWorkflowRunTerminal('running')).toBe(false);
|
|
637
|
+
expect(isWorkflowStatus('pending')).toBe(true);
|
|
638
|
+
expect(isWorkflowStatus('timed_out')).toBe(false);
|
|
639
|
+
});
|
|
640
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
JobDisplayDuration,
|
|
3
|
+
JobMode,
|
|
4
|
+
JobStatus,
|
|
5
|
+
JobStatusReason,
|
|
6
|
+
ListenerStatus,
|
|
7
|
+
ResolutionReason,
|
|
8
|
+
} from './entities/job.js';
|
|
9
|
+
export {
|
|
10
|
+
defaultJobExecution,
|
|
11
|
+
isTerminalJobStatus,
|
|
12
|
+
Job,
|
|
13
|
+
resolveJobExecution,
|
|
14
|
+
TERMINAL_WORKFLOW_JOB_STATUSES,
|
|
15
|
+
toJob,
|
|
16
|
+
WORKFLOW_JOB_STATUSES,
|
|
17
|
+
} from './entities/job.js';
|
|
18
|
+
export type {
|
|
19
|
+
JobExecutionDisplayDuration,
|
|
20
|
+
JobExecutionStatus,
|
|
21
|
+
JobExecutionTime,
|
|
22
|
+
} from './entities/job-execution.js';
|
|
23
|
+
export {JobExecution, toJobExecution} from './entities/job-execution.js';
|
|
24
|
+
export type {
|
|
25
|
+
AgentConfigIssue,
|
|
26
|
+
AgentStepConfig,
|
|
27
|
+
Step,
|
|
28
|
+
StepError,
|
|
29
|
+
StepErrorCategory,
|
|
30
|
+
StepErrorReason,
|
|
31
|
+
StepSourceLocation,
|
|
32
|
+
} from './entities/step.js';
|
|
33
|
+
export {toStep} from './entities/step.js';
|
|
34
|
+
export type {
|
|
35
|
+
StepAttemptDisplayDuration,
|
|
36
|
+
StepGateResult,
|
|
37
|
+
} from './entities/step-attempt.js';
|
|
38
|
+
export {StepAttempt, toStepAttempt} from './entities/step-attempt.js';
|
|
39
|
+
export type {
|
|
40
|
+
WorkflowRun,
|
|
41
|
+
WorkflowRunDetail,
|
|
42
|
+
WorkflowRunListItem,
|
|
43
|
+
WorkflowRunListPage,
|
|
44
|
+
WorkflowRunStatus,
|
|
45
|
+
WorkflowSourceSnapshot,
|
|
46
|
+
WorkflowStatus,
|
|
47
|
+
} from './entities/workflow-run.js';
|
|
48
|
+
export {
|
|
49
|
+
isWorkflowRunTerminal,
|
|
50
|
+
isWorkflowStatus,
|
|
51
|
+
TERMINAL_WORKFLOW_RUN_STATUSES,
|
|
52
|
+
toWorkflowRun,
|
|
53
|
+
toWorkflowRunDetail,
|
|
54
|
+
toWorkflowRunListItem,
|
|
55
|
+
toWorkflowRunListPage,
|
|
56
|
+
WORKFLOW_RUN_STATUSES,
|
|
57
|
+
workflowRunShortId,
|
|
58
|
+
workflowRunTriggerDisplayLabel,
|
|
59
|
+
workflowRunTriggerLabel,
|
|
60
|
+
} from './entities/workflow-run.js';
|
|
61
|
+
export type {WorkflowRunAttemptDisplayDuration} from './entities/workflow-run-attempt.js';
|
|
62
|
+
export {
|
|
63
|
+
toWorkflowRunAttempt,
|
|
64
|
+
WorkflowRunAttempt,
|
|
65
|
+
WorkflowRunAttemptSummary,
|
|
66
|
+
} from './entities/workflow-run-attempt.js';
|