@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.
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +5 -5
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +34 -0
- package/dist/src/plugins/handler-adapter.d.ts.map +1 -1
- package/dist/src/plugins/handler-adapter.js +2 -2
- package/dist/src/plugins/handler-adapter.js.map +1 -1
- package/dist/src/plugins/plugin-loader.d.ts +1 -1
- package/dist/src/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/src/runtime/context.d.ts +5 -2
- package/dist/src/runtime/context.d.ts.map +1 -1
- package/dist/src/runtime/phased-executor.js +1 -1
- package/dist/src/runtime/phased-executor.js.map +1 -1
- package/dist/src/runtime/pipeline-runtime.js +1 -1
- package/dist/src/runtime/pipeline-runtime.js.map +1 -1
- package/dist/src/server/pipeline-server.d.ts +3 -1
- package/dist/src/server/pipeline-server.d.ts.map +1 -1
- package/dist/src/server/pipeline-server.js +9 -5
- package/dist/src/server/pipeline-server.js.map +1 -1
- package/dist/src/testing/fixtures/kanban-todo.config.d.ts.map +1 -1
- package/dist/src/testing/fixtures/kanban-todo.config.js +3 -5
- package/dist/src/testing/fixtures/kanban-todo.config.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/ketchup-plan.md +8 -0
- package/package.json +3 -3
- package/src/plugins/handler-adapter.specs.ts +22 -1
- package/src/plugins/handler-adapter.ts +3 -2
- package/src/plugins/plugin-loader.specs.ts +0 -7
- package/src/plugins/plugin-loader.ts +1 -1
- package/src/runtime/context.ts +5 -2
- package/src/runtime/phased-executor.specs.ts +46 -0
- package/src/runtime/phased-executor.ts +1 -1
- package/src/runtime/pipeline-runtime.specs.ts +23 -0
- package/src/runtime/pipeline-runtime.ts +1 -1
- package/src/server/pipeline-server.ts +10 -5
- 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 &&
|
|
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
|
|
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(
|
|
1000
|
-
|
|
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/
|
|
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(),
|