@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.
Files changed (327) hide show
  1. package/.storybook/main.ts +1 -0
  2. package/.storybook/preview.css +10 -0
  3. package/.storybook/preview.tsx +97 -0
  4. package/.swcrc +42 -0
  5. package/.turbo/turbo-build.log +2 -0
  6. package/.turbo/turbo-type$colon$emit.log +1 -0
  7. package/.turbo/turbo-type.log +1 -0
  8. package/CHANGELOG.md +162 -0
  9. package/LICENSE +21 -0
  10. package/dist/components/identifier/identifier.d.ts +6 -0
  11. package/dist/components/identifier/identifier.d.ts.map +1 -0
  12. package/dist/components/identifier/identifier.js +144 -0
  13. package/dist/components/identifier/identifier.js.map +1 -0
  14. package/dist/components/identifier/index.d.ts +2 -0
  15. package/dist/components/identifier/index.d.ts.map +1 -0
  16. package/dist/components/identifier/index.js +3 -0
  17. package/dist/components/identifier/index.js.map +1 -0
  18. package/dist/components/job-graph/graph-model.d.ts +27 -0
  19. package/dist/components/job-graph/graph-model.d.ts.map +1 -0
  20. package/dist/components/job-graph/graph-model.js +107 -0
  21. package/dist/components/job-graph/graph-model.js.map +1 -0
  22. package/dist/components/job-graph/index.d.ts +3 -0
  23. package/dist/components/job-graph/index.d.ts.map +1 -0
  24. package/dist/components/job-graph/index.js +3 -0
  25. package/dist/components/job-graph/index.js.map +1 -0
  26. package/dist/components/job-graph/job-duration-format.d.ts +4 -0
  27. package/dist/components/job-graph/job-duration-format.d.ts.map +1 -0
  28. package/dist/components/job-graph/job-duration-format.js +41 -0
  29. package/dist/components/job-graph/job-duration-format.js.map +1 -0
  30. package/dist/components/job-graph/job-duration-label.d.ts +5 -0
  31. package/dist/components/job-graph/job-duration-label.d.ts.map +1 -0
  32. package/dist/components/job-graph/job-duration-label.js +33 -0
  33. package/dist/components/job-graph/job-duration-label.js.map +1 -0
  34. package/dist/components/job-graph/job-graph-content.d.ts +9 -0
  35. package/dist/components/job-graph/job-graph-content.d.ts.map +1 -0
  36. package/dist/components/job-graph/job-graph-content.js +181 -0
  37. package/dist/components/job-graph/job-graph-content.js.map +1 -0
  38. package/dist/components/job-graph/job-graph-view.d.ts +11 -0
  39. package/dist/components/job-graph/job-graph-view.d.ts.map +1 -0
  40. package/dist/components/job-graph/job-graph-view.js +24 -0
  41. package/dist/components/job-graph/job-graph-view.js.map +1 -0
  42. package/dist/components/job-graph/job-graph.d.ts +3 -0
  43. package/dist/components/job-graph/job-graph.d.ts.map +1 -0
  44. package/dist/components/job-graph/job-graph.js +21 -0
  45. package/dist/components/job-graph/job-graph.js.map +1 -0
  46. package/dist/components/job-graph/job-node.d.ts +16 -0
  47. package/dist/components/job-graph/job-node.d.ts.map +1 -0
  48. package/dist/components/job-graph/job-node.js +196 -0
  49. package/dist/components/job-graph/job-node.js.map +1 -0
  50. package/dist/components/job-graph/types.d.ts +9 -0
  51. package/dist/components/job-graph/types.d.ts.map +1 -0
  52. package/dist/components/job-graph/types.js +3 -0
  53. package/dist/components/job-graph/types.js.map +1 -0
  54. package/dist/components/step-list/index.d.ts +3 -0
  55. package/dist/components/step-list/index.d.ts.map +1 -0
  56. package/dist/components/step-list/index.js +3 -0
  57. package/dist/components/step-list/index.js.map +1 -0
  58. package/dist/components/step-list/step-list-model.d.ts +36 -0
  59. package/dist/components/step-list/step-list-model.d.ts.map +1 -0
  60. package/dist/components/step-list/step-list-model.js +135 -0
  61. package/dist/components/step-list/step-list-model.js.map +1 -0
  62. package/dist/components/step-list/step-list.d.ts +32 -0
  63. package/dist/components/step-list/step-list.d.ts.map +1 -0
  64. package/dist/components/step-list/step-list.js +409 -0
  65. package/dist/components/step-list/step-list.js.map +1 -0
  66. package/dist/components/workflow-run-duration-label.d.ts +8 -0
  67. package/dist/components/workflow-run-duration-label.d.ts.map +1 -0
  68. package/dist/components/workflow-run-duration-label.js +84 -0
  69. package/dist/components/workflow-run-duration-label.js.map +1 -0
  70. package/dist/components/workflow-run-list/index.d.ts +2 -0
  71. package/dist/components/workflow-run-list/index.d.ts.map +1 -0
  72. package/dist/components/workflow-run-list/index.js +3 -0
  73. package/dist/components/workflow-run-list/index.js.map +1 -0
  74. package/dist/components/workflow-run-list/run-display.d.ts +5 -0
  75. package/dist/components/workflow-run-list/run-display.d.ts.map +1 -0
  76. package/dist/components/workflow-run-list/run-display.js +19 -0
  77. package/dist/components/workflow-run-list/run-display.js.map +1 -0
  78. package/dist/components/workflow-run-list/types.d.ts +21 -0
  79. package/dist/components/workflow-run-list/types.d.ts.map +1 -0
  80. package/dist/components/workflow-run-list/types.js +3 -0
  81. package/dist/components/workflow-run-list/types.js.map +1 -0
  82. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts +14 -0
  83. package/dist/components/workflow-run-list/workflow-run-list-content.d.ts.map +1 -0
  84. package/dist/components/workflow-run-list/workflow-run-list-content.js +37 -0
  85. package/dist/components/workflow-run-list/workflow-run-list-content.js.map +1 -0
  86. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts +10 -0
  87. package/dist/components/workflow-run-list/workflow-run-list-header.d.ts.map +1 -0
  88. package/dist/components/workflow-run-list/workflow-run-list-header.js +55 -0
  89. package/dist/components/workflow-run-list/workflow-run-list-header.js.map +1 -0
  90. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts +15 -0
  91. package/dist/components/workflow-run-list/workflow-run-list-states.d.ts.map +1 -0
  92. package/dist/components/workflow-run-list/workflow-run-list-states.js +103 -0
  93. package/dist/components/workflow-run-list/workflow-run-list-states.js.map +1 -0
  94. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts +3 -0
  95. package/dist/components/workflow-run-list/workflow-run-list-view.d.ts.map +1 -0
  96. package/dist/components/workflow-run-list/workflow-run-list-view.js +46 -0
  97. package/dist/components/workflow-run-list/workflow-run-list-view.js.map +1 -0
  98. package/dist/components/workflow-run-list/workflow-run-list.d.ts +3 -0
  99. package/dist/components/workflow-run-list/workflow-run-list.d.ts.map +1 -0
  100. package/dist/components/workflow-run-list/workflow-run-list.js +20 -0
  101. package/dist/components/workflow-run-list/workflow-run-list.js.map +1 -0
  102. package/dist/components/workflow-run-list/workflow-run-row.d.ts +14 -0
  103. package/dist/components/workflow-run-list/workflow-run-row.d.ts.map +1 -0
  104. package/dist/components/workflow-run-list/workflow-run-row.js +172 -0
  105. package/dist/components/workflow-run-list/workflow-run-row.js.map +1 -0
  106. package/dist/components/workflow-run-summary/index.d.ts +2 -0
  107. package/dist/components/workflow-run-summary/index.d.ts.map +1 -0
  108. package/dist/components/workflow-run-summary/index.js +3 -0
  109. package/dist/components/workflow-run-summary/index.js.map +1 -0
  110. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts +9 -0
  111. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.d.ts.map +1 -0
  112. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js +138 -0
  113. package/dist/components/workflow-run-summary/workflow-run-attempt-switcher.js.map +1 -0
  114. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts +20 -0
  115. package/dist/components/workflow-run-summary/workflow-run-summary.d.ts.map +1 -0
  116. package/dist/components/workflow-run-summary/workflow-run-summary.js +252 -0
  117. package/dist/components/workflow-run-summary/workflow-run-summary.js.map +1 -0
  118. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts +7 -0
  119. package/dist/components/workflow-run-view/agent-config-failure-callout.d.ts.map +1 -0
  120. package/dist/components/workflow-run-view/agent-config-failure-callout.js +84 -0
  121. package/dist/components/workflow-run-view/agent-config-failure-callout.js.map +1 -0
  122. package/dist/components/workflow-run-view/index.d.ts +3 -0
  123. package/dist/components/workflow-run-view/index.d.ts.map +1 -0
  124. package/dist/components/workflow-run-view/index.js +4 -0
  125. package/dist/components/workflow-run-view/index.js.map +1 -0
  126. package/dist/components/workflow-run-view/job-card.d.ts +17 -0
  127. package/dist/components/workflow-run-view/job-card.d.ts.map +1 -0
  128. package/dist/components/workflow-run-view/job-card.js +476 -0
  129. package/dist/components/workflow-run-view/job-card.js.map +1 -0
  130. package/dist/components/workflow-run-view/job-execution-switcher.d.ts +10 -0
  131. package/dist/components/workflow-run-view/job-execution-switcher.d.ts.map +1 -0
  132. package/dist/components/workflow-run-view/job-execution-switcher.js +171 -0
  133. package/dist/components/workflow-run-view/job-execution-switcher.js.map +1 -0
  134. package/dist/components/workflow-run-view/job-execution-time-text.d.ts +6 -0
  135. package/dist/components/workflow-run-view/job-execution-time-text.d.ts.map +1 -0
  136. package/dist/components/workflow-run-view/job-execution-time-text.js +24 -0
  137. package/dist/components/workflow-run-view/job-execution-time-text.js.map +1 -0
  138. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts +9 -0
  139. package/dist/components/workflow-run-view/step-attempt-log-panel.d.ts.map +1 -0
  140. package/dist/components/workflow-run-view/step-attempt-log-panel.js +152 -0
  141. package/dist/components/workflow-run-view/step-attempt-log-panel.js.map +1 -0
  142. package/dist/components/workflow-run-view/workflow-run-selection.d.ts +14 -0
  143. package/dist/components/workflow-run-view/workflow-run-selection.d.ts.map +1 -0
  144. package/dist/components/workflow-run-view/workflow-run-selection.js +56 -0
  145. package/dist/components/workflow-run-view/workflow-run-selection.js.map +1 -0
  146. package/dist/components/workflow-run-view/workflow-run-states.d.ts +12 -0
  147. package/dist/components/workflow-run-view/workflow-run-states.d.ts.map +1 -0
  148. package/dist/components/workflow-run-view/workflow-run-states.js +91 -0
  149. package/dist/components/workflow-run-view/workflow-run-states.js.map +1 -0
  150. package/dist/components/workflow-run-view/workflow-run-view.d.ts +15 -0
  151. package/dist/components/workflow-run-view/workflow-run-view.d.ts.map +1 -0
  152. package/dist/components/workflow-run-view/workflow-run-view.js +285 -0
  153. package/dist/components/workflow-run-view/workflow-run-view.js.map +1 -0
  154. package/dist/components/workflow-source-panel/index.d.ts +2 -0
  155. package/dist/components/workflow-source-panel/index.d.ts.map +1 -0
  156. package/dist/components/workflow-source-panel/index.js +3 -0
  157. package/dist/components/workflow-source-panel/index.js.map +1 -0
  158. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts +13 -0
  159. package/dist/components/workflow-source-panel/workflow-source-panel.d.ts.map +1 -0
  160. package/dist/components/workflow-source-panel/workflow-source-panel.js +91 -0
  161. package/dist/components/workflow-source-panel/workflow-source-panel.js.map +1 -0
  162. package/dist/components/workflow-status/status-visuals.d.ts +12 -0
  163. package/dist/components/workflow-status/status-visuals.d.ts.map +1 -0
  164. package/dist/components/workflow-status/status-visuals.js +54 -0
  165. package/dist/components/workflow-status/status-visuals.js.map +1 -0
  166. package/dist/components/workflow-status/workflow-status-icon.d.ts +22 -0
  167. package/dist/components/workflow-status/workflow-status-icon.d.ts.map +1 -0
  168. package/dist/components/workflow-status/workflow-status-icon.js +100 -0
  169. package/dist/components/workflow-status/workflow-status-icon.js.map +1 -0
  170. package/dist/core/entities/job-execution.d.ts +69 -0
  171. package/dist/core/entities/job-execution.d.ts.map +1 -0
  172. package/dist/core/entities/job-execution.js +83 -0
  173. package/dist/core/entities/job-execution.js.map +1 -0
  174. package/dist/core/entities/job.d.ts +56 -0
  175. package/dist/core/entities/job.d.ts.map +1 -0
  176. package/dist/core/entities/job.js +71 -0
  177. package/dist/core/entities/job.js.map +1 -0
  178. package/dist/core/entities/step-attempt.d.ts +49 -0
  179. package/dist/core/entities/step-attempt.d.ts.map +1 -0
  180. package/dist/core/entities/step-attempt.js +48 -0
  181. package/dist/core/entities/step-attempt.js.map +1 -0
  182. package/dist/core/entities/step.d.ts +41 -0
  183. package/dist/core/entities/step.d.ts.map +1 -0
  184. package/dist/core/entities/step.js +51 -0
  185. package/dist/core/entities/step.js.map +1 -0
  186. package/dist/core/entities/workflow-run-attempt.d.ts +44 -0
  187. package/dist/core/entities/workflow-run-attempt.d.ts.map +1 -0
  188. package/dist/core/entities/workflow-run-attempt.js +51 -0
  189. package/dist/core/entities/workflow-run-attempt.js.map +1 -0
  190. package/dist/core/entities/workflow-run.d.ts +61 -0
  191. package/dist/core/entities/workflow-run.d.ts.map +1 -0
  192. package/dist/core/entities/workflow-run.js +104 -0
  193. package/dist/core/entities/workflow-run.js.map +1 -0
  194. package/dist/core/workflow-run-url-state.d.ts +13 -0
  195. package/dist/core/workflow-run-url-state.d.ts.map +1 -0
  196. package/dist/core/workflow-run-url-state.js +43 -0
  197. package/dist/core/workflow-run-url-state.js.map +1 -0
  198. package/dist/core/workflow-run.d.ts +13 -0
  199. package/dist/core/workflow-run.d.ts.map +1 -0
  200. package/dist/core/workflow-run.js +8 -0
  201. package/dist/core/workflow-run.js.map +1 -0
  202. package/dist/env.d.js +2 -0
  203. package/dist/env.d.js.map +1 -0
  204. package/dist/feature.d.ts +20 -0
  205. package/dist/feature.d.ts.map +1 -0
  206. package/dist/feature.js +27 -0
  207. package/dist/feature.js.map +1 -0
  208. package/dist/hooks/api/workflow-runs.d.ts +109 -0
  209. package/dist/hooks/api/workflow-runs.d.ts.map +1 -0
  210. package/dist/hooks/api/workflow-runs.js +394 -0
  211. package/dist/hooks/api/workflow-runs.js.map +1 -0
  212. package/dist/index.d.ts +5 -0
  213. package/dist/index.d.ts.map +1 -0
  214. package/dist/index.js +5 -0
  215. package/dist/index.js.map +1 -0
  216. package/dist/pages/workflow-run-first-time-use.d.ts +6 -0
  217. package/dist/pages/workflow-run-first-time-use.d.ts.map +1 -0
  218. package/dist/pages/workflow-run-first-time-use.js +17 -0
  219. package/dist/pages/workflow-run-first-time-use.js.map +1 -0
  220. package/dist/pages/workflow-run-page.d.ts +8 -0
  221. package/dist/pages/workflow-run-page.d.ts.map +1 -0
  222. package/dist/pages/workflow-run-page.js +83 -0
  223. package/dist/pages/workflow-run-page.js.map +1 -0
  224. package/dist/routes/run-detail.d.ts +8 -0
  225. package/dist/routes/run-detail.d.ts.map +1 -0
  226. package/dist/routes/run-detail.js +21 -0
  227. package/dist/routes/run-detail.js.map +1 -0
  228. package/dist/routes/runs.d.ts +8 -0
  229. package/dist/routes/runs.d.ts.map +1 -0
  230. package/dist/routes/runs.js +20 -0
  231. package/dist/routes/runs.js.map +1 -0
  232. package/dist/tsconfig.test.tsbuildinfo +1 -0
  233. package/package.json +114 -0
  234. package/src/components/identifier/identifier.tsx +178 -0
  235. package/src/components/identifier/index.ts +1 -0
  236. package/src/components/job-graph/graph-model.test.ts +189 -0
  237. package/src/components/job-graph/graph-model.ts +178 -0
  238. package/src/components/job-graph/index.ts +2 -0
  239. package/src/components/job-graph/job-duration-format.ts +54 -0
  240. package/src/components/job-graph/job-duration-label.tsx +29 -0
  241. package/src/components/job-graph/job-graph-content.tsx +225 -0
  242. package/src/components/job-graph/job-graph-view.test.tsx +298 -0
  243. package/src/components/job-graph/job-graph-view.tsx +45 -0
  244. package/src/components/job-graph/job-graph.stories.tsx +182 -0
  245. package/src/components/job-graph/job-graph.tsx +24 -0
  246. package/src/components/job-graph/job-node.stories.tsx +364 -0
  247. package/src/components/job-graph/job-node.test.tsx +347 -0
  248. package/src/components/job-graph/job-node.tsx +202 -0
  249. package/src/components/job-graph/types.ts +9 -0
  250. package/src/components/step-list/index.ts +6 -0
  251. package/src/components/step-list/step-list-model.test.ts +369 -0
  252. package/src/components/step-list/step-list-model.ts +205 -0
  253. package/src/components/step-list/step-list.stories.tsx +419 -0
  254. package/src/components/step-list/step-list.test.tsx +566 -0
  255. package/src/components/step-list/step-list.tsx +494 -0
  256. package/src/components/workflow-run-duration-label.tsx +118 -0
  257. package/src/components/workflow-run-list/index.ts +1 -0
  258. package/src/components/workflow-run-list/run-display.test.ts +53 -0
  259. package/src/components/workflow-run-list/run-display.ts +22 -0
  260. package/src/components/workflow-run-list/types.ts +22 -0
  261. package/src/components/workflow-run-list/workflow-run-list-content.tsx +58 -0
  262. package/src/components/workflow-run-list/workflow-run-list-header.tsx +53 -0
  263. package/src/components/workflow-run-list/workflow-run-list-states.tsx +86 -0
  264. package/src/components/workflow-run-list/workflow-run-list-view.test.tsx +178 -0
  265. package/src/components/workflow-run-list/workflow-run-list-view.tsx +57 -0
  266. package/src/components/workflow-run-list/workflow-run-list.stories.tsx +111 -0
  267. package/src/components/workflow-run-list/workflow-run-list.tsx +29 -0
  268. package/src/components/workflow-run-list/workflow-run-row.tsx +176 -0
  269. package/src/components/workflow-run-summary/index.ts +1 -0
  270. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.test.tsx +230 -0
  271. package/src/components/workflow-run-summary/workflow-run-attempt-switcher.tsx +146 -0
  272. package/src/components/workflow-run-summary/workflow-run-summary.stories.tsx +414 -0
  273. package/src/components/workflow-run-summary/workflow-run-summary.test.tsx +354 -0
  274. package/src/components/workflow-run-summary/workflow-run-summary.tsx +295 -0
  275. package/src/components/workflow-run-view/agent-config-failure-callout.stories.tsx +140 -0
  276. package/src/components/workflow-run-view/agent-config-failure-callout.tsx +93 -0
  277. package/src/components/workflow-run-view/index.ts +2 -0
  278. package/src/components/workflow-run-view/job-card.stories.tsx +788 -0
  279. package/src/components/workflow-run-view/job-card.tsx +566 -0
  280. package/src/components/workflow-run-view/job-execution-switcher.tsx +170 -0
  281. package/src/components/workflow-run-view/job-execution-time-text.tsx +34 -0
  282. package/src/components/workflow-run-view/step-attempt-log-panel.test.tsx +290 -0
  283. package/src/components/workflow-run-view/step-attempt-log-panel.tsx +152 -0
  284. package/src/components/workflow-run-view/workflow-run-selection.test.ts +280 -0
  285. package/src/components/workflow-run-view/workflow-run-selection.ts +89 -0
  286. package/src/components/workflow-run-view/workflow-run-states.tsx +70 -0
  287. package/src/components/workflow-run-view/workflow-run-view.test.tsx +1214 -0
  288. package/src/components/workflow-run-view/workflow-run-view.tsx +341 -0
  289. package/src/components/workflow-source-panel/index.ts +1 -0
  290. package/src/components/workflow-source-panel/workflow-source-panel.stories.tsx +110 -0
  291. package/src/components/workflow-source-panel/workflow-source-panel.test.tsx +96 -0
  292. package/src/components/workflow-source-panel/workflow-source-panel.tsx +136 -0
  293. package/src/components/workflow-status/status-visuals.test.ts +38 -0
  294. package/src/components/workflow-status/status-visuals.ts +36 -0
  295. package/src/components/workflow-status/workflow-status-icon.stories.tsx +90 -0
  296. package/src/components/workflow-status/workflow-status-icon.tsx +135 -0
  297. package/src/core/entities/job-execution.ts +139 -0
  298. package/src/core/entities/job.ts +149 -0
  299. package/src/core/entities/step-attempt.ts +89 -0
  300. package/src/core/entities/step.ts +105 -0
  301. package/src/core/entities/workflow-run-attempt.ts +87 -0
  302. package/src/core/entities/workflow-run.ts +183 -0
  303. package/src/core/workflow-run-url-state.ts +61 -0
  304. package/src/core/workflow-run.test.ts +640 -0
  305. package/src/core/workflow-run.ts +66 -0
  306. package/src/env.d.ts +8 -0
  307. package/src/feature.ts +26 -0
  308. package/src/hooks/api/workflow-runs.test.tsx +410 -0
  309. package/src/hooks/api/workflow-runs.ts +485 -0
  310. package/src/index.ts +45 -0
  311. package/src/page-harness-budget.test.ts +33 -0
  312. package/src/pages/workflow-run-first-time-use.tsx +17 -0
  313. package/src/pages/workflow-run-page.test.tsx +517 -0
  314. package/src/pages/workflow-run-page.tsx +89 -0
  315. package/src/routes/run-detail.tsx +15 -0
  316. package/src/routes/runs.tsx +11 -0
  317. package/test/fixtures/logs.ts +13 -0
  318. package/test/fixtures/workflow-run.ts +311 -0
  319. package/test/pages.tsx +79 -0
  320. package/test/render.tsx +40 -0
  321. package/test/setup.ts +3 -0
  322. package/tsconfig.build.json +9 -0
  323. package/tsconfig.build.tsbuildinfo +1 -0
  324. package/tsconfig.json +3 -0
  325. package/tsconfig.test.json +8 -0
  326. package/vercel.json +8 -0
  327. package/vitest.config.ts +70 -0
