@tablation/crew 0.142.5 → 0.143.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/dist/cli.js +146 -25
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6684,17 +6684,33 @@ function recheckBaseStops(state, route2) {
|
|
|
6684
6684
|
}
|
|
6685
6685
|
var heldWorktreeKey = (repo, path) => `worktree_held:${repo}:${path}`;
|
|
6686
6686
|
var HELD_WORKTREE_REMINDER_MS = 24 * 60 * 60 * 1e3;
|
|
6687
|
+
var HELD_WORKTREE_MIN_SWEEPS = 2;
|
|
6688
|
+
var HELD_WORKTREE_MIN_AGE_MS = 10 * 60 * 1e3;
|
|
6687
6689
|
function noteHeldWorktree(state, h, nowMs = Date.now()) {
|
|
6688
6690
|
const store = state.shipAttention();
|
|
6689
6691
|
const previous = store.previous();
|
|
6690
6692
|
const key = heldWorktreeKey(h.repo, h.path);
|
|
6691
6693
|
const existing = previous.find((i) => i.key === key)?.held;
|
|
6692
6694
|
const nowIso = new Date(nowMs).toISOString();
|
|
6695
|
+
let firstSeenAt = existing?.firstSeenAt;
|
|
6696
|
+
if (!existing) {
|
|
6697
|
+
const pending = state.pendingHeldWorktrees();
|
|
6698
|
+
const all = pending.previous();
|
|
6699
|
+
const p = all[key]?.reason === h.reason ? all[key] : void 0;
|
|
6700
|
+
const sweeps = (p?.sweeps ?? 0) + 1;
|
|
6701
|
+
firstSeenAt = p?.firstSeenAt ?? nowIso;
|
|
6702
|
+
if (sweeps < HELD_WORKTREE_MIN_SWEEPS && nowMs - Date.parse(firstSeenAt) < HELD_WORKTREE_MIN_AGE_MS) {
|
|
6703
|
+
pending.persist({ ...all, [key]: { reason: h.reason, firstSeenAt, sweeps } });
|
|
6704
|
+
return null;
|
|
6705
|
+
}
|
|
6706
|
+
const { [key]: _promoted, ...rest } = all;
|
|
6707
|
+
if (key in all) pending.persist(rest);
|
|
6708
|
+
}
|
|
6693
6709
|
const lastWarned = existing ? Date.parse(existing.lastWarnedAt) : NaN;
|
|
6694
6710
|
const warn = !existing ? "first" : existing.reason !== h.reason ? "changed" : !(nowMs - lastWarned < HELD_WORKTREE_REMINDER_MS) ? "reminder" : null;
|
|
6695
6711
|
const held = {
|
|
6696
6712
|
...h,
|
|
6697
|
-
firstSeenAt
|
|
6713
|
+
firstSeenAt,
|
|
6698
6714
|
lastWarnedAt: warn ? nowIso : existing.lastWarnedAt
|
|
6699
6715
|
};
|
|
6700
6716
|
const n = h.ticket.replace(/^\D+/, "");
|
|
@@ -6709,6 +6725,15 @@ function noteHeldWorktree(state, h, nowMs = Date.now()) {
|
|
|
6709
6725
|
return warn;
|
|
6710
6726
|
}
|
|
6711
6727
|
function reconcileHeldWorktrees(state, repo, log, stillRefused) {
|
|
6728
|
+
const pending = state.pendingHeldWorktrees();
|
|
6729
|
+
const waiting = pending.previous();
|
|
6730
|
+
const keep = Object.fromEntries(Object.entries(waiting).filter(([key]) => {
|
|
6731
|
+
const [, r, ...rest] = key.split(":");
|
|
6732
|
+
const path = rest.join(":");
|
|
6733
|
+
if (r !== repo) return true;
|
|
6734
|
+
return existsSync18(path) && !(stillRefused && !stillRefused.has(path));
|
|
6735
|
+
}));
|
|
6736
|
+
if (Object.keys(keep).length !== Object.keys(waiting).length) pending.persist(keep);
|
|
6712
6737
|
for (const i of state.shipAttention().previous()) {
|
|
6713
6738
|
if (i.kind !== "worktree_held" || !i.held || i.held.repo !== repo) continue;
|
|
6714
6739
|
const gone = !existsSync18(i.held.path);
|
|
@@ -7448,6 +7473,28 @@ var State = class _State {
|
|
|
7448
7473
|
}
|
|
7449
7474
|
};
|
|
7450
7475
|
}
|
|
7476
|
+
/**
|
|
7477
|
+
* Worktree refusals not yet old enough to publish as `worktree_held` items
|
|
7478
|
+
* (CREW-3204), keyed by the item key. Kept apart from `shipAttention()` so no
|
|
7479
|
+
* client sees a refusal that may clear on its own. A corrupt or missing file
|
|
7480
|
+
* reads as empty.
|
|
7481
|
+
*/
|
|
7482
|
+
pendingHeldWorktrees() {
|
|
7483
|
+
const file = ".worktree-held-pending.json";
|
|
7484
|
+
return {
|
|
7485
|
+
previous: () => {
|
|
7486
|
+
try {
|
|
7487
|
+
const parsed = JSON.parse(readFileSync21(this.path(file), "utf8"));
|
|
7488
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
7489
|
+
} catch {
|
|
7490
|
+
return {};
|
|
7491
|
+
}
|
|
7492
|
+
},
|
|
7493
|
+
persist: (next) => {
|
|
7494
|
+
writeFileSync16(this.path(file), JSON.stringify(next));
|
|
7495
|
+
}
|
|
7496
|
+
};
|
|
7497
|
+
}
|
|
7451
7498
|
/**
|
|
7452
7499
|
* When the release phase last ran a cycle (CREW-1373), as the mtime of a
|
|
7453
7500
|
* marker file. `touch()` is called at the start and the end of every cycle
|
|
@@ -19149,6 +19196,13 @@ function culpritByFiles(candidates2, paths) {
|
|
|
19149
19196
|
function planBuildFailureBounce(cwd, c, base, remote) {
|
|
19150
19197
|
return { ...c, base, remote, worktree: worktreeForBranch(cwd, c.branch) };
|
|
19151
19198
|
}
|
|
19199
|
+
function outsideNote(b) {
|
|
19200
|
+
if (b.inBranch !== false || !b.failingFiles?.length) return "";
|
|
19201
|
+
const shown = b.failingFiles.slice(0, 5).map((f) => `\`${f}\``).join(", ");
|
|
19202
|
+
return `**None of the files the failure names (${shown}) are among this branch's changes**, so this may be a flake or a failure that already lives on \`${b.base ?? "the base"}\` rather than something the branch broke; check that before changing code.
|
|
19203
|
+
|
|
19204
|
+
`;
|
|
19205
|
+
}
|
|
19152
19206
|
function buildFailureComment(b) {
|
|
19153
19207
|
const how = b.how === "pair" && b.sibling ? `Each branch passes the hook alone; \`${b.branch}\` together with ${b.sibling.key} (\`${b.sibling.branch}\`) fails it. ${b.sibling.key} was verified first, so the fix belongs on this branch: \`git merge ${b.remote}/${b.sibling.branch}\` first, then fix what disagrees. Fix it on this branch, never a fresh one.` : b.how === "files" ? `The failing output names files that only \`${b.branch}\` changed among the branches in that release.` : `Built alone on the previous \`${b.base}\`, \`${b.branch}\` fails the same hook.`;
|
|
19154
19208
|
return `${BUILD_FAILURE_MARKER}
|
|
@@ -19157,7 +19211,7 @@ function buildFailureComment(b) {
|
|
|
19157
19211
|
|
|
19158
19212
|
\`${b.branch}\` was verified, but the release's \`${b.hook}\` hook failed once it was merged with the other branches in the same release. ${how}
|
|
19159
19213
|
|
|
19160
|
-
First step: \`git merge ${b.remote}/${b.base}\` in ${b.worktree ? `\`${b.worktree}\`` : "the branch's worktree"}, rebuild, and fix what disagrees \u2014 the merge is clean at the text level, so this is a semantic conflict (a duplicate identifier, a changed signature) with work that landed on \`${b.base}\` after this branch was cut. Push as a plain fast-forward and hand back to QA as usual.
|
|
19214
|
+
${outsideNote(b)}First step: \`git merge ${b.remote}/${b.base}\` in ${b.worktree ? `\`${b.worktree}\`` : "the branch's worktree"}, rebuild, and fix what disagrees \u2014 the merge is clean at the text level, so this is a semantic conflict (a duplicate identifier, a changed signature) with work that landed on \`${b.base}\` after this branch was cut. Push as a plain fast-forward and hand back to QA as usual.
|
|
19161
19215
|
|
|
19162
19216
|
\`\`\`
|
|
19163
19217
|
${b.tail.trimEnd()}
|
|
@@ -19171,13 +19225,32 @@ function priorBuildFailures(ticket, events) {
|
|
|
19171
19225
|
const pushes = mine.filter((e) => e.event_type === "pushed").map(stamp);
|
|
19172
19226
|
return mine.filter((e) => e.event_type === "build_failed" && pushes.some((p) => p > stamp(e))).length;
|
|
19173
19227
|
}
|
|
19174
|
-
function
|
|
19228
|
+
function priorFailureNote(ticket, events) {
|
|
19229
|
+
const stamp = (e) => e.occurred_at ?? e.created_at ?? "";
|
|
19230
|
+
return events.filter((e) => e.record_id === ticket.id && e.event_type === "build_failed").sort((a, b) => stamp(a).localeCompare(stamp(b))).map((e) => e.message ?? "").pop();
|
|
19231
|
+
}
|
|
19232
|
+
function failureComparison(b, previousNote) {
|
|
19233
|
+
const now = b.failingFiles ?? failingPaths(b.tail, b.cwd ?? "/\0");
|
|
19234
|
+
const before = previousNote ? failingPaths(previousNote, b.cwd ?? "/\0") : [];
|
|
19235
|
+
const lines2 = [];
|
|
19236
|
+
if (!before.length || !now.length) {
|
|
19237
|
+
lines2.push("- Same failure both times? Unknown: the output of at least one run names no file.");
|
|
19238
|
+
} else {
|
|
19239
|
+
const same = now.filter((f) => before.includes(f));
|
|
19240
|
+
lines2.push(same.length ? `- Same failure both times: yes, ${same.map((f) => `\`${f}\``).join(", ")} fails in both.` : `- Same failure both times: **no**. First ${before.slice(0, 3).map((f) => `\`${f}\``).join(", ")}, now ${now.slice(0, 3).map((f) => `\`${f}\``).join(", ")}. Two different failures look like a flake, not a branch that keeps breaking.`);
|
|
19241
|
+
}
|
|
19242
|
+
lines2.push(b.inBranch == null ? "- Failing files among the branch's changes? Unknown: the failure names no file." : b.inBranch ? "- Failing files among the branch's changes: yes." : "- Failing files among the branch's changes: **no**, none of them. Not proof, but the branch probably did not break it.");
|
|
19243
|
+
return lines2.join("\n");
|
|
19244
|
+
}
|
|
19245
|
+
function buildFailureEscalation(b, previousNote) {
|
|
19175
19246
|
return `${BUILD_FAILURE_MARKER}
|
|
19176
19247
|
|
|
19177
19248
|
**Failed the release gate again after a hand-back \u2014 stopping rather than looping.**
|
|
19178
19249
|
|
|
19179
19250
|
\`${b.branch}\` was handed back for breaking the \`${b.hook}\` hook, pushed, verified again, and breaks it once more. That is a call for a person, not another lap through the lanes.
|
|
19180
19251
|
|
|
19252
|
+
${failureComparison(b, previousNote)}
|
|
19253
|
+
|
|
19181
19254
|
\`\`\`
|
|
19182
19255
|
${b.tail.trimEnd()}
|
|
19183
19256
|
\`\`\``;
|
|
@@ -19195,7 +19268,7 @@ async function applyBuildFailureBounce(writer, b, contract, memberId, log, dryRu
|
|
|
19195
19268
|
{ status: contract.statuses.needsHuman, ...prior.operatorId ? { assignee_id: prior.operatorId } : {} },
|
|
19196
19269
|
b.ticket.updated_at
|
|
19197
19270
|
);
|
|
19198
|
-
await writer.postEvent(b.ticket.id, buildFailureEscalation(b), memberId, "build_failed_escalated").catch(() => {
|
|
19271
|
+
await writer.postEvent(b.ticket.id, buildFailureEscalation(b, prior.previousNote), memberId, "build_failed_escalated").catch(() => {
|
|
19199
19272
|
log.warn("escalated, but the note failed to post", t);
|
|
19200
19273
|
});
|
|
19201
19274
|
log.warn(`breaks the ${b.hook} hook again after a hand-back \u2014 escalated to ${contract.statuses.needsHuman}`, t);
|
|
@@ -20195,16 +20268,24 @@ var HOOK_FAILURE_TAIL_LINES = 15;
|
|
|
20195
20268
|
function hookFailure(o, name, output) {
|
|
20196
20269
|
return { hook: name, label: hookLabel(o.repo, name), tail: lastLines(output, HOOK_FAILURE_TAIL_LINES) };
|
|
20197
20270
|
}
|
|
20198
|
-
function looksLikeWorkerCrash(output) {
|
|
20199
|
-
const crashSignature = /worker process was terminated by another process|signal=SIG(SEGV|ABRT|BUS)/i;
|
|
20200
|
-
const assertionDiff = /(AssertionError|Expected:|Received:|✕|not ok \d)/;
|
|
20201
|
-
return crashSignature.test(output) && !assertionDiff.test(output);
|
|
20202
|
-
}
|
|
20203
20271
|
function looksLikeTransientResolveFailure(output) {
|
|
20204
20272
|
const resolveFailure = /Rolldown failed to resolve import|Could not resolve|\[vite\]: Failed to resolve import/i;
|
|
20205
20273
|
const realBuildError = /(TS\d{4}:|SyntaxError|error TS|Cannot find module '\.)/;
|
|
20206
20274
|
return resolveFailure.test(output) && !realBuildError.test(output);
|
|
20207
20275
|
}
|
|
20276
|
+
async function rerunOnce(o, name, first) {
|
|
20277
|
+
o.emit.warn(`${name} gate failed \u2014 rerunning once on the same composition before blaming a branch`);
|
|
20278
|
+
const again = await hook(o, name);
|
|
20279
|
+
if (!again || again.code !== 0) return again ?? first;
|
|
20280
|
+
o.emit.warn(`${name} gate passed on the rerun \u2014 treating the first failure as a flake and going on`);
|
|
20281
|
+
(o.flakeLog ??= []).push({
|
|
20282
|
+
hook: name,
|
|
20283
|
+
label: hookLabel(o.repo, name),
|
|
20284
|
+
tail: lastLines(first.output, HOOK_FAILURE_TAIL_LINES),
|
|
20285
|
+
files: failingPaths(first.output, o.cwd)
|
|
20286
|
+
});
|
|
20287
|
+
return again;
|
|
20288
|
+
}
|
|
20208
20289
|
var hook = async (o, name, env = {}) => {
|
|
20209
20290
|
const script = o.repo.hooks[name];
|
|
20210
20291
|
if (!script) return null;
|
|
@@ -20779,7 +20860,7 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20779
20860
|
const byFile = culpritByFiles(withFiles, failingPaths(output, o.cwd));
|
|
20780
20861
|
if (byFile) {
|
|
20781
20862
|
o.emit.warn(`${name} failed; its output names files only ${byFile.c.branch} changed \u2014 treating it as the culprit`, { ticket: byFile.c.ticket.issue_id });
|
|
20782
|
-
culprits.push({ c: byFile.c, how: "files", tail: lastLines(output, HOOK_FAILURE_TAIL_LINES) });
|
|
20863
|
+
culprits.push({ c: byFile.c, how: "files", tail: lastLines(output, HOOK_FAILURE_TAIL_LINES), paths: failingPaths(output, o.cwd) });
|
|
20783
20864
|
} else if (applied.length === 1) {
|
|
20784
20865
|
const only = applied[0];
|
|
20785
20866
|
gitOk(o.cwd, ["reset", "--hard", preMerge]);
|
|
@@ -20790,7 +20871,7 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20790
20871
|
return { tried: `Isolation found no culprit: the ${name} hook also fails on the base alone, without ${only.branch}, so there is no branch to hand back.` };
|
|
20791
20872
|
}
|
|
20792
20873
|
o.emit.warn(`${name} failed with only ${only.branch} merged and passes without it \u2014 treating it as the culprit`, { ticket: only.ticket.issue_id });
|
|
20793
|
-
culprits.push({ c: only, how: "solo", tail: lastLines(output, HOOK_FAILURE_TAIL_LINES) });
|
|
20874
|
+
culprits.push({ c: only, how: "solo", tail: lastLines(output, HOOK_FAILURE_TAIL_LINES), paths: failingPaths(output, o.cwd) });
|
|
20794
20875
|
} else if (applied.length > cap) {
|
|
20795
20876
|
o.emit.warn(`${name} failed with ${applied.length} branches merged, over release.isolateFailures.maxCandidates (${cap}) \u2014 not isolating`);
|
|
20796
20877
|
return { tried: `Isolation was skipped: ${applied.length} branches were merged, over release.isolateFailures.maxCandidates (${cap}).` };
|
|
@@ -20803,7 +20884,7 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20803
20884
|
const r = await hook(o, name);
|
|
20804
20885
|
if (r && r.code !== 0) {
|
|
20805
20886
|
o.emit.warn(`${c.branch} fails the ${name} hook on its own`, { ticket: c.ticket.issue_id });
|
|
20806
|
-
culprits.push({ c, how: "solo", tail: lastLines(r.output, HOOK_FAILURE_TAIL_LINES) });
|
|
20887
|
+
culprits.push({ c, how: "solo", tail: lastLines(r.output, HOOK_FAILURE_TAIL_LINES), paths: failingPaths(r.output, o.cwd) });
|
|
20807
20888
|
}
|
|
20808
20889
|
}
|
|
20809
20890
|
if (culprits.length === 0) {
|
|
@@ -20816,13 +20897,14 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20816
20897
|
const r = await hook(o, name);
|
|
20817
20898
|
if (r && r.code !== 0) {
|
|
20818
20899
|
o.emit.warn(`${applied[j].branch} fails the ${name} hook together with ${applied[i].branch}`, { ticket: applied[j].ticket.issue_id });
|
|
20819
|
-
culprits.push({ c: applied[j], how: "pair", sibling: applied[i], tail: lastLines(r.output, HOOK_FAILURE_TAIL_LINES) });
|
|
20900
|
+
culprits.push({ c: applied[j], how: "pair", sibling: applied[i], tail: lastLines(r.output, HOOK_FAILURE_TAIL_LINES), paths: failingPaths(r.output, o.cwd) });
|
|
20820
20901
|
break;
|
|
20821
20902
|
}
|
|
20822
20903
|
}
|
|
20823
20904
|
if (culprits.length === 0 && truncated) {
|
|
20824
20905
|
let lo = 2, hi = applied.length;
|
|
20825
20906
|
let tail3 = lastLines(output, HOOK_FAILURE_TAIL_LINES);
|
|
20907
|
+
let paths = failingPaths(output, o.cwd);
|
|
20826
20908
|
while (lo < hi) {
|
|
20827
20909
|
const mid = Math.floor((lo + hi) / 2);
|
|
20828
20910
|
gitOk(o.cwd, ["reset", "--hard", preMerge]);
|
|
@@ -20838,11 +20920,12 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20838
20920
|
if (r && r.code !== 0) {
|
|
20839
20921
|
hi = mid;
|
|
20840
20922
|
tail3 = lastLines(r.output, HOOK_FAILURE_TAIL_LINES);
|
|
20923
|
+
paths = failingPaths(r.output, o.cwd);
|
|
20841
20924
|
} else lo = mid + 1;
|
|
20842
20925
|
}
|
|
20843
20926
|
const owner = applied[hi - 1];
|
|
20844
20927
|
o.emit.warn(`${owner.branch} is the first branch whose prefix fails the ${name} hook (bisected over ${applied.length})`, { ticket: owner.ticket.issue_id });
|
|
20845
|
-
culprits.push({ c: owner, how: "pair", sibling: applied[hi - 2], tail: tail3 });
|
|
20928
|
+
culprits.push({ c: owner, how: "pair", sibling: applied[hi - 2], tail: tail3, paths });
|
|
20846
20929
|
}
|
|
20847
20930
|
}
|
|
20848
20931
|
}
|
|
@@ -20863,11 +20946,19 @@ async function isolateAndRetry(o, name, output, merged, preMerge, decision, fres
|
|
|
20863
20946
|
hook: name,
|
|
20864
20947
|
tail: x.tail,
|
|
20865
20948
|
how: x.how,
|
|
20949
|
+
cwd: o.cwd,
|
|
20950
|
+
failingFiles: x.paths,
|
|
20951
|
+
inBranch: x.paths.length === 0 ? null : x.paths.some((p) => withFiles.find((w) => w.c === x.c)?.changed.has(p) ?? false),
|
|
20866
20952
|
...x.sibling ? { sibling: { key: x.sibling.ticket.issue_tag ?? x.sibling.ticket.issue_id, branch: x.sibling.branch } } : {}
|
|
20867
20953
|
}))
|
|
20868
20954
|
};
|
|
20869
20955
|
}
|
|
20870
20956
|
async function mergeAndRelease(o, decision, fresh, releaseBranch, isolated = false) {
|
|
20957
|
+
const flakeLog = o.flakeLog ?? [];
|
|
20958
|
+
const outcome = await mergeAndReleaseBody({ ...o, flakeLog }, decision, fresh, releaseBranch, isolated);
|
|
20959
|
+
return flakeLog.length ? { ...outcome, flakes: [...flakeLog] } : outcome;
|
|
20960
|
+
}
|
|
20961
|
+
async function mergeAndReleaseBody(o, decision, fresh, releaseBranch, isolated = false) {
|
|
20871
20962
|
o.emit.enter("merge");
|
|
20872
20963
|
const preMerge = o.dryRun ? "" : headSha(o.cwd);
|
|
20873
20964
|
const merged = [];
|
|
@@ -21000,10 +21091,7 @@ async function mergeAndRelease(o, decision, fresh, releaseBranch, isolated = fal
|
|
|
21000
21091
|
if (o.dryRun) o.emit.emit(`would run the test gate: ${hookLabel(o.repo, "test")}`);
|
|
21001
21092
|
else {
|
|
21002
21093
|
let r = await hook(o, "test");
|
|
21003
|
-
if (r && r.code !== 0 &&
|
|
21004
|
-
o.emit.warn("test gate failed with what looks like a worker crash, not a real failure \u2014 retrying once");
|
|
21005
|
-
r = await hook(o, "test");
|
|
21006
|
-
}
|
|
21094
|
+
if (r && r.code !== 0 && !o.dryRun) r = await rerunOnce(o, "test", r);
|
|
21007
21095
|
if (r && r.code !== 0 && !isolated) {
|
|
21008
21096
|
const out = await isolateAndRetry(o, "test", r.output, merged, preMerge, decision, fresh, releaseBranch);
|
|
21009
21097
|
if (out && "tried" in out) isolation = out.tried;
|
|
@@ -21061,10 +21149,7 @@ async function mergeAndRelease(o, decision, fresh, releaseBranch, isolated = fal
|
|
|
21061
21149
|
}
|
|
21062
21150
|
} else {
|
|
21063
21151
|
let r = await hook(o, "build");
|
|
21064
|
-
if (r && r.code !== 0
|
|
21065
|
-
o.emit.warn("build failed with what looks like a transient dependency-resolution glitch, not a real failure \u2014 retrying once");
|
|
21066
|
-
r = await hook(o, "build");
|
|
21067
|
-
}
|
|
21152
|
+
if (r && r.code !== 0) r = await rerunOnce(o, "build", r);
|
|
21068
21153
|
if (r && r.code !== 0 && !isolated) {
|
|
21069
21154
|
const out = await isolateAndRetry(o, "build", r.output, merged, preMerge, decision, fresh, releaseBranch);
|
|
21070
21155
|
if (out && "tried" in out) isolation = out.tried;
|
|
@@ -25801,23 +25886,42 @@ async function applyWorktreeSweep(cwd, actions, dryRun, log, remote = "origin",
|
|
|
25801
25886
|
);
|
|
25802
25887
|
}
|
|
25803
25888
|
}
|
|
25889
|
+
const n = Number(a.ticket.issue_id.replace(/^\D+/, ""));
|
|
25890
|
+
const pids = pidsInWorktree(a.path, n);
|
|
25891
|
+
const liveRun = !!held && liveRuns(held.state.dir).some((r) => (r.ticket ?? "").replace(/^\D+/, "") === String(n));
|
|
25892
|
+
const defer = () => {
|
|
25893
|
+
log.emit(
|
|
25894
|
+
`leaving ${a.path} for the next cycle: ${liveRun ? `${a.ticket.issue_id} has a run in progress on this ship` : `processes are still inside it (${pids.join(" ")})`}`,
|
|
25895
|
+
{ ticket: a.ticket.issue_id, step: "worktree" }
|
|
25896
|
+
);
|
|
25897
|
+
};
|
|
25898
|
+
if (!dryRun && liveRun && existsSync53(a.path)) {
|
|
25899
|
+
defer();
|
|
25900
|
+
continue;
|
|
25901
|
+
}
|
|
25804
25902
|
if (!dryRun && existsSync53(a.path)) {
|
|
25805
25903
|
let dirty = false;
|
|
25806
25904
|
try {
|
|
25807
25905
|
dirty = status(a.path).length > 0;
|
|
25808
25906
|
} catch {
|
|
25809
25907
|
}
|
|
25908
|
+
if (dirty && pids.length) {
|
|
25909
|
+
defer();
|
|
25910
|
+
continue;
|
|
25911
|
+
}
|
|
25810
25912
|
if (dirty) {
|
|
25811
25913
|
refuse2(a, "uncommitted changes", "it has uncommitted changes");
|
|
25812
25914
|
continue;
|
|
25813
25915
|
}
|
|
25814
25916
|
}
|
|
25815
25917
|
if (!dryRun && a.requirePushed && a.branch && existsSync53(a.path) && remoteConfigured(cwd, remote) && worktreeHoldsUnpushed(a.path, remote)) {
|
|
25918
|
+
if (pids.length) {
|
|
25919
|
+
defer();
|
|
25920
|
+
continue;
|
|
25921
|
+
}
|
|
25816
25922
|
refuse2(a, "unpushed commits", `${a.branch} has commits that are not on ${remote}`);
|
|
25817
25923
|
continue;
|
|
25818
25924
|
}
|
|
25819
|
-
const n = Number(a.ticket.issue_id.replace(/^\D+/, ""));
|
|
25820
|
-
const pids = pidsInWorktree(a.path, n);
|
|
25821
25925
|
if (pids.length) {
|
|
25822
25926
|
log.emit(
|
|
25823
25927
|
`${dryRun ? "would kill" : "killing"} processes still inside ${a.path}: ${pids.join(" ")}`,
|
|
@@ -29815,7 +29919,7 @@ ${changed2.map((c) => ` - ${c}
|
|
|
29815
29919
|
seat,
|
|
29816
29920
|
remit,
|
|
29817
29921
|
dryRun,
|
|
29818
|
-
{ count: priorBuildFailures(cu.ticket, prior), operatorId: c.resolved?.operator }
|
|
29922
|
+
{ count: priorBuildFailures(cu.ticket, prior), operatorId: c.resolved?.operator, previousNote: priorFailureNote(cu.ticket, prior) }
|
|
29819
29923
|
);
|
|
29820
29924
|
if (r.kind === "failed") {
|
|
29821
29925
|
remit.warn(`could not hand back ${cu.ticket.issue_id}: ${r.why}`, { step: "release" });
|
|
@@ -29839,6 +29943,23 @@ ${cu.tail.trimEnd()}
|
|
|
29839
29943
|
}
|
|
29840
29944
|
}
|
|
29841
29945
|
}
|
|
29946
|
+
if (outcome.flakes?.length && !dryRun) {
|
|
29947
|
+
const seat = releaseSeat(c);
|
|
29948
|
+
for (const f of outcome.flakes) {
|
|
29949
|
+
const files = f.files.length ? f.files.map((p) => `\`${p}\``).join(", ") : "no file named in the output";
|
|
29950
|
+
await applyFailureAlert(tracker, {
|
|
29951
|
+
level: "warn",
|
|
29952
|
+
headline: `${scope}: flaky ${f.hook} gate`,
|
|
29953
|
+
detail: `The \`${f.hook}\` hook (${f.label}) failed once during a release and passed on an immediate rerun of the same composition, so no branch was blamed and the release went on. Failing: ${files}.
|
|
29954
|
+
|
|
29955
|
+
\`\`\`
|
|
29956
|
+
${f.tail.trimEnd()}
|
|
29957
|
+
\`\`\``
|
|
29958
|
+
}, scope, all, seat, remit, dryRun, await alertPlacement()).catch((e) => {
|
|
29959
|
+
remit.warn(`could not file/update a flaky-gate ticket: ${e.message}`, { step: "release" });
|
|
29960
|
+
});
|
|
29961
|
+
}
|
|
29962
|
+
}
|
|
29842
29963
|
if (outcome.conflicts?.length || outcome.unbuildable?.length) {
|
|
29843
29964
|
const handedBack = [...await tracker.events("conflict_handed_back"), ...await tracker.events("pushed")];
|
|
29844
29965
|
const flagged = await tracker.events("stranded_flagged");
|
package/package.json
CHANGED