pi-spine 2.34.0 → 2.36.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-dashboard.mjs +87 -4
- package/bin/spine-integrate.mjs +5 -5
- package/bin/spine-plan.mjs +14 -1
- package/package.json +1 -1
- package/skills/create-spine-tasks/SKILL.md +7 -7
- package/skills/spine-orchestrate-waves/SKILL.md +1 -1
- package/skills/spine-release-operator/SKILL.md +2 -2
- package/src/batch/engine-lanes/queue.mjs +5 -0
- package/src/batch/engine-lanes/vl-slot-dispatch.mjs +227 -0
- package/src/batch/engine-lanes/vl-wave-dispatch.mjs +325 -0
- package/src/batch/engine-scope.mjs +116 -0
- package/src/batch/engine.mjs +28 -95
- package/src/batch/integrate.mjs +3 -3
- package/src/batch/resume-multi-queue.mjs +276 -75
- package/src/cli/board-select.mjs +26 -10
- package/src/config/defaults.mjs +8 -5
- package/src/config/spine-config-schema.mjs +28 -12
- package/src/dashboard/snapshot-lanes.mjs +97 -2
- package/src/integrations/issues/providers/github.mjs +47 -0
- package/src/integrations/{github → issues}/sync-on-land.mjs +32 -59
- /package/src/integrations/{github → issues}/mission-issue-links.mjs +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { readJournalTail, summarizeJournalEvent } from "../batch/journal.mjs";
|
|
8
|
+
import { VL_SLOT_CONFLICT_WAIT_EVENT } from "../batch/engine-lanes/vl-slot-dispatch.mjs";
|
|
8
9
|
import {
|
|
9
10
|
deriveLanesThroughput,
|
|
10
11
|
emptyLaneThroughputStats,
|
|
@@ -39,8 +40,25 @@ const ACTIVITY_PHASE_LABELS = {
|
|
|
39
40
|
final_review: "final review",
|
|
40
41
|
rework: "rework",
|
|
41
42
|
failed: "failed",
|
|
43
|
+
conflict_wait: "conflict wait",
|
|
42
44
|
};
|
|
43
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Lane-scoped journal events that prove the physical slot holds (or just
|
|
48
|
+
* took) work: a VL bind, a live worker/task, or an open review running on
|
|
49
|
+
* the lane. Used to decide whether a `lane.slot_conflict_wait` for the slot
|
|
50
|
+
* is still the newest truth (free + blocked) or has been superseded by a
|
|
51
|
+
* fresh dispatch (SP-901 / #327).
|
|
52
|
+
*
|
|
53
|
+
* @type {Set<string>}
|
|
54
|
+
*/
|
|
55
|
+
const LANE_SLOT_OCCUPANCY_EVENTS = new Set([
|
|
56
|
+
"lane.tasks_serialized",
|
|
57
|
+
"task.started",
|
|
58
|
+
"lane.heartbeat",
|
|
59
|
+
"review.started",
|
|
60
|
+
]);
|
|
61
|
+
|
|
44
62
|
export function truncateWorktreePath(worktreePath) {
|
|
45
63
|
if (!worktreePath) return null;
|
|
46
64
|
const parts = String(worktreePath).split(/[/\\]/).filter(Boolean);
|
|
@@ -58,7 +76,7 @@ export function heartbeatAgeSeconds(lastHeartbeatAt, now = Date.now()) {
|
|
|
58
76
|
return Math.max(0, Math.floor((now - ts) / 1000));
|
|
59
77
|
}
|
|
60
78
|
|
|
61
|
-
export function classifyLaneStatus({ lane, classifiedTasks, stallConfig, now = Date.now(), diagnosis = null }) {
|
|
79
|
+
export function classifyLaneStatus({ lane, classifiedTasks, stallConfig, now = Date.now(), diagnosis = null, conflictWaitActive = false }) {
|
|
62
80
|
const taskIds = lane.taskIds ?? [];
|
|
63
81
|
const tasks = classifiedTasks.filter((task) => taskIds.includes(task.taskId));
|
|
64
82
|
|
|
@@ -87,6 +105,12 @@ export function classifyLaneStatus({ lane, classifiedTasks, stallConfig, now = D
|
|
|
87
105
|
);
|
|
88
106
|
if (!hasActive) return "completed";
|
|
89
107
|
|
|
108
|
+
// SP-901 (#327/#358): a free slot whose ready work is blocked only by a
|
|
109
|
+
// file-scope conflict is not live "running" and not "stale" (nothing is
|
|
110
|
+
// hung — progress resumes when the conflicting VL settles). Diagnosed
|
|
111
|
+
// lanes keep their batch-level status above.
|
|
112
|
+
if (conflictWaitActive) return "conflict_wait";
|
|
113
|
+
|
|
90
114
|
let referenceMs = null;
|
|
91
115
|
if (lane.lastHeartbeatAt != null) {
|
|
92
116
|
referenceMs =
|
|
@@ -204,11 +228,64 @@ function taskHasReworkMarker(laneNumber, taskId, journalEvents) {
|
|
|
204
228
|
return false;
|
|
205
229
|
}
|
|
206
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Latest conflict-wait state for a physical slot (SP-901 / #327, #358 display AC).
|
|
233
|
+
*
|
|
234
|
+
* Slot-pool dispatch journals `lane.slot_conflict_wait` (payload `slot` = the
|
|
235
|
+
* free physical slot) each time a slot is free but every remaining ready VL
|
|
236
|
+
* is blocked by a file-scope conflict or a same-VL serial queue. A slot is
|
|
237
|
+
* conflict-waiting only while that event is the newest slot-relevant journal
|
|
238
|
+
* signal: any newer lane-scoped occupancy event (bind, task start, worker
|
|
239
|
+
* heartbeat, open review) means the slot took work and the wait is over.
|
|
240
|
+
*
|
|
241
|
+
* @param {number} laneNumber Physical slot / lane row number.
|
|
242
|
+
* @param {Array<object>} journalEvents Journal events in append order.
|
|
243
|
+
* @returns {{ active: boolean, payload: object | null }} `active` is true
|
|
244
|
+
* only when a conflict-wait for this slot is newer than any occupancy
|
|
245
|
+
* signal for the lane; `payload` is the raw conflict-wait event payload.
|
|
246
|
+
*/
|
|
247
|
+
export function resolveLaneConflictWait(laneNumber, journalEvents) {
|
|
248
|
+
const events = journalEvents ?? [];
|
|
249
|
+
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
250
|
+
const event = events[i];
|
|
251
|
+
if (event.type === VL_SLOT_CONFLICT_WAIT_EVENT) {
|
|
252
|
+
const payload = event.payload && typeof event.payload === "object" ? event.payload : {};
|
|
253
|
+
if (Number(payload.slot) === laneNumber) {
|
|
254
|
+
return { active: true, payload };
|
|
255
|
+
}
|
|
256
|
+
continue; // conflict-wait for a different slot — irrelevant here
|
|
257
|
+
}
|
|
258
|
+
if (LANE_SLOT_OCCUPANCY_EVENTS.has(event.type) && laneEventMatches(laneNumber, event)) {
|
|
259
|
+
return { active: false, payload: null }; // slot took work after the wait
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return { active: false, payload: null };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* @param {object} params
|
|
267
|
+
* @param {object} [params.conflictWait] Result of `resolveLaneConflictWait`.
|
|
268
|
+
* @returns {{ slot: number | null, reason: string, blockedByOverlap: object[], queuedBehindRunning: Array<string | number | null>, runningVlIds: Array<string | number | null>, readyCount: number } | null}
|
|
269
|
+
*/
|
|
270
|
+
function formatConflictWaitDetail(conflictWait) {
|
|
271
|
+
if (!conflictWait?.active || !conflictWait.payload) return null;
|
|
272
|
+
const payload = conflictWait.payload;
|
|
273
|
+
return {
|
|
274
|
+
slot: payload.slot != null ? Number(payload.slot) : null,
|
|
275
|
+
reason: typeof payload.reason === "string" ? payload.reason : "scope_conflict",
|
|
276
|
+
blockedByOverlap: Array.isArray(payload.blockedByOverlap) ? payload.blockedByOverlap : [],
|
|
277
|
+
queuedBehindRunning: Array.isArray(payload.queuedBehindRunning) ? payload.queuedBehindRunning : [],
|
|
278
|
+
runningVlIds: Array.isArray(payload.runningVlIds) ? payload.runningVlIds : [],
|
|
279
|
+
readyCount: Number(payload.readyCount) || 0,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
207
283
|
export function resolveLaneActivityPhase({
|
|
208
284
|
laneNumber,
|
|
209
285
|
activeTaskIds = [],
|
|
210
286
|
classifiedTasks = [],
|
|
211
287
|
journalEvents = [],
|
|
288
|
+
conflictWait = null,
|
|
212
289
|
}) {
|
|
213
290
|
const activeIds = new Set((activeTaskIds ?? []).map(String));
|
|
214
291
|
if (activeIds.size === 0) {
|
|
@@ -248,6 +325,13 @@ export function resolveLaneActivityPhase({
|
|
|
248
325
|
}
|
|
249
326
|
}
|
|
250
327
|
|
|
328
|
+
// SP-901 (#327): a slot whose newest signal is a conflict-wait has no live
|
|
329
|
+
// worker — do not fall through to heartbeat/worker phases that read as
|
|
330
|
+
// "running" at a round barrier.
|
|
331
|
+
if (conflictWait?.active) {
|
|
332
|
+
return { activityPhase: "conflict_wait", activityPhaseLabel: ACTIVITY_PHASE_LABELS.conflict_wait };
|
|
333
|
+
}
|
|
334
|
+
|
|
251
335
|
const heartbeatMeta = resolveLaneHeartbeatMeta(laneNumber, events);
|
|
252
336
|
if (heartbeatMeta.workerPhase === "launching") {
|
|
253
337
|
return { activityPhase: "launching", activityPhaseLabel: ACTIVITY_PHASE_LABELS.launching };
|
|
@@ -432,11 +516,13 @@ export function buildLaneRows({
|
|
|
432
516
|
laneTaskIds: lane.taskIds ?? [],
|
|
433
517
|
});
|
|
434
518
|
const activeTaskIds = computeActiveTaskIdsForLane({ lane, classifiedTasks, currentWaveTaskIds });
|
|
519
|
+
const conflictWait = resolveLaneConflictWait(lane.laneNumber, journalEvents);
|
|
435
520
|
const activity = resolveLaneActivityPhase({
|
|
436
521
|
laneNumber: lane.laneNumber,
|
|
437
522
|
activeTaskIds,
|
|
438
523
|
classifiedTasks,
|
|
439
524
|
journalEvents,
|
|
525
|
+
conflictWait,
|
|
440
526
|
});
|
|
441
527
|
const throughput =
|
|
442
528
|
throughputByLane.get(lane.laneNumber) ?? emptyLaneThroughputStats();
|
|
@@ -454,12 +540,21 @@ export function buildLaneRows({
|
|
|
454
540
|
return {
|
|
455
541
|
laneId: lane.laneId ?? `lane-${lane.laneNumber}`,
|
|
456
542
|
laneNumber: lane.laneNumber,
|
|
457
|
-
status: classifyLaneStatus({
|
|
543
|
+
status: classifyLaneStatus({
|
|
544
|
+
lane,
|
|
545
|
+
classifiedTasks,
|
|
546
|
+
stallConfig,
|
|
547
|
+
now,
|
|
548
|
+
diagnosis,
|
|
549
|
+
conflictWaitActive: conflictWait.active,
|
|
550
|
+
}),
|
|
458
551
|
activeTaskIds,
|
|
459
552
|
runningTaskId,
|
|
460
553
|
queuedTaskIds,
|
|
461
554
|
activityPhase: activity.activityPhase,
|
|
462
555
|
activityPhaseLabel: activity.activityPhaseLabel,
|
|
556
|
+
conflictWait: conflictWait.active,
|
|
557
|
+
conflictWaitDetail: formatConflictWaitDetail(conflictWait),
|
|
463
558
|
taskIds: lane.taskIds ?? [],
|
|
464
559
|
heartbeatAgeSeconds: heartbeatAgeSecondsValue,
|
|
465
560
|
heartbeatKind: heartbeatMeta.heartbeatKind,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default GitHub provider for opt-in issue sync on land (#387, SP-892).
|
|
3
|
+
*
|
|
4
|
+
* Holds the `gh` CLI runner extracted from
|
|
5
|
+
* `src/integrations/github/sync-on-land.mjs`: array-args spawn (no shell),
|
|
6
|
+
* piped output, hard timeout, and the `{ status, stdout, stderr, error }`
|
|
7
|
+
* result shape. Sync callers keep the soft-fail contract — a missing,
|
|
8
|
+
* hung, or failing `gh` never throws from here; the caller inspects the
|
|
9
|
+
* result. Future non-github providers live alongside this module.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { spawnSync } from "node:child_process";
|
|
13
|
+
|
|
14
|
+
/** Hard timeout per `gh` call so a hung CLI cannot stall the integrate path. */
|
|
15
|
+
export const GH_CALL_TIMEOUT_MS = 30_000;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} GhRunResult
|
|
19
|
+
* @property {number | null} status
|
|
20
|
+
* @property {string} [stdout]
|
|
21
|
+
* @property {string} [stderr]
|
|
22
|
+
* @property {Error | null} [error]
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Default `gh` runner: array-args spawn (no shell), piped output, hard timeout.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} projectRoot
|
|
29
|
+
* @param {string[]} args
|
|
30
|
+
* @param {object} [deps]
|
|
31
|
+
* @param {typeof import("node:child_process").spawnSync} [deps.spawn] Injectable spawn (tests stub this).
|
|
32
|
+
* @returns {GhRunResult}
|
|
33
|
+
*/
|
|
34
|
+
export function defaultRunGh(projectRoot, args, { spawn = spawnSync } = {}) {
|
|
35
|
+
const result = spawn("gh", args, {
|
|
36
|
+
cwd: projectRoot,
|
|
37
|
+
encoding: "utf-8",
|
|
38
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
39
|
+
timeout: GH_CALL_TIMEOUT_MS,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
status: result.status ?? null,
|
|
43
|
+
stdout: typeof result.stdout === "string" ? result.stdout : "",
|
|
44
|
+
stderr: typeof result.stderr === "string" ? result.stderr : "",
|
|
45
|
+
error: result.error ?? null,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* After a successful integrate (`.DONE` tasks on the batch base), comment on
|
|
5
5
|
* and close issues referenced by task Mission `Closes #N` / `Partial #N`
|
|
6
|
-
* links (format per #147). Strictly opt-in via `integrations.
|
|
6
|
+
* links (format per #147). Strictly opt-in via `integrations.issues.syncOnLand`
|
|
7
7
|
* (default off); every failure path is soft — integrate results never change
|
|
8
8
|
* because `gh` is missing, unauthenticated, or a single issue call fails.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import path from "node:path";
|
|
13
|
-
import { spawnSync } from "node:child_process";
|
|
14
13
|
|
|
15
14
|
import { parseMissionIssueLinks } from "./mission-issue-links.mjs";
|
|
15
|
+
import { defaultRunGh } from "./providers/github.mjs";
|
|
16
16
|
import { commandExists } from "../../util/command-exists.mjs";
|
|
17
17
|
import { appendJournalEvent } from "../../batch/journal.mjs";
|
|
18
18
|
import { resolveTasksRootPath } from "../../config/env-overrides.mjs";
|
|
@@ -20,32 +20,27 @@ import { resolveTasksRootPath } from "../../config/env-overrides.mjs";
|
|
|
20
20
|
/** Terminal-success statuses whose `.DONE` landed work on the batch base. */
|
|
21
21
|
const DONE_ON_BASE_STATUSES = new Set(["completed", "succeeded"]);
|
|
22
22
|
|
|
23
|
-
/** Hard timeout per `gh` call so a hung CLI cannot stall the integrate path. */
|
|
24
|
-
const GH_CALL_TIMEOUT_MS = 30_000;
|
|
25
|
-
|
|
26
23
|
/** Directory (relative to projectRoot) for temp comment body files. */
|
|
27
|
-
const BODY_DIR = path.join(".spine", "
|
|
24
|
+
const BODY_DIR = path.join(".spine", "issues-sync");
|
|
28
25
|
|
|
29
26
|
/**
|
|
30
27
|
* @typedef {import("./mission-issue-links.mjs").MissionIssueLinks} MissionIssueLinks
|
|
31
28
|
*/
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
|
-
* @typedef {
|
|
35
|
-
* @property {number | null} status
|
|
36
|
-
* @property {string} [stdout]
|
|
37
|
-
* @property {string} [stderr]
|
|
38
|
-
* @property {Error | null} [error]
|
|
31
|
+
* @typedef {import("./providers/github.mjs").GhRunResult} GhRunResult
|
|
39
32
|
*/
|
|
40
33
|
|
|
41
34
|
/**
|
|
42
|
-
* Resolve the opt-in flag
|
|
35
|
+
* Resolve the opt-in flag (forge-neutral `integrations.issues` since SP-890/#387;
|
|
36
|
+
* legacy `integrations.github` is rejected at config validation). Missing/invalid
|
|
37
|
+
* config disables sync (default off).
|
|
43
38
|
*
|
|
44
39
|
* @param {Record<string, any> | null | undefined} config Effective spine config.
|
|
45
|
-
* @returns {boolean} True only when `integrations.
|
|
40
|
+
* @returns {boolean} True only when `integrations.issues.syncOnLand === true`.
|
|
46
41
|
*/
|
|
47
|
-
export function
|
|
48
|
-
return config?.integrations?.
|
|
42
|
+
export function resolveIssueSyncOnLandConfig(config) {
|
|
43
|
+
return config?.integrations?.issues?.syncOnLand === true;
|
|
49
44
|
}
|
|
50
45
|
|
|
51
46
|
/**
|
|
@@ -72,28 +67,6 @@ export function collectDoneOnBaseTasks(batch) {
|
|
|
72
67
|
return done;
|
|
73
68
|
}
|
|
74
69
|
|
|
75
|
-
/**
|
|
76
|
-
* Default `gh` runner: array-args spawn (no shell), piped output, hard timeout.
|
|
77
|
-
*
|
|
78
|
-
* @param {string} projectRoot
|
|
79
|
-
* @param {string[]} args
|
|
80
|
-
* @returns {GhRunResult}
|
|
81
|
-
*/
|
|
82
|
-
function defaultRunGh(projectRoot, args) {
|
|
83
|
-
const result = spawnSync("gh", args, {
|
|
84
|
-
cwd: projectRoot,
|
|
85
|
-
encoding: "utf-8",
|
|
86
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
87
|
-
timeout: GH_CALL_TIMEOUT_MS,
|
|
88
|
-
});
|
|
89
|
-
return {
|
|
90
|
-
status: result.status ?? null,
|
|
91
|
-
stdout: typeof result.stdout === "string" ? result.stdout : "",
|
|
92
|
-
stderr: typeof result.stderr === "string" ? result.stderr : "",
|
|
93
|
-
error: result.error ?? null,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
70
|
/**
|
|
98
71
|
* @param {string} filePath
|
|
99
72
|
* @returns {string}
|
|
@@ -160,7 +133,7 @@ export function buildLandCommentBody({ taskId, batchId, mergeCommit, action }) {
|
|
|
160
133
|
`Landed on \`main\` by **${taskId}** (batch \`${batchId}\`).`,
|
|
161
134
|
"",
|
|
162
135
|
commitLine +
|
|
163
|
-
"- Closed automatically by spine (`integrations.
|
|
136
|
+
"- Closed automatically by spine (`integrations.issues.syncOnLand`).",
|
|
164
137
|
"",
|
|
165
138
|
].join("\n");
|
|
166
139
|
}
|
|
@@ -168,7 +141,7 @@ export function buildLandCommentBody({ taskId, batchId, mergeCommit, action }) {
|
|
|
168
141
|
`Partially addressed on \`main\` by **${taskId}** (batch \`${batchId}\`) — issue left open.`,
|
|
169
142
|
"",
|
|
170
143
|
commitLine +
|
|
171
|
-
"- Commented automatically by spine (`integrations.
|
|
144
|
+
"- Commented automatically by spine (`integrations.issues.syncOnLand`).",
|
|
172
145
|
"",
|
|
173
146
|
].join("\n");
|
|
174
147
|
}
|
|
@@ -204,7 +177,7 @@ function writeCommentBodyFile({ projectRoot, batchId, issue, body }) {
|
|
|
204
177
|
* Integrate entry point (#383): resolve the `.DONE`-on-base task set and
|
|
205
178
|
* tasksRoot from batch state + effective config, then run the sync. Best-effort
|
|
206
179
|
* only — never throws into the integrate success path; internal errors journal
|
|
207
|
-
* as `
|
|
180
|
+
* as `issues.sync_failed` instead of failing the integrate.
|
|
208
181
|
*
|
|
209
182
|
* @param {object} params
|
|
210
183
|
* @param {string} params.projectRoot
|
|
@@ -212,7 +185,7 @@ function writeCommentBodyFile({ projectRoot, batchId, issue, body }) {
|
|
|
212
185
|
* @param {object} params.batch Parsed batch state.
|
|
213
186
|
* @param {Record<string, any> | null | undefined} params.config Effective spine config (null → sync disabled).
|
|
214
187
|
* @param {string | null} [params.mergeCommit] Integrate merge commit.
|
|
215
|
-
* @param {boolean} [params.
|
|
188
|
+
* @param {boolean} [params.noIssueSync] `--no-issue-sync` escape hatch.
|
|
216
189
|
* @param {(projectRoot: string, args: string[]) => GhRunResult} [params.runGh] Injectable gh runner.
|
|
217
190
|
* @param {(cmd: string) => boolean} [params.ghPresent] Injectable gh probe.
|
|
218
191
|
* @param {JournalAppendFn} [params.journalAppend] Injectable journal appender.
|
|
@@ -225,7 +198,7 @@ export function syncIssuesAfterIntegrate({
|
|
|
225
198
|
batch,
|
|
226
199
|
config,
|
|
227
200
|
mergeCommit = null,
|
|
228
|
-
|
|
201
|
+
noIssueSync = false,
|
|
229
202
|
runGh,
|
|
230
203
|
ghPresent,
|
|
231
204
|
journalAppend,
|
|
@@ -239,7 +212,7 @@ export function syncIssuesAfterIntegrate({
|
|
|
239
212
|
tasksRoot: config ? resolveTasksRootPath(projectRoot, config) : null,
|
|
240
213
|
config,
|
|
241
214
|
mergeCommit,
|
|
242
|
-
|
|
215
|
+
noIssueSync,
|
|
243
216
|
runGh,
|
|
244
217
|
ghPresent,
|
|
245
218
|
journalAppend,
|
|
@@ -249,7 +222,7 @@ export function syncIssuesAfterIntegrate({
|
|
|
249
222
|
const message = err instanceof Error ? err.message : String(err);
|
|
250
223
|
try {
|
|
251
224
|
const journal = journalAppend ?? appendJournalEvent;
|
|
252
|
-
journal(projectRoot, batchId, "
|
|
225
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
253
226
|
reason: "internal_error",
|
|
254
227
|
error: message.slice(0, 500),
|
|
255
228
|
hint: "spine status --diagnose",
|
|
@@ -274,7 +247,7 @@ export function syncIssuesAfterIntegrate({
|
|
|
274
247
|
* @param {Record<string, any> | null | undefined} params.config Effective config.
|
|
275
248
|
* @param {string | null} [params.mergeCommit] Integrate merge commit.
|
|
276
249
|
* @param {boolean} [params.dryRun] Plan only — no gh calls, no journal.
|
|
277
|
-
* @param {boolean} [params.
|
|
250
|
+
* @param {boolean} [params.noIssueSync] `--no-issue-sync` escape hatch.
|
|
278
251
|
* @param {(projectRoot: string, args: string[]) => GhRunResult} [params.runGh] Injectable gh runner.
|
|
279
252
|
* @param {(cmd: string) => boolean} [params.ghPresent] Injectable gh probe.
|
|
280
253
|
* @param {JournalAppendFn} [params.journalAppend] Injectable journal appender.
|
|
@@ -299,7 +272,7 @@ export function syncIssuesOnLand({
|
|
|
299
272
|
config,
|
|
300
273
|
mergeCommit = null,
|
|
301
274
|
dryRun = false,
|
|
302
|
-
|
|
275
|
+
noIssueSync = false,
|
|
303
276
|
runGh,
|
|
304
277
|
ghPresent,
|
|
305
278
|
journalAppend,
|
|
@@ -328,10 +301,10 @@ export function syncIssuesOnLand({
|
|
|
328
301
|
planned,
|
|
329
302
|
});
|
|
330
303
|
|
|
331
|
-
if (
|
|
332
|
-
return skip("
|
|
304
|
+
if (noIssueSync) {
|
|
305
|
+
return skip("no_issue_sync_flag");
|
|
333
306
|
}
|
|
334
|
-
if (!
|
|
307
|
+
if (!resolveIssueSyncOnLandConfig(config)) {
|
|
335
308
|
return skip("sync_disabled");
|
|
336
309
|
}
|
|
337
310
|
if (!tasksRoot) {
|
|
@@ -350,7 +323,7 @@ export function syncIssuesOnLand({
|
|
|
350
323
|
});
|
|
351
324
|
} catch (err) {
|
|
352
325
|
const message = err instanceof Error ? err.message : String(err);
|
|
353
|
-
journal(projectRoot, batchId, "
|
|
326
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
354
327
|
reason: "parse_error",
|
|
355
328
|
error: message.slice(0, 500),
|
|
356
329
|
hint: "spine status --diagnose",
|
|
@@ -359,7 +332,7 @@ export function syncIssuesOnLand({
|
|
|
359
332
|
}
|
|
360
333
|
planned.push(...collection.links);
|
|
361
334
|
for (const readError of collection.readErrors) {
|
|
362
|
-
journal(projectRoot, batchId, "
|
|
335
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
363
336
|
reason: "prompt_unreadable",
|
|
364
337
|
error: readError.slice(0, 500),
|
|
365
338
|
hint: "spine status --diagnose",
|
|
@@ -384,17 +357,17 @@ export function syncIssuesOnLand({
|
|
|
384
357
|
}
|
|
385
358
|
|
|
386
359
|
if (!present("gh")) {
|
|
387
|
-
journal(projectRoot, batchId, "
|
|
360
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
388
361
|
reason: "gh_missing",
|
|
389
|
-
hint: "Install GitHub CLI (https://cli.github.com/) or disable integrations.
|
|
362
|
+
hint: "Install GitHub CLI (https://cli.github.com/) or disable integrations.issues.syncOnLand",
|
|
390
363
|
});
|
|
391
|
-
return skip("gh_missing", "Install GitHub CLI (https://cli.github.com/) or disable integrations.
|
|
364
|
+
return skip("gh_missing", "Install GitHub CLI (https://cli.github.com/) or disable integrations.issues.syncOnLand");
|
|
392
365
|
}
|
|
393
366
|
|
|
394
367
|
const auth = run(projectRoot, ["auth", "status"]);
|
|
395
368
|
if ((auth.status ?? 1) !== 0) {
|
|
396
369
|
const stderr = (auth.stderr ?? "").trim().slice(0, 500);
|
|
397
|
-
journal(projectRoot, batchId, "
|
|
370
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
398
371
|
reason: "gh_auth",
|
|
399
372
|
error: stderr,
|
|
400
373
|
hint: "Run `gh auth login`, then re-run `spine integrate` (or close manually per the release-operator runbook §4.3c)",
|
|
@@ -411,7 +384,7 @@ export function syncIssuesOnLand({
|
|
|
411
384
|
} catch (err) {
|
|
412
385
|
const message = err instanceof Error ? err.message : String(err);
|
|
413
386
|
failures.push({ taskId, issue, action, error: message });
|
|
414
|
-
journal(projectRoot, batchId, "
|
|
387
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
415
388
|
issue,
|
|
416
389
|
action,
|
|
417
390
|
taskId,
|
|
@@ -425,7 +398,7 @@ export function syncIssuesOnLand({
|
|
|
425
398
|
if ((comment.status ?? 1) !== 0) {
|
|
426
399
|
const stderr = (comment.stderr ?? comment.stdout ?? "").trim().slice(0, 500) || "gh issue comment failed";
|
|
427
400
|
failures.push({ taskId, issue, action, error: stderr });
|
|
428
|
-
journal(projectRoot, batchId, "
|
|
401
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
429
402
|
issue,
|
|
430
403
|
action,
|
|
431
404
|
taskId,
|
|
@@ -443,7 +416,7 @@ export function syncIssuesOnLand({
|
|
|
443
416
|
if ((close.status ?? 1) !== 0) {
|
|
444
417
|
const stderr = (close.stderr ?? close.stdout ?? "").trim().slice(0, 500) || "gh issue close failed";
|
|
445
418
|
failures.push({ taskId, issue, action, error: stderr });
|
|
446
|
-
journal(projectRoot, batchId, "
|
|
419
|
+
journal(projectRoot, batchId, "issues.sync_failed", {
|
|
447
420
|
issue,
|
|
448
421
|
action,
|
|
449
422
|
taskId,
|
|
@@ -458,7 +431,7 @@ export function syncIssuesOnLand({
|
|
|
458
431
|
}
|
|
459
432
|
bodyFile.cleanup();
|
|
460
433
|
synced.push({ taskId, issue, action, closed });
|
|
461
|
-
journal(projectRoot, batchId, "
|
|
434
|
+
journal(projectRoot, batchId, "issues.synced", {
|
|
462
435
|
issue,
|
|
463
436
|
action,
|
|
464
437
|
taskId,
|
|
File without changes
|