@@ -0,0 +1,566 @@
1
+ import type {StepAttemptDto, WorkflowRunStepDetailDto} from '@shipfox/api-workflows-dto';
2
+ import {Text} from '@shipfox/react-ui/typography';
3
+ import {render, screen} from '@testing-library/react';
4
+ import userEvent from '@testing-library/user-event';
5
+ import {useState} from 'react';
6
+ import type {Job} from '#core/workflow-run.js';
7
+ import {
8
+ type JobDtoOverrides,
9
+ workflowJob,
10
+ workflowJobExecutionDto,
11
+ workflowStepAttemptDto,
12
+ workflowStepDto,
13
+ } from '#test/fixtures/workflow-run.js';
14
+ import {StepList} from './step-list.js';
15
+
16
+ const LOGS_FOR_RE = /^logs for /u;
17
+
18
+ describe('StepList', () => {
19
+ test('renders a labelled flat step list', () => {
20
+ render(
21
+ <StepList
22
+ job={makeJob({
23
+ steps: [makeStep({name: 'build', attempts: [makeAttempt({status: 'running'})]})],
24
+ })}
25
+ />,
26
+ );
27
+
28
+ expect(screen.getByRole('region', {name: 'build'})).toBeInTheDocument();
29
+ expect(screen.queryByText('1 step')).not.toBeInTheDocument();
30
+ expect(screen.getByRole('button', {name: 'build, Running, attempt 1'})).toBeInTheDocument();
31
+ expect(screen.queryByText('Grouped')).not.toBeInTheDocument();
32
+ });
33
+
34
+ test('expands and collapses a row without rendering built-in detail content', async () => {
35
+ const user = userEvent.setup();
36
+ render(
37
+ <StepList
38
+ job={makeJob({
39
+ steps: [makeStep({name: 'build', attempts: [makeAttempt({status: 'running'})]})],
40
+ })}
41
+ />,
42
+ );
43
+ const build = screen.getByRole('button', {name: 'build, Running, attempt 1'});
44
+
45
+ await user.click(build);
46
+
47
+ expect(build).toHaveAttribute('aria-expanded', 'false');
48
+ expect(screen.queryByText('Source')).not.toBeInTheDocument();
49
+
50
+ await user.click(build);
51
+
52
+ expect(build).toHaveAttribute('aria-expanded', 'false');
53
+ });
54
+
55
+ test('renders expanded slot content with the selected attempt context', async () => {
56
+ const user = userEvent.setup();
57
+ const attempt = makeAttempt({status: 'running'});
58
+ const step = makeStep({
59
+ name: 'deploy',
60
+ status: 'running',
61
+ source_location: {start_line: 4, end_line: 6},
62
+ attempts: [attempt],
63
+ });
64
+ render(
65
+ <StepList
66
+ job={makeJob({steps: [step]})}
67
+ renderExpandedStep={({
68
+ stepId,
69
+ stepLabel,
70
+ sourceLocation,
71
+ attempt,
72
+ attemptId,
73
+ attemptStatus,
74
+ }) => (
75
+ <Text size="sm">
76
+ slot for {stepId} label {stepLabel} lines{' '}
77
+ {sourceLocation ? `${sourceLocation.startLine}-${sourceLocation.endLine}` : 'none'}{' '}
78
+ attempt {attempt} id {attemptId} status {attemptStatus}
79
+ </Text>
80
+ )}
81
+ />,
82
+ );
83
+ const deploy = screen.getByRole('button', {name: 'deploy, Running, attempt 1'});
84
+
85
+ await user.click(deploy);
86
+
87
+ expect(deploy).toHaveAttribute('aria-expanded', 'true');
88
+ expect(
89
+ screen.getByText(
90
+ `slot for ${step.id} label deploy lines 4-6 attempt 1 id ${attempt.id} status running`,
91
+ ),
92
+ ).toBeInTheDocument();
93
+ });
94
+
95
+ test('keeps multiple expanded rows open', async () => {
96
+ const user = userEvent.setup();
97
+ const buildAttempt = makeAttempt({status: 'succeeded'});
98
+ const deployAttempt = makeAttempt({status: 'running'});
99
+ const build = makeStep({name: 'build', attempts: [buildAttempt]});
100
+ const deploy = makeStep({name: 'deploy', position: 1, attempts: [deployAttempt]});
101
+ render(
102
+ <StepList
103
+ job={makeJob({steps: [build, deploy]})}
104
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
105
+ />,
106
+ );
107
+ const buildRow = screen.getByRole('button', {name: 'build, Succeeded, attempt 1'});
108
+ const deployRow = screen.getByRole('button', {name: 'deploy, Running, attempt 1'});
109
+
110
+ await user.click(buildRow);
111
+ await user.click(deployRow);
112
+
113
+ expect(buildRow).toHaveAttribute('aria-expanded', 'true');
114
+ expect(deployRow).toHaveAttribute('aria-expanded', 'true');
115
+ expect(screen.getByText(`logs for ${buildAttempt.id}`)).toBeInTheDocument();
116
+ expect(screen.getByText(`logs for ${deployAttempt.id}`)).toBeInTheDocument();
117
+ });
118
+
119
+ test('keeps multiple expanded rows open when external attempt selection is singular', async () => {
120
+ const user = userEvent.setup();
121
+ const buildAttempt = makeAttempt({status: 'succeeded'});
122
+ const deployAttempt = makeAttempt({status: 'running'});
123
+ const build = makeStep({name: 'build', attempts: [buildAttempt]});
124
+ const deploy = makeStep({name: 'deploy', position: 1, attempts: [deployAttempt]});
125
+ const job = makeJob({steps: [build, deploy]});
126
+
127
+ function ControlledStepList() {
128
+ const [selectedAttemptId, setSelectedAttemptId] = useState<string | null>(null);
129
+
130
+ return (
131
+ <StepList
132
+ job={job}
133
+ selectedAttemptId={selectedAttemptId}
134
+ onSelectedAttemptChange={(attemptId) => setSelectedAttemptId(attemptId ?? null)}
135
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
136
+ />
137
+ );
138
+ }
139
+
140
+ render(<ControlledStepList />);
141
+ const buildRow = screen.getByRole('button', {name: 'build, Succeeded, attempt 1'});
142
+ const deployRow = screen.getByRole('button', {name: 'deploy, Running, attempt 1'});
143
+
144
+ await user.click(buildRow);
145
+ await user.click(deployRow);
146
+
147
+ expect(buildRow).toHaveAttribute('aria-expanded', 'true');
148
+ expect(deployRow).toHaveAttribute('aria-expanded', 'true');
149
+ expect(screen.getByText(`logs for ${buildAttempt.id}`)).toBeInTheDocument();
150
+ expect(screen.getByText(`logs for ${deployAttempt.id}`)).toBeInTheDocument();
151
+ });
152
+
153
+ test('reports selection changes including collapse', async () => {
154
+ const user = userEvent.setup();
155
+ const onSelectedAttemptChange = vi.fn();
156
+ const attempt = makeAttempt();
157
+ const step = makeStep({name: 'deploy', attempts: [attempt]});
158
+ render(
159
+ <StepList job={makeJob({steps: [step]})} onSelectedAttemptChange={onSelectedAttemptChange} />,
160
+ );
161
+ const deploy = screen.getByRole('button', {name: 'deploy, Pending, attempt 1'});
162
+
163
+ await user.click(deploy);
164
+ await user.click(deploy);
165
+
166
+ expect(onSelectedAttemptChange).toHaveBeenNthCalledWith(1, attempt.id);
167
+ expect(onSelectedAttemptChange).toHaveBeenNthCalledWith(2, undefined);
168
+ });
169
+
170
+ test('keeps row selection singular when no expanded content is rendered', async () => {
171
+ const user = userEvent.setup();
172
+ const buildAttempt = makeAttempt({status: 'succeeded'});
173
+ const deployAttempt = makeAttempt({status: 'running'});
174
+ const build = makeStep({name: 'build', attempts: [buildAttempt]});
175
+ const deploy = makeStep({name: 'deploy', position: 1, attempts: [deployAttempt]});
176
+ render(<StepList job={makeJob({steps: [build, deploy]})} />);
177
+ const buildRow = screen.getByRole('button', {name: 'build, Succeeded, attempt 1'});
178
+ const deployRow = screen.getByRole('button', {name: 'deploy, Running, attempt 1'});
179
+
180
+ await user.click(buildRow);
181
+ await user.click(deployRow);
182
+
183
+ expect(buildRow).not.toHaveClass('bg-background-components-hover');
184
+ expect(deployRow).toHaveClass('bg-background-components-hover');
185
+ });
186
+
187
+ test('opens a default selected attempt', () => {
188
+ const attempt = makeAttempt();
189
+ const step = makeStep({name: 'deploy', attempts: [attempt]});
190
+ render(
191
+ <StepList
192
+ job={makeJob({steps: [step]})}
193
+ defaultSelectedAttemptId={attempt.id}
194
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
195
+ />,
196
+ );
197
+
198
+ expect(screen.getByRole('button', {name: 'deploy, Pending, attempt 1'})).toHaveAttribute(
199
+ 'aria-expanded',
200
+ 'true',
201
+ );
202
+ expect(screen.getByText(`logs for ${attempt.id}`)).toBeInTheDocument();
203
+ });
204
+
205
+ test('starts collapsed for a controlled empty selected attempt', async () => {
206
+ const user = userEvent.setup();
207
+ const onSelectedAttemptChange = vi.fn();
208
+ const attempt = makeAttempt();
209
+ const step = makeStep({name: 'deploy', attempts: [attempt]});
210
+ const job = makeJob({steps: [step]});
211
+ const {rerender} = render(
212
+ <StepList
213
+ job={job}
214
+ defaultSelectedAttemptId={attempt.id}
215
+ selectedAttemptId={attempt.id}
216
+ onSelectedAttemptChange={onSelectedAttemptChange}
217
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
218
+ />,
219
+ );
220
+ const deploy = screen.getByRole('button', {name: 'deploy, Pending, attempt 1'});
221
+ expect(screen.getByText(`logs for ${attempt.id}`)).toBeInTheDocument();
222
+
223
+ rerender(
224
+ <StepList
225
+ job={job}
226
+ defaultSelectedAttemptId={attempt.id}
227
+ selectedAttemptId={null}
228
+ onSelectedAttemptChange={onSelectedAttemptChange}
229
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
230
+ />,
231
+ );
232
+ expect(screen.queryByText(`logs for ${attempt.id}`)).not.toBeInTheDocument();
233
+
234
+ await user.click(deploy);
235
+
236
+ expect(screen.getByText(`logs for ${attempt.id}`)).toBeInTheDocument();
237
+ expect(onSelectedAttemptChange).toHaveBeenCalledWith(attempt.id);
238
+ });
239
+
240
+ test('auto-opens the latest running attempt', () => {
241
+ const installAttempt = makeAttempt({status: 'running', execution_order: 2});
242
+ const deployAttempt = makeAttempt({status: 'running', execution_order: 4});
243
+ const finishedAttempt = makeAttempt({status: 'succeeded', execution_order: 5});
244
+ render(
245
+ <StepList
246
+ job={makeJob({
247
+ steps: [
248
+ makeStep({
249
+ name: 'install',
250
+ status: 'running',
251
+ attempts: [installAttempt],
252
+ }),
253
+ makeStep({
254
+ name: 'deploy',
255
+ position: 1,
256
+ status: 'running',
257
+ attempts: [deployAttempt],
258
+ }),
259
+ makeStep({
260
+ name: 'notify',
261
+ position: 2,
262
+ status: 'succeeded',
263
+ attempts: [finishedAttempt],
264
+ }),
265
+ ],
266
+ })}
267
+ autoSelectActiveAttempt
268
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
269
+ />,
270
+ );
271
+
272
+ expect(screen.getByRole('button', {name: 'install, Running, attempt 1'})).toHaveAttribute(
273
+ 'aria-expanded',
274
+ 'false',
275
+ );
276
+ expect(screen.getByRole('button', {name: 'deploy, Running, attempt 1'})).toHaveAttribute(
277
+ 'aria-expanded',
278
+ 'true',
279
+ );
280
+ expect(screen.getByText(`logs for ${deployAttempt.id}`)).toBeInTheDocument();
281
+ });
282
+
283
+ test('does not auto-open when no attempt is running', () => {
284
+ render(
285
+ <StepList
286
+ job={makeJob({
287
+ steps: [makeStep({name: 'deploy', attempts: [makeAttempt({status: 'succeeded'})]})],
288
+ })}
289
+ autoSelectActiveAttempt
290
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
291
+ />,
292
+ );
293
+
294
+ expect(screen.getByRole('button', {name: 'deploy, Succeeded, attempt 1'})).toHaveAttribute(
295
+ 'aria-expanded',
296
+ 'false',
297
+ );
298
+ expect(screen.queryByText(LOGS_FOR_RE)).not.toBeInTheDocument();
299
+ });
300
+
301
+ test('preserves manual collapse across same-job polling and resets on job change', async () => {
302
+ const user = userEvent.setup();
303
+ const attempt = makeAttempt({status: 'running'});
304
+ const step = makeStep({name: 'deploy', status: 'running', attempts: [attempt]});
305
+ const job = makeJob({steps: [step]});
306
+ const {rerender} = render(
307
+ <StepList
308
+ job={job}
309
+ autoSelectActiveAttempt
310
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
311
+ />,
312
+ );
313
+ const deploy = screen.getByRole('button', {name: 'deploy, Running, attempt 1'});
314
+ expect(screen.getByText(`logs for ${attempt.id}`)).toBeInTheDocument();
315
+
316
+ await user.click(deploy);
317
+ rerender(
318
+ <StepList
319
+ job={makeJob({
320
+ id: job.id,
321
+ name: job.name,
322
+ key: job.key,
323
+ status: job.status,
324
+ job_executions: [
325
+ workflowJobExecutionDto({
326
+ id: job.jobExecutions[0]?.id ?? '77777777-7777-4777-8777-000000000001',
327
+ job_id: job.id,
328
+ steps: [step],
329
+ }),
330
+ ],
331
+ updated_at: '2026-06-21T12:02:00.000Z',
332
+ })}
333
+ autoSelectActiveAttempt
334
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
335
+ />,
336
+ );
337
+
338
+ expect(screen.queryByText(`logs for ${attempt.id}`)).not.toBeInTheDocument();
339
+
340
+ const nextAttempt = makeAttempt({status: 'running'});
341
+ const nextStep = makeStep({name: 'test', status: 'running', attempts: [nextAttempt]});
342
+ rerender(
343
+ <StepList
344
+ job={makeJob({
345
+ id: '44444444-4444-4444-8444-000000000002',
346
+ name: 'test',
347
+ steps: [nextStep],
348
+ })}
349
+ autoSelectActiveAttempt
350
+ renderExpandedStep={({attemptId}) => <Text size="sm">logs for {attemptId}</Text>}
351
+ />,
352
+ );
353
+
354
+ expect(screen.getByText(`logs for ${nextAttempt.id}`)).toBeInTheDocument();
355
+ });
356
+
357
+ test('renders each attempt as its own flat row', () => {
358
+ render(
359
+ <StepList
360
+ job={makeJob({
361
+ steps: [
362
+ makeStep({
363
+ name: 'gate',
364
+ status: 'failed',
365
+ error: {message: 'Gate failed', category: 'user', reason: 'agent_invocation_failed'},
366
+ attempts: [
367
+ makeAttempt({attempt: 1, status: 'failed', exit_code: 1}),
368
+ makeAttempt({
369
+ attempt: 2,
370
+ status: 'failed',
371
+ exit_code: 2,
372
+ restart_feedback: 'retry',
373
+ }),
374
+ ],
375
+ }),
376
+ ],
377
+ })}
378
+ />,
379
+ );
380
+
381
+ expect(
382
+ screen.getByRole('button', {
383
+ name: 'gate, Failed, attempt 1, User',
384
+ }),
385
+ ).toBeInTheDocument();
386
+ expect(
387
+ screen.getByRole('button', {
388
+ name: 'gate, Failed, attempt 2, User',
389
+ }),
390
+ ).toBeInTheDocument();
391
+ expect(screen.queryByText('User')).not.toBeInTheDocument();
392
+ expect(screen.getByText('#1')).toBeInTheDocument();
393
+ expect(screen.getByText('#2')).toBeInTheDocument();
394
+ expect(screen.queryByText('2 attempts')).not.toBeInTheDocument();
395
+ expect(screen.queryByText('exit 2')).not.toBeInTheDocument();
396
+ expect(screen.queryByText('Restarted')).not.toBeInTheDocument();
397
+ expect(screen.queryByText('Gate failed')).not.toBeInTheDocument();
398
+ });
399
+
400
+ test('renders finished attempt duration from the step attempt model', () => {
401
+ render(
402
+ <StepList
403
+ job={makeJob({
404
+ steps: [
405
+ makeStep({
406
+ name: 'deploy',
407
+ status: 'succeeded',
408
+ attempts: [
409
+ makeAttempt({
410
+ status: 'succeeded',
411
+ started_at: '2026-06-21T12:00:00.000Z',
412
+ finished_at: '2026-06-21T12:01:05.000Z',
413
+ }),
414
+ ],
415
+ }),
416
+ ],
417
+ })}
418
+ />,
419
+ );
420
+
421
+ expect(screen.getByRole('button', {name: 'deploy, Succeeded, attempt 1'})).toBeInTheDocument();
422
+ expect(screen.getByText('1m 05s')).toBeInTheDocument();
423
+ });
424
+
425
+ test('omits zero-attempt steps and hides the attempt chip for one-attempt rows', () => {
426
+ render(
427
+ <StepList
428
+ job={makeJob({
429
+ steps: [
430
+ makeStep({name: 'queued', position: 1}),
431
+ makeStep({
432
+ name: 'build',
433
+ position: 2,
434
+ status: 'succeeded',
435
+ attempts: [makeAttempt({attempt: 1, status: 'succeeded'})],
436
+ }),
437
+ ],
438
+ })}
439
+ />,
440
+ );
441
+
442
+ expect(screen.queryByRole('button', {name: 'queued, Pending'})).not.toBeInTheDocument();
443
+ expect(screen.getByRole('button', {name: 'build, Succeeded, attempt 1'})).toBeInTheDocument();
444
+ expect(screen.queryByText('#1')).not.toBeInTheDocument();
445
+ expect(screen.queryByText('1 attempt')).not.toBeInTheDocument();
446
+ });
447
+
448
+ test('defaults to the active execution when no execution is provided', () => {
449
+ render(
450
+ <StepList
451
+ job={makeJob({
452
+ job_executions: [
453
+ workflowJobExecutionDto({
454
+ id: 'execution-1',
455
+ sequence: 1,
456
+ status: 'failed',
457
+ steps: [
458
+ makeStep({
459
+ name: 'old attempt',
460
+ attempts: [makeAttempt({status: 'failed'})],
461
+ }),
462
+ ],
463
+ }),
464
+ workflowJobExecutionDto({
465
+ id: 'execution-2',
466
+ sequence: 2,
467
+ status: 'running',
468
+ steps: [
469
+ makeStep({
470
+ name: 'active attempt',
471
+ attempts: [makeAttempt({status: 'running'})],
472
+ }),
473
+ ],
474
+ }),
475
+ ],
476
+ })}
477
+ />,
478
+ );
479
+
480
+ expect(
481
+ screen.getByRole('button', {name: 'active attempt, Running, attempt 1'}),
482
+ ).toBeInTheDocument();
483
+ expect(screen.queryByRole('button', {name: 'old attempt, Failed, attempt 1'})).toBeNull();
484
+ });
485
+
486
+ test('renders an empty state', () => {
487
+ render(<StepList job={makeJob({steps: []})} />);
488
+
489
+ expect(screen.getByText('No steps recorded')).toBeInTheDocument();
490
+ expect(screen.getByText('This job has not recorded any steps.')).toBeInTheDocument();
491
+ });
492
+
493
+ test('renders a running empty state without the animated status glyph', () => {
494
+ render(
495
+ <StepList
496
+ job={makeJob({status: 'running', steps: []})}
497
+ emptyState={{
498
+ title: 'Waiting for the first step',
499
+ description: 'This job is running, but no steps have started yet.',
500
+ status: 'running',
501
+ }}
502
+ />,
503
+ );
504
+
505
+ expect(screen.getByText('Waiting for the first step')).toBeInTheDocument();
506
+ expect(
507
+ screen.getByText('This job is running, but no steps have started yet.'),
508
+ ).toBeInTheDocument();
509
+ expect(screen.queryByRole('img', {name: 'Running'})).not.toBeInTheDocument();
510
+ });
511
+
512
+ test('renders a skipped empty state with a status glyph', () => {
513
+ render(
514
+ <StepList
515
+ job={makeJob({status: 'skipped', status_reason: 'dependency_not_completed', steps: []})}
516
+ emptyState={{
517
+ title: 'This job was skipped',
518
+ description: 'A required job did not complete, so this job was skipped.',
519
+ status: 'skipped',
520
+ }}
521
+ />,
522
+ );
523
+
524
+ expect(screen.getByText('This job was skipped')).toBeInTheDocument();
525
+ expect(
526
+ screen.getByText('A required job did not complete, so this job was skipped.'),
527
+ ).toBeInTheDocument();
528
+ expect(screen.getByRole('img', {name: 'Skipped'})).toBeInTheDocument();
529
+ });
530
+
531
+ test('renders a cancelled empty state with distinct copy', () => {
532
+ render(
533
+ <StepList
534
+ job={makeJob({status: 'cancelled', steps: []})}
535
+ emptyState={{
536
+ title: 'Cancelled before start',
537
+ description: 'This job was cancelled before any step started.',
538
+ status: 'cancelled',
539
+ }}
540
+ />,
541
+ );
542
+
543
+ expect(screen.getByText('Cancelled before start')).toBeInTheDocument();
544
+ expect(screen.getByText('This job was cancelled before any step started.')).toBeInTheDocument();
545
+ expect(screen.getByRole('img', {name: 'Cancelled'})).toBeInTheDocument();
546
+ });
547
+
548
+ test('keeps long labels accessible', () => {
549
+ const name = 'release-production-multi-region-with-canary-and-smoke-tests';
550
+ render(<StepList job={makeJob({steps: [makeStep({name, attempts: [makeAttempt()]})]})} />);
551
+
552
+ expect(screen.getByRole('button', {name: `${name}, Pending, attempt 1`})).toBeInTheDocument();
553
+ });
554
+ });
555
+
556
+ function makeJob(overrides: JobDtoOverrides = {}): Job {
557
+ return workflowJob(overrides);
558
+ }
559
+
560
+ function makeStep(overrides: Partial<WorkflowRunStepDetailDto> = {}): WorkflowRunStepDetailDto {
561
+ return workflowStepDto(overrides);
562
+ }
563
+
564
+ function makeAttempt(overrides: Partial<StepAttemptDto> = {}): StepAttemptDto {
565
+ return workflowStepAttemptDto(overrides);
566
+ }