pi-spine 2.15.0 → 2.17.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/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 +63 -7
- package/skills/spine-release-operator/references/issue-intake-checklist.md +1 -1
- package/skills/spine-release-operator/references/pi-async-orchestration.md +2 -1
- package/skills/spine-release-operator/references/post-integrate-regression-gate.md +15 -0
- package/src/batch/abort.mjs +82 -68
- package/src/batch/batch-guards.mjs +14 -0
- package/src/batch/batch-meta-reconstruct.mjs +5 -2
- package/src/batch/batch-state-lock.mjs +357 -0
- package/src/batch/contract-exec.mjs +12 -8
- 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/review-code.mjs +224 -0
- package/src/batch/engine-lanes/review-final.mjs +318 -0
- package/src/batch/engine-lanes/review-plan.mjs +315 -0
- package/src/batch/engine-lanes/review-poll.mjs +427 -0
- package/src/batch/engine-lanes/review-stub.mjs +146 -0
- package/src/batch/engine-lanes/review.mjs +4 -1532
- package/src/batch/engine-lanes.mjs +9 -37
- package/src/batch/engine.mjs +8 -16
- package/src/batch/lifecycle.mjs +106 -95
- 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-multi.mjs +6 -2
- package/src/batch/resume.mjs +1 -1
- package/src/batch/review-spawn.mjs +4 -3
- package/src/batch/state-io.mjs +55 -41
- 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/cursor-rules/profile.mjs +5 -1
- package/src/config/defaults.mjs +10 -1
- package/src/config/settings-fields.mjs +14 -0
- package/src/config/worker-context.mjs +2 -1
- package/src/planner/file-scope.mjs +109 -7
- package/src/tasks/analyze/index.mjs +16 -28
- package/src/tasks/packet/parse-prompt.mjs +138 -3
- package/src/tasks/validate-contract-warn.mjs +45 -0
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 |
|
|
@@ -35,7 +35,8 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
|
|
|
35
35
|
4. `spine preflight` green; **`npm run release:check` green (blocking gate)** on current `main`
|
|
36
36
|
5. **CI workflow green on release commit** (release-safe profile — parity with `ci.yml`) before tag push
|
|
37
37
|
6. Operator explicitly approved publish; version bumped and tag pushed (if approved)
|
|
38
|
-
7.
|
|
38
|
+
7. Every release-scoped `Closes #NNN` / `Closes: #NNN` issue is **CLOSED** on GitHub once its fix is on `main` (close after each land — do not wait for publish)
|
|
39
|
+
8. Final report with composition table, issues closed/deferred, verification output
|
|
39
40
|
|
|
40
41
|
## Hard rules
|
|
41
42
|
|
|
@@ -57,6 +58,7 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
|
|
|
57
58
|
- **Never** mid-release-edit `.spine/spine-config.json` agent pins (`agents.worker.model` / `agents.reviewer.model`) while a batch is running or integrated work is still unpublished. Pin **one worker** per release; escalate models **only** on content/contract failure — never on quota/403 or launch storms, which make releases worse (F7, [#248](https://github.com/beettlle/pi-spine/issues/248)). To override mid-release, first record the reason and date in the release manifest
|
|
58
59
|
- **Heed** the doctor/preflight **quota-risk advisory** ([#251](https://github.com/beettlle/pi-spine/issues/251)): `spine doctor` surfaces `ok: true, warning: true` when escalate/hard worker pins target quota-constrained pools without headroom evidence, or recent run-metrics show launch-storm / quota-abort patterns. It is advisory only — never fails preflight — and does not change the mid-release pin-thrash ban above
|
|
59
60
|
- **Always** push/sync `main` to `origin` after each land loop once the post-integrate regression gate is green — do not let `main` drift far ahead of `origin` during a release (F8, [#249](https://github.com/beettlle/pi-spine/issues/249))
|
|
61
|
+
- **Always** close GitHub issues linked as `Closes #NNN` / `Closes: #NNN` **as soon as that task's work is on `main`** (after integrate + post-integrate `release:check` green) — do **not** defer closing until Phase 6 publish. Leave `Partial #NNN` / `Partial: #NNN` open. Phase 6 is only a final sweep for any still-open `Closes` links (v2.15.0 left #257–#261, #263 open after ship — avoid that)
|
|
60
62
|
- **Do not** start a second batch while another batch is **running** on this repo
|
|
61
63
|
- **Never** background `spine batch resume --attached` or `resume --attached --force` ([#163](https://github.com/beettlle/pi-spine/issues/163))
|
|
62
64
|
- **Release and agent batches:** use **detached** `spine batch start|resume` (omit `--attached`); monitor with MonitorCreate, `spine wait`, or `spine status --diagnose` ([#163](https://github.com/beettlle/pi-spine/issues/163), [#185](https://github.com/beettlle/pi-spine/issues/185)) — see [agent-shell-batch-policy.md](../spine-autonomous-operator/references/agent-shell-batch-policy.md)
|
|
@@ -149,7 +151,7 @@ spine tasks analyze pending
|
|
|
149
151
|
**Map issues to tasks:**
|
|
150
152
|
|
|
151
153
|
```bash
|
|
152
|
-
rg 'Closes:|Partial:' spine-tasks/*/PROMPT.md
|
|
154
|
+
rg 'Closes #|Closes:|Partial #|Partial:' spine-tasks/*/PROMPT.md
|
|
153
155
|
```
|
|
154
156
|
|
|
155
157
|
Read `spine-tasks/CONTEXT.md` for `Next Task ID`.
|
|
@@ -205,7 +207,7 @@ Require explicit **"approve release scope"** before Phase 3.
|
|
|
205
207
|
For issues in manifest without SP-*:
|
|
206
208
|
|
|
207
209
|
- Follow **`create-spine-tasks`** (lean mode default)
|
|
208
|
-
- Mission: `Closes
|
|
210
|
+
- Mission: `Closes #NNN` (or `Closes: #NNN`) — use `Partial #NNN` / `Partial: #NNN` when scoped
|
|
209
211
|
- Size S/M; ≤4 impl steps; Contract + Testing step
|
|
210
212
|
- Update `dependencies.json`, `CONTEXT.md`, increment `Next Task ID`
|
|
211
213
|
|
|
@@ -231,6 +233,7 @@ For every task in manifest scope:
|
|
|
231
233
|
- [ ] Doc paths in File Scope match Documentation Requirements (#144)
|
|
232
234
|
- [ ] `dependencies.json` matches PROMPT `## Dependencies`
|
|
233
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)
|
|
234
237
|
|
|
235
238
|
```bash
|
|
236
239
|
spine tasks validate <release-scope>
|
|
@@ -335,6 +338,8 @@ test "${PIPESTATUS[0]}" -eq 0
|
|
|
335
338
|
|
|
336
339
|
Full reference: [post-integrate-regression-gate.md](references/post-integrate-regression-gate.md).
|
|
337
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
|
+
|
|
338
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.
|
|
339
344
|
|
|
340
345
|
**Do not** judge pass/fail from `tail` output — `tail` exits 0 even when `release:check` failed.
|
|
@@ -349,6 +354,42 @@ git push origin main
|
|
|
349
354
|
|
|
350
355
|
Do not let `main` drift far ahead of `origin` between waves — v2.12.1 ran **24 commits ahead** of `origin` at Phase 5 (F8, [#249](https://github.com/beettlle/pi-spine/issues/249)). Local-only releases may defer this push; record the deferral in the manifest publish checklist.
|
|
351
356
|
|
|
357
|
+
### 4.3c Close GitHub issues for landed tasks (blocking hygiene)
|
|
358
|
+
|
|
359
|
+
After §4.3a is green (and §4.3b push when remote publish is the goal), **close every open issue fully resolved by tasks that just landed** — same wave, same land loop. Do not wait for Phase 6 or npm publish.
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
# Issues linked from the wave's newly-.DONE tasks:
|
|
363
|
+
rg -n 'Closes #|Closes: #' spine-tasks/SP-*/PROMPT.md
|
|
364
|
+
|
|
365
|
+
# For each Closes #NNN (not Partial) whose SP-* is .DONE on main and still OPEN:
|
|
366
|
+
gh issue view NNN --repo beettlle/pi-spine --json state,title
|
|
367
|
+
gh issue close NNN --repo beettlle/pi-spine --reason completed --comment "$(cat <<EOF
|
|
368
|
+
Fixed on \`main\` by **SP-XXX** (release v{TARGET}).
|
|
369
|
+
|
|
370
|
+
- Commit(s): \`<sha>\` — <subject>
|
|
371
|
+
- Batch: <batchId> (integrated)
|
|
372
|
+
EOF
|
|
373
|
+
)"
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
| Link in PROMPT Mission | Action after land |
|
|
377
|
+
|------------------------|-------------------|
|
|
378
|
+
| `Closes #NNN` / `Closes: #NNN` | **Close** when that task's `.DONE` is on `main` and §4.3a passed |
|
|
379
|
+
| `Partial #NNN` / `Partial: #NNN` | **Leave open** — note progress in a comment if useful |
|
|
380
|
+
| Manifest-mapped issue with no `Closes` line | Close only if acceptance criteria are fully met; otherwise comment + leave open |
|
|
381
|
+
|
|
382
|
+
**Fail closed before next wave / Phase 5:** every release-scoped `Closes #NNN` for tasks already `.DONE` on `main` must show `state: CLOSED`. Re-check:
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Example: verify still-open Closes targets for release-scoped DONE tasks
|
|
386
|
+
for n in $(rg -o 'Closes:? #([0-9]+)' -r '$1' spine-tasks/SP-*/PROMPT.md | sort -u); do
|
|
387
|
+
gh issue view "$n" --repo beettlle/pi-spine --json number,state -q '"\(.number) \(.state)"'
|
|
388
|
+
done
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Record closed issue numbers in the release manifest intake / composition notes.
|
|
392
|
+
|
|
352
393
|
### 4.4 Recovery
|
|
353
394
|
|
|
354
395
|
Always: `spine status --diagnose`
|
|
@@ -489,20 +530,33 @@ If retries exhaust, **STOP** — treat it as a real missing-version failure and
|
|
|
489
530
|
|
|
490
531
|
Update `spine-tasks/CONTEXT.md` release note (version + date).
|
|
491
532
|
|
|
492
|
-
Close GitHub issues
|
|
533
|
+
### Close remaining GitHub issues (final sweep)
|
|
534
|
+
|
|
535
|
+
§4.3c should already have closed each `Closes #NNN` when its task landed. Before the final report, **sweep** any still-open issues that release-scoped DONE tasks fully resolve:
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
rg -n 'Closes #|Closes: #' spine-tasks/SP-*/PROMPT.md
|
|
539
|
+
# For each still-OPEN Closes #NNN whose SP-* is .DONE on main:
|
|
540
|
+
gh issue close NNN --repo beettlle/pi-spine --reason completed --comment "…"
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
Include the published version/tag in the close comment when closing at Phase 6 (e.g. `Shipped in **v{TARGET}**`). Leave `Partial #NNN` open.
|
|
544
|
+
|
|
545
|
+
**Fail closed:** do not mark the release cycle complete while any release-scoped `Closes #NNN` issue remains OPEN.
|
|
493
546
|
|
|
494
547
|
---
|
|
495
548
|
|
|
496
549
|
## Final report (required)
|
|
497
550
|
|
|
498
551
|
1. **Release manifest** — path, target version, profile, composition table
|
|
499
|
-
2. **Tasks completed** — SP-IDs, waves, issues closed
|
|
500
|
-
3. **Deferred backlog** — count and top items for next release
|
|
552
|
+
2. **Tasks completed** — SP-IDs, waves, issues closed (list `#NNN` CLOSED with close time or comment URL)
|
|
553
|
+
3. **Deferred backlog** — count and top items for next release (issues left OPEN + rationale)
|
|
501
554
|
4. **Authoring changes** — new SP-* created, splits/fixes in Phase 3
|
|
502
555
|
5. **Issues filed** — pi-spine GitHub links or "none"
|
|
503
556
|
6. **Recovery actions** — aborts, retries, contract fixes
|
|
504
557
|
7. **Verification** — paste `spine preflight` tail, **`npm run release:check` output** (or log path), test/coverage output
|
|
505
558
|
8. **Publish** — version bumped (Y/N), tag pushed (Y/N), workflow URL, or "awaiting operator approval"
|
|
559
|
+
9. **Issue tracker hygiene** — confirm every release-scoped `Closes #NNN` is CLOSED (paste `gh issue view` states or list)
|
|
506
560
|
|
|
507
561
|
---
|
|
508
562
|
|
|
@@ -527,6 +581,8 @@ preflight → for each wave: MonitorCreate batch start (or foreground) → onDon
|
|
|
527
581
|
gate approve → integrate → npm install → batch complete →
|
|
528
582
|
post-integrate release:check (exit 0 required; no tail-only verification) →
|
|
529
583
|
git push origin main when remote publish is the goal (F8) →
|
|
530
|
-
|
|
584
|
+
close Closes #NNN issues for tasks that just landed (§4.3c; do not wait for publish) →
|
|
585
|
+
MonitorCreate release:check → HARD STOP if non-zero (fix on main, re-run) → only if exit 0: verify ci.yml green on HEAD (gh run list/watch) → HARD STOP if not green → only then: STOP for publish approval →
|
|
586
|
+
after publish: Phase 6 issue sweep for any still-open Closes links → final report must list CLOSED issue numbers.
|
|
531
587
|
resume --attached --force stays foreground. Post final report with composition table.
|
|
532
588
|
```
|
|
@@ -71,7 +71,7 @@ Prefer when:
|
|
|
71
71
|
|
|
72
72
|
Exclude when:
|
|
73
73
|
|
|
74
|
-
- Fixed on `main` but issue not closed
|
|
74
|
+
- Fixed on `main` but issue not closed — **unless** this release will close it immediately (hygiene debt from a prior land; close in §4.3c / Phase 6 sweep before selecting new work for the same issue)
|
|
75
75
|
- Requires external repo reproduction without minimal repro
|
|
76
76
|
- Blocked by epic infrastructure not in this release
|
|
77
77
|
|
|
@@ -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
|
```
|
|
@@ -15,6 +15,7 @@ Run on current `main` after:
|
|
|
15
15
|
3. **Before next wave** — do not start wave N+1 until gate passes on `main`
|
|
16
16
|
4. **Before first `git push origin main`** during a release cycle
|
|
17
17
|
5. **Before `npm version`** — Phase 5 `release:check` (same command; re-run if `main` moved)
|
|
18
|
+
6. **After gate green** — close GitHub `Closes #NNN` issues for tasks that just landed (spine-release-operator §4.3c); do not defer until publish
|
|
18
19
|
|
|
19
20
|
---
|
|
20
21
|
|
|
@@ -37,6 +38,19 @@ echo "release:check exit: $?"
|
|
|
37
38
|
|
|
38
39
|
---
|
|
39
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
|
+
|
|
40
54
|
## Verification discipline
|
|
41
55
|
|
|
42
56
|
| Do | Do not |
|
|
@@ -44,6 +58,7 @@ echo "release:check exit: $?"
|
|
|
44
58
|
| Run full `npm run release:check` | Pipe through `tail` or `head` for pass/fail decisions |
|
|
45
59
|
| Verify exit code explicitly (`$?` or `${PIPESTATUS[0]}`) | Claim "passed" from truncated log tail |
|
|
46
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 |
|
|
47
62
|
|
|
48
63
|
**Anti-pattern:** `npm run release:check 2>&1 | tail -20` — `tail` exits 0 even when `release:check` failed.
|
|
49
64
|
|
package/src/batch/abort.mjs
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { loadSpineConfig } from "../config/spine-config-load.mjs";
|
|
9
|
+
import { writeJsonAtomic } from "../fs/atomic-write.mjs";
|
|
9
10
|
import { archiveBatchStatePath } from "./lifecycle.mjs";
|
|
10
11
|
import { appendJournalEvent, journalPath, readJournalEvents, readJournalTail } from "./journal.mjs";
|
|
11
12
|
import { loadBatchStateFile } from "./reconcile.mjs";
|
|
12
13
|
import { appendBatchHistoryEntry } from "./state.mjs";
|
|
14
|
+
import { withBatchStateLock } from "./batch-state-lock.mjs";
|
|
13
15
|
import { removeLaneWorktrees, maxLaneNumberFromBatchState } from "./worktree.mjs";
|
|
14
16
|
import { terminateLaneWorkers } from "./worker-host.mjs";
|
|
15
17
|
|
|
@@ -36,15 +38,21 @@ export function readAbortSignal(projectRoot, batchId) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
/**
|
|
41
|
+
* Write the abort signal atomically under the global batch-state lock
|
|
42
|
+
* (SP-722 / #264) so a concurrent engine heartbeat never observes a
|
|
43
|
+
* half-written signal.
|
|
44
|
+
*
|
|
39
45
|
* @param {string} projectRoot
|
|
40
46
|
* @param {string} batchId
|
|
41
47
|
* @param {object} payload
|
|
42
48
|
*/
|
|
43
49
|
export function writeAbortSignal(projectRoot, batchId, payload) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
return withBatchStateLock(projectRoot, () => {
|
|
51
|
+
const signalPath = abortSignalPath(projectRoot, batchId);
|
|
52
|
+
fs.mkdirSync(path.dirname(signalPath), { recursive: true });
|
|
53
|
+
writeJsonAtomic(signalPath, payload);
|
|
54
|
+
return signalPath;
|
|
55
|
+
});
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
/**
|
|
@@ -211,77 +219,83 @@ export function abortBatch(ctx) {
|
|
|
211
219
|
};
|
|
212
220
|
}
|
|
213
221
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
222
|
+
// Terminal abort write section runs under the global batch-state lock
|
|
223
|
+
// (SP-722 / #264): abort signal, archive, history entry, and clearing the
|
|
224
|
+
// active state must not interleave with a concurrent engine save or a
|
|
225
|
+
// concurrent complete/resume writer.
|
|
226
|
+
return withBatchStateLock(projectRoot, () => {
|
|
227
|
+
const snapshot = buildAbortedSnapshot(loaded.raw, reason);
|
|
228
|
+
writeAbortSignal(projectRoot, batchId, {
|
|
229
|
+
hard,
|
|
230
|
+
reason: reason ?? null,
|
|
231
|
+
requestedAt: new Date().toISOString(),
|
|
232
|
+
});
|
|
220
233
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
234
|
+
if (hard) {
|
|
235
|
+
killLaneWorkers(snapshot.lanes, true);
|
|
236
|
+
}
|
|
224
237
|
|
|
225
|
-
|
|
238
|
+
const archivePath = writeBatchArchive(projectRoot, batchId, snapshot);
|
|
226
239
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
240
|
+
const eventsBefore = readJournalEvents(projectRoot, batchId);
|
|
241
|
+
const journalTail = readJournalTail(eventsBefore);
|
|
242
|
+
appendJournalEvent(projectRoot, batchId, "batch.aborted", {
|
|
243
|
+
reason: reason ?? null,
|
|
244
|
+
hard,
|
|
245
|
+
archivePath: path.relative(projectRoot, archivePath),
|
|
246
|
+
journalEventsBeforeAbort: eventsBefore.length,
|
|
247
|
+
journalTailEventTypes: journalTail.map((event) => event.type),
|
|
248
|
+
});
|
|
236
249
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
250
|
+
const journalFile = journalPath(projectRoot, batchId);
|
|
251
|
+
if (!fs.existsSync(journalFile)) {
|
|
252
|
+
return {
|
|
253
|
+
ok: false,
|
|
254
|
+
exitCode: 1,
|
|
255
|
+
error: "journal_missing_after_abort",
|
|
256
|
+
headline: "Abort archived state but journal file is missing",
|
|
257
|
+
suggestedCommand: "spine status --diagnose",
|
|
258
|
+
batchId,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
248
261
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
262
|
+
appendBatchHistoryEntry(projectRoot, {
|
|
263
|
+
batchId,
|
|
264
|
+
action: "aborted",
|
|
265
|
+
endedAt: snapshot.endedAt,
|
|
266
|
+
hard,
|
|
267
|
+
reason: reason ?? null,
|
|
268
|
+
archivePath: path.relative(projectRoot, archivePath),
|
|
269
|
+
});
|
|
257
270
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
271
|
+
if (hard) {
|
|
272
|
+
const configResult = loadSpineConfig(projectRoot);
|
|
273
|
+
const config = configResult.config ?? {};
|
|
274
|
+
if (shouldCleanupWorktreesOnHardAbort(config)) {
|
|
275
|
+
const laneCount = maxLaneNumberFromBatchState(snapshot);
|
|
276
|
+
removeLaneWorktrees(projectRoot, batchId, laneCount);
|
|
277
|
+
appendJournalEvent(projectRoot, batchId, "batch.worktrees_cleaned", {
|
|
278
|
+
batchId,
|
|
279
|
+
laneCount,
|
|
280
|
+
reason: "hard_abort",
|
|
281
|
+
});
|
|
282
|
+
}
|
|
269
283
|
}
|
|
270
|
-
}
|
|
271
284
|
|
|
272
|
-
|
|
285
|
+
clearActiveBatchState(loaded.path);
|
|
273
286
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
+
return {
|
|
288
|
+
ok: true,
|
|
289
|
+
exitCode: 0,
|
|
290
|
+
batchId,
|
|
291
|
+
diagnosis: "aborted",
|
|
292
|
+
hard,
|
|
293
|
+
headline: hard
|
|
294
|
+
? `Batch ${batchId} hard-aborted and archived`
|
|
295
|
+
: `Batch ${batchId} aborted and archived`,
|
|
296
|
+
suggestedCommand: "spine preflight",
|
|
297
|
+
alternatives: ["spine batch dismiss", "spine status --diagnose"],
|
|
298
|
+
archivePath,
|
|
299
|
+
};
|
|
300
|
+
});
|
|
287
301
|
}
|