@auto-engineer/pipeline 0.14.0 → 0.16.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 (316) hide show
  1. package/.turbo/turbo-build.log +5 -6
  2. package/CHANGELOG.md +24 -0
  3. package/README.md +279 -0
  4. package/dist/src/builder/define.d.ts +6 -2
  5. package/dist/src/builder/define.d.ts.map +1 -1
  6. package/dist/src/builder/define.js +17 -7
  7. package/dist/src/builder/define.js.map +1 -1
  8. package/dist/src/core/descriptors.d.ts +6 -2
  9. package/dist/src/core/descriptors.d.ts.map +1 -1
  10. package/dist/src/graph/filter-graph.d.ts +3 -0
  11. package/dist/src/graph/filter-graph.d.ts.map +1 -0
  12. package/dist/src/graph/filter-graph.js +80 -0
  13. package/dist/src/graph/filter-graph.js.map +1 -0
  14. package/dist/src/graph/types.d.ts +8 -0
  15. package/dist/src/graph/types.d.ts.map +1 -1
  16. package/dist/src/index.d.ts +1 -0
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/index.js.map +1 -1
  19. package/dist/src/projections/await-tracker-projection.d.ts +31 -0
  20. package/dist/src/projections/await-tracker-projection.d.ts.map +1 -0
  21. package/dist/src/projections/await-tracker-projection.js +35 -0
  22. package/dist/src/projections/await-tracker-projection.js.map +1 -0
  23. package/dist/src/projections/index.d.ts +4 -0
  24. package/dist/src/projections/index.d.ts.map +1 -0
  25. package/dist/src/projections/index.js +4 -0
  26. package/dist/src/projections/index.js.map +1 -0
  27. package/dist/src/projections/item-status-projection.d.ts +22 -0
  28. package/dist/src/projections/item-status-projection.d.ts.map +1 -0
  29. package/dist/src/projections/item-status-projection.js +11 -0
  30. package/dist/src/projections/item-status-projection.js.map +1 -0
  31. package/dist/src/projections/latest-run-projection.d.ts +15 -0
  32. package/dist/src/projections/latest-run-projection.d.ts.map +1 -0
  33. package/dist/src/projections/latest-run-projection.js +7 -0
  34. package/dist/src/projections/latest-run-projection.js.map +1 -0
  35. package/dist/src/projections/message-log-projection.d.ts +51 -0
  36. package/dist/src/projections/message-log-projection.d.ts.map +1 -0
  37. package/dist/src/projections/message-log-projection.js +51 -0
  38. package/dist/src/projections/message-log-projection.js.map +1 -0
  39. package/dist/src/projections/node-status-projection.d.ts +23 -0
  40. package/dist/src/projections/node-status-projection.d.ts.map +1 -0
  41. package/dist/src/projections/node-status-projection.js +10 -0
  42. package/dist/src/projections/node-status-projection.js.map +1 -0
  43. package/dist/src/projections/phased-execution-projection.d.ts +77 -0
  44. package/dist/src/projections/phased-execution-projection.d.ts.map +1 -0
  45. package/dist/src/projections/phased-execution-projection.js +54 -0
  46. package/dist/src/projections/phased-execution-projection.js.map +1 -0
  47. package/dist/src/projections/settled-instance-projection.d.ts +67 -0
  48. package/dist/src/projections/settled-instance-projection.d.ts.map +1 -0
  49. package/dist/src/projections/settled-instance-projection.js +66 -0
  50. package/dist/src/projections/settled-instance-projection.js.map +1 -0
  51. package/dist/src/projections/stats-projection.d.ts +9 -0
  52. package/dist/src/projections/stats-projection.d.ts.map +1 -0
  53. package/dist/src/projections/stats-projection.js +16 -0
  54. package/dist/src/projections/stats-projection.js.map +1 -0
  55. package/dist/src/runtime/await-tracker.d.ts +17 -7
  56. package/dist/src/runtime/await-tracker.d.ts.map +1 -1
  57. package/dist/src/runtime/await-tracker.js +32 -29
  58. package/dist/src/runtime/await-tracker.js.map +1 -1
  59. package/dist/src/runtime/context.d.ts +1 -1
  60. package/dist/src/runtime/context.d.ts.map +1 -1
  61. package/dist/src/runtime/event-command-map.d.ts +3 -3
  62. package/dist/src/runtime/event-command-map.d.ts.map +1 -1
  63. package/dist/src/runtime/event-command-map.js +6 -2
  64. package/dist/src/runtime/event-command-map.js.map +1 -1
  65. package/dist/src/runtime/phased-executor.d.ts +14 -9
  66. package/dist/src/runtime/phased-executor.d.ts.map +1 -1
  67. package/dist/src/runtime/phased-executor.js +113 -105
  68. package/dist/src/runtime/phased-executor.js.map +1 -1
  69. package/dist/src/runtime/pipeline-runtime.d.ts.map +1 -1
  70. package/dist/src/runtime/pipeline-runtime.js +2 -2
  71. package/dist/src/runtime/pipeline-runtime.js.map +1 -1
  72. package/dist/src/runtime/settled-tracker.d.ts +12 -10
  73. package/dist/src/runtime/settled-tracker.d.ts.map +1 -1
  74. package/dist/src/runtime/settled-tracker.js +89 -80
  75. package/dist/src/runtime/settled-tracker.js.map +1 -1
  76. package/dist/src/server/pipeline-server.d.ts +31 -9
  77. package/dist/src/server/pipeline-server.d.ts.map +1 -1
  78. package/dist/src/server/pipeline-server.js +424 -123
  79. package/dist/src/server/pipeline-server.js.map +1 -1
  80. package/dist/src/server/sse-manager.d.ts +0 -1
  81. package/dist/src/server/sse-manager.d.ts.map +1 -1
  82. package/dist/src/server/sse-manager.js +0 -3
  83. package/dist/src/server/sse-manager.js.map +1 -1
  84. package/dist/src/store/index.d.ts +3 -0
  85. package/dist/src/store/index.d.ts.map +1 -0
  86. package/dist/src/store/index.js +3 -0
  87. package/dist/src/store/index.js.map +1 -0
  88. package/dist/src/store/pipeline-event-store.d.ts +10 -0
  89. package/dist/src/store/pipeline-event-store.d.ts.map +1 -0
  90. package/dist/src/store/pipeline-event-store.js +112 -0
  91. package/dist/src/store/pipeline-event-store.js.map +1 -0
  92. package/dist/src/store/pipeline-read-model.d.ts +49 -0
  93. package/dist/src/store/pipeline-read-model.d.ts.map +1 -0
  94. package/dist/src/store/pipeline-read-model.js +156 -0
  95. package/dist/src/store/pipeline-read-model.js.map +1 -0
  96. package/dist/src/store/sqlite-pipeline-event-store.d.ts +14 -0
  97. package/dist/src/store/sqlite-pipeline-event-store.d.ts.map +1 -0
  98. package/dist/src/store/sqlite-pipeline-event-store.js +20 -0
  99. package/dist/src/store/sqlite-pipeline-event-store.js.map +1 -0
  100. package/dist/src/testing/fixtures/kanban-full.pipeline.js +2 -2
  101. package/dist/src/testing/fixtures/kanban-full.pipeline.js.map +1 -1
  102. package/dist/src/testing/fixtures/kanban.pipeline.js +2 -2
  103. package/dist/src/testing/fixtures/kanban.pipeline.js.map +1 -1
  104. package/dist/tsconfig.tsbuildinfo +1 -1
  105. package/ketchup-plan.md +1216 -0
  106. package/package.json +6 -4
  107. package/src/builder/define.specs.ts +5 -4
  108. package/src/builder/define.ts +24 -11
  109. package/src/config/pipeline-config.specs.ts +32 -0
  110. package/src/core/descriptors.ts +7 -2
  111. package/src/graph/filter-graph.specs.ts +267 -0
  112. package/src/graph/filter-graph.ts +111 -0
  113. package/src/graph/types.specs.ts +0 -14
  114. package/src/graph/types.ts +10 -0
  115. package/src/index.ts +1 -0
  116. package/src/projections/await-tracker-projection.specs.ts +24 -0
  117. package/src/projections/await-tracker-projection.ts +68 -0
  118. package/src/projections/index.ts +11 -0
  119. package/src/projections/item-status-projection.specs.ts +130 -0
  120. package/src/projections/item-status-projection.ts +32 -0
  121. package/src/projections/latest-run-projection.ts +20 -0
  122. package/src/projections/message-log-projection.ts +113 -0
  123. package/src/projections/node-status-projection.ts +33 -0
  124. package/src/projections/phased-execution-projection.specs.ts +202 -0
  125. package/src/projections/phased-execution-projection.ts +146 -0
  126. package/src/projections/settled-instance-projection.specs.ts +296 -0
  127. package/src/projections/settled-instance-projection.ts +160 -0
  128. package/src/projections/stats-projection.ts +26 -0
  129. package/src/runtime/await-tracker.specs.ts +57 -34
  130. package/src/runtime/await-tracker.ts +43 -31
  131. package/src/runtime/context.ts +1 -1
  132. package/src/runtime/event-command-map.ts +11 -4
  133. package/src/runtime/phased-executor.specs.ts +357 -81
  134. package/src/runtime/phased-executor.ts +134 -128
  135. package/src/runtime/pipeline-runtime.specs.ts +65 -0
  136. package/src/runtime/pipeline-runtime.ts +6 -4
  137. package/src/runtime/settled-tracker.specs.ts +716 -120
  138. package/src/runtime/settled-tracker.ts +100 -102
  139. package/src/server/pipeline-server.e2e.specs.ts +10 -16
  140. package/src/server/pipeline-server.specs.ts +1441 -211
  141. package/src/server/pipeline-server.ts +535 -144
  142. package/src/server/sse-manager.specs.ts +67 -36
  143. package/src/server/sse-manager.ts +0 -4
  144. package/src/store/index.ts +2 -0
  145. package/src/store/pipeline-event-store.specs.ts +357 -0
  146. package/src/store/pipeline-event-store.ts +156 -0
  147. package/src/store/pipeline-read-model.specs.ts +1170 -0
  148. package/src/store/pipeline-read-model.ts +223 -0
  149. package/src/store/sqlite-pipeline-event-store.specs.ts +13 -0
  150. package/src/store/sqlite-pipeline-event-store.ts +36 -0
  151. package/src/testing/fixtures/kanban-full.pipeline.ts +2 -2
  152. package/src/testing/fixtures/kanban.pipeline.ts +2 -2
  153. package/tsconfig.json +1 -1
  154. package/vitest.config.ts +1 -8
  155. package/claude.md +0 -160
  156. package/dist/src/__tests__/e2e/helpers.d.ts +0 -48
  157. package/dist/src/__tests__/e2e/helpers.d.ts.map +0 -1
  158. package/dist/src/__tests__/e2e/helpers.js +0 -253
  159. package/dist/src/__tests__/e2e/helpers.js.map +0 -1
  160. package/dist/src/__tests__/e2e/kanban-migration.e2e.specs.d.ts +0 -2
  161. package/dist/src/__tests__/e2e/kanban-migration.e2e.specs.d.ts.map +0 -1
  162. package/dist/src/__tests__/e2e/kanban-migration.e2e.specs.js +0 -195
  163. package/dist/src/__tests__/e2e/kanban-migration.e2e.specs.js.map +0 -1
  164. package/dist/src/__tests__/e2e/types.d.ts +0 -107
  165. package/dist/src/__tests__/e2e/types.d.ts.map +0 -1
  166. package/dist/src/__tests__/e2e/types.js +0 -2
  167. package/dist/src/__tests__/e2e/types.js.map +0 -1
  168. package/dist/src/builder/define.specs.d.ts +0 -2
  169. package/dist/src/builder/define.specs.d.ts.map +0 -1
  170. package/dist/src/builder/define.specs.js +0 -435
  171. package/dist/src/builder/define.specs.js.map +0 -1
  172. package/dist/src/core/descriptors.specs.d.ts +0 -2
  173. package/dist/src/core/descriptors.specs.d.ts.map +0 -1
  174. package/dist/src/core/descriptors.specs.js +0 -24
  175. package/dist/src/core/descriptors.specs.js.map +0 -1
  176. package/dist/src/core/types.specs.d.ts +0 -2
  177. package/dist/src/core/types.specs.d.ts.map +0 -1
  178. package/dist/src/core/types.specs.js +0 -40
  179. package/dist/src/core/types.specs.js.map +0 -1
  180. package/dist/src/file-syncer/crypto/jwe-encryptor.d.ts +0 -15
  181. package/dist/src/file-syncer/crypto/jwe-encryptor.d.ts.map +0 -1
  182. package/dist/src/file-syncer/crypto/jwe-encryptor.js +0 -64
  183. package/dist/src/file-syncer/crypto/jwe-encryptor.js.map +0 -1
  184. package/dist/src/file-syncer/crypto/provider-resolver.d.ts +0 -24
  185. package/dist/src/file-syncer/crypto/provider-resolver.d.ts.map +0 -1
  186. package/dist/src/file-syncer/crypto/provider-resolver.js +0 -71
  187. package/dist/src/file-syncer/crypto/provider-resolver.js.map +0 -1
  188. package/dist/src/file-syncer/discovery/bareImports.d.ts +0 -3
  189. package/dist/src/file-syncer/discovery/bareImports.d.ts.map +0 -1
  190. package/dist/src/file-syncer/discovery/bareImports.js +0 -36
  191. package/dist/src/file-syncer/discovery/bareImports.js.map +0 -1
  192. package/dist/src/file-syncer/discovery/dts.d.ts +0 -8
  193. package/dist/src/file-syncer/discovery/dts.d.ts.map +0 -1
  194. package/dist/src/file-syncer/discovery/dts.js +0 -99
  195. package/dist/src/file-syncer/discovery/dts.js.map +0 -1
  196. package/dist/src/file-syncer/index.d.ts +0 -46
  197. package/dist/src/file-syncer/index.d.ts.map +0 -1
  198. package/dist/src/file-syncer/index.js +0 -392
  199. package/dist/src/file-syncer/index.js.map +0 -1
  200. package/dist/src/file-syncer/sync/resolveSyncFileSet.d.ts +0 -7
  201. package/dist/src/file-syncer/sync/resolveSyncFileSet.d.ts.map +0 -1
  202. package/dist/src/file-syncer/sync/resolveSyncFileSet.js +0 -86
  203. package/dist/src/file-syncer/sync/resolveSyncFileSet.js.map +0 -1
  204. package/dist/src/file-syncer/types/wire.d.ts +0 -14
  205. package/dist/src/file-syncer/types/wire.d.ts.map +0 -1
  206. package/dist/src/file-syncer/types/wire.js +0 -2
  207. package/dist/src/file-syncer/types/wire.js.map +0 -1
  208. package/dist/src/file-syncer/utils/hash.d.ts +0 -5
  209. package/dist/src/file-syncer/utils/hash.d.ts.map +0 -1
  210. package/dist/src/file-syncer/utils/hash.js +0 -19
  211. package/dist/src/file-syncer/utils/hash.js.map +0 -1
  212. package/dist/src/file-syncer/utils/path.d.ts +0 -13
  213. package/dist/src/file-syncer/utils/path.d.ts.map +0 -1
  214. package/dist/src/file-syncer/utils/path.js +0 -74
  215. package/dist/src/file-syncer/utils/path.js.map +0 -1
  216. package/dist/src/graph/types.specs.d.ts +0 -2
  217. package/dist/src/graph/types.specs.d.ts.map +0 -1
  218. package/dist/src/graph/types.specs.js +0 -148
  219. package/dist/src/graph/types.specs.js.map +0 -1
  220. package/dist/src/logging/event-logger.specs.d.ts +0 -2
  221. package/dist/src/logging/event-logger.specs.d.ts.map +0 -1
  222. package/dist/src/logging/event-logger.specs.js +0 -81
  223. package/dist/src/logging/event-logger.specs.js.map +0 -1
  224. package/dist/src/plugins/handler-adapter.specs.d.ts +0 -2
  225. package/dist/src/plugins/handler-adapter.specs.d.ts.map +0 -1
  226. package/dist/src/plugins/handler-adapter.specs.js +0 -129
  227. package/dist/src/plugins/handler-adapter.specs.js.map +0 -1
  228. package/dist/src/plugins/plugin-loader.specs.d.ts +0 -2
  229. package/dist/src/plugins/plugin-loader.specs.d.ts.map +0 -1
  230. package/dist/src/plugins/plugin-loader.specs.js +0 -246
  231. package/dist/src/plugins/plugin-loader.specs.js.map +0 -1
  232. package/dist/src/runtime/await-tracker.specs.d.ts +0 -2
  233. package/dist/src/runtime/await-tracker.specs.d.ts.map +0 -1
  234. package/dist/src/runtime/await-tracker.specs.js +0 -46
  235. package/dist/src/runtime/await-tracker.specs.js.map +0 -1
  236. package/dist/src/runtime/context.specs.d.ts +0 -2
  237. package/dist/src/runtime/context.specs.d.ts.map +0 -1
  238. package/dist/src/runtime/context.specs.js +0 -26
  239. package/dist/src/runtime/context.specs.js.map +0 -1
  240. package/dist/src/runtime/event-command-map.specs.d.ts +0 -2
  241. package/dist/src/runtime/event-command-map.specs.d.ts.map +0 -1
  242. package/dist/src/runtime/event-command-map.specs.js +0 -108
  243. package/dist/src/runtime/event-command-map.specs.js.map +0 -1
  244. package/dist/src/runtime/phased-executor.specs.d.ts +0 -2
  245. package/dist/src/runtime/phased-executor.specs.d.ts.map +0 -1
  246. package/dist/src/runtime/phased-executor.specs.js +0 -256
  247. package/dist/src/runtime/phased-executor.specs.js.map +0 -1
  248. package/dist/src/runtime/pipeline-runtime.specs.d.ts +0 -2
  249. package/dist/src/runtime/pipeline-runtime.specs.d.ts.map +0 -1
  250. package/dist/src/runtime/pipeline-runtime.specs.js +0 -192
  251. package/dist/src/runtime/pipeline-runtime.specs.js.map +0 -1
  252. package/dist/src/runtime/settled-tracker.specs.d.ts +0 -2
  253. package/dist/src/runtime/settled-tracker.specs.d.ts.map +0 -1
  254. package/dist/src/runtime/settled-tracker.specs.js +0 -361
  255. package/dist/src/runtime/settled-tracker.specs.js.map +0 -1
  256. package/dist/src/server/full-orchestration.e2e.specs.d.ts +0 -2
  257. package/dist/src/server/full-orchestration.e2e.specs.d.ts.map +0 -1
  258. package/dist/src/server/full-orchestration.e2e.specs.js +0 -561
  259. package/dist/src/server/full-orchestration.e2e.specs.js.map +0 -1
  260. package/dist/src/server/pipeline-server.e2e.specs.d.ts +0 -2
  261. package/dist/src/server/pipeline-server.e2e.specs.d.ts.map +0 -1
  262. package/dist/src/server/pipeline-server.e2e.specs.js +0 -381
  263. package/dist/src/server/pipeline-server.e2e.specs.js.map +0 -1
  264. package/dist/src/server/pipeline-server.specs.d.ts +0 -2
  265. package/dist/src/server/pipeline-server.specs.d.ts.map +0 -1
  266. package/dist/src/server/pipeline-server.specs.js +0 -662
  267. package/dist/src/server/pipeline-server.specs.js.map +0 -1
  268. package/dist/src/server/sse-manager.specs.d.ts +0 -2
  269. package/dist/src/server/sse-manager.specs.d.ts.map +0 -1
  270. package/dist/src/server/sse-manager.specs.js +0 -158
  271. package/dist/src/server/sse-manager.specs.js.map +0 -1
  272. package/dist/src/testing/event-capture.specs.d.ts +0 -2
  273. package/dist/src/testing/event-capture.specs.d.ts.map +0 -1
  274. package/dist/src/testing/event-capture.specs.js +0 -114
  275. package/dist/src/testing/event-capture.specs.js.map +0 -1
  276. package/dist/src/testing/fixtures/kanban-full.pipeline.specs.d.ts +0 -2
  277. package/dist/src/testing/fixtures/kanban-full.pipeline.specs.d.ts.map +0 -1
  278. package/dist/src/testing/fixtures/kanban-full.pipeline.specs.js +0 -263
  279. package/dist/src/testing/fixtures/kanban-full.pipeline.specs.js.map +0 -1
  280. package/dist/src/testing/fixtures/kanban.pipeline.specs.d.ts +0 -2
  281. package/dist/src/testing/fixtures/kanban.pipeline.specs.d.ts.map +0 -1
  282. package/dist/src/testing/fixtures/kanban.pipeline.specs.js +0 -29
  283. package/dist/src/testing/fixtures/kanban.pipeline.specs.js.map +0 -1
  284. package/dist/src/testing/kanban-todo.e2e.specs.d.ts +0 -2
  285. package/dist/src/testing/kanban-todo.e2e.specs.d.ts.map +0 -1
  286. package/dist/src/testing/kanban-todo.e2e.specs.js +0 -160
  287. package/dist/src/testing/kanban-todo.e2e.specs.js.map +0 -1
  288. package/dist/src/testing/mock-handlers.specs.d.ts +0 -2
  289. package/dist/src/testing/mock-handlers.specs.d.ts.map +0 -1
  290. package/dist/src/testing/mock-handlers.specs.js +0 -193
  291. package/dist/src/testing/mock-handlers.specs.js.map +0 -1
  292. package/dist/src/testing/real-execution.e2e.specs.d.ts +0 -2
  293. package/dist/src/testing/real-execution.e2e.specs.d.ts.map +0 -1
  294. package/dist/src/testing/real-execution.e2e.specs.js +0 -140
  295. package/dist/src/testing/real-execution.e2e.specs.js.map +0 -1
  296. package/dist/src/testing/real-plugin.e2e.specs.d.ts +0 -2
  297. package/dist/src/testing/real-plugin.e2e.specs.d.ts.map +0 -1
  298. package/dist/src/testing/real-plugin.e2e.specs.js +0 -65
  299. package/dist/src/testing/real-plugin.e2e.specs.js.map +0 -1
  300. package/dist/src/testing/server-startup.e2e.specs.d.ts +0 -2
  301. package/dist/src/testing/server-startup.e2e.specs.d.ts.map +0 -1
  302. package/dist/src/testing/server-startup.e2e.specs.js +0 -104
  303. package/dist/src/testing/server-startup.e2e.specs.js.map +0 -1
  304. package/dist/src/testing/snapshot-compare.specs.d.ts +0 -2
  305. package/dist/src/testing/snapshot-compare.specs.d.ts.map +0 -1
  306. package/dist/src/testing/snapshot-compare.specs.js +0 -112
  307. package/dist/src/testing/snapshot-compare.specs.js.map +0 -1
  308. package/dist/src/testing/snapshot-sanitize.specs.d.ts +0 -2
  309. package/dist/src/testing/snapshot-sanitize.specs.d.ts.map +0 -1
  310. package/dist/src/testing/snapshot-sanitize.specs.js +0 -104
  311. package/dist/src/testing/snapshot-sanitize.specs.js.map +0 -1
  312. package/docs/testing-analysis.md +0 -395
  313. package/pomodoro-plan.md +0 -651
  314. package/src/core/descriptors.specs.ts +0 -28
  315. package/src/core/types.specs.ts +0 -44
  316. package/src/runtime/context.specs.ts +0 -28
