@oisincoveney/pipeline 3.11.4 → 3.11.5

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.
@@ -1,4 +1,5 @@
1
1
  import { uniqueStrings } from "./strings.js";
2
+ import { resolveExecutableDependencyIds } from "./planning/dependency-refs.js";
2
3
  import { z } from "zod";
3
4
  import { Data } from "effect";
4
5
  //#region src/argo-graph.ts
@@ -88,26 +89,7 @@ var ArgoGraphCompiler = class {
88
89
  this.compileNodes(node.children ?? [], [...inheritedNeeds, ...node.needs]);
89
90
  }
90
91
  resolveDependencyTaskNames(nodeIds) {
91
- return uniqueStrings(nodeIds.flatMap((nodeId) => this.resolveDependencyNodeIds(nodeId).map((id) => argoTaskName(id))));
92
- }
93
- resolveDependencyNodeIds(nodeId) {
94
- const node = this.nodeById.get(nodeId);
95
- if (!node) return [];
96
- const kind = node.kind;
97
- switch (kind) {
98
- case "agent":
99
- case "builtin":
100
- case "command": return [node.id];
101
- case "group": return this.resolveGroupNodeIds(node);
102
- case "parallel": return this.resolveParallelNodeIds(node);
103
- default: throw new ArgoGraphCompilerError(String(kind), node.id);
104
- }
105
- }
106
- resolveGroupNodeIds(node) {
107
- return uniqueStrings([...node.nodes ?? [], ...node.needs].flatMap((id) => this.resolveDependencyNodeIds(id)));
108
- }
109
- resolveParallelNodeIds(node) {
110
- return uniqueStrings((node.children ?? []).flatMap((child) => this.resolveDependencyNodeIds(child.id)));
92
+ return uniqueStrings(resolveExecutableDependencyIds(this.nodeById, nodeIds).map((id) => argoTaskName(id)));
111
93
  }
