pi-spine 2.16.0 → 2.18.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/bin/spine-gate.mjs +8 -2
- package/package.json +1 -1
- package/skills/create-spine-tasks/SKILL.md +3 -1
- package/skills/create-spine-tasks/references/contract-template.md +12 -12
- package/skills/create-spine-tasks/references/prompt-template.md +8 -6
- package/skills/spine-autonomous-operator/SKILL.md +2 -0
- package/skills/spine-autonomous-operator/references/agent-shell-batch-policy.md +1 -1
- package/skills/spine-orchestrate-waves/SKILL.md +6 -4
- package/skills/spine-orchestrate-waves/references/outer-loop.md +16 -1
- package/skills/spine-release-operator/SKILL.md +3 -0
- package/skills/spine-release-operator/references/pi-async-orchestration.md +2 -1
- package/skills/spine-release-operator/references/post-integrate-regression-gate.md +14 -0
- package/src/batch/batch-guards.mjs +14 -0
- package/src/batch/batch-meta-reconstruct.mjs +5 -2
- package/src/batch/diagnosis-worker-done-missing.mjs +12 -1
- package/src/batch/engine-lanes/matrix-run.mjs +122 -26
- package/src/batch/engine-lanes/merge.mjs +16 -11
- package/src/batch/engine-lanes/phase.mjs +45 -0
- package/src/batch/engine-lanes/queue.mjs +1 -1
- package/src/batch/engine-lanes.mjs +9 -37
- package/src/batch/engine.mjs +8 -16
- package/src/batch/gate.mjs +153 -6
- package/src/batch/heartbeat.mjs +18 -0
- package/src/batch/post-merge-finalize.mjs +128 -0
- package/src/batch/post-merge-limbo.mjs +14 -85
- package/src/batch/readers/spine-state.mjs +22 -1
- package/src/batch/readers/taskplane-state.mjs +22 -1
- package/src/batch/reconcile-batch.mjs +1 -1
- package/src/batch/resume-common.mjs +1 -1
- package/src/batch/resume-gate-reopen.mjs +50 -0
- package/src/batch/resume-multi-validate.mjs +43 -0
- package/src/batch/resume-multi.mjs +6 -2
- package/src/batch/resume-prompt-parse-fail.mjs +75 -0
- package/src/batch/resume.mjs +21 -40
- package/src/batch/review-spawn.mjs +4 -3
- package/src/batch/salvage-batch-integrate-gate.mjs +180 -0
- package/src/batch/salvage-batch-integrate.mjs +66 -4
- package/src/batch/worker-heartbeat.mjs +31 -6
- package/src/batch/worker-host.mjs +27 -1
- package/src/batch/worker-output.mjs +56 -0
- package/src/cli/journal-follow.mjs +3 -1
- package/src/cli/lane-logs.mjs +3 -1
- package/src/cli/settings-slash.mjs +2 -1
- package/src/config/worker-context.mjs +2 -1
- package/src/planner/matrix.mjs +24 -0
- package/src/tasks/analyze/index.mjs +2 -1
- package/src/tasks/validate-contract-warn.mjs +45 -0
package/bin/spine-gate.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Integrate gate inspection and resolution (PRD §12, FR-GATE).
|
|
4
|
-
* Usage: spine gate [approve|reject|status] [--batch ID] [--reason text] [--json]
|
|
4
|
+
* Usage: spine gate [approve|reject|status|reopen] [--batch ID] [--reason text] [--json]
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { isCliEntrypoint } from "./spine-cli/shared.mjs";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
approveIntegrateGate,
|
|
11
11
|
getIntegrateGateStatus,
|
|
12
12
|
rejectIntegrateGate,
|
|
13
|
+
reopenIntegrateGateForCompletedBatch,
|
|
13
14
|
} from "../src/batch/gate.mjs";
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -113,13 +114,18 @@ export function runSpineGate(options) {
|
|
|
113
114
|
case "status":
|
|
114
115
|
result = getIntegrateGateStatus({ projectRoot, batchId });
|
|
115
116
|
break;
|
|
117
|
+
case "reopen":
|
|
118
|
+
// SP-740 / #275: re-open + re-approve path for completed batches after
|
|
119
|
+
// stale_revision or a removed gate record.
|
|
120
|
+
result = reopenIntegrateGateForCompletedBatch({ projectRoot, batchId });
|
|
121
|
+
break;
|
|
116
122
|
default:
|
|
117
123
|
result = {
|
|
118
124
|
ok: false,
|
|
119
125
|
exitCode: 1,
|
|
120
126
|
headline: `Unknown gate action: ${action}`,
|
|
121
127
|
suggestedCommand: "spine gate status",
|
|
122
|
-
error: "Use approve, reject, or
|
|
128
|
+
error: "Use approve, reject, status, or reopen",
|
|
123
129
|
};
|
|
124
130
|
}
|
|
125
131
|
|
package/package.json
CHANGED
|
@@ -307,7 +307,7 @@ Use [references/prompt-template.md](references/prompt-template.md). Spine-specif
|
|
|
307
307
|
- **Environment** — include `npm run typecheck && SPINE_WORKER_STUB=1 npm test` when that is the project test command
|
|
308
308
|
- **Git Commit Convention** — `feat(SP-###): …` at step boundaries
|
|
309
309
|
- **Worker tools** — when Review Level > 0, steps must note `spine_review_step` after each step
|
|
310
|
-
- **Testing step (required for all tasks)** — every packet MUST include `### Step N: Testing & Verification` inside `## Steps`, placed **before** `## Completion Criteria`. This applies to **docs-only Review Level 0 tasks** as well — omitting the step causes `prompt_parse_failed` at batch launch (SP-075). Docs-only tasks still run the full test suite; they may omit
|
|
310
|
+
- **Testing step (required for all tasks)** — every packet MUST include `### Step N: Testing & Verification` inside `## Steps`, placed **before** `## Completion Criteria`. This applies to **docs-only Review Level 0 tasks** as well — omitting the step causes `prompt_parse_failed` at batch launch (SP-075). Docs-only tasks still run the full test suite; they may omit lint and coverage-gate checkboxes when no application code changes. **Code tasks:** Contract `testCommand` must prefix project lint/analyze (`npm run lint &&` for pi-spine).
|
|
311
311
|
- **Coverage gate** — when the task changes application code, add a coverage verification checkbox in the Testing step using `testing.testWithCoverage` (≥77% line coverage policy)
|
|
312
312
|
- **Contract (required for new SP-\* tasks)** — add `## Contract` after `## File Scope` using [references/contract-template.md](references/contract-template.md). Include `testCommand` for code tasks; use `` `true` `` for docs-only S tasks. When `testCommand` is `` `true` `` (docs-only), **always** include `fileScopeMustChange` listing at least one documentation deliverable path — without it, workers can pass contract by creating only `.DONE` (SP-214 batch `20260612T204048`, SP-457 batch `20260703T022335`). When using `fileScopeMustNotChange`, follow parallel-only semantics and never ban `spine-tasks/**` (see contract template and [File Scope and parallel batches](#file-scope-and-parallel-batches)). Legacy `TP-*` packets may omit Contract when `contract.legacyTaskIdPrefixes` includes `TP-`.
|
|
313
313
|
- **Completion** — worker creates `{task-folder}/.DONE`; batch engine may auto-commit remaining work
|
|
@@ -556,6 +556,7 @@ Before reporting launch commands:
|
|
|
556
556
|
- [ ] Every **Must Update** doc path also appears in `## File Scope` ([#144](https://github.com/beettlle/pi-spine/issues/144))
|
|
557
557
|
- [ ] Docs-only tasks: consider `fileScopeMustNotChange` on `src/**`, `bin/**` ([#142](https://github.com/beettlle/pi-spine/issues/142)); see [Docs-only contract pattern](#docs-only-contract-pattern-fr-sta-12)
|
|
558
558
|
- [ ] S/M patch Contract uses scoped `node --test` — not `npm test` or `npm test -- path` ([#141](https://github.com/beettlle/pi-spine/issues/141), SP-522)
|
|
559
|
+
- [ ] Code tasks (File Scope touches `src/**`, `bin/**`, `tests/**`, or `scripts/**`): Contract `testCommand` prefixes project lint/analyze (`npm run lint &&` for pi-spine)
|
|
559
560
|
- [ ] Shared-module behavior change: `rg` old strings in `tests/`; all hit files in `testCommand` or documented for post-integrate `release:check` ([post-integrate-regression-gate.md](../spine-release-operator/references/post-integrate-regression-gate.md))
|
|
560
561
|
- [ ] Plan waves ≤8 tasks when possible — `spine plan` warns when exceeded ([#143](https://github.com/beettlle/pi-spine/issues/143), SP-524)
|
|
561
562
|
- [ ] When parallelism is intended: `spine plan` shows `N lanes in parallel` for that wave — or document why overlapping scopes / real deps forced serial collapse ([#193](https://github.com/beettlle/pi-spine/issues/193))
|
|
@@ -586,6 +587,7 @@ Hydration commits (STATUS.md expansions) may happen mid-step for crash recovery.
|
|
|
586
587
|
- **Self-contained PROMPT.md** — the worker has no memory of this conversation. Cross-model reviewers receive a **fresh spawn** (FR-REV-04) with only the review request, diff, and Contract — not `referenceDocs` or worker rules. Place acceptance criteria and spec references in PROMPT `## Mission`, `## Contract`, and step checkboxes.
|
|
587
588
|
- **Issue links in Mission ([#147](https://github.com/beettlle/pi-spine/issues/147))** — Use `Closes #N` when this task fully resolves the issue. Use `Partial #N` when this task is one of several addressing the issue. Place on the first line of `## Mission` (not `Closes: [#N]` or `GitHub: [#N]` variants).
|
|
588
589
|
- **Scoped `testCommand` for cross-model batches** — lane worktrees differ from dev checkouts; broad `flutter test` / `npm test` can fail in lanes even when targeted tests pass. See [cross-model authoring guidance](references/contract-template.md#cross-model-authoring-worker--reviewer) for the `testCommand` decision table.
|
|
590
|
+
- **Lint in code-task contracts** — prefix `testCommand` with project lint/analyze (`npm run lint &&` for pi-spine). Contract verify runs the authored command in-lane; without lint, ESLint failures surface only at operator post-integrate `release:check` (post-mortem v2.15.0 F-C). Docs-only (`testCommand: true`) stays exempt.
|
|
589
591
|
- **Scoped contract ≠ full regression** — changing shared modules (diagnosis, reconcile, parse-prompt) can break tests outside the task's scoped `testCommand`. Authors must `rg` old strings in `tests/` and include related test files in Contract, or rely on operator post-integrate `release:check` on `main` ([post-integrate-regression-gate.md](../spine-release-operator/references/post-integrate-regression-gate.md)).
|
|
590
592
|
- **S/M patch tasks: no coverage gate in Contract** — do not chain `npm run coverage:check` or bare `npm test` in `## Contract` `testCommand` on Size S/M tasks; integrate gate owns full coverage at merge. Use scoped `node --test path/to.test.mjs` (SP-521 / [#141](https://github.com/beettlle/pi-spine/issues/141)). `spine tasks validate` warns when violated.
|
|
591
593
|
- **Testing step required (never omit)** — every task packet needs `### Step N: Testing & Verification` inside `## Steps`, before `## Completion Criteria`. **Do not skip this for docs-only or Review Level 0 tasks** — the worker rejects packets without a Testing step. Use `testing.test` from spine config; for **code deliverables**, also include `testing.testWithCoverage` and a **≥77% line coverage** checkbox (see prompt template). Docs-only tasks may omit the coverage checkbox.
|
|
@@ -15,7 +15,7 @@ Normative schema: [PRD v2.0 implementation handoff §4](../../docs/PRD-v2.0-impl
|
|
|
15
15
|
|
|
16
16
|
| Field | Value |
|
|
17
17
|
|-------|-------|
|
|
18
|
-
| testCommand | `npm run
|
|
18
|
+
| testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/final-verdict.test.mjs` |
|
|
19
19
|
| fileScopeMustChange | `src/batch/review.mjs`, `bin/spine-tasks.mjs` |
|
|
20
20
|
| fileScopeMustNotChange | `src/planner/**` |
|
|
21
21
|
| minLineCoverage | 77 |
|
|
@@ -36,7 +36,7 @@ Avoid `` `bin/a.mjs,bin/b.mjs` `` — `tasks validate` warns (or errors in requi
|
|
|
36
36
|
|
|
37
37
|
| Field | When to include | Value format |
|
|
38
38
|
|-------|-----------------|--------------|
|
|
39
|
-
| `testCommand` | **Required** for code tasks (Review Level ≥ 1, Size M/L, or implementation steps) | Shell command in backticks; max 500 chars; no newlines. Use `` `true` `` for docs-only S tasks with no code changes. When `` `true` ``, **always** pair with `fileScopeMustChange` (see below). |
|
|
39
|
+
| `testCommand` | **Required** for code tasks (Review Level ≥ 1, Size M/L, or implementation steps) | Shell command in backticks; max 500 chars; no newlines. **Code tasks:** prefix with project lint/analyze (`npm run lint &&` for pi-spine; `flutter analyze` scoped for Flutter). Contract verify executes this command at final review — lint runs in-lane when authored here. Post-integrate `release:check` remains the whole-repo backstop (full suite + coverage). Use `` `true` `` for docs-only S tasks with no code changes. When `` `true` ``, **always** pair with `fileScopeMustChange` (see below). |
|
|
40
40
|
| `fileScopeMustChange` | When you need proof specific paths were touched; **required** when `testCommand` is `` `true` `` | Comma-separated paths/globs relative to repo root; **one backtick per path** (not `` `a.mjs,b.mjs` ``). Trailing `/` means directory prefix match (e.g. `src/domain/types/` matches any file under that directory). For docs-only tasks, list at least one documentation deliverable path — without it, workers can pass contract by creating only `.DONE` (SP-214 batch `20260612T204048`, SP-457 batch `20260703T022335`). |
|
|
41
41
|
| `fileScopeMustNotChange` | When **parallel lanes** must not collide on product paths (see semantics below) | Comma-separated paths/globs relative to repo root; **one backtick per path** |
|
|
42
42
|
| `minLineCoverage` | When task changes application code | Integer 0–100 (pi-spine policy: **77**) |
|
|
@@ -101,7 +101,7 @@ Symptom in journal: `testCommand` passes but `fileScopeMustNotChange` fails with
|
|
|
101
101
|
|
|
102
102
|
| Field | Value |
|
|
103
103
|
|-------|-------|
|
|
104
|
-
| testCommand | `npm
|
|
104
|
+
| testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/tasks/validate-cli.test.mjs` |
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### M task with coverage gate
|
|
@@ -111,7 +111,7 @@ Symptom in journal: `testCommand` passes but `fileScopeMustNotChange` fails with
|
|
|
111
111
|
|
|
112
112
|
| Field | Value |
|
|
113
113
|
|-------|-------|
|
|
114
|
-
| testCommand | `npm run
|
|
114
|
+
| testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/tasks/validate-prompt.test.mjs` |
|
|
115
115
|
| fileScopeMustChange | `src/tasks/packet/validate-prompt.mjs` |
|
|
116
116
|
| minLineCoverage | 77 |
|
|
117
117
|
```
|
|
@@ -150,7 +150,7 @@ For docs-only tasks, add `fileScopeMustNotChange` on product-code directories so
|
|
|
150
150
|
| Situation | Contract pattern |
|
|
151
151
|
|-----------|------------------|
|
|
152
152
|
| No application code changes; documentation or skill text only | `` `true` `` + `fileScopeMustChange` on deliverable doc paths (+ optional `fileScopeMustNotChange` on `src/**`, `bin/**`) |
|
|
153
|
-
| Small code change with an existing targeted test file | `` `node --test tests/feature.test.mjs` `` (see [scoped testCommand](#scoped-testcommand) below) |
|
|
153
|
+
| Small code change with an existing targeted test file | `` `npm run lint && npm run typecheck && node --test tests/feature.test.mjs` `` (see [scoped testCommand](#scoped-testcommand) below) |
|
|
154
154
|
| Code change but no narrow test yet; full suite unsafe in lane | Scoped command matching the Testing step, or split into a code task + docs task |
|
|
155
155
|
|
|
156
156
|
Use docs-only when the worker's only product deliverable is documentation. Use scoped `node --test` when the task changes application code — even Size S/M patches should not use bare `` `npm test` `` or `` `npm test -- path` `` in Contract ([#141](https://github.com/beettlle/pi-spine/issues/141)).
|
|
@@ -162,7 +162,7 @@ Use docs-only when the worker's only product deliverable is documentation. Use s
|
|
|
162
162
|
|
|
163
163
|
| Field | Value |
|
|
164
164
|
|-------|-------|
|
|
165
|
-
| testCommand | `npm run typecheck && SPINE_WORKER_STUB=1
|
|
165
|
+
| testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/final-verdict.test.mjs` |
|
|
166
166
|
| fileScopeMustChange | `src/batch/review.mjs` |
|
|
167
167
|
| fileScopeMustNotChange | `src/planner/**`, `src/batch/journal.mjs` |
|
|
168
168
|
| artifactsMustExist | `tests/batch/final-verdict.test.mjs` |
|
|
@@ -177,7 +177,7 @@ Use when a task runs a multi-hour external matrix or CI arm with little in-repo
|
|
|
177
177
|
|
|
178
178
|
| Field | Value |
|
|
179
179
|
|-------|-------|
|
|
180
|
-
| testCommand | `npm run typecheck && SPINE_WORKER_STUB=1
|
|
180
|
+
| testCommand | `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 node --experimental-strip-types --test tests/batch/status-classification-align.test.mjs` |
|
|
181
181
|
| stallTimeoutMinutes | 240 |
|
|
182
182
|
| extendGraceOnFileScope | true |
|
|
183
183
|
| fileScopeMustChange | `spine-tasks/SP-029-*/STATUS.md` |
|
|
@@ -222,11 +222,11 @@ Reviewers spawn as **fresh sessions** with no memory of the worker session (FR-R
|
|
|
222
222
|
| Task type | Recommended `testCommand` |
|
|
223
223
|
|-----------|---------------------------|
|
|
224
224
|
| Docs-only, no code changes | `` `true` `` **and** `fileScopeMustChange` with at least one deliverable doc path |
|
|
225
|
-
| Single module, targeted tests exist | `` `node --test tests/feature.test.mjs` `` or `` `flutter test test/unit/services/foo_test.dart` `` |
|
|
226
|
-
| **Shared-module behavior change** (diagnosis, reconcile, parse-prompt, worktree, doctor) |
|
|
227
|
-
| Full-suite safe in lane worktree | `` `npm run typecheck && SPINE_WORKER_STUB=1 npm test` `` |
|
|
228
|
-
| Coverage gate required (pi-spine ≥77
|
|
229
|
-
| Long external job (>2h) |
|
|
225
|
+
| Single module, targeted tests exist (Size S/M) | `` `npm run lint && npm run typecheck && node --test tests/feature.test.mjs` `` or `` `flutter analyze && flutter test test/unit/services/foo_test.dart` `` |
|
|
226
|
+
| **Shared-module behavior change** (diagnosis, reconcile, parse-prompt, worktree, doctor) | `` `npm run lint &&` `` then chain **all** related `tests/**/*.test.mjs` from `rg` for old strings — not only the new test file (see below) |
|
|
227
|
+
| Full-suite safe in lane worktree (Size L) | `` `npm run lint && npm run typecheck && SPINE_WORKER_STUB=1 npm test` `` |
|
|
228
|
+
| Coverage gate required (pi-spine ≥77%, Size L) | `` `npm run lint && npm run coverage:check` `` |
|
|
229
|
+
| Long external job (>2h) | `` `npm run lint &&` `` scoped command + `stallTimeoutMinutes` and `extendGraceOnFileScope` in Contract (see SP-314 example above) |
|
|
230
230
|
|
|
231
231
|
### Shared-module behavior changes
|
|
232
232
|
|
|
@@ -109,14 +109,16 @@ Review Level 0 is ONLY for trivial changes. Most M+ tasks need Level ≥1.
|
|
|
109
109
|
### Step [N-1]: Testing & Verification
|
|
110
110
|
|
|
111
111
|
> **Required for every task** — including docs-only and Review Level 0 packets.
|
|
112
|
-
> ZERO test failures allowed.
|
|
113
|
-
>
|
|
112
|
+
> ZERO test failures allowed. Run the commands below; do **not** assume the Testing step equals full CI parity.
|
|
113
|
+
> Contract verify runs only `testCommand` from `## Contract` at final review.
|
|
114
|
+
> Operator post-integrate `npm run release:check` owns the whole-repo gate (typecheck → lint → full tests → coverage).
|
|
114
115
|
>
|
|
115
|
-
> **
|
|
116
|
-
>
|
|
116
|
+
> **Code tasks** (File Scope touches `src/`, `bin/`, `tests/`, or `scripts/`): include `npm run lint` in Contract `testCommand` and mirror it here.
|
|
117
|
+
> **Docs-only tasks:** keep this step; run the full test suite from project config. Omit lint and coverage checkboxes when no application code changes.
|
|
117
118
|
|
|
118
|
-
- [ ] Run
|
|
119
|
-
- [ ] Run
|
|
119
|
+
- [ ] Run lint (code tasks only): `npm run lint` — or project analyze command when present
|
|
120
|
+
- [ ] Run Contract `testCommand`: `[exact command from ## Contract — typically lint && typecheck && scoped node --test]`
|
|
121
|
+
- [ ] Run coverage gate (only when Contract requires it): `[testWithCoverage command, e.g. npm run coverage:check]` — **≥77% line coverage** on in-scope changed code
|
|
120
122
|
- [ ] Run integration tests (if applicable)
|
|
121
123
|
- [ ] Fix all failures
|
|
122
124
|
|
|
@@ -205,6 +205,8 @@ test "${PIPESTATUS[0]}" -eq 0
|
|
|
205
205
|
|
|
206
206
|
Full reference: [post-integrate-regression-gate.md](../spine-release-operator/references/post-integrate-regression-gate.md).
|
|
207
207
|
|
|
208
|
+
**Contract vs gate:** contract verify runs only authored `testCommand` (new packets should include lint); post-integrate `release:check` validates the merged tree (full suite + coverage). Do not skip §3.3a because contract verify passed.
|
|
209
|
+
|
|
208
210
|
**If non-zero:** fix on `main`, commit, re-run. Do **not** start wave N+1 until green.
|
|
209
211
|
|
|
210
212
|
### 3.4 Advance
|
|
@@ -86,7 +86,7 @@ Full reference: [post-integrate-regression-gate.md](../../spine-release-operator
|
|
|
86
86
|
| Do | Do not |
|
|
87
87
|
|----|--------|
|
|
88
88
|
| Verify `$?` or `${PIPESTATUS[0]}` after `release:check` | Use `\| tail` alone for pass/fail |
|
|
89
|
-
| Re-run after manual merge / conflict resolution | Assume scoped task `testCommand` covered full CI |
|
|
89
|
+
| Re-run after manual merge / conflict resolution | Assume scoped task `testCommand` covered full CI (includes **lint** — contract verify does not unless authored) |
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
@@ -130,6 +130,7 @@ Full reference: [references/outer-loop.md](references/outer-loop.md).
|
|
|
130
130
|
Inspect `.spine/runtime/<batchId>/evidence/`:
|
|
131
131
|
|
|
132
132
|
- [ ] Contract verify passed for every task in the wave
|
|
133
|
+
- [ ] Contract pass does **not** imply lint or full CI passed — contract runs only authored `testCommand`; post-integrate `release:check` still required after integrate
|
|
133
134
|
- [ ] Test output present and scoped (not truncated by `maxBuffer` — avoid bare full-suite `testCommand` in PROMPTs)
|
|
134
135
|
- [ ] Review artifacts acceptable (`.reviews/` or engine-stored review verdicts)
|
|
135
136
|
- [ ] No unexpected `fileScopeMustChange` / `fileScopeMustNotChange` violations
|
|
@@ -142,7 +143,7 @@ Inspect `.spine/runtime/<batchId>/evidence/`:
|
|
|
142
143
|
|
|
143
144
|
| Diagnosis | Agent action |
|
|
144
145
|
|-----------|--------------|
|
|
145
|
-
| `needs_integrate` | Evidence checklist → `spine gate approve` → `spine integrate` → `spine batch complete` → push |
|
|
146
|
+
| `needs_integrate` | Evidence checklist → `spine gate approve` → `spine integrate` → `spine batch complete` → post-integrate `release:check` (exit 0) → push |
|
|
146
147
|
| `needs_retry` | `spine batch retry <taskId>` then `spine batch resume` (detached); amend PROMPT contract if scope wrong |
|
|
147
148
|
| `needs_retry` + `review_exhausted` | Inspect `.reviews/` feedback; fix implementation or packet scope, then retry |
|
|
148
149
|
| `needs_retry` + `contract_failed` | Edit `PROMPT.md` `testCommand` or file scope, then retry |
|
|
@@ -180,7 +181,7 @@ When all waves finish, report:
|
|
|
180
181
|
1. **Waves executed** — indices, task IDs per wave
|
|
181
182
|
2. **Land loops** — integrate commits, push status
|
|
182
183
|
3. **Recoveries** — retries, contract fixes, conflict resolution
|
|
183
|
-
4. **Verification** — paste `spine preflight` and final `spine plan pending` (should show 0 pending)
|
|
184
|
+
4. **Verification** — last wave post-integrate `release:check` log path + verified exit 0; paste `spine preflight` and final `spine plan pending` (should show 0 pending)
|
|
184
185
|
5. **Follow-ups** — deferred tasks, CONTEXT.md tech debt, issues to file
|
|
185
186
|
|
|
186
187
|
---
|
|
@@ -209,6 +210,7 @@ When all waves finish, report:
|
|
|
209
210
|
```text
|
|
210
211
|
Resume spine wave orchestration: spine plan pending --json → pick next wave W →
|
|
211
212
|
spine batch start pending --wave W (detached) → spine status --diagnose → spine wait →
|
|
212
|
-
branch on diagnosis (evidence checklist before gate approve) → integrate → batch complete →
|
|
213
|
-
repeat until plan shows 0 waves.
|
|
213
|
+
branch on diagnosis (evidence checklist before gate approve) → integrate → batch complete →
|
|
214
|
+
post-integrate npm run release:check (verify exit 0) → push → repeat until plan shows 0 waves.
|
|
215
|
+
Post completion report.
|
|
214
216
|
```
|
|
@@ -82,6 +82,21 @@ Increment `$WAVE` and repeat until `spine plan pending` shows no remaining waves
|
|
|
82
82
|
|
|
83
83
|
---
|
|
84
84
|
|
|
85
|
+
## Evidence checklist (before `spine gate approve`)
|
|
86
|
+
|
|
87
|
+
Inspect `.spine/runtime/<batchId>/evidence/`:
|
|
88
|
+
|
|
89
|
+
- [ ] Contract verify passed for every task in the wave
|
|
90
|
+
- [ ] Contract pass does **not** imply lint or full CI passed — contract runs only authored `testCommand`; post-integrate `release:check` still required after integrate
|
|
91
|
+
- [ ] Test output present and scoped (not truncated by `maxBuffer`)
|
|
92
|
+
- [ ] Review artifacts acceptable
|
|
93
|
+
- [ ] No unexpected file-scope violations
|
|
94
|
+
- [ ] Operator explicitly approves landing — never auto-approve without reading evidence
|
|
95
|
+
|
|
96
|
+
See [post-integrate-regression-gate.md](../../spine-release-operator/references/post-integrate-regression-gate.md) for contract vs `release:check` scope.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
85
100
|
## Multi-wave strategy
|
|
86
101
|
|
|
87
102
|
**Preferred: agent repeats per wave.** Each iteration is an independent land loop. The agent reviews evidence, approves or rejects the gate, handles failures, then starts the next wave. This approach:
|
|
@@ -108,7 +123,7 @@ After `spine wait` returns or `spine status --diagnose` reports a non-running st
|
|
|
108
123
|
|
|
109
124
|
| Diagnosis | Agent action |
|
|
110
125
|
|-----------|--------------|
|
|
111
|
-
| `needs_integrate` | Review evidence under `.spine/runtime/<batchId>/evidence/` → `spine gate approve` → `spine integrate` → `spine batch complete` → push |
|
|
126
|
+
| `needs_integrate` | Review evidence under `.spine/runtime/<batchId>/evidence/` → `spine gate approve` → `spine integrate` → `spine batch complete` → post-integrate `release:check` (exit 0) → push |
|
|
112
127
|
| `needs_retry` | `spine batch retry <taskId>` then `spine batch resume` (detached); amend PROMPT contract if scope is wrong |
|
|
113
128
|
| `needs_retry` + `review_exhausted` | Inspect `.reviews/` feedback; fix implementation or packet scope, then retry |
|
|
114
129
|
| `needs_retry` + `contract_failed` | Edit `PROMPT.md` `testCommand` or file scope, then retry |
|
|
@@ -233,6 +233,7 @@ For every task in manifest scope:
|
|
|
233
233
|
- [ ] Doc paths in File Scope match Documentation Requirements (#144)
|
|
234
234
|
- [ ] `dependencies.json` matches PROMPT `## Dependencies`
|
|
235
235
|
- [ ] Same-wave tasks have disjoint `fileScopeMustChange`
|
|
236
|
+
- [ ] Code tasks: Contract `testCommand` prefixes project lint/analyze (`npm run lint &&` for pi-spine) — see [contract-template.md](../../create-spine-tasks/references/contract-template.md)
|
|
236
237
|
|
|
237
238
|
```bash
|
|
238
239
|
spine tasks validate <release-scope>
|
|
@@ -337,6 +338,8 @@ test "${PIPESTATUS[0]}" -eq 0
|
|
|
337
338
|
|
|
338
339
|
Full reference: [post-integrate-regression-gate.md](references/post-integrate-regression-gate.md).
|
|
339
340
|
|
|
341
|
+
**Why this gate still runs when contracts include lint:** contract verify runs only the authored `testCommand` in an isolated lane; post-integrate `release:check` validates the **merged tree** (full suite, coverage, cross-file call sites). Do not skip §4.3a because contract verify passed.
|
|
342
|
+
|
|
340
343
|
**If non-zero:** fix on `main`, commit, re-run gate. Do **not** start wave N+1, push, or proceed to Phase 5 until green.
|
|
341
344
|
|
|
342
345
|
**Do not** judge pass/fail from `tail` output — `tail` exits 0 even when `release:check` failed.
|
|
@@ -29,7 +29,8 @@ Paste diagnosis headline and exit evidence. Do not claim success without CLI out
|
|
|
29
29
|
### onDone prompt template (release:check)
|
|
30
30
|
|
|
31
31
|
```text
|
|
32
|
-
release:check monitor completed.
|
|
32
|
+
release:check monitor completed. Verify exit code from monitor metadata (not log tail alone).
|
|
33
|
+
Read /tmp/pi-spine-release-check.log for failure details when exit is non-zero.
|
|
33
34
|
If exit 0: present pre-publish checklist from docs/release/npm-publish.md.
|
|
34
35
|
If non-zero: STOP; summarize first failing step; do not bump version.
|
|
35
36
|
```
|
|
@@ -38,6 +38,19 @@ echo "release:check exit: $?"
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
+
## Contract verify vs release:check
|
|
42
|
+
|
|
43
|
+
| Layer | What runs | What it catches |
|
|
44
|
+
|-------|-----------|-----------------|
|
|
45
|
+
| Contract verify (per task) | PROMPT `testCommand` in lane worktree | Scoped tests, typecheck, and **lint when authored** (`npm run lint && …`) |
|
|
46
|
+
| Post-integrate `release:check` (per wave) | `npm run typecheck && npm run lint && SPINE_WORKER_STUB=1 npm test && npm run coverage:check` | Whole-repo typecheck, lint, full suite, coverage, cross-file drift |
|
|
47
|
+
|
|
48
|
+
**Authoring rule (new packets):** code tasks prefix Contract `testCommand` with project lint/analyze so ESLint failures surface in-lane, not only here. Post-integrate `release:check` remains mandatory after every land loop — it catches merged-tree gaps contracts cannot see.
|
|
49
|
+
|
|
50
|
+
**Anti-pattern:** defer lint fixes to Phase 5 publish only — run this gate after **each wave** so lint regressions fail before wave N+1 starts.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
41
54
|
## Verification discipline
|
|
42
55
|
|
|
43
56
|
| Do | Do not |
|
|
@@ -45,6 +58,7 @@ echo "release:check exit: $?"
|
|
|
45
58
|
| Run full `npm run release:check` | Pipe through `tail` or `head` for pass/fail decisions |
|
|
46
59
|
| Verify exit code explicitly (`$?` or `${PIPESTATUS[0]}`) | Claim "passed" from truncated log tail |
|
|
47
60
|
| Save log path in manifest publish checklist | Assume scoped task `testCommand` covered full CI suite |
|
|
61
|
+
| Treat contract verify as CI parity | Contract pass does not imply lint or full-suite pass — only `release:check` does |
|
|
48
62
|
|
|
49
63
|
**Anti-pattern:** `npm run release:check 2>&1 | tail -20` — `tail` exits 0 even when `release:check` failed.
|
|
50
64
|
|
|
@@ -67,3 +67,17 @@ export function rejectNestedBatchStart(projectRoot) {
|
|
|
67
67
|
`Parent batch: ${parentBatchId}, projectRoot: ${projectRoot}\n`,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {string} batchId
|
|
73
|
+
* @returns {{ ok: true, exitCode: 0, batchId: string, paused: true, output: string }}
|
|
74
|
+
*/
|
|
75
|
+
export function buildEnginePausedResult(batchId) {
|
|
76
|
+
return {
|
|
77
|
+
ok: true,
|
|
78
|
+
exitCode: 0,
|
|
79
|
+
batchId,
|
|
80
|
+
paused: true,
|
|
81
|
+
output: "Batch paused.\n",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -9,8 +9,11 @@ import { BATCH_META_FILENAME, batchMetaPath } from "./batch-meta.mjs";
|
|
|
9
9
|
import { appendJournalEvent, readJournalEvents } from "./journal.mjs";
|
|
10
10
|
import { rebuildBatchStateFromJournal } from "./journal-rebuild.mjs";
|
|
11
11
|
import { computePendingTasks, findResumableWave } from "./resume-validation.mjs";
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// Leaf rewire (SP-735 / #267): state-io/state-guards are leaves; state.mjs stays only for
|
|
13
|
+
// createInitialBatchState, which is defined in the state facade.
|
|
14
|
+
import { createInitialBatchState } from "./state.mjs";
|
|
15
|
+
import { loadSpineBatchState, saveSpineBatchState } from "./state-io.mjs";
|
|
16
|
+
import { clearBatchEnginePid } from "./state-guards.mjs";
|
|
14
17
|
import { laneTaskBranch, laneWorktreePath } from "./worktree.mjs";
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
* Worker exited without `.DONE` diagnosis helpers (SP-313 / issue #18).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
BACKGROUND_VERIFICATION_HINT,
|
|
8
|
+
detectBackgroundedVerification,
|
|
9
|
+
} from "./worker-output.mjs";
|
|
10
|
+
|
|
6
11
|
/** Worker exited cleanly but never wrote `.DONE`. */
|
|
7
12
|
export const WORKER_DONE_MISSING_OUTPUT_MARKERS = [
|
|
8
13
|
"pi exited but .DONE was not created",
|
|
@@ -81,7 +86,13 @@ export function buildWorkerDoneMissingHeadline(batchLabel, ctx = {}) {
|
|
|
81
86
|
: ctx.workerOutputSnippet
|
|
82
87
|
? `: ${ctx.workerOutputSnippet}`
|
|
83
88
|
: "";
|
|
84
|
-
|
|
89
|
+
// SP-741 (#276): point operators at the backgrounded-verification cause when
|
|
90
|
+
// the captured output shows the worker exited mid-verification.
|
|
91
|
+
const hintInput = [tail, ctx.workerOutputSnippet, ctx.output].filter(Boolean).join("\n");
|
|
92
|
+
const backgroundHint = detectBackgroundedVerification(hintInput)
|
|
93
|
+
? ` — ${BACKGROUND_VERIFICATION_HINT}`
|
|
94
|
+
: "";
|
|
95
|
+
return `${batchLabel} ${taskLabel} exited without .DONE${fileHint}${logHint}${tailHint}${backgroundHint}`;
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
/** @param {object} ctx */
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
10
11
|
import {
|
|
11
12
|
acquireLaneSlot,
|
|
12
13
|
aggregateMatrixOutcomes,
|
|
@@ -19,6 +20,7 @@ import {
|
|
|
19
20
|
runShellInDir,
|
|
20
21
|
substituteRowCommand,
|
|
21
22
|
} from "./matrix.mjs";
|
|
23
|
+
import { applyMatrixRowToPrompt } from "../../planner/matrix.mjs";
|
|
22
24
|
import { commitLaneAndValidateWorktree } from "./commit.mjs";
|
|
23
25
|
import { recordLaneTaskMetric } from "./queue.mjs";
|
|
24
26
|
import { appendJournalEvent } from "../journal.mjs";
|
|
@@ -47,13 +49,63 @@ export function readParentContract(parentTaskFolderAbs) {
|
|
|
47
49
|
return parseContract(fs.readFileSync(promptPath, "utf-8"));
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Serve a matrix LLM row its row-substituted PROMPT.md (#232). Reads the parent
|
|
54
|
+
* PROMPT.md (same source convention as `readParentContract`), substitutes
|
|
55
|
+
* `{matrix.<column>}` placeholders across the whole document — steps, contract
|
|
56
|
+
* fields, and File Scope paths — and writes the result to the row worktree's
|
|
57
|
+
* PROMPT.md so `runWorker` and the spawned worker both read row-specific
|
|
58
|
+
* content instead of raw `{matrix.*}` refs.
|
|
59
|
+
*
|
|
60
|
+
* @param {object} params
|
|
61
|
+
* @param {string} params.parentTaskFolderAbs Parent task folder in the main checkout.
|
|
62
|
+
* @param {string} params.worktreePath Row worktree root.
|
|
63
|
+
* @param {string} params.taskFolderRel Task folder path relative to the worktree root.
|
|
64
|
+
* @param {Record<string, string>} params.row Matrix row values keyed by column.
|
|
65
|
+
* @returns {{ servedPrompt: string, sha256: string }} Exact bytes served plus their digest.
|
|
66
|
+
* @throws When the parent PROMPT.md is missing, or on unknown `{matrix.X}`
|
|
67
|
+
* references (fail-loud via `substituteMatrixVariables`).
|
|
68
|
+
*/
|
|
69
|
+
function serveMatrixRowPrompt({ parentTaskFolderAbs, worktreePath, taskFolderRel, row }) {
|
|
70
|
+
const promptPath = path.join(parentTaskFolderAbs, "PROMPT.md");
|
|
71
|
+
if (!fs.existsSync(promptPath)) {
|
|
72
|
+
throw new Error(`parent PROMPT.md not found: ${promptPath}`);
|
|
73
|
+
}
|
|
74
|
+
const substituted = applyMatrixRowToPrompt(fs.readFileSync(promptPath, "utf-8"), row);
|
|
75
|
+
const rowPromptPath = path.join(worktreePath, taskFolderRel, "PROMPT.md");
|
|
76
|
+
fs.mkdirSync(path.dirname(rowPromptPath), { recursive: true });
|
|
77
|
+
fs.writeFileSync(rowPromptPath, substituted, "utf-8");
|
|
78
|
+
const sha256 = createHash("sha256").update(substituted, "utf-8").digest("hex");
|
|
79
|
+
return { servedPrompt: substituted, sha256 };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Restore the authored PROMPT.md and drop the row's `.DONE` after a successful
|
|
84
|
+
* LLM row so the per-row commit carries only real row output. Row branches are
|
|
85
|
+
* merged into the lane (SP-697), and per-row PROMPT/.DONE content always
|
|
86
|
+
* differs (row values, completion timestamps) — committing either would
|
|
87
|
+
* add/add-conflict every multi-row LLM matrix merge. The parent writes the
|
|
88
|
+
* lane-level `.DONE` after all rows merge, mirroring the execute path.
|
|
89
|
+
*
|
|
90
|
+
* @param {object} params
|
|
91
|
+
* @param {string} params.worktreePath Row worktree root.
|
|
92
|
+
* @param {string} params.taskFolderRel Task folder path relative to the worktree root.
|
|
93
|
+
* @param {string} [params.projectRoot] Main repo root for git identity.
|
|
94
|
+
*/
|
|
95
|
+
function restoreMatrixRowPrompt({ worktreePath, taskFolderRel, projectRoot }) {
|
|
96
|
+
const promptRel = `${taskFolderRel.replace(/\\/g, "/")}/PROMPT.md`;
|
|
97
|
+
gitExec(worktreePath, ["checkout", "--", promptRel], { projectRoot });
|
|
98
|
+
fs.rmSync(path.join(worktreePath, taskFolderRel, ".DONE"), { force: true });
|
|
99
|
+
}
|
|
100
|
+
|
|
50
101
|
/**
|
|
51
102
|
* Execute a single matrix row in its own worktree. Substitutes `{matrix.X}`
|
|
52
|
-
* placeholders for execution-only rows; LLM rows delegate to `runWorker
|
|
53
|
-
*
|
|
103
|
+
* placeholders for execution-only rows; LLM rows delegate to `runWorker` with a
|
|
104
|
+
* row-substituted PROMPT.md served into the row worktree (#232). Commits
|
|
105
|
+
* successful row output to the row branch.
|
|
54
106
|
*
|
|
55
107
|
* @param {object} params
|
|
56
|
-
* @returns {Promise<{ rowId: string, ok: boolean, exitCode: number, output: string, worktreePath?: string, branch?: string, commitSha?: string }>}
|
|
108
|
+
* @returns {Promise<{ rowId: string, ok: boolean, exitCode: number, output: string, worktreePath?: string, branch?: string, commitSha?: string, servedPrompt?: string }>}
|
|
57
109
|
*/
|
|
58
110
|
export async function runMatrixSubLane({
|
|
59
111
|
projectRoot,
|
|
@@ -231,29 +283,73 @@ export async function runMatrixSubLane({
|
|
|
231
283
|
}
|
|
232
284
|
}
|
|
233
285
|
} else {
|
|
234
|
-
// LLM rows delegate to the worker in the row worktree.
|
|
235
|
-
//
|
|
236
|
-
//
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
286
|
+
// LLM rows delegate to the worker in the row worktree. Serve the row its
|
|
287
|
+
// row-substituted PROMPT.md first (#232): steps, contract fields, and File
|
|
288
|
+
// Scope all carry this row's values, so the worker never sees raw
|
|
289
|
+
// `{matrix.*}` refs. Substitution is fail-loud (SP-670 engine): an unknown
|
|
290
|
+
// reference fails the row instead of reaching the worker.
|
|
291
|
+
try {
|
|
292
|
+
const { servedPrompt, sha256 } = serveMatrixRowPrompt({
|
|
293
|
+
parentTaskFolderAbs,
|
|
294
|
+
worktreePath,
|
|
295
|
+
taskFolderRel,
|
|
296
|
+
row: values,
|
|
297
|
+
});
|
|
298
|
+
recordMatrixEvent(projectRoot, batchId, "matrix.sub_lane.prompt_served", {
|
|
299
|
+
taskId,
|
|
300
|
+
laneNumber,
|
|
301
|
+
rowId,
|
|
302
|
+
correlationId: laneCorrelationId,
|
|
303
|
+
sha256,
|
|
304
|
+
chars: servedPrompt.length,
|
|
305
|
+
});
|
|
306
|
+
const workerResult = await runWorker({
|
|
307
|
+
worktreePath,
|
|
308
|
+
taskFolder: path.join(worktreePath, taskFolderRel),
|
|
309
|
+
projectRoot,
|
|
310
|
+
batchId,
|
|
311
|
+
laneNumber,
|
|
312
|
+
taskId,
|
|
313
|
+
laneBranch: branch,
|
|
314
|
+
laneCorrelationId: `${laneCorrelationId}-matrix-${rowId}`,
|
|
315
|
+
fileScopePaths: [],
|
|
316
|
+
config,
|
|
317
|
+
});
|
|
318
|
+
result = {
|
|
319
|
+
rowId,
|
|
320
|
+
ok: Boolean(workerResult.ok),
|
|
321
|
+
exitCode: workerResult.exitCode ?? 0,
|
|
322
|
+
output: workerResult.output ?? "",
|
|
323
|
+
worktreePath,
|
|
324
|
+
branch,
|
|
325
|
+
};
|
|
326
|
+
if (result.ok) {
|
|
327
|
+
// Drop the substitution scaffolding before the per-row commit so
|
|
328
|
+
// row→lane merges stay conflict-free (see restoreMatrixRowPrompt).
|
|
329
|
+
try {
|
|
330
|
+
restoreMatrixRowPrompt({ worktreePath, taskFolderRel, projectRoot });
|
|
331
|
+
} catch (restoreErr) {
|
|
332
|
+
const restoreMessage = restoreErr instanceof Error ? restoreErr.message : String(restoreErr);
|
|
333
|
+
result = {
|
|
334
|
+
...result,
|
|
335
|
+
ok: false,
|
|
336
|
+
exitCode: 1,
|
|
337
|
+
output: `${result.output}\nmatrix row prompt restore failed: ${restoreMessage}`,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
result.servedPrompt = servedPrompt;
|
|
342
|
+
} catch (err) {
|
|
343
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
344
|
+
result = {
|
|
345
|
+
rowId,
|
|
346
|
+
ok: false,
|
|
347
|
+
exitCode: 1,
|
|
348
|
+
output: `matrix row prompt substitution failed: ${message}`,
|
|
349
|
+
worktreePath,
|
|
350
|
+
branch,
|
|
351
|
+
};
|
|
352
|
+
}
|
|
257
353
|
}
|
|
258
354
|
|
|
259
355
|
if (result.ok) {
|
|
@@ -27,7 +27,6 @@ import { recordWaveMergeResult } from "../merge/wave-merge-state.mjs";
|
|
|
27
27
|
import { recordMergeBlocked } from "../lifecycle.mjs";
|
|
28
28
|
import { appendJournalEvent } from "../journal.mjs";
|
|
29
29
|
import { countCommitsAhead, gitPorcelain } from "../lane-commit.mjs";
|
|
30
|
-
import { maybeFinalizeAfterWaveMerge } from "../post-merge-limbo.mjs";
|
|
31
30
|
import { saveSpineBatchState } from "../state.mjs";
|
|
32
31
|
import { loadTaskFileScopePaths } from "./queue.mjs";
|
|
33
32
|
import { laneTaskBranch } from "../worktree.mjs";
|
|
@@ -606,9 +605,11 @@ export function mergeLaneToOrch({
|
|
|
606
605
|
}
|
|
607
606
|
|
|
608
607
|
/**
|
|
609
|
-
* @param {object} params
|
|
608
|
+
* @param {object} params — includes optional `finalizeAfterWaveMerge(hookParams)` hook injected
|
|
609
|
+
* by callers that own the limbo graph (`maybeFinalizeAfterWaveMerge` from post-merge-limbo.mjs,
|
|
610
|
+
* SP-734). Omitted → skip post-wave-merge finalize.
|
|
610
611
|
*/
|
|
611
|
-
export
|
|
612
|
+
export function mergeWaveLanesToOrch({
|
|
612
613
|
projectRoot,
|
|
613
614
|
state,
|
|
614
615
|
batchId,
|
|
@@ -616,6 +617,7 @@ export async function mergeWaveLanesToOrch({
|
|
|
616
617
|
orchBranch,
|
|
617
618
|
waveIndex,
|
|
618
619
|
resumed = false,
|
|
620
|
+
finalizeAfterWaveMerge = null,
|
|
619
621
|
}) {
|
|
620
622
|
const waveTaskIds = state.wavePlan?.[waveIndex] ?? [];
|
|
621
623
|
const needsReplanTask = (state.tasks ?? []).find(
|
|
@@ -730,14 +732,17 @@ export async function mergeWaveLanesToOrch({
|
|
|
730
732
|
});
|
|
731
733
|
saveSpineBatchState(projectRoot, state);
|
|
732
734
|
|
|
733
|
-
const finalizeResult =
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
735
|
+
const finalizeResult =
|
|
736
|
+
typeof finalizeAfterWaveMerge === "function"
|
|
737
|
+
? finalizeAfterWaveMerge({
|
|
738
|
+
projectRoot,
|
|
739
|
+
state,
|
|
740
|
+
batchId,
|
|
741
|
+
orchBranch,
|
|
742
|
+
waveIndex,
|
|
743
|
+
resumed,
|
|
744
|
+
})
|
|
745
|
+
: null;
|
|
741
746
|
|
|
742
747
|
return {
|
|
743
748
|
ok: true,
|