@auto-engineer/pipeline 1.12.0 → 1.13.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 (36) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +5 -5
  3. package/.turbo/turbo-type-check.log +1 -1
  4. package/CHANGELOG.md +34 -0
  5. package/dist/src/plugins/handler-adapter.d.ts.map +1 -1
  6. package/dist/src/plugins/handler-adapter.js +2 -2
  7. package/dist/src/plugins/handler-adapter.js.map +1 -1
  8. package/dist/src/plugins/plugin-loader.d.ts +1 -1
  9. package/dist/src/plugins/plugin-loader.d.ts.map +1 -1
  10. package/dist/src/runtime/context.d.ts +5 -2
  11. package/dist/src/runtime/context.d.ts.map +1 -1
  12. package/dist/src/runtime/phased-executor.js +1 -1
  13. package/dist/src/runtime/phased-executor.js.map +1 -1
  14. package/dist/src/runtime/pipeline-runtime.js +1 -1
  15. package/dist/src/runtime/pipeline-runtime.js.map +1 -1
  16. package/dist/src/server/pipeline-server.d.ts +3 -1
  17. package/dist/src/server/pipeline-server.d.ts.map +1 -1
  18. package/dist/src/server/pipeline-server.js +9 -5
  19. package/dist/src/server/pipeline-server.js.map +1 -1
  20. package/dist/src/testing/fixtures/kanban-todo.config.d.ts.map +1 -1
  21. package/dist/src/testing/fixtures/kanban-todo.config.js +3 -5
  22. package/dist/src/testing/fixtures/kanban-todo.config.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/ketchup-plan.md +8 -0
  25. package/package.json +3 -3
  26. package/src/plugins/handler-adapter.specs.ts +22 -1
  27. package/src/plugins/handler-adapter.ts +3 -2
  28. package/src/plugins/plugin-loader.specs.ts +0 -7
  29. package/src/plugins/plugin-loader.ts +1 -1
  30. package/src/runtime/context.ts +5 -2
  31. package/src/runtime/phased-executor.specs.ts +46 -0
  32. package/src/runtime/phased-executor.ts +1 -1
  33. package/src/runtime/pipeline-runtime.specs.ts +23 -0
  34. package/src/runtime/pipeline-runtime.ts +1 -1
  35. package/src/server/pipeline-server.ts +10 -5
  36. package/src/testing/fixtures/kanban-todo.config.ts +3 -5