112
94
  terminalTasks() {
113
95
  const dependedOn = new Set(this.tasks.flatMap((task) => task.dependencies));
@@ -481,8 +481,8 @@ declare const configSchema: z.ZodObject<{
481
481
  schedules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
482
482
  description: z.ZodOptional<z.ZodString>;
483
483
  baseline: z.ZodEnum<{
484
- quick: "quick";
485
484
  execute: "execute";
485
+ quick: "quick";
486
486
  }>;
487
487
  max_parallel_nodes: z.ZodOptional<z.ZodNumber>;
488
488
  node_catalog: z.ZodOptional<z.ZodString>;
@@ -5,13 +5,13 @@ import { z } from "zod";
5
5
  //#region src/moka-submit.d.ts
6
6
  declare const mokaSubmitDirectHooksSchema: z.ZodRecord<z.ZodEnum<{
7
7
  "workflow.start": "workflow.start";
8
+ "node.finish": "node.finish";
9
+ "node.start": "node.start";
8
10
  "workflow.success": "workflow.success";
9
11
  "workflow.failure": "workflow.failure";
10
12
  "workflow.complete": "workflow.complete";
11
- "node.start": "node.start";
12
13
  "node.success": "node.success";
13
14
  "node.error": "node.error";
14
- "node.finish": "node.finish";
15
15
  "gate.failure": "gate.failure";
16
16
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
17
17
  failure: z.ZodDefault<z.ZodEnum<{
@@ -94,13 +94,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
94
94
  }, z.core.$strict>>;
95
95
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
96
96
  "workflow.start": "workflow.start";
97
+ "node.finish": "node.finish";
98
+ "node.start": "node.start";
97
99
  "workflow.success": "workflow.success";
98
100
  "workflow.failure": "workflow.failure";
99
101
  "workflow.complete": "workflow.complete";
100
- "node.start": "node.start";
101
102
  "node.success": "node.success";
102
103
  "node.error": "node.error";
103
- "node.finish": "node.finish";
104
104
  "gate.failure": "gate.failure";
105
105
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
106
106
  failure: z.ZodDefault<z.ZodEnum<{
@@ -161,8 +161,8 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
161
161
  }, z.core.$strict>>;
162
162
  serviceAccountName: z.ZodOptional<z.ZodString>;
163
163
  mode: z.ZodEnum<{
164
- full: "full";
165
164
  quick: "quick";
165
+ full: "full";
166
166
  }>;
167
167
  schedulePath: z.ZodOptional<z.ZodString>;
168
168
  scheduleYaml: z.ZodOptional<z.ZodString>;
@@ -207,13 +207,13 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
207
207
  }, z.core.$strict>>;
208
208
  hooks: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
209
209
  "workflow.start": "workflow.start";
210
+ "node.finish": "node.finish";
211
+ "node.start": "node.start";
210
212
  "workflow.success": "workflow.success";
211
213
  "workflow.failure": "workflow.failure";
212
214
  "workflow.complete": "workflow.complete";
213
- "node.start": "node.start";
214
215
  "node.success": "node.success";
215
216
  "node.error": "node.error";
216
- "node.finish": "node.finish";
217
217
  "gate.failure": "gate.failure";
218
218
  }> & z.core.$partial, z.ZodDiscriminatedUnion<[z.ZodObject<{
219
219
  failure: z.ZodDefault<z.ZodEnum<{
@@ -0,0 +1,43 @@
1
+ import { uniqueStrings } from "../strings.js";
2
+ //#region src/planning/dependency-refs.ts
3
+ /**
4
+ * Index every planned node — including the children nested inside `parallel`
5
+ * containers — by id, so a dependency id can be resolved regardless of nesting.
6
+ */
7
+ function indexPlannedNodesById(nodes, into = /* @__PURE__ */ new Map()) {
8
+ for (const node of nodes) {
9
+ into.set(node.id, node);
10
+ indexPlannedNodesById(node.children ?? [], into);
11
+ }
12
+ return into;
13
+ }
14
+ /**
15
+ * Expand dependency ids to the executable (branch-producing) leaf node ids,
16
+ * making `group`/`parallel` container nodes transparent.
17
+ *
18
+ * A container produces no output of its own: a `parallel` lowers to its children
19
+ * and a `group` is a pure dependency anchor, so neither pushes a `nodes/<id>`
20
+ * result branch. A downstream node that lists the container in `needs` actually
21
+ * depends on the container's executable descendants. Both the Argo DAG ordering
22
+ * and the runner's upstream-output (git ref) materialization resolve dependencies
23
+ * through this one function so the two representations never diverge — divergence
24
+ * is what made review nodes fetch a non-existent `nodes/mechanical-checks` branch.
25
+ */
26
+ function resolveExecutableDependencyIds(nodeById, needs) {
27
+ const resolveOne = (nodeId) => {
28
+ const node = nodeById.get(nodeId);
29
+ if (!node) return [];
30
+ const kind = node.kind;
31
+ switch (kind) {
32
+ case "agent":
33
+ case "builtin":
34
+ case "command": return [node.id];
35
+ case "group": return uniqueStrings([...node.nodes ?? [], ...node.needs].flatMap(resolveOne));
36
+ case "parallel": return uniqueStrings((node.children ?? []).flatMap((child) => resolveOne(child.id)));
37
+ default: throw new Error(`resolveExecutableDependencyIds: unsupported node kind '${String(kind)}' on '${node.id}'`);
38
+ }
39
+ };
40
+ return uniqueStrings(needs.flatMap(resolveOne));
41
+ }
42
+ //#endregion
43
+ export { indexPlannedNodesById, resolveExecutableDependencyIds };
@@ -1,3 +1,4 @@
1
+ import { indexPlannedNodesById, resolveExecutableDependencyIds } from "../planning/dependency-refs.js";
1
2
  import { loadPipelineConfig } from "../config/load.js";
2
3
  import "../config.js";
3
4
  import { findPlannedNode } from "../planned-node.js";
@@ -120,20 +121,21 @@ function runRunnerCommandEffect(options, runtime) {
120
121
  workflowId: compiled.workflowId
121
122
  }, "schedule.compile finish");
122
123
  const node = yield* resolveRunnerTargetNode(payload, compiled, descriptor);
124
+ const dependencyNodeIds = resolveExecutableDependencyIds(indexPlannedNodesById(compiled.plan.topologicalOrder), node.needs);
123
125
  logger.info({
124
- dependencyCount: node.needs.length,
126
+ dependencyCount: dependencyNodeIds.length,
125
127
  nodeId: descriptor.nodeId,
126
128
  phase: "dependency.merge",
127
129
  status: "start"
128
130
  }, "dependency.merge start");
129
131
  yield* io.mergeDependencyRefs({
130
132
  committer: compiled.config.runner_command.git.committer,
131
- dependencyNodeIds: node.needs,
133
+ dependencyNodeIds,
132
134
  payload,
133
135
  worktreePath
134
136
  });
135
137
  logger.info({
136
- dependencyCount: node.needs.length,
138
+ dependencyCount: dependencyNodeIds.length,
137
139
  nodeId: descriptor.nodeId,
138
140
  phase: "dependency.merge",
139
141
  status: "finish"
@@ -43,8 +43,8 @@ declare const runnerDeliverySchema: z.ZodObject<{
43
43
  declare const mokaSubmissionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
44
44
  kind: z.ZodLiteral<"graph">;
45
45
  mode: z.ZodEnum<{
46
- full: "full";
47
46
  quick: "quick";
47
+ full: "full";
48
48
  }>;
49
49
  }, z.core.$strict>, z.ZodObject<{
50
50
  argv: z.ZodArray<z.ZodString>;
@@ -104,8 +104,8 @@ declare const runnerCommandPayloadSchema: z.ZodObject<{
104
104
  submission: z.ZodDefault<z.ZodDiscriminatedUnion<[z.ZodObject<{
105
105
  kind: z.ZodLiteral<"graph">;
106
106
  mode: z.ZodEnum<{
107
- full: "full";
108
107
  quick: "quick";
108
+ full: "full";
109
109
  }>;
110
110
  }, z.core.$strict>, z.ZodObject<{
111
111
  argv: z.ZodArray<z.ZodString>;
@@ -11,8 +11,8 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
11
11
  runId: z.ZodString;
12
12
  sequence: z.ZodNumber;
13
13
  type: z.ZodEnum<{
14
- "workflow.start": "workflow.start";
15
14
  "workflow.planned": "workflow.planned";
15
+ "workflow.start": "workflow.start";
16
16
  }>;
17
17
  workflowPlan: z.ZodObject<{
18
18
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -58,10 +58,10 @@ declare const runnerEventRecordSchema: z.ZodUnion<readonly [z.ZodObject<{
58
58
  }>;
59
59
  }, z.core.$strip>;
60
60
  type: z.ZodEnum<{
61
- "node.start": "node.start";
62
- "node.finish": "node.finish";
63
61
  "agent.finish": "agent.finish";
64
62
  "agent.start": "agent.start";
63
+ "node.finish": "node.finish";
64
+ "node.start": "node.start";
65
65
  }>;
66
66
  }, z.core.$strip>, z.ZodObject<{
67
67
  at: z.ZodOptional<z.ZodString>;
@@ -189,8 +189,8 @@ declare const runnerEventBatchSchema: z.ZodObject<{
189
189
  runId: z.ZodString;
190
190
  sequence: z.ZodNumber;
191
191
  type: z.ZodEnum<{
192
- "workflow.start": "workflow.start";
193
192
  "workflow.planned": "workflow.planned";
193
+ "workflow.start": "workflow.start";
194
194
  }>;
195
195
  workflowPlan: z.ZodObject<{
196
196
  edges: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -236,10 +236,10 @@ declare const runnerEventBatchSchema: z.ZodObject<{
236
236
  }>;
237
237
  }, z.core.$strip>;
238
238
  type: z.ZodEnum<{
239
- "node.start": "node.start";
240
- "node.finish": "node.finish";
241
239
  "agent.finish": "agent.finish";
242
240
  "agent.start": "agent.start";
241
+ "node.finish": "node.finish";
242
+ "node.start": "node.start";
243
243
  }>;
244
244
  }, z.core.$strip>, z.ZodObject<{
245
245
  at: z.ZodOptional<z.ZodString>;
package/package.json CHANGED
@@ -127,7 +127,7 @@
127
127
  "prepack": "bun run build:cli"
128
128
  },
129
129
  "type": "module",
130
- "version": "3.11.4",
130
+ "version": "3.11.5",
131
131
  "description": "Config-driven multi-agent pipeline runner for repository work",
132
132
  "main": "./dist/index.js",
133
133
  "types": "./dist/index.d.ts",