@@ -1,112 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { compareEventSequence, containsSubsequence, findMissingEvents, findUnexpectedEvents, formatSnapshotDiff, } from './snapshot-compare.js';
3
- describe('snapshot-compare', () => {
4
- describe('compareEventSequence', () => {
5
- it('should match identical sequences', () => {
6
- const result = compareEventSequence(['A', 'B', 'C'], ['A', 'B', 'C']);
7
- expect(result.matches).toBe(true);
8
- expect(result.differences).toHaveLength(0);
9
- });
10
- it('should detect mismatches', () => {
11
- const result = compareEventSequence(['A', 'B', 'C'], ['A', 'X', 'C']);
12
- expect(result.matches).toBe(false);
13
- expect(result.differences).toHaveLength(1);
14
- expect(result.differences[0]).toEqual({
15
- type: 'mismatch',
16
- index: 1,
17
- expected: 'B',
18
- actual: 'X',
19
- });
20
- });
21
- it('should detect missing events', () => {
22
- const result = compareEventSequence(['A', 'B', 'C'], ['A', 'B']);
23
- expect(result.matches).toBe(false);
24
- expect(result.differences).toContainEqual({
25
- type: 'missing',
26
- index: 2,
27
- expected: 'C',
28
- });
29
- });
30
- it('should detect extra events', () => {
31
- const result = compareEventSequence(['A', 'B'], ['A', 'B', 'C']);
32
- expect(result.matches).toBe(false);
33
- expect(result.differences).toContainEqual({
34
- type: 'extra',
35
- index: 2,
36
- actual: 'C',
37
- });
38
- });
39
- it('should report counts', () => {
40
- const result = compareEventSequence(['A', 'B', 'C'], ['A', 'B']);
41
- expect(result.expectedCount).toBe(3);
42
- expect(result.actualCount).toBe(2);
43
- });
44
- });
45
- describe('containsSubsequence', () => {
46
- it('should find exact subsequence', () => {
47
- expect(containsSubsequence(['A', 'B', 'C', 'D'], ['B', 'C'])).toBe(true);
48
- });
49
- it('should find non-contiguous subsequence', () => {
50
- expect(containsSubsequence(['A', 'B', 'C', 'D'], ['A', 'C'])).toBe(true);
51
- });
52
- it('should return false for missing subsequence', () => {
53
- expect(containsSubsequence(['A', 'B', 'C'], ['X', 'Y'])).toBe(false);
54
- });
55
- it('should return true for empty subsequence', () => {
56
- expect(containsSubsequence(['A', 'B'], [])).toBe(true);
57
- });
58
- it('should return false for empty sequence with non-empty subsequence', () => {
59
- expect(containsSubsequence([], ['A'])).toBe(false);
60
- });
61
- it('should require order', () => {
62
- expect(containsSubsequence(['A', 'B', 'C'], ['C', 'A'])).toBe(false);
63
- });
64
- });
65
- describe('findMissingEvents', () => {
66
- it('should find missing events', () => {
67
- const missing = findMissingEvents(['A', 'B', 'C'], ['A', 'B', 'D']);
68
- expect(missing).toEqual(['D']);
69
- });
70
- it('should return empty for all present', () => {
71
- const missing = findMissingEvents(['A', 'B', 'C'], ['A', 'B']);
72
- expect(missing).toEqual([]);
73
- });
74
- });
75
- describe('findUnexpectedEvents', () => {
76
- it('should find unexpected events', () => {
77
- const unexpected = findUnexpectedEvents(['A', 'B', 'X'], ['A', 'B', 'C']);
78
- expect(unexpected).toEqual(['X']);
79
- });
80
- it('should return empty when all allowed', () => {
81
- const unexpected = findUnexpectedEvents(['A', 'B'], ['A', 'B', 'C']);
82
- expect(unexpected).toEqual([]);
83
- });
84
- });
85
- describe('formatSnapshotDiff', () => {
86
- it('should format matching result', () => {
87
- const result = compareEventSequence(['A', 'B'], ['A', 'B']);
88
- const formatted = formatSnapshotDiff(result);
89
- expect(formatted).toContain('✓');
90
- expect(formatted).toContain('matches');
91
- });
92
- it('should format mismatching result', () => {
93
- const result = compareEventSequence(['A', 'B'], ['A', 'X']);
94
- const formatted = formatSnapshotDiff(result);
95
- expect(formatted).toContain('✗');
96
- expect(formatted).toContain('mismatch');
97
- expect(formatted).toContain('Expected "B"');
98
- expect(formatted).toContain('got "X"');
99
- });
100
- it('should format missing events', () => {
101
- const result = compareEventSequence(['A', 'B', 'C'], ['A', 'B']);
102
- const formatted = formatSnapshotDiff(result);
103
- expect(formatted).toContain('Missing "C"');
104
- });
105
- it('should format extra events', () => {
106
- const result = compareEventSequence(['A', 'B'], ['A', 'B', 'C']);
107
- const formatted = formatSnapshotDiff(result);
108
- expect(formatted).toContain('Unexpected "C"');
109
- });
110
- });
111
- });
112
- //# sourceMappingURL=snapshot-compare.specs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot-compare.specs.js","sourceRoot":"","sources":["../../../src/testing/snapshot-compare.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;YAC1C,MAAM,MAAM,GAAG,oBAAoB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACtE,M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C,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=snapshot-sanitize.specs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot-sanitize.specs.d.ts","sourceRoot":"","sources":["../../../src/testing/snapshot-sanitize.specs.ts"],"names":[],"mappings":""}
@@ -1,104 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { sanitizeEvent, sanitizeEvents } from './snapshot-sanitize.js';
3
- describe('snapshot-sanitize', () => {
4
- describe('sanitizeEvent', () => {
5
- it('should preserve type and data', () => {
6
- const event = {
7
- type: 'TestEvent',
8
- data: { foo: 'bar', count: 42 },
9
- };
10
- const sanitized = sanitizeEvent(event);
11
- expect(sanitized.type).toBe('TestEvent');
12
- expect(sanitized.data).toEqual({ foo: 'bar', count: 42 });
13
- });
14
- it('should strip timestamp', () => {
15
- const event = {
16
- type: 'TestEvent',
17
- data: {},
18
- timestamp: new Date('2025-01-01T00:00:00.000Z'),
19
- };
20
- const sanitized = sanitizeEvent(event);
21
- expect(sanitized).not.toHaveProperty('timestamp');
22
- });
23
- it('should strip requestId', () => {
24
- const event = {
25
- type: 'TestEvent',
26
- data: {},
27
- requestId: 'req-12345',
28
- };
29
- const sanitized = sanitizeEvent(event);
30
- expect(sanitized).not.toHaveProperty('requestId');
31
- });
32
- it('should strip correlationId', () => {
33
- const event = {
34
- type: 'TestEvent',
35
- data: {},
36
- correlationId: 'corr-67890',
37
- };
38
- const sanitized = sanitizeEvent(event);
39
- expect(sanitized).not.toHaveProperty('correlationId');
40
- });
41
- it('should strip all volatile fields at once', () => {
42
- const event = {
43
- type: 'CompleteEvent',
44
- data: { result: 'success' },
45
- timestamp: new Date('2025-01-01T00:00:00.000Z'),
46
- requestId: 'req-abc',
47
- correlationId: 'corr-xyz',
48
- };
49
- const sanitized = sanitizeEvent(event);
50
- expect(sanitized).toEqual({
51
- type: 'CompleteEvent',
52
- data: { result: 'success' },
53
- });
54
- });
55
- it('should return a new object (not mutate original)', () => {
56
- const testDate = new Date('2025-01-01T00:00:00.000Z');
57
- const event = {
58
- type: 'TestEvent',
59
- data: { value: 1 },
60
- timestamp: testDate,
61
- };
62
- const sanitized = sanitizeEvent(event);
63
- expect(event.timestamp).toBe(testDate);
64
- expect(sanitized).not.toBe(event);
65
- });
66
- });
67
- describe('sanitizeEvents', () => {
68
- it('should sanitize empty array', () => {
69
- const result = sanitizeEvents([]);
70
- expect(result).toEqual([]);
71
- });
72
- it('should sanitize multiple events', () => {
73
- const events = [
74
- { type: 'First', data: { a: 1 }, timestamp: new Date(), requestId: 'r1' },
75
- { type: 'Second', data: { b: 2 }, correlationId: 'c2' },
76
- { type: 'Third', data: { c: 3 } },
77
- ];
78
- const sanitized = sanitizeEvents(events);
79
- expect(sanitized).toEqual([
80
- { type: 'First', data: { a: 1 } },
81
- { type: 'Second', data: { b: 2 } },
82
- { type: 'Third', data: { c: 3 } },
83
- ]);
84
- });
85
- it('should preserve event order', () => {
86
- const events = [
87
- { type: 'A', data: {} },
88
- { type: 'B', data: {} },
89
- { type: 'C', data: {} },
90
- ];
91
- const sanitized = sanitizeEvents(events);
92
- expect(sanitized.map((e) => e.type)).toEqual(['A', 'B', 'C']);
93
- });
94
- });
95
- describe('SanitizedEvent type', () => {
96
- it('should be assignable from sanitizeEvent result', () => {
97
- const event = { type: 'Test', data: { x: 1 } };
98
- const sanitized = sanitizeEvent(event);
99
- expect(sanitized.type).toBe('Test');
100
- expect(sanitized.data).toEqual({ x: 1 });
101
- });
102
- });
103
- });
104
- //# sourceMappingURL=snapshot-sanitize.specs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot-sanitize.specs.js","sourceRoot":"","sources":["../../../src/testing/snapshot-sanitize.specs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAuB,aAAa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I,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;gBACvB,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;gBACvB,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;aACxB,CAAC;YAEF,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;YAEzC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,KAAK,GAAU,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,MAAM,SAAS,GAAmB,aAAa,CAAC,KAAK,CAAC,CAAC;YAEvD,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,395 +0,0 @@
1
- # Pipeline Package Testing Analysis
2
-
3
- ## Source: CLI E2E Snapshots Analysis
4
-
5
- This document captures the findings from analyzing the CLI's E2E test snapshots to inform how we test the pipeline package's orchestration capabilities.
6
-
7
- ---
8
-
9
- ## Snapshot Files Analyzed
10
-
11
- | File | Purpose | Key Insights |
12
- | ------------------------------ | ----------------------------------- | ------------------------------------------------------------------- |
13
- | `registry.snapshot.json` | Expected `/registry` response | 11 event handlers, 16 command handlers, full metadata |
14
- | `pipeline-graph.snapshot.json` | Expected `/pipeline` response | 11 nodes, 13 edges, `commandToEvents` and `eventToCommand` mappings |
15
- | `event-stream.snapshot.json` | Full event sequence from workflow | ~200+ events showing scatter-gather, retry, phased execution |
16
- | `golden-master.snapshot.json` | Complete baseline + execution state | Too large to load fully, contains status progression |
17
-
18
- ---
19
-
20
- ## Registry Response Shape
21
-
22
- ```typescript
23
- interface RegistryResponse {
24
- eventHandlers: string[]; // ['SchemaExported', 'SliceGenerated', ...]
25
- commandHandlers: string[]; // ['CheckClient', 'CheckLint', 'CheckTests', ...]
26
- commandsWithMetadata: Array<{
27
- id: string; // '@auto-engineer/narrative/export:schema'
28
- name: string; // 'ExportSchema'
29
- alias: string; // 'export:schema'
30
- description: string; // 'Export flow schemas to context directory'
31
- package: string; // '@auto-engineer/narrative'
32
- version: string; // '0.13.1'
33
- category: string; // 'export'
34
- icon: string; // 'download'
35
- }>;
36
- folds: string[]; // [] (empty in kanban example)
37
- }
38
- ```
39
-
40
- **Event Handlers (11):**
41
-
42
- - SchemaExported, SliceGenerated, SliceImplemented, ServerGenerated
43
- - IAGenerated, ClientGenerated, ComponentImplemented, ComponentImplementationFailed
44
- - ClientChecked
45
-
46
- **Command Handlers (16):**
47
-
48
- - CheckClient, CheckLint, CheckTests, CheckTypes
49
- - CopyExample, ExportSchema, GenerateClient, GenerateIA, GenerateServer
50
- - ImplementClient, ImplementComponent, ImplementServer, ImplementSlice
51
- - ImportDesignSystem, StartClient, StartServer
52
-
53
- ---
54
-
55
- ## Pipeline Graph Response Shape
56
-
57
- ```typescript
58
- interface PipelineResponse {
59
- nodes: Array<{
60
- id: string; // '@auto-engineer/narrative/export:schema'
61
- name: string; // 'ExportSchema'
62
- title: string; // 'Export Schema'
63
- alias: string; // 'export:schema'
64
- description: string;
65
- package: string;
66
- version: string;
67
- category: string;
68
- icon: string;
69
- status: 'None' | 'idle' | 'running' | 'pass' | 'fail';
70
- }>;
71
- edges: Array<{
72
- from: string; // '@auto-engineer/narrative/export:schema'
73
- to: string; // '@auto-engineer/server-generator-apollo-emmett/generate:server'
74
- }>;
75
- commandToEvents: Record<string, string[]>; // { 'CheckTypes': ['TypeCheckPassed', 'TypeCheckFailed'] }
76
- eventToCommand: Record<string, string>; // { 'TypeCheckPassed': 'CheckTypes' }
77
- }
78
- ```
79
-
80
- **Key Edges (showing workflow):**
81
-
82
- 1. `export:schema` → `generate:server`
83
- 2. `generate:server` → `implement:slice`
84
- 3. `implement:slice` → `check:tests`, `check:types`, `check:lint` (scatter)
85
- 4. `check:tests`, `check:types`, `check:lint` → `implement:slice` (retry loop)
86
- 5. `generate:server` → `generate:ia`, `start:server` (parallel)
87
- 6. `generate:ia` → `generate:client`
88
- 7. `generate:client` → `implement:component`, `start:client`
89
-
90
- ---
91
-
92
- ## Event Stream Analysis
93
-
94
- ### Event Types and Counts (from partial analysis)
95
-
96
- | Event Type | Count | Notes |
97
- | ---------------------- | ----- | -------------------------------------------- |
98
- | SchemaExported | 2 | Initial + possibly retry |
99
- | SliceGenerated | 10+ | One per slice (5 slices × retries) |
100
- | ServerGenerationFailed | 1 | pnpm install failure |
101
- | ServerGenerated | 1 | Success after retry |
102
- | SliceImplemented | 31 | Multiple implementations per slice (retries) |
103
- | TypeCheckPassed | 24 | After successful checks |
104
- | TypeCheckFailed | ? | Triggers retry |
105
- | TestsCheckPassed | 31 | One per slice implementation |
106
- | LintCheckPassed | 25 | One per slice implementation |
107
- | ComponentImplemented | 58 | All components across phases |
108
-
109
- ### Workflow Sequence Pattern
110
-
111
- ```
112
- 1. ExportSchema command
113
- └── SchemaExported event
114
-
115
- 2. SchemaExported triggers GenerateServer
116
- └── SliceGenerated × N (one per slice)
117
- └── ServerGenerated (when all slices generated)
118
-
119
- 3. SliceGenerated triggers ImplementSlice (per slice)
120
- └── SliceImplemented event
121
-
122
- 4. SliceImplemented triggers SCATTER:
123
- ├── CheckTests → TestsCheckPassed | TestsCheckFailed
124
- ├── CheckTypes → TypeCheckPassed | TypeCheckFailed
125
- └── CheckLint → LintCheckPassed | LintCheckFailed
126
-
127
- 5. on.settled(['CheckTests', 'CheckTypes', 'CheckLint']) GATHER:
128
- └── If any failed AND attempts < MAX_RETRIES:
129
- └── ImplementSlice with error context → goto step 3
130
- └── If all passed OR max retries exceeded:
131
- └── Continue (no dispatch)
132
-
133
- 6. ServerGenerated triggers PARALLEL:
134
- ├── GenerateIA → IAGenerated
135
- └── StartServer → ServerStarted
136
-
137
- 7. IAGenerated triggers GenerateClient
138
- └── ClientGenerated event (with components list)
139
-
140
- 8. ClientGenerated triggers PHASED EXECUTION:
141
- Phase 1: molecules (parallel)
142
- └── ImplementComponent × N → ComponentImplemented × N
143
- Phase 2: organisms (parallel, after ALL molecules complete)
144
- └── ImplementComponent × N → ComponentImplemented × N
145
- Phase 3: pages (parallel, after ALL organisms complete)
146
- └── ImplementComponent × N → ComponentImplemented × N
147
- ```
148
-
149
- ---
150
-
151
- ## Orchestration Patterns to Test
152
-
153
- ### 1. Scatter-Gather Pattern
154
-
155
- **Trigger:** `SliceImplemented` event
156
- **Scatter:** Dispatch `CheckTests`, `CheckTypes`, `CheckLint` in parallel
157
- **Gather:** Wait for all 3 to complete (via correlationId tracking)
158
- **Decision:** Fire `ImplementSlice` with errors if any check failed
159
-
160
- ```typescript
161
- // Test scenario
162
- it('should scatter 3 checks and gather results', async () => {
163
- // Send ImplementSlice command
164
- await dispatchCommand('ImplementSlice', { slicePath: './test-slice' });
165
-
166
- // Wait for SliceImplemented event
167
- await waitForEvent('SliceImplemented');
168
-
169
- // Verify all 3 checks were dispatched
170
- const messages = await getMessages();
171
- const checkCommands = messages.filter(
172
- (m) => m.messageType === 'command' && ['CheckTests', 'CheckTypes', 'CheckLint'].includes(m.message.type),
173
- );
174
- expect(checkCommands).toHaveLength(3);
175
-
176
- // Verify same correlationId
177
- const correlationIds = new Set(checkCommands.map((c) => c.message.correlationId));
178
- expect(correlationIds.size).toBe(1);
179
- });
180
- ```
181
-
182
- ### 2. Retry Loop Pattern
183
-
184
- **Trigger:** `on.settled` handler fires with failures
185
- **Action:** Dispatch `ImplementSlice` with error context
186
- **Limit:** MAX_RETRIES = 4
187
-
188
- ```typescript
189
- // Test scenario
190
- it('should retry up to MAX_RETRIES times on failure', async () => {
191
- // Configure CheckTypes to fail first 3 times
192
- mockHandler('CheckTypes', (cmd, attempt) =>
193
- attempt < 3 ? { type: 'TypeCheckFailed', data: { errors: 'TS2322' } } : { type: 'TypeCheckPassed', data: {} },
194
- );
195
-
196
- await dispatchCommand('ImplementSlice', { slicePath: './test' });
197
- await waitForSettled(10000);
198
-
199
- const events = await getEvents();
200
- const typeCheckEvents = events.filter((e) => e.type.includes('TypeCheck'));
201
-
202
- // Should have 3 failures then 1 success
203
- expect(typeCheckEvents.map((e) => e.type)).toEqual([
204
- 'TypeCheckFailed',
205
- 'TypeCheckFailed',
206
- 'TypeCheckFailed',
207
- 'TypeCheckPassed',
208
- ]);
209
- });
210
-
211
- it('should stop retrying after MAX_RETRIES', async () => {
212
- // Configure CheckTypes to always fail
213
- mockHandler('CheckTypes', () => ({ type: 'TypeCheckFailed', data: {} }));
214
-
215
- await dispatchCommand('ImplementSlice', { slicePath: './test' });
216
- await waitForSettled(10000);
217
-
218
- const events = await getEvents();
219
- const implementSliceCommands = events.filter((e) => e.type === 'SliceImplemented');
220
-
221
- // Should have MAX_RETRIES + 1 attempts (initial + retries)
222
- expect(implementSliceCommands.length).toBeLessThanOrEqual(5); // 1 + MAX_RETRIES
223
- });
224
- ```
225
-
226
- ### 3. Phased Execution Pattern
227
-
228
- **Trigger:** `ClientGenerated` event with components list
229
- **Phases:** `['molecule', 'organism', 'page']`
230
- **Gate:** All items in phase N must complete before phase N+1 starts
231
-
232
- ```typescript
233
- // Test scenario
234
- it('should execute phases in order', async () => {
235
- const dispatchOrder: string[] = [];
236
-
237
- mockHandler('ImplementComponent', (cmd) => {
238
- dispatchOrder.push(cmd.data.componentType);
239
- return { type: 'ComponentImplemented', data: cmd.data };
240
- });
241
-
242
- await dispatchCommand('GenerateClient', {});
243
- // Mock returns: { components: [
244
- // { type: 'molecule', filePath: 'm1.tsx' },
245
- // { type: 'organism', filePath: 'o1.tsx' },
246
- // { type: 'page', filePath: 'p1.tsx' },
247
- // ]}
248
-
249
- await waitForAllComponentsImplemented(10000);
250
-
251
- // Verify order: all molecules before any organisms
252
- const moleculeIndices = dispatchOrder.map((t, i) => (t === 'molecule' ? i : -1)).filter((i) => i >= 0);
253
- const organismIndices = dispatchOrder.map((t, i) => (t === 'organism' ? i : -1)).filter((i) => i >= 0);
254
-
255
- expect(Math.max(...moleculeIndices)).toBeLessThan(Math.min(...organismIndices));
256
- });
257
- ```
258
-
259
- ### 4. Parallel Dispatch Pattern
260
-
261
- **Trigger:** `ServerGenerated` event
262
- **Action:** Dispatch `GenerateIA` AND `StartServer` simultaneously
263
-
264
- ```typescript
265
- // Test scenario
266
- it('should dispatch parallel commands from single event', async () => {
267
- await dispatchCommand('GenerateServer', { modelPath: './schema.json' });
268
- await waitForEvent('ServerGenerated');
269
-
270
- const messages = await getMessages();
271
- const commandsAfterServerGenerated = messages
272
- .filter((m) => m.messageType === 'command')
273
- .filter((m) => ['GenerateIA', 'StartServer'].includes(m.message.type));
274
-
275
- expect(commandsAfterServerGenerated).toHaveLength(2);
276
-
277
- // Verify same correlationId (dispatched from same trigger)
278
- const correlationIds = new Set(commandsAfterServerGenerated.map((c) => c.message.correlationId));
279
- expect(correlationIds.size).toBe(1);
280
- });
281
- ```
282
-
283
- ---
284
-
285
- ## Testing Approach for Pipeline Package
286
-
287
- ### Unit Tests (per component)
288
-
289
- 1. **SettledTracker** - Track commands, fire on completion
290
- 2. **EventCommandMapper** - Map events to source commands
291
- 3. **PhasedExecutor** - Gate phases, track completion
292
- 4. **EventLogger** - Write events to disk
293
-
294
- ### Integration Tests (component combinations)
295
-
296
- 1. **Runtime + SettledTracker** - Handler dispatches command, tracker fires
297
- 2. **Server + Runtime + Tracker** - HTTP request triggers full flow
298
- 3. **Server + Logger** - Events written to disk
299
-
300
- ### E2E Tests (full workflow)
301
-
302
- 1. **Scatter-Gather Test** - SliceImplemented → 3 checks → gather
303
- 2. **Retry Test** - Failed checks → retry loop → success
304
- 3. **Phased Test** - ClientGenerated → molecules → organisms → pages
305
- 4. **Snapshot Test** - Compare event sequence to CLI snapshot
306
-
307
- ### Mock Handlers
308
-
309
- ```typescript
310
- interface MockHandlerConfig {
311
- [commandType: string]: (command: Command, attempt: number) => Event | Event[];
312
- }
313
-
314
- function createMockHandlers(config: MockHandlerConfig): CommandHandler[] {
315
- const attemptCounts = new Map<string, number>();
316
-
317
- return Object.entries(config).map(([name, factory]) => ({
318
- name,
319
- events: inferEventsFromFactory(factory),
320
- handle: async (cmd: Command) => {
321
- const key = `${name}:${JSON.stringify(cmd.data)}`;
322
- const attempt = (attemptCounts.get(key) ?? 0) + 1;
323
- attemptCounts.set(key, attempt);
324
- return factory(cmd, attempt);
325
- },
326
- }));
327
- }
328
- ```
329
-
330
- ---
331
-
332
- ## Snapshot Comparison Strategy
333
-
334
- ### Event Type Sequence (order-aware)
335
-
336
- ```typescript
337
- interface SequenceComparisonResult {
338
- match: boolean;
339
- missing: string[]; // Events in expected but not actual
340
- extra: string[]; // Events in actual but not expected
341
- orderViolations: Array<{
342
- // Events out of expected order
343
- event: string;
344
- expectedAfter: string;
345
- actuallyBefore: string;
346
- }>;
347
- }
348
- ```
349
-
350
- ### Event Count Validation (order-agnostic)
351
-
352
- ```typescript
353
- interface CountComparisonResult {
354
- match: boolean;
355
- mismatches: Array<{
356
- eventType: string;
357
- expected: number;
358
- actual: number;
359
- }>;
360
- }
361
- ```
362
-
363
- ### Causal Chain Validation
364
-
365
- Verify that events respect causal dependencies:
366
-
367
- - `SchemaExported` BEFORE `SliceGenerated`
368
- - `SliceImplemented` BEFORE `TestsCheckPassed`
369
- - `ComponentImplemented(molecule)` BEFORE `ComponentImplemented(organism)`
370
-
371
- ```typescript
372
- const causalDependencies: [string, string][] = [
373
- ['SchemaExported', 'SliceGenerated'],
374
- ['SliceGenerated', 'SliceImplemented'],
375
- ['SliceImplemented', 'TestsCheckPassed'],
376
- ['SliceImplemented', 'TypeCheckPassed'],
377
- ['SliceImplemented', 'LintCheckPassed'],
378
- ['ServerGenerated', 'IAGenerated'],
379
- ['IAGenerated', 'ClientGenerated'],
380
- ['ClientGenerated', 'ComponentImplemented'],
381
- ];
382
- ```
383
-
384
- ---
385
-
386
- ## File Locations
387
-
388
- | Test Type | Location |
389
- | ----------------- | ------------------------------------------------- |
390
- | Unit tests | `packages/pipeline/src/**/*.specs.ts` |
391
- | Integration tests | `packages/pipeline/src/**/*.integration.specs.ts` |
392
- | E2E tests | `packages/pipeline/src/server/*.e2e.specs.ts` |
393
- | Snapshot fixtures | `packages/pipeline/src/testing/__snapshots__/` |
394
- | Mock handlers | `packages/pipeline/src/testing/mock-handlers.ts` |
395
- | Test utilities | `packages/pipeline/src/testing/helpers.ts` |