pi-spine 2.22.0 → 2.24.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/README.md +1 -1
- package/package.json +5 -5
- package/skills/spine-release-operator/SKILL.md +78 -8
- package/src/batch/engine-lanes/commit.mjs +5 -6
- package/src/batch/engine-lanes/matrix-run.mjs +46 -23
- package/src/batch/engine-lanes/matrix.mjs +8 -6
- package/src/batch/engine-lanes/merge.mjs +57 -25
- package/src/batch/engine-lanes/orch-sync.mjs +13 -6
- package/src/batch/engine-lanes/phase.mjs +8 -2
- package/src/batch/engine-lanes/queue.mjs +33 -3
- package/src/batch/engine-lanes/review-code.mjs +28 -3
- package/src/batch/engine-lanes/review-final.mjs +39 -3
- package/src/batch/engine-lanes/review-plan.mjs +32 -5
- package/src/batch/engine-lanes/review-poll.mjs +32 -9
- package/src/batch/engine-lanes/review-stub.mjs +1 -2
- package/src/batch/engine-lanes/review.mjs +0 -1
- package/src/batch/engine-lanes.mjs +33 -5
- package/src/batch/reconcile-batch.mjs +13 -18
- package/src/batch/reconcile-classify.mjs +21 -11
- package/src/batch/reconcile-diagnosis-context.mjs +1 -2
- package/src/batch/reconcile-diagnosis.mjs +18 -19
- package/src/batch/reconcile-light-cache.mjs +0 -1
- package/src/batch/reconcile-orphan.mjs +9 -8
- package/src/batch/reconcile.mjs +0 -1
- package/src/doctor/run-doctor-checks.mjs +41 -3
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ Primary monitor surfaces: **`spine status --diagnose`**, **`spine dashboard`** /
|
|
|
49
49
|
| [pi](https://pi.dev) coding agent | ≥ 0.80.0 (`pi.minPiVersion`) | Yes |
|
|
50
50
|
| Git (worktree support) | — | Yes |
|
|
51
51
|
|
|
52
|
-
These are the Wave A floors ([#285](https://github.com/beettlle/pi-spine/issues/285)). `spine doctor` **warns** when the installed pi is below `pi.minPiVersion` ("pi version supported"). The optional peer `@earendil-works/pi-coding-agent` is developed and tested against `^0.87.
|
|
52
|
+
These are the Wave A floors ([#285](https://github.com/beettlle/pi-spine/issues/285)). `spine doctor` **warns** when the installed pi is below `pi.minPiVersion` ("pi version supported"). The optional peer `@earendil-works/pi-coding-agent` is developed and tested against `^0.87.1` (pinned in `devDependencies`; the `peerDependencies` range stays `*`).
|
|
53
53
|
|
|
54
54
|
## Install
|
|
55
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-spine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "Orchestration spine for long-running pi development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@earendil-works/pi-coding-agent": "^0.87.
|
|
76
|
-
"@types/node": "^22.
|
|
77
|
-
"eslint": "^10.
|
|
75
|
+
"@earendil-works/pi-coding-agent": "^0.87.1",
|
|
76
|
+
"@types/node": "^22.20.4",
|
|
77
|
+
"eslint": "^10.11.0",
|
|
78
78
|
"globals": "^17.12.0",
|
|
79
|
-
"typebox": "1.3.
|
|
79
|
+
"typebox": "1.3.34",
|
|
80
80
|
"typescript": "6.0.3"
|
|
81
81
|
},
|
|
82
82
|
"license": "MIT",
|
|
@@ -35,8 +35,9 @@ 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.
|
|
39
|
-
8.
|
|
38
|
+
7. **npm stage completed via GitHub Actions** — `release.yml` Stage step green; then maintainer **approves** with 2FA; `npm view pi-spine version` matches the tag (stage alone is not publish)
|
|
39
|
+
8. 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)
|
|
40
|
+
9. Final report with composition table, issues closed/deferred, verification output
|
|
40
41
|
|
|
41
42
|
## Hard rules
|
|
42
43
|
|
|
@@ -46,6 +47,9 @@ Invoke explicitly: `/skill:spine-release-operator` or "run a spine release cycle
|
|
|
46
47
|
- **Never** run `npm version` or `git push --tags` without explicit operator approval
|
|
47
48
|
- **Never** run `npm version` or `git push --tags` when `npm run release:check` exits non-zero on current `main` ([#175](https://github.com/beettlle/pi-spine/issues/175))
|
|
48
49
|
- **Never** run `npm version` or `git push --tags` when the **CI** workflow is not green on current `HEAD` — release-safe profile: typecheck + lint + tests + coverage (parity with `ci.yml`) ([#156](https://github.com/beettlle/pi-spine/issues/156))
|
|
50
|
+
- **Never** claim the package is on npm until the staged package is **approved** with 2FA and `npm view pi-spine version` matches the release — tag push and green `release.yml` stage alone are not publish
|
|
51
|
+
- **Never** re-run `npm version` / retag when `release.yml` failed after a correct `v*` tag already exists — fix Trusted Publisher / OIDC config or re-dispatch Release on the existing tag (see Phase 6 § Publish failure recovery)
|
|
52
|
+
- **Never** use local `npm publish` for routine releases — CI stages via OIDC (`npm stage publish`); emergency manual only after explicit operator approval (see `docs/release/npm-publish.md`)
|
|
49
53
|
- **Always** parse target version / bump type **before** task selection (Phase 2)
|
|
50
54
|
- **Always** record dependency drift in Phase 1 (`npm outdated` + `npm audit`) and apply include/defer thresholds — never auto-add a full “update all deps” task; see [issue-intake-checklist.md](references/issue-intake-checklist.md) § Dependency drift check
|
|
51
55
|
- **Always** prioritize documentation issues over enhancements
|
|
@@ -519,15 +523,79 @@ npm version patch # or minor / major — must match Phase 2 profile
|
|
|
519
523
|
git push && git push --tags
|
|
520
524
|
```
|
|
521
525
|
|
|
522
|
-
|
|
526
|
+
### CI stages to npm via OIDC (not the operator shell)
|
|
527
|
+
|
|
528
|
+
**Canonical publish path:** pushing `v*` triggers [`.github/workflows/release.yml`](../../.github/workflows/release.yml). That workflow:
|
|
529
|
+
|
|
530
|
+
1. Checks out the tag
|
|
531
|
+
2. Verifies CI green on the tagged commit (or runs the full gate if no green CI yet)
|
|
532
|
+
3. Ensures npm ≥ 11.15 and runs `npm stage publish --access public --ignore-scripts --provenance` with **Trusted Publishing (OIDC)** — `permissions.id-token: write`; no `NPMSECRET`
|
|
533
|
+
4. Creates the GitHub Release (`gh release create`)
|
|
534
|
+
|
|
535
|
+
**Not live yet:** Trusted Publisher is **stage-only**. A maintainer must approve with 2FA before the version is installable:
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
npm stage list
|
|
539
|
+
npm stage view <stage-id>
|
|
540
|
+
npm stage approve <stage-id> # prompts for 2FA
|
|
541
|
+
# or: npmjs.com → package → Staged Packages → Approve
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
Operator Phase 6 after approval is: **bump → push tag → watch `release.yml` (stage) → human approve → smoke**. Full mechanics: `docs/release/npm-publish.md`.
|
|
545
|
+
|
|
546
|
+
Monitor Release workflow until conclusion:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
gh run list --workflow release.yml --limit 3
|
|
550
|
+
# Prefer the run for this tag:
|
|
551
|
+
gh run list --workflow release.yml --branch v{VERSION} --limit 3
|
|
552
|
+
gh run watch --exit-status <run-id>
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
**pi async:** `MonitorCreate` with `gh run watch --exit-status <run-id>`, `timeout: 1800000`, `onDone` to report conclusion; if green, remind operator to approve the staged package, then run smoke.
|
|
556
|
+
|
|
557
|
+
**Publish success criteria (all required):**
|
|
558
|
+
|
|
559
|
+
- `release.yml` conclusion `success` (stage + GitHub Release)
|
|
560
|
+
- Staged package **approved** (2FA) — `npm view pi-spine version` equals the released version
|
|
561
|
+
- GitHub Release exists for `v{VERSION}` (`gh release view v{VERSION}`)
|
|
562
|
+
|
|
563
|
+
Tag push + green **CI** (`ci.yml`) alone is **not** enough — `ci.yml` does not stage or publish. Green stage alone is **not** enough — approve is required.
|
|
564
|
+
|
|
565
|
+
### Publish failure recovery (HARD STOP — do not retag)
|
|
566
|
+
|
|
567
|
+
When `release.yml` fails, diagnose with the failed job log before any recovery:
|
|
523
568
|
|
|
524
569
|
```bash
|
|
570
|
+
gh run view <run-id> --log-failed
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
| Symptom | Meaning | Action |
|
|
574
|
+
|---------|---------|--------|
|
|
575
|
+
| OIDC / trusted publisher mismatch / `ENEEDAUTH` | Trusted Publisher config wrong (workflow name, Environment name set while job has none, stage permission missing) | Fix npm Trusted Publisher; re-dispatch same tag — do **not** `npm version` again |
|
|
576
|
+
| Legacy `E404` on PUT with `NPMSECRET` | Old token path still in use or secret bad | Prefer OIDC; emergency: rotate `NPMSECRET` only if workflow still uses token |
|
|
577
|
+
| Validation steps failed (typecheck / lint / coverage / CLI smoke) | Tagged commit not release-safe | Fix on `main`, create a **new** patch version + tag; do not force-publish a broken tag |
|
|
578
|
+
| CI gate failed for tagged commit | Pre-tag CI was red or missing | Fix `main` / re-run `ci.yml`; new tag if the old tag pointed at a bad commit |
|
|
579
|
+
| Stage green but install missing version | Not approved yet | Approve with 2FA; do not retag |
|
|
580
|
+
| GitHub Release step failed after stage succeeded | Notes/release page only | Create release manually; do not double-stage the same version without rejecting the prior stage first |
|
|
581
|
+
|
|
582
|
+
**Re-dispatch existing tag** (after Trusted Publisher / transient registry fix):
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
# Tag must already exist; this re-runs checkout → gate → stage → gh release
|
|
586
|
+
# workflow_dispatch uses the workflow file from the branch you select (usually main)
|
|
587
|
+
gh workflow run release.yml -f tag=v{VERSION}
|
|
525
588
|
gh run list --workflow release.yml --limit 3
|
|
589
|
+
gh run watch --exit-status <new-run-id>
|
|
526
590
|
```
|
|
527
591
|
|
|
528
|
-
|
|
592
|
+
UI equivalent: **Actions → Release → Run workflow** → enter `v{VERSION}`.
|
|
593
|
+
|
|
594
|
+
**Do not** delete/retag/`npm version` again when the only failure was auth/OIDC — package.json and the `v*` tag are already correct.
|
|
595
|
+
|
|
596
|
+
Distinguish **stage auth failures** (table above) from **post-approve install E404/ETARGET** (registry lag F9 — smoke section below) and from **pre-approve missing version** (approve pending).
|
|
529
597
|
|
|
530
|
-
Post-publish smoke per `docs/release/npm-publish.md` — **
|
|
598
|
+
Post-publish smoke per `docs/release/npm-publish.md` — **only after stage success and 2FA approve**. **Retry on registry lag (F9, [#247](https://github.com/beettlle/pi-spine/issues/247)):** the first `npm install -g` right after approve can fail with `ETARGET` / "No matching version found" while the registry propagates, even when `npm view` already lists the version. Prefer the bounded wrapper:
|
|
531
599
|
|
|
532
600
|
```bash
|
|
533
601
|
scripts/post-publish-smoke.sh <version>
|
|
@@ -571,7 +639,7 @@ Include the published version/tag in the close comment when closing at Phase 6 (
|
|
|
571
639
|
6. **Issues filed** — pi-spine GitHub links or "none"
|
|
572
640
|
7. **Recovery actions** — aborts, retries, contract fixes
|
|
573
641
|
8. **Verification** — paste `spine preflight` tail, **`npm run release:check` output** (or log path), test/coverage output
|
|
574
|
-
9. **Publish** — version bumped (Y/N), tag pushed (Y/N),
|
|
642
|
+
9. **Publish** — version bumped (Y/N), tag pushed (Y/N), `release.yml` URL + conclusion, stage approved (Y/N), `npm view pi-spine version`, or "awaiting operator approval" / "blocked on Trusted Publisher" / "awaiting stage approve"
|
|
575
643
|
10. **Issue tracker hygiene** — confirm every release-scoped `Closes #NNN` is CLOSED (paste `gh issue view` states or list)
|
|
576
644
|
|
|
577
645
|
---
|
|
@@ -584,7 +652,8 @@ Include the published version/tag in the close comment when closing at Phase 6 (
|
|
|
584
652
|
| Issues repo | `beettlle/pi-spine` |
|
|
585
653
|
| Pre-publish gate | `npm run release:check` (typecheck → lint → tests → coverage; CI parity) |
|
|
586
654
|
| Pre-tag CI gate | `ci.yml` green on `HEAD` via `gh run list` / `gh run watch` before `npm version` ([#156](https://github.com/beettlle/pi-spine/issues/156)) |
|
|
587
|
-
| Publish |
|
|
655
|
+
| Publish | **CI-only OIDC stage** — `.github/workflows/release.yml` runs `npm stage publish` (`id-token: write`). Trusted Publisher: stage-only. Human 2FA approve before installable |
|
|
656
|
+
| Re-publish | `gh workflow run release.yml -f tag=vX.Y.Z` after Trusted Publisher fix — never retag for auth-only failures |
|
|
588
657
|
| Pending backlog | Run `spine plan pending` — release executes **subset only** |
|
|
589
658
|
|
|
590
659
|
## Short prompt (resume mid-release)
|
|
@@ -599,6 +668,7 @@ post-integrate release:check (exit 0 required; no tail-only verification) →
|
|
|
599
668
|
git push origin main when remote publish is the goal (F8) →
|
|
600
669
|
close Closes #NNN issues for tasks that just landed (§4.3c; do not wait for publish) →
|
|
601
670
|
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 →
|
|
602
|
-
after
|
|
671
|
+
after approve: npm version + push tags → watch release.yml (OIDC `npm stage publish`) → on OIDC/auth failure fix Trusted Publisher and gh workflow run release.yml -f tag=v{TARGET} (do not retag) →
|
|
672
|
+
human 2FA approve staged package (npmjs.com or `npm stage approve`) → confirm npm view + gh release view → post-publish smoke → Phase 6 issue sweep → final report must list CLOSED issue numbers.
|
|
603
673
|
resume --attached --force stays foreground. Post final report with composition table.
|
|
604
674
|
```
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Lane commit and post-commit dirty validation (SP-427 / #73).
|
|
4
3
|
*/
|
|
@@ -27,15 +26,15 @@ const DIRTY_AFTER_COMMIT_MESSAGE =
|
|
|
27
26
|
* @param {string} params.taskId
|
|
28
27
|
* @param {string} params.batchId
|
|
29
28
|
* @param {string} params.taskFolder
|
|
30
|
-
* @param {string}
|
|
29
|
+
* @param {string} params.projectRoot
|
|
31
30
|
* @param {string[]} [params.fileScopePaths]
|
|
32
31
|
* @param {string[]} [params.ignorePatterns]
|
|
33
|
-
* @param {
|
|
34
|
-
* @param {
|
|
32
|
+
* @param {Record<string, any>} params.task
|
|
33
|
+
* @param {Record<string, any>} params.lane
|
|
35
34
|
* @param {number} params.laneNumber
|
|
36
35
|
* @param {string} params.laneCorrelationId
|
|
37
|
-
* @param {
|
|
38
|
-
* @param {
|
|
36
|
+
* @param {Record<string, any>} params.state
|
|
37
|
+
* @param {Record<string, any>} params.config
|
|
39
38
|
* @returns {{ ok: true, laneCommit: object } | { ok: false, error: string, output?: string }}
|
|
40
39
|
*/
|
|
41
40
|
export function commitLaneAndValidateWorktree({
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Matrix task / sub-lane runners (SP-671 / #217).
|
|
4
3
|
*
|
|
@@ -43,7 +42,7 @@ import { gitExec } from "../git-exec.mjs";
|
|
|
43
42
|
* Read the `## Contract` table from a parent task folder (un-substituted).
|
|
44
43
|
*
|
|
45
44
|
* @param {string} parentTaskFolderAbs
|
|
46
|
-
* @returns {
|
|
45
|
+
* @returns {ReturnType<typeof parseContract> | null}
|
|
47
46
|
*/
|
|
48
47
|
export function readParentContract(parentTaskFolderAbs) {
|
|
49
48
|
const promptPath = path.join(parentTaskFolderAbs, "PROMPT.md");
|
|
@@ -130,6 +129,18 @@ export function resolveMatrixRowConcurrency({ matrixMaxParallel, maxParallel = 1
|
|
|
130
129
|
* worker child env (`buildMatrixRowEnv`).
|
|
131
130
|
*
|
|
132
131
|
* @param {object} params
|
|
132
|
+
* @param {string} params.projectRoot
|
|
133
|
+
* @param {string} params.batchId
|
|
134
|
+
* @param {number} params.laneNumber
|
|
135
|
+
* @param {string} params.taskId
|
|
136
|
+
* @param {string} params.laneBranch Lane task branch the row worktree branches from.
|
|
137
|
+
* @param {string} params.laneCorrelationId
|
|
138
|
+
* @param {{ rowId: string, values: Record<string, string> }} params.row
|
|
139
|
+
* @param {"execute" | "llm"} params.matrixType
|
|
140
|
+
* @param {string} params.parentTaskFolderAbs
|
|
141
|
+
* @param {string} params.taskFolderRel
|
|
142
|
+
* @param {Record<string, any>} [params.config]
|
|
143
|
+
* @param {string} [params.baseBranch]
|
|
133
144
|
* @param {number} [params.rowIndex] 0-based index of this row in the matrix.
|
|
134
145
|
* @param {number} [params.rowCount] Total matrix row count.
|
|
135
146
|
* @returns {Promise<{ rowId: string, ok: boolean, exitCode: number, output: string, worktreePath?: string, branch?: string, commitSha?: string, servedPrompt?: string }>}
|
|
@@ -223,7 +234,7 @@ export async function runMatrixSubLane({
|
|
|
223
234
|
};
|
|
224
235
|
}
|
|
225
236
|
|
|
226
|
-
/** @type {{ rowId: string, ok: boolean, exitCode: number, output: string, worktreePath?: string, branch?: string }} */
|
|
237
|
+
/** @type {{ rowId: string, ok: boolean, exitCode: number, output: string, worktreePath?: string, branch?: string, commitSha?: string, servedPrompt?: string }} */
|
|
227
238
|
let result;
|
|
228
239
|
|
|
229
240
|
if (matrixType === "execute") {
|
|
@@ -333,7 +344,8 @@ export async function runMatrixSubLane({
|
|
|
333
344
|
sha256,
|
|
334
345
|
chars: servedPrompt.length,
|
|
335
346
|
});
|
|
336
|
-
const workerResult =
|
|
347
|
+
const workerResult = /** @type {{ ok?: boolean, exitCode?: number, output?: string, classification?: string }} */ (
|
|
348
|
+
await runWorker({
|
|
337
349
|
worktreePath,
|
|
338
350
|
taskFolder: path.join(worktreePath, taskFolderRel),
|
|
339
351
|
projectRoot,
|
|
@@ -345,7 +357,7 @@ export async function runMatrixSubLane({
|
|
|
345
357
|
fileScopePaths: [],
|
|
346
358
|
config,
|
|
347
359
|
...(matrixEnv ? { extraEnv: matrixEnv } : {}),
|
|
348
|
-
});
|
|
360
|
+
}));
|
|
349
361
|
result = {
|
|
350
362
|
rowId,
|
|
351
363
|
ok: Boolean(workerResult.ok),
|
|
@@ -397,7 +409,7 @@ export async function runMatrixSubLane({
|
|
|
397
409
|
{ projectRoot },
|
|
398
410
|
);
|
|
399
411
|
}
|
|
400
|
-
const sha = gitExec(worktreePath, ["rev-parse", "HEAD"], { projectRoot });
|
|
412
|
+
const sha = /** @type {string} */ (gitExec(worktreePath, ["rev-parse", "HEAD"], { projectRoot }));
|
|
401
413
|
result.commitSha = sha;
|
|
402
414
|
recordMatrixEvent(projectRoot, batchId, "matrix.sub_lane.completed", {
|
|
403
415
|
taskId,
|
|
@@ -450,12 +462,12 @@ export async function runMatrixSubLane({
|
|
|
450
462
|
*
|
|
451
463
|
* @param {object} params
|
|
452
464
|
* @param {string} params.projectRoot
|
|
453
|
-
* @param {
|
|
465
|
+
* @param {Record<string, any>} params.state Live batch state.
|
|
454
466
|
* @param {string} params.batchId
|
|
455
467
|
* @param {string} params.baseBranch
|
|
456
|
-
* @param {
|
|
457
|
-
* @param {
|
|
458
|
-
* @param {
|
|
468
|
+
* @param {Record<string, any>} params.config
|
|
469
|
+
* @param {Record<string, any>} params.task
|
|
470
|
+
* @param {Record<string, any>} params.lane
|
|
459
471
|
* @param {string} params.taskFolderRel
|
|
460
472
|
* @param {string} params.laneCorrelationId
|
|
461
473
|
* @param {string[]} params.fileScopePaths
|
|
@@ -536,8 +548,16 @@ export async function runMatrixTaskForResume({
|
|
|
536
548
|
* branches (fresh and carried-over) are merged back into the lane worktree so
|
|
537
549
|
* the normal lane-commit + wave-merge carry all rows' output.
|
|
538
550
|
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
551
|
+
* Params bag keys: `projectRoot` (string), `state` (live batch state),
|
|
552
|
+
* `batchId` (string), `baseBranch` (string), `config` (spine config), `task`
|
|
553
|
+
* (parent matrix task, mutated in place), `lane` (lane identity with
|
|
554
|
+
* `laneNumber`/`branch`/`worktreePath`), `taskFolderRel` (string),
|
|
555
|
+
* `laneCorrelationId` (string), `fileScopePaths` (string[]), `matrix` (packet
|
|
556
|
+
* matrix rows from `loadMatrixTaskRows`), `maxParallel` (global
|
|
557
|
+
* `lanes.maxParallel`, pool size).
|
|
558
|
+
*
|
|
559
|
+
* @param {Record<string, any>} params
|
|
560
|
+
* @returns {Promise<{ ok: boolean, aborted?: boolean, error?: string, output?: string, laneCommit?: object, workerResult?: { ok: boolean, classification?: string, exitCode?: number, output?: string } }>}
|
|
541
561
|
*/
|
|
542
562
|
export async function runMatrixTaskOnLane({
|
|
543
563
|
projectRoot,
|
|
@@ -575,9 +595,9 @@ export async function runMatrixTaskOnLane({
|
|
|
575
595
|
// rows keep their status + persisted worktree/branch for retry carry-over,
|
|
576
596
|
// `canceled` rows stay excluded, and only failed/pending rows re-enter the
|
|
577
597
|
// sweep. Fresh rows start `pending`.
|
|
578
|
-
task.matrixRows = matrix.rows.map((row) => {
|
|
598
|
+
task.matrixRows = matrix.rows.map((/** @type {any} */ row) => {
|
|
579
599
|
const existing = Array.isArray(task.matrixRows)
|
|
580
|
-
? task.matrixRows.find((entry) => entry && entry.rowId === row.rowId)
|
|
600
|
+
? task.matrixRows.find((/** @type {any} */ entry) => entry && entry.rowId === row.rowId)
|
|
581
601
|
: null;
|
|
582
602
|
return existing ?? {
|
|
583
603
|
rowId: row.rowId,
|
|
@@ -595,7 +615,7 @@ export async function runMatrixTaskOnLane({
|
|
|
595
615
|
const runnableRows = [];
|
|
596
616
|
const skippedRowIds = [];
|
|
597
617
|
for (const row of matrix.rows) {
|
|
598
|
-
const entry = task.matrixRows.find((m) => m.rowId === row.rowId);
|
|
618
|
+
const entry = task.matrixRows.find((/** @type {any} */ m) => m.rowId === row.rowId);
|
|
599
619
|
if (entry.status === "succeeded") {
|
|
600
620
|
const carryWorktree = typeof entry.worktreePath === "string" ? entry.worktreePath : null;
|
|
601
621
|
const carryBranch = typeof entry.branch === "string" ? entry.branch : null;
|
|
@@ -641,13 +661,13 @@ export async function runMatrixTaskOnLane({
|
|
|
641
661
|
laneNumber,
|
|
642
662
|
laneId: lane.laneId,
|
|
643
663
|
correlationId: laneCorrelationId,
|
|
644
|
-
rowIds: matrix.rows.map((row) => row.rowId),
|
|
664
|
+
rowIds: matrix.rows.map((/** @type {any} */ row) => row.rowId),
|
|
645
665
|
matrixType: matrix.type,
|
|
646
666
|
maxParallel,
|
|
647
667
|
matrixMaxParallel,
|
|
648
668
|
rowConcurrency,
|
|
649
|
-
runnableRowIds: runnableRows.map((row) => row.rowId),
|
|
650
|
-
carriedOverRowIds: carryOverRows.map((carry) => carry.row.rowId),
|
|
669
|
+
runnableRowIds: runnableRows.map((/** @type {any} */ row) => row.rowId),
|
|
670
|
+
carriedOverRowIds: carryOverRows.map((/** @type {any} */ carry) => carry.row.rowId),
|
|
651
671
|
skippedRowIds,
|
|
652
672
|
});
|
|
653
673
|
|
|
@@ -659,7 +679,7 @@ export async function runMatrixTaskOnLane({
|
|
|
659
679
|
const rowLaneNumber = await acquireLaneSlot(state, maxParallel);
|
|
660
680
|
// Per-row live status (#230): flip to `running` only once the row actually
|
|
661
681
|
// holds a slot, and persist so `spine status` sees it from another process.
|
|
662
|
-
const runningEntry = task.matrixRows.find((m) => m.rowId === row.rowId);
|
|
682
|
+
const runningEntry = task.matrixRows.find((/** @type {any} */ m) => m.rowId === row.rowId);
|
|
663
683
|
if (runningEntry) {
|
|
664
684
|
runningEntry.status = "running";
|
|
665
685
|
saveEngineBatchState(projectRoot, state);
|
|
@@ -697,6 +717,9 @@ export async function runMatrixTaskOnLane({
|
|
|
697
717
|
ok: false,
|
|
698
718
|
exitCode: 1,
|
|
699
719
|
output: `sub-lane crashed: ${message}`,
|
|
720
|
+
worktreePath: undefined,
|
|
721
|
+
branch: undefined,
|
|
722
|
+
commitSha: undefined,
|
|
700
723
|
};
|
|
701
724
|
} finally {
|
|
702
725
|
releaseLaneSlot(state, rowLaneNumber);
|
|
@@ -704,7 +727,7 @@ export async function runMatrixTaskOnLane({
|
|
|
704
727
|
});
|
|
705
728
|
|
|
706
729
|
for (const rowResult of results) {
|
|
707
|
-
const entry = task.matrixRows.find((m) => m.rowId === rowResult.rowId);
|
|
730
|
+
const entry = task.matrixRows.find((/** @type {any} */ m) => m.rowId === rowResult.rowId);
|
|
708
731
|
if (entry) {
|
|
709
732
|
entry.status = rowResult.ok ? "succeeded" : "failed";
|
|
710
733
|
entry.exitCode = rowResult.exitCode ?? null;
|
|
@@ -724,8 +747,8 @@ export async function runMatrixTaskOnLane({
|
|
|
724
747
|
// scope).
|
|
725
748
|
const { ok, failedRowIds } = aggregateMatrixOutcomes(
|
|
726
749
|
task.matrixRows
|
|
727
|
-
.filter((entry) => entry.status !== "canceled")
|
|
728
|
-
.map((entry) => ({ rowId: entry.rowId, ok: entry.status === "succeeded" })),
|
|
750
|
+
.filter((/** @type {any} */ entry) => entry.status !== "canceled")
|
|
751
|
+
.map((/** @type {any} */ entry) => ({ rowId: entry.rowId, ok: entry.status === "succeeded" })),
|
|
729
752
|
);
|
|
730
753
|
|
|
731
754
|
if (!ok) {
|
|
@@ -735,7 +758,7 @@ export async function runMatrixTaskOnLane({
|
|
|
735
758
|
// Failed rows' worktrees are cleaned up; succeeded rows keep theirs as
|
|
736
759
|
// carry-over material for a row-scoped retry (#230).
|
|
737
760
|
removeMatrixSubLaneWorktree(projectRoot, rowResult.worktreePath, rowResult.branch);
|
|
738
|
-
const failedEntry = task.matrixRows.find((m) => m.rowId === rowResult.rowId);
|
|
761
|
+
const failedEntry = task.matrixRows.find((/** @type {any} */ m) => m.rowId === rowResult.rowId);
|
|
739
762
|
if (failedEntry) {
|
|
740
763
|
delete failedEntry.worktreePath;
|
|
741
764
|
delete failedEntry.branch;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Matrix sub-lane execution (SP-671 / #217).
|
|
4
3
|
*
|
|
@@ -35,7 +34,7 @@ import { appendJournalEvent } from "../journal.mjs";
|
|
|
35
34
|
* task is not a matrix task.
|
|
36
35
|
*
|
|
37
36
|
* @param {string} taskFolderPath Absolute path to the task folder (parent for matrix).
|
|
38
|
-
* @returns {{ rows: Array<{ rowId: string, values: Record<string,string> }>, columns: string[], type:
|
|
37
|
+
* @returns {{ rows: Array<{ rowId: string, values: Record<string,string> }>, columns: string[], type: "execute" | "llm" } | null}
|
|
39
38
|
*/
|
|
40
39
|
export function loadMatrixTaskRows(taskFolderPath) {
|
|
41
40
|
if (!taskFolderPath || !fs.existsSync(path.join(taskFolderPath, "PROMPT.md"))) {
|
|
@@ -48,7 +47,9 @@ export function loadMatrixTaskRows(taskFolderPath) {
|
|
|
48
47
|
return null;
|
|
49
48
|
}
|
|
50
49
|
const prompt = packet?.prompt;
|
|
51
|
-
const matrix = Array
|
|
50
|
+
const matrix = /** @type {Array<Record<string, string>> | null} */ (
|
|
51
|
+
Array.isArray(prompt?.matrix) ? prompt.matrix : null
|
|
52
|
+
);
|
|
52
53
|
if (!matrix || matrix.length === 0) return null;
|
|
53
54
|
const columns = Array.isArray(prompt.matrixColumns) ? prompt.matrixColumns : [];
|
|
54
55
|
const rows = matrix.map((values) => ({
|
|
@@ -273,8 +274,8 @@ export function removeMatrixSubLaneWorktree(projectRoot, worktreePath, branch) {
|
|
|
273
274
|
* @returns {Record<string, string> | null}
|
|
274
275
|
*/
|
|
275
276
|
export function buildMatrixRowEnv({ taskId, rowId, rowIndex, rowCount }) {
|
|
276
|
-
if (!Number.isInteger(rowIndex) || rowIndex < 0) return null;
|
|
277
|
-
if (!Number.isInteger(rowCount) || rowCount < 0) return null;
|
|
277
|
+
if (typeof rowIndex !== "number" || !Number.isInteger(rowIndex) || rowIndex < 0) return null;
|
|
278
|
+
if (typeof rowCount !== "number" || !Number.isInteger(rowCount) || rowCount < 0) return null;
|
|
278
279
|
return {
|
|
279
280
|
SPINE_MATRIX_JOB_ID: String(taskId ?? ""),
|
|
280
281
|
SPINE_MATRIX_TASK_ID: String(rowId ?? ""),
|
|
@@ -302,8 +303,9 @@ export function runShellInDir(cwd, command, extraEnv = null) {
|
|
|
302
303
|
stdio: ["ignore", "pipe", "pipe"],
|
|
303
304
|
});
|
|
304
305
|
let output = "";
|
|
306
|
+
/** @type {(chunk: unknown) => void} */
|
|
305
307
|
const append = (chunk) => {
|
|
306
|
-
output += chunk
|
|
308
|
+
output += String(chunk);
|
|
307
309
|
};
|
|
308
310
|
child.stdout?.on("data", append);
|
|
309
311
|
child.stderr?.on("data", append);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Engine lane merge-phase wiring — lane→orch merges and rules-manifest conflict resolution.
|
|
4
3
|
*/
|
|
@@ -69,6 +68,7 @@ function listUnmergedPaths(projectRoot) {
|
|
|
69
68
|
/**
|
|
70
69
|
* @param {string} projectRoot
|
|
71
70
|
* @param {string} ref
|
|
71
|
+
* @returns {{ ok: true, manifest: import("../../config/cursor-rules/discover.mjs").CursorRulesManifest } | { ok: false, error: string }}
|
|
72
72
|
*/
|
|
73
73
|
function readRulesManifestFromRef(projectRoot, ref) {
|
|
74
74
|
const output = git(projectRoot, ["show", `${ref}:${RULES_MANIFEST_REL_PATH}`], {
|
|
@@ -112,6 +112,7 @@ export { resolveRulesManifestIntegrateDrift } from "../rules-manifest-drift.mjs"
|
|
|
112
112
|
/**
|
|
113
113
|
* @param {string} projectRoot
|
|
114
114
|
* @param {2 | 3} stage
|
|
115
|
+
* @returns {{ ok: true, manifest: import("../../config/cursor-rules/discover.mjs").CursorRulesManifest } | { ok: false, error: string }}
|
|
115
116
|
*/
|
|
116
117
|
function readRulesManifestMergeStage(projectRoot, stage) {
|
|
117
118
|
const output = git(projectRoot, ["show", `:${stage}:${RULES_MANIFEST_REL_PATH}`], {
|
|
@@ -161,7 +162,7 @@ function resolveRulesManifestMergeConflict(projectRoot) {
|
|
|
161
162
|
const theirsResult = readRulesManifestMergeStage(projectRoot, 3);
|
|
162
163
|
if (!oursResult.ok || !theirsResult.ok) {
|
|
163
164
|
return {
|
|
164
|
-
ok: false,
|
|
165
|
+
ok: /** @type {const} */ (false),
|
|
165
166
|
error: "unable to read rules-manifest merge stages",
|
|
166
167
|
};
|
|
167
168
|
}
|
|
@@ -177,8 +178,8 @@ function resolveRulesManifestMergeConflict(projectRoot) {
|
|
|
177
178
|
writeRulesManifestAtomic(projectRoot, resolved.manifest);
|
|
178
179
|
gitAddFilteredPaths(projectRoot, [RULES_MANIFEST_REL_PATH], { projectRoot });
|
|
179
180
|
return {
|
|
180
|
-
ok: true,
|
|
181
|
-
autoResolved: true,
|
|
181
|
+
ok: /** @type {const} */ (true),
|
|
182
|
+
autoResolved: /** @type {const} */ (true),
|
|
182
183
|
generatedAt: resolved.manifest.generatedAt,
|
|
183
184
|
};
|
|
184
185
|
}
|
|
@@ -196,7 +197,7 @@ function tryAutoResolveOutOfScopeMergeConflict({
|
|
|
196
197
|
projectRoot,
|
|
197
198
|
filePath,
|
|
198
199
|
laneFileScopePaths,
|
|
199
|
-
_laneChangedFiles,
|
|
200
|
+
laneChangedFiles: _laneChangedFiles,
|
|
200
201
|
}) {
|
|
201
202
|
if (pathInLaneFileScope(filePath, laneFileScopePaths)) {
|
|
202
203
|
return { ok: false, reason: "in_lane_file_scope" };
|
|
@@ -220,7 +221,7 @@ function tryAutoResolveOutOfScopeMergeConflict({
|
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
/**
|
|
223
|
-
* @param {
|
|
224
|
+
* @param {Record<string, any>} state
|
|
224
225
|
* @param {number} laneNumber
|
|
225
226
|
* @param {string[]} waveTaskIds
|
|
226
227
|
*/
|
|
@@ -228,7 +229,7 @@ function collectLaneWaveFileScope(state, laneNumber, waveTaskIds) {
|
|
|
228
229
|
/** @type {Set<string>} */
|
|
229
230
|
const patterns = new Set();
|
|
230
231
|
for (const taskId of waveTaskIds) {
|
|
231
|
-
const task = (state.tasks ?? []).find((entry) => entry?.taskId === taskId);
|
|
232
|
+
const task = (state.tasks ?? []).find((/** @type {any} */ entry) => entry?.taskId === taskId);
|
|
232
233
|
if (!task || task.laneNumber !== laneNumber) continue;
|
|
233
234
|
const folder = task.taskFolder;
|
|
234
235
|
if (!folder) continue;
|
|
@@ -243,12 +244,15 @@ function collectLaneWaveFileScope(state, laneNumber, waveTaskIds) {
|
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
/**
|
|
247
|
+
* Auto-resolve lane→orch merge conflicts for known conflict classes.
|
|
248
|
+
*
|
|
246
249
|
* @param {string} projectRoot
|
|
247
250
|
* @param {object} [options]
|
|
248
251
|
* @param {string[]} [options.laneFileScopePaths]
|
|
249
252
|
* @param {string} [options.taskBranch]
|
|
250
253
|
* @param {string} [options.orchBranch]
|
|
251
254
|
* @param {number} [options.waveIndex]
|
|
255
|
+
* @returns {{ ok: true, autoResolved: true, generatedAt?: string, outOfScopePaths?: string[], adoptionDocPaths?: string[], skippedGitignoredPaths?: string[] } | { ok: false, error: string, failureClass?: string, outOfScopePaths?: string[], adoptionDocPaths?: string[], skippedGitignoredPaths?: string[] }}
|
|
252
256
|
*/
|
|
253
257
|
export function tryAutoResolveMergeConflicts(projectRoot, options = {}) {
|
|
254
258
|
const { laneFileScopePaths = [], taskBranch, orchBranch, waveIndex } = options;
|
|
@@ -274,11 +278,11 @@ export function tryAutoResolveMergeConflicts(projectRoot, options = {}) {
|
|
|
274
278
|
/** @type {Set<string>} */
|
|
275
279
|
let laneChangedFiles = new Set();
|
|
276
280
|
if (canResolveOutOfScope) {
|
|
277
|
-
const mergeBase = git(projectRoot, ["merge-base", orchBranch, taskBranch], {
|
|
281
|
+
const mergeBase = git(projectRoot, ["merge-base", /** @type {string} */ (orchBranch), /** @type {string} */ (taskBranch)], {
|
|
278
282
|
throwOnError: false,
|
|
279
283
|
});
|
|
280
284
|
if (mergeBase) {
|
|
281
|
-
laneChangedFiles = listBranchChangedFiles(projectRoot, mergeBase, taskBranch);
|
|
285
|
+
laneChangedFiles = listBranchChangedFiles(projectRoot, mergeBase, /** @type {string} */ (taskBranch));
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
|
|
@@ -411,7 +415,10 @@ export function tryAutoResolveMergeConflicts(projectRoot, options = {}) {
|
|
|
411
415
|
};
|
|
412
416
|
}
|
|
413
417
|
|
|
414
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* @deprecated use tryAutoResolveMergeConflicts
|
|
420
|
+
* @param {string} projectRoot
|
|
421
|
+
*/
|
|
415
422
|
export function tryAutoResolveRulesManifestMergeConflict(projectRoot) {
|
|
416
423
|
return tryAutoResolveMergeConflicts(projectRoot, {});
|
|
417
424
|
}
|
|
@@ -424,15 +431,12 @@ function gitStrict(projectRoot, args) {
|
|
|
424
431
|
return git(projectRoot, args);
|
|
425
432
|
}
|
|
426
433
|
|
|
427
|
-
/**
|
|
428
|
-
* @param {object} params
|
|
429
|
-
* @param {boolean} [params.requireLaneCommits] When true, task branch must be ahead of orch before merge (post lane auto-commit).
|
|
430
|
-
*/
|
|
431
434
|
/**
|
|
432
435
|
* Clear generatedAt-only rules-manifest drift on the working tree before lane→orch merge.
|
|
433
436
|
* Workers refresh the manifest during pi sessions; an uncommitted copy blocks `git merge`.
|
|
434
437
|
*
|
|
435
438
|
* @param {string} projectRoot
|
|
439
|
+
* @returns {{ ok: true, resolved: boolean, action?: string } | { ok: false, failureClass: string, error: string }}
|
|
436
440
|
*/
|
|
437
441
|
function resolveRulesManifestPreMergeDrift(projectRoot) {
|
|
438
442
|
const dirtyPaths = listDirtyPaths(projectRoot);
|
|
@@ -443,7 +447,7 @@ function resolveRulesManifestPreMergeDrift(projectRoot) {
|
|
|
443
447
|
return { ok: true, resolved: false };
|
|
444
448
|
}
|
|
445
449
|
|
|
446
|
-
const headRef = gitStrict(projectRoot, ["rev-parse", "HEAD"]);
|
|
450
|
+
const headRef = /** @type {string} */ (gitStrict(projectRoot, ["rev-parse", "HEAD"]));
|
|
447
451
|
const headResult = readRulesManifestFromRef(projectRoot, headRef);
|
|
448
452
|
const working = loadRulesManifest(projectRoot);
|
|
449
453
|
if (!working) {
|
|
@@ -478,6 +482,22 @@ function resolveRulesManifestPreMergeDrift(projectRoot) {
|
|
|
478
482
|
return { ok: true, resolved: true, action: "restored_head_for_lane_merge" };
|
|
479
483
|
}
|
|
480
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Merge a lane task branch into the orch branch, auto-resolving known conflict
|
|
487
|
+
* classes (rules-manifest, adoption/PRD docs, out-of-scope dependency drift).
|
|
488
|
+
*
|
|
489
|
+
* @param {object} params
|
|
490
|
+
* @param {string} params.projectRoot
|
|
491
|
+
* @param {string} params.baseBranch
|
|
492
|
+
* @param {string} params.orchBranch
|
|
493
|
+
* @param {string} params.taskBranch
|
|
494
|
+
* @param {string} params.batchId
|
|
495
|
+
* @param {boolean} [params.requireLaneCommits] When true, task branch must be ahead of orch before merge (post lane auto-commit).
|
|
496
|
+
* @param {string[]} [params.laneFileScopePaths]
|
|
497
|
+
* @param {string[]} [params.laneTaskFolders]
|
|
498
|
+
* @param {number} [params.waveIndex]
|
|
499
|
+
* @returns {{ ok: true, mergeCommit: string, commitsAhead: number } | { ok: false, failureClass?: string, error: string, outOfScopePaths?: string[], skippedGitignoredPaths?: string[] }}
|
|
500
|
+
*/
|
|
481
501
|
export function mergeLaneToOrch({
|
|
482
502
|
projectRoot,
|
|
483
503
|
baseBranch,
|
|
@@ -501,7 +521,7 @@ export function mergeLaneToOrch({
|
|
|
501
521
|
};
|
|
502
522
|
}
|
|
503
523
|
|
|
504
|
-
const orchHeadBefore = gitStrict(projectRoot, ["rev-parse", orchBranch]);
|
|
524
|
+
const orchHeadBefore = /** @type {string} */ (gitStrict(projectRoot, ["rev-parse", orchBranch]));
|
|
505
525
|
const commitsAhead = countCommitsAhead(projectRoot, orchBranch, taskBranch);
|
|
506
526
|
|
|
507
527
|
if (Array.isArray(laneTaskFolders) && laneTaskFolders.length > 0) {
|
|
@@ -567,7 +587,7 @@ export function mergeLaneToOrch({
|
|
|
567
587
|
gitStrict(projectRoot, ["commit", "--no-edit"]);
|
|
568
588
|
}
|
|
569
589
|
|
|
570
|
-
const mergeCommit = gitStrict(projectRoot, ["rev-parse", "HEAD"]);
|
|
590
|
+
const mergeCommit = /** @type {string} */ (gitStrict(projectRoot, ["rev-parse", "HEAD"]));
|
|
571
591
|
|
|
572
592
|
if (requireLaneCommits && mergeCommit === orchHeadBefore) {
|
|
573
593
|
return {
|
|
@@ -605,9 +625,21 @@ export function mergeLaneToOrch({
|
|
|
605
625
|
}
|
|
606
626
|
|
|
607
627
|
/**
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
628
|
+
* Merge every succeeded lane of a wave into the orch branch, then run the
|
|
629
|
+
* optional `finalizeAfterWaveMerge(hookParams)` hook injected by callers that
|
|
630
|
+
* own the limbo graph (`maybeFinalizeAfterWaveMerge` from post-merge-limbo.mjs,
|
|
631
|
+
* SP-734). Omitted → skip post-wave-merge finalize.
|
|
632
|
+
*
|
|
633
|
+
* @param {object} params
|
|
634
|
+
* @param {string} params.projectRoot
|
|
635
|
+
* @param {Record<string, any>} params.state
|
|
636
|
+
* @param {string} params.batchId
|
|
637
|
+
* @param {string} params.baseBranch
|
|
638
|
+
* @param {string} params.orchBranch
|
|
639
|
+
* @param {number} params.waveIndex
|
|
640
|
+
* @param {boolean} [params.resumed]
|
|
641
|
+
* @param {((params: object) => unknown) | null} [params.finalizeAfterWaveMerge]
|
|
642
|
+
* @returns {{ ok: true, mergeCommit: string | null, finalized: boolean, finalizeResult: unknown } | { ok: false, error: string, laneNumber?: number, failureClass?: string | null, blockedBy?: string, exitReason?: string }}
|
|
611
643
|
*/
|
|
612
644
|
export function mergeWaveLanesToOrch({
|
|
613
645
|
projectRoot,
|
|
@@ -621,7 +653,7 @@ export function mergeWaveLanesToOrch({
|
|
|
621
653
|
}) {
|
|
622
654
|
const waveTaskIds = state.wavePlan?.[waveIndex] ?? [];
|
|
623
655
|
const needsReplanTask = (state.tasks ?? []).find(
|
|
624
|
-
(entry) =>
|
|
656
|
+
(/** @type {any} */ entry) =>
|
|
625
657
|
waveTaskIds.includes(entry?.taskId) && entry?.exitReason === "needs_replan",
|
|
626
658
|
);
|
|
627
659
|
if (needsReplanTask) {
|
|
@@ -639,8 +671,8 @@ export function mergeWaveLanesToOrch({
|
|
|
639
671
|
for (const lane of lanes) {
|
|
640
672
|
const laneNumber = lane.laneNumber;
|
|
641
673
|
const waveTaskIds = state.wavePlan?.[waveIndex] ?? [];
|
|
642
|
-
const laneSucceeded = waveTaskIds.some((taskId) => {
|
|
643
|
-
const task = (state.tasks ?? []).find((entry) => entry?.taskId === taskId);
|
|
674
|
+
const laneSucceeded = waveTaskIds.some((/** @type {any} */ taskId) => {
|
|
675
|
+
const task = (state.tasks ?? []).find((/** @type {any} */ entry) => entry?.taskId === taskId);
|
|
644
676
|
return task && task.laneNumber === laneNumber && task.status === "succeeded";
|
|
645
677
|
});
|
|
646
678
|
if (!laneSucceeded) continue;
|
|
@@ -648,8 +680,8 @@ export function mergeWaveLanesToOrch({
|
|
|
648
680
|
const taskBranch = lane.branch ?? laneTaskBranch(batchId, laneNumber);
|
|
649
681
|
const laneFileScopePaths = collectLaneWaveFileScope(state, laneNumber, waveTaskIds);
|
|
650
682
|
const laneTaskFolders = waveTaskIds
|
|
651
|
-
.map((taskId) => {
|
|
652
|
-
const task = (state.tasks ?? []).find((entry) => entry?.taskId === taskId);
|
|
683
|
+
.map((/** @type {any} */ taskId) => {
|
|
684
|
+
const task = (state.tasks ?? []).find((/** @type {any} */ entry) => entry?.taskId === taskId);
|
|
653
685
|
if (!task || task.laneNumber !== laneNumber || !task.taskFolder) return null;
|
|
654
686
|
return task.taskFolder;
|
|
655
687
|
})
|