@@ -117,7 +117,7 @@ export class PhasedExecutor {
117
117
  let pending = 0;
118
118
  const currentPhase = execution.phases[execution.currentPhaseIndex];
119
119
  for (const item of execution.items) {
120
- if (item.phase === currentPhase && item.dispatched && !item.completed) {
120
+ if (item.phase === currentPhase && !item.completed) {
121
121
  pending++;
122
122
  }
123
123
  }
@@ -235,6 +235,29 @@ describe('PipelineRuntime', () => {
235
235
  expect(phasedCalled).toBe(true);
236
236
  });
237
237
 
238
+ it('should propagate startPhased rejection', async () => {
239
+ const ctx = {
240
+ sendCommand: async () => {},
241
+ emit: async () => {},
242
+ correlationId: 'test',
243
+ startPhased: async () => {
244
+ throw new Error('phased-setup-failed');
245
+ },
246
+ };
247
+ type Item = { id: string; p: 'high' | 'low' };
248
+ const pipeline = define('test')
249
+ .on('Items')
250
+ .forEach((e: { data: { items: Item[] } }) => e.data.items)
251
+ .groupInto(['high', 'low'], (i: Item) => i.p)
252
+ .process('Cmd', (i: Item) => ({ id: i.id }))
253
+ .onComplete({ success: 'Done', failure: 'Fail', itemKey: () => '' })
254
+ .build();
255
+ const runtime = new PipelineRuntime(pipeline.descriptor);
256
+ await expect(runtime.handleEvent({ type: 'Items', data: { items: [{ id: '1', p: 'low' }] } }, ctx)).rejects.toThrow(
257
+ 'phased-setup-failed',
258
+ );
259
+ });
260
+
238
261
  it('should dispatch multiple emit commands in parallel, not sequentially', async () => {
239
262
  const callOrder: string[] = [];
240
263
  let resolveA: () => void;
@@ -43,7 +43,7 @@ export class PipelineRuntime {
43
43
  break;
44
44
  case 'foreach-phased':
45
45
  if (ctx.startPhased !== undefined) {
46
- ctx.startPhased(handler, event);
46
+ await ctx.startPhased(handler, event);
47
47
  } else {
48
48
  await this.executeForEachPhasedHandler(handler, event, ctx);
49
49
  }
@@ -31,6 +31,7 @@ export interface CommandHandlerWithMetadata extends CommandHandler {
31
31
  fields?: Record<string, unknown>;
32
32
  examples?: unknown[];
33
33
  events?: EventDefinition[];
34
+ handle: (command: Command, context?: PipelineContext) => Promise<Event | Event[]>;
34
35
  }
35
36
 
36
37
  export interface PipelineServerConfig {
@@ -900,7 +901,8 @@ export class PipelineServer {
900
901
  await this.updateNodeStatus(command.correlationId, command.type, 'running');
901
902
  await this.settledTracker.onCommandStarted(command);
902
903
 
903
- const resultEvent = await handler.handle(command);
904
+ const ctx = this.createContext(command.correlationId);
905
+ const resultEvent = await handler.handle(command, ctx);
904
906
  const events = Array.isArray(resultEvent) ? resultEvent : [resultEvent];
905
907
 
906
908
  const finalStatus = this.getStatusFromEvents(events);
@@ -988,21 +990,24 @@ export class PipelineServer {
988
990
  this.sseManager.broadcast(event);
989
991
  await this.routeEventToPipelines(event);
990
992
  },
991
- sendCommand: async (type: string, data: unknown) => {
993
+ sendCommand: async (type: string, data: unknown, overrideCorrelationId?: string) => {
992
994
  const requestId = `req-${nanoid()}`;
995
+ const effectiveCorrelationId = overrideCorrelationId ?? correlationId;
993
996
  const command: Command & { correlationId: string; requestId: string } = {
994
997
  type,
995
998
  data: data as Record<string, unknown>,
996
- correlationId,
999
+ correlationId: effectiveCorrelationId,
997
1000
  requestId,
998
1001
  };
999
- await this.emitCommandDispatched(correlationId, requestId, type, data as Record<string, unknown>);
1000
- await this.processCommand(command);
1002
+ await this.emitCommandDispatched(effectiveCorrelationId, requestId, type, data as Record<string, unknown>);
1003
+ void this.processCommand(command);
1001
1004
  },
1002
1005
  /* v8 ignore next 3 - integration path tested via pipeline-runtime.specs.ts */
1003
1006
  startPhased: async (handler, event) => {
1004
1007
  await this.phasedExecutor.startPhased(handler, event, correlationId);
1005
1008
  },
1009
+ eventStore: this.eventStoreContext.eventStore,
1010
+ messageBus: this.messageBus,
1006
1011
  };
1007
1012
  }
1008
1013
 
@@ -4,15 +4,13 @@ import { createKanbanFullPipeline } from './kanban-full.pipeline';
4
4
  export default pipelineConfig({
5
5
  plugins: [
6
6
  '@auto-engineer/server-checks',
7
- '@auto-engineer/design-system-importer',
8
7
  '@auto-engineer/server-generator-apollo-emmett',
9
8
  '@auto-engineer/narrative',
10
- '@auto-engineer/frontend-checks',
11
- '@auto-engineer/frontend-implementer',
12
- '@auto-engineer/component-implementer',
13
9
  '@auto-engineer/information-architect',
14
- '@auto-engineer/frontend-generator-react-graphql',
10
+ '@auto-engineer/generate-react-client',
11
+ '@auto-engineer/react-component-implementer',
15
12
  '@auto-engineer/server-implementer',
13
+ '@auto-engineer/app-implementer',
16
14
  '@auto-engineer/dev-server',
17
15
  ],
18
16
  pipeline: createKanbanFullPipeline(),