@nanobpm/nano-workforce 0.121.0 → 0.122.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/CHANGELOG.md +7 -0
- package/app/delivery.test.ts +76 -43
- package/app/lineage.test.ts +0 -5
- package/app/lineage.ts +24 -8
- package/app/mergesPerDay.test.ts +8 -92
- package/app/mergesPerDay.ts +7 -60
- package/app/plan.ts +26 -28
- package/app/planGateway.test.ts +25 -19
- package/app/service.ts +88 -45
- package/db/migrations/070_drop_plan_projection_columns.sql +31 -0
- package/db/migrations/071_drop_merges_per_day_table.sql +21 -0
- package/db/migrations/072_drop_lineage_view_backed_columns.sql +23 -0
- package/operations/acknowledgeEpic.test.ts +65 -16
- package/operations/acknowledgeEpic.ts +6 -2
- package/package.json +1 -1
- package/workers/record-plan/worker.test.ts +11 -9
- package/workers/record-plan/worker.ts +4 -8
- package/workers/record-wave/worker.test.ts +13 -11
- package/workers/record-wave/worker.ts +8 -12
- package/workers/select-wave/worker.test.ts +16 -14
- package/workers/select-wave/worker.ts +5 -6
|
@@ -142,8 +142,9 @@ test("record-wave retries the same wave when a task is still pending", async ()
|
|
|
142
142
|
trialMergeSkipReason: "wave-still-pending",
|
|
143
143
|
});
|
|
144
144
|
assertEquals((planUpdates[0].patch as Record<string, unknown>).gate_wave, 1);
|
|
145
|
-
//
|
|
146
|
-
|
|
145
|
+
// Wave progress (current_wave/wave_label) was retired as a stored projection (epic #412) — derived
|
|
146
|
+
// from `plan_tasks` by the plan_wave_label VIEW — so record-wave no longer writes it.
|
|
147
|
+
assertEquals("current_wave" in (planUpdates[0].patch as Record<string, unknown>), false);
|
|
147
148
|
// Domain-phase projection (#261): more waves remain, so the epic stays Implementing (wave n/t).
|
|
148
149
|
assertEquals((planUpdates[0].patch as Record<string, unknown>).epic_phase, "Implementing (wave 2/2)");
|
|
149
150
|
});
|
|
@@ -171,20 +172,21 @@ test("record-wave pins current_wave to the last index and clears gate_wave on th
|
|
|
171
172
|
app,
|
|
172
173
|
);
|
|
173
174
|
|
|
174
|
-
// Final wave (2 of 3): no successor wave — gate cleared
|
|
175
|
-
//
|
|
175
|
+
// Final wave (2 of 3): no successor wave — gate cleared. Wave progress (current_wave/wave_label)
|
|
176
|
+
// is no longer a stored column (epic #412; derived from `plan_tasks` by the plan_wave_label VIEW),
|
|
177
|
+
// so record-wave writes neither.
|
|
176
178
|
assertEquals((planUpdates[0].patch as Record<string, unknown>).gate_wave, null);
|
|
177
|
-
assertEquals((planUpdates[0].patch as Record<string, unknown>)
|
|
178
|
-
assertEquals((planUpdates[0].patch as Record<string, unknown>)
|
|
179
|
+
assertEquals("current_wave" in (planUpdates[0].patch as Record<string, unknown>), false);
|
|
180
|
+
assertEquals("wave_label" in (planUpdates[0].patch as Record<string, unknown>), false);
|
|
179
181
|
// Domain-phase projection (#261): the final wave landed with no successor and no trial merge, so
|
|
180
182
|
// the epic enters Finalizing (record-results then advances to the Dispatched terminal).
|
|
181
183
|
assertEquals((planUpdates[0].patch as Record<string, unknown>).epic_phase, "Finalizing");
|
|
182
184
|
});
|
|
183
185
|
|
|
184
|
-
test("record-wave
|
|
186
|
+
test("record-wave writes no wave-progress columns for a taskless plan (waveCount 0)", async () => {
|
|
185
187
|
// A taskless plan runs record-wave with waveCount 0 (the MI `implement` step completed
|
|
186
|
-
// immediately).
|
|
187
|
-
//
|
|
188
|
+
// immediately). Wave progress was retired as a stored projection (epic #412), so record-wave never
|
|
189
|
+
// writes current_wave/wave_label regardless.
|
|
188
190
|
const { app, planUpdates } = fakeApp([]);
|
|
189
191
|
|
|
190
192
|
await handler(
|
|
@@ -201,8 +203,8 @@ test("record-wave keeps all wave-progress fields NULL for a taskless plan (waveC
|
|
|
201
203
|
);
|
|
202
204
|
|
|
203
205
|
const patch = planUpdates[0].patch as Record<string, unknown>;
|
|
204
|
-
assertEquals(patch
|
|
205
|
-
assertEquals(patch
|
|
206
|
+
assertEquals("current_wave" in patch, false);
|
|
207
|
+
assertEquals("wave_label" in patch, false);
|
|
206
208
|
});
|
|
207
209
|
|
|
208
210
|
test("record-wave skips trial merge for mergify-queue repos with 2+ heads", async () => {
|
|
@@ -302,17 +302,15 @@ const handler: AppJobHandler<In, Out> = async (job, app) => {
|
|
|
302
302
|
const nextWave = stillPendingCurrentWave ? currentWave : currentWave + 1;
|
|
303
303
|
const hasMoreWaves = stillPendingCurrentWave || nextWave < waveCount;
|
|
304
304
|
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
//
|
|
308
|
-
//
|
|
305
|
+
// Wave index the epic is now on (issue #137): while more waves remain, the wave about to run; on
|
|
306
|
+
// the final wave, pinned to the last index so a finished epic reads N/N (nextWave would be
|
|
307
|
+
// waveCount, one past the last band). This is a LOCAL value only — it is used below to derive the
|
|
308
|
+
// `epic_phase` (Implementing wave n/t) and the domain phase.
|
|
309
309
|
const projectedCurrentWave = hasMoreWaves ? nextWave : Math.max(0, waveCount - 1);
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
//
|
|
313
|
-
//
|
|
314
|
-
const currentWaveProjection = waveCount > 0 ? projectedCurrentWave : null;
|
|
315
|
-
const waveLabel = waveCount > 0 ? `${projectedCurrentWave + 1}/${waveCount}` : null;
|
|
310
|
+
// Operator-visibility wave progress (current_wave / wave_label) was RETIRED as a stored projection
|
|
311
|
+
// (epic #412) — it is now derived from `plan_tasks` by the `plan_wave_label` / `plan_read_model`
|
|
312
|
+
// VIEWs (060/061), so this worker no longer denormalises it (select-wave no longer writes it
|
|
313
|
+
// either). `projectedCurrentWave` above is not persisted; it only feeds the phase derivation.
|
|
316
314
|
|
|
317
315
|
// Domain-phase projection (#261): the wave landed — stamp the phase the epic is ENTERING next,
|
|
318
316
|
// which is data-dependent here (unlike the structural spine writers). A trial merge runs → Trial
|
|
@@ -336,8 +334,6 @@ const handler: AppJobHandler<In, Out> = async (job, app) => {
|
|
|
336
334
|
try {
|
|
337
335
|
await plans(app.data).update(planKey, {
|
|
338
336
|
gate_wave: hasMoreWaves ? currentWave : null,
|
|
339
|
-
current_wave: currentWaveProjection,
|
|
340
|
-
wave_label: waveLabel,
|
|
341
337
|
epic_phase: epicPhase,
|
|
342
338
|
updated_at: ts,
|
|
343
339
|
});
|
|
@@ -67,21 +67,22 @@ async function selectWave(rows: Row[], deps: DepRow[]) {
|
|
|
67
67
|
return out as { waveTasks: unknown[] };
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
test("select-wave
|
|
70
|
+
test("select-wave dispatches the active wave without writing wave-progress columns", async () => {
|
|
71
71
|
const rows: Row[] = [
|
|
72
72
|
{ id: 1, plan_key: "owner/repo#63", task_id: "a", title: "A", prompt: "do A", status: "pending", wave: 1 },
|
|
73
73
|
];
|
|
74
|
-
const plans: Record<string, unknown>[] = [{ plan_key: "owner/repo#63"
|
|
74
|
+
const plans: Record<string, unknown>[] = [{ plan_key: "owner/repo#63" }];
|
|
75
75
|
const out = await handler(
|
|
76
76
|
{ variables: { planKey: "owner/repo#63", currentWave: 1 }, elementId: "select-wave" } as any,
|
|
77
77
|
fakeApp(rows, [], plans),
|
|
78
78
|
);
|
|
79
79
|
assertEquals((out as { waveTasks: unknown[] }).waveTasks.length, 1);
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
assertEquals(plans[0].
|
|
84
|
-
assertEquals(plans[0].
|
|
80
|
+
// Wave progress (current_wave/wave_count/wave_label) was retired as a stored projection (epic
|
|
81
|
+
// #412; the columns are dropped by migration 070) — it is derived from `plan_tasks` by the
|
|
82
|
+
// plan_wave_label VIEW — so select-wave introduces no wave-progress field onto the plan row.
|
|
83
|
+
assertEquals(plans[0].current_wave, undefined);
|
|
84
|
+
assertEquals(plans[0].wave_count, undefined);
|
|
85
|
+
assertEquals(plans[0].wave_label, undefined);
|
|
85
86
|
// Domain-phase projection (#261): dispatching the wave marks the epic Implementing (wave n/t),
|
|
86
87
|
// derived from this worker's BPMN element id + the levelize records.
|
|
87
88
|
assertEquals(plans[0].epic_phase, "Implementing (wave 2/2)");
|
|
@@ -124,17 +125,18 @@ test("select-wave leaves bound_artifacts untouched for a root epic (no resolvedA
|
|
|
124
125
|
assertEquals(plans[0].bound_artifacts, undefined);
|
|
125
126
|
});
|
|
126
127
|
|
|
127
|
-
test("select-wave
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
|
|
128
|
+
test("select-wave writes no wave-progress columns when there are no levelized rows", async () => {
|
|
129
|
+
// Wave progress was retired as a stored projection (epic #412; the columns are dropped by
|
|
130
|
+
// migration 070; it is derived from `plan_tasks` by the plan_wave_label VIEW), so select-wave
|
|
131
|
+
// introduces no wave-progress field onto the plan row.
|
|
132
|
+
const plans: Record<string, unknown>[] = [{ plan_key: "owner/repo#63" }];
|
|
131
133
|
await handler(
|
|
132
134
|
{ variables: { planKey: "owner/repo#63", currentWave: 0 } } as any,
|
|
133
135
|
fakeApp([], [], plans),
|
|
134
136
|
);
|
|
135
|
-
assertEquals(plans[0].current_wave,
|
|
136
|
-
assertEquals(plans[0].wave_count,
|
|
137
|
-
assertEquals(plans[0].wave_label,
|
|
137
|
+
assertEquals(plans[0].current_wave, undefined);
|
|
138
|
+
assertEquals(plans[0].wave_count, undefined);
|
|
139
|
+
assertEquals(plans[0].wave_label, undefined);
|
|
138
140
|
});
|
|
139
141
|
|
|
140
142
|
test("select-wave leaves dependents pending behind a waiting-for-lane dependency", async () => {
|
|
@@ -78,17 +78,16 @@ const handler: AppJobHandler<In, Out> = async (job, app) => {
|
|
|
78
78
|
: [];
|
|
79
79
|
try {
|
|
80
80
|
await plans(app.data).update(planKey, {
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
wave_label: waveCount > 0 ? `${currentWave + 1}/${waveCount}` : null,
|
|
81
|
+
// Operator-visibility wave progress (current_wave / wave_count / wave_label) was RETIRED as a
|
|
82
|
+
// stored projection (epic #412) — it is now derived from `plan_tasks` by the `plan_wave_label`
|
|
83
|
+
// / `plan_read_model` VIEWs (060/061), so select-wave no longer denormalises it. This write
|
|
84
|
+
// still stamps the derived domain phase and the inter-epic gate's bound artifacts.
|
|
86
85
|
...(epicPhase ? { epic_phase: epicPhase } : {}),
|
|
87
86
|
...(boundArtifacts.length > 0 ? { bound_artifacts: JSON.stringify(boundArtifacts) } : {}),
|
|
88
87
|
updated_at: ts,
|
|
89
88
|
});
|
|
90
89
|
} catch (err) {
|
|
91
|
-
app.log.error(`select-wave: projecting
|
|
90
|
+
app.log.error(`select-wave: projecting plan row (epic phase / bound artifacts) failed for ${planKey}`, {
|
|
92
91
|
err: String(err),
|
|
93
92
|
});
|
|
94
93
|
}
|