toolroll 0.9.129 → 0.9.131
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/CHANGELOG.md +44 -0
- package/dist/agent-fence.js +0 -2
- package/dist/agent-state.js +1 -1
- package/dist/agents-board.js +0 -3
- package/dist/assignment.js +4 -3
- package/dist/backup-ui.js +6 -3
- package/dist/bounded-spawn.js +0 -1
- package/dist/browser/manifest.json +57 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.br +0 -0
- package/dist/browser/terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css.gz +0 -0
- package/dist/browser/{terminal.js → terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js} +1 -1
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.br +0 -0
- package/dist/browser/terminal.8978c8cbb268e1006f4b0be371c2401b58078e6d9f1380f4a5c2a12da843909f.js.gz +0 -0
- package/dist/browser/{workspace.js → workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js} +25 -25
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.br +0 -0
- package/dist/browser/workspace.4f5935dc80574baadf1adafd39a08c567fb1fac1323052ca355546622f9b06d2.js.gz +0 -0
- package/dist/browser/{workspace.css → workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css} +1 -1
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.br +0 -0
- package/dist/browser/workspace.a0752f935cfeaf16758d1085fe8f3e1719a7cd525b91a9c9943c789d65879a54.css.gz +0 -0
- package/dist/browser-shell.js +271 -25
- package/dist/builder-restart.js +13 -4
- package/dist/builder.js +4 -1
- package/dist/canvas-freshness.js +122 -0
- package/dist/canvas-fs.js +273 -0
- package/dist/canvas-reads.js +747 -0
- package/dist/canvas-state-key.js +45 -0
- package/dist/canvas-state-worker.js +12 -0
- package/dist/central-recovery-stage.js +3 -3
- package/dist/chat-actions.js +26 -0
- package/dist/chat-channel.js +4 -3
- package/dist/chat-follow.js +4 -0
- package/dist/chat-task-actions.js +1 -1
- package/dist/chat-warmth.js +0 -1
- package/dist/check-report.js +0 -6
- package/dist/commit-extract.js +79 -40
- package/dist/companion/access.js +1 -0
- package/dist/companion/actions.js +79 -16
- package/dist/companion/canvas.js +141 -0
- package/dist/companion/chat-origin.js +92 -0
- package/dist/companion/chat.js +571 -0
- package/dist/companion/daemon.js +46 -5
- package/dist/companion/finish.js +51 -0
- package/dist/companion/reads.js +5 -1
- package/dist/companion/schema.js +64 -0
- package/dist/companion/service.js +1 -0
- package/dist/companion/store.js +1 -0
- package/dist/companion/webauthn.js +11 -2
- package/dist/console-instance.js +0 -4
- package/dist/contracts/console-api.js +1 -1
- package/dist/converse.js +0 -1
- package/dist/coordinator.js +1 -1
- package/dist/db-tuning.js +16 -0
- package/dist/desktop-config.js +156 -0
- package/dist/desktop-host.js +6 -152
- package/dist/desktop-update.js +1 -1
- package/dist/discord.js +9 -3
- package/dist/dispatch.js +32 -4
- package/dist/doctor.js +30 -0
- package/dist/evidence.js +49 -3
- package/dist/exec.js +3 -0
- package/dist/finished-task-sql.js +14 -0
- package/dist/flexible-answers.js +0 -1
- package/dist/git-views.js +7 -1
- package/dist/github-read.js +41 -0
- package/dist/guides.js +4 -3
- package/dist/invoke.js +12 -2
- package/dist/lead-doors.js +50 -3
- package/dist/lead-queue-runtime.js +18 -6
- package/dist/lead-queue.js +25 -0
- package/dist/lead-status.js +3 -3
- package/dist/live-backup-change.js +93 -0
- package/dist/live-backup.js +75 -31
- package/dist/live-bus.js +3 -2
- package/dist/live-records.js +0 -1
- package/dist/local-owner.js +0 -1
- package/dist/loop-recovery.js +40 -0
- package/dist/maintenance.js +29 -1
- package/dist/model-choices.js +0 -11
- package/dist/needs-you.js +2 -0
- package/dist/nightly-check.js +0 -3
- package/dist/nightly-github.js +1 -2
- package/dist/notification-retention.js +119 -0
- package/dist/observations.js +0 -1
- package/dist/operate.js +393 -56
- package/dist/planner.js +4 -1
- package/dist/pull-request-flow.js +56 -15
- package/dist/qr.js +0 -25
- package/dist/query-index-schema.js +10 -0
- package/dist/read-executor-worker.js +9 -7
- package/dist/read-executor.js +18 -1
- package/dist/read-worker-connection.js +7 -0
- package/dist/release-adapters.js +63 -48
- package/dist/release-auto.js +17 -13
- package/dist/release-card.js +0 -4
- package/dist/release-cli.js +58 -10
- package/dist/release-next.js +1 -1
- package/dist/release-stops.js +71 -0
- package/dist/release-supersede.js +125 -0
- package/dist/release-supervise.js +90 -0
- package/dist/release.js +265 -42
- package/dist/restore-retirement.js +4 -1
- package/dist/result-review.js +0 -3
- package/dist/retention-ui.js +1 -1
- package/dist/retention.js +14 -21
- package/dist/review-context.js +0 -5
- package/dist/route-rules.js +1 -5
- package/dist/runner.js +36 -1
- package/dist/sandbox-runtime.js +0 -1
- package/dist/scope.js +1 -13
- package/dist/scout.js +4 -7
- package/dist/serve.js +122 -12
- package/dist/server/kit.js +1 -0
- package/dist/server/live.js +9 -2
- package/dist/server/pages.js +3 -2
- package/dist/server/phone-engine-api.js +22 -2
- package/dist/server/render-pages.js +1 -11
- package/dist/server/render-results.js +0 -1
- package/dist/server/render-tasks.js +0 -68
- package/dist/server/route-table.js +1 -1
- package/dist/server/settings-phone.js +32 -9
- package/dist/server/settings-scripts.js +1 -1
- package/dist/server/settings-section-table.js +0 -3
- package/dist/server/settings-sections.js +4 -2
- package/dist/server/settings.js +20 -5
- package/dist/server/terminals.js +2 -1
- package/dist/shutdown-proof.js +29 -0
- package/dist/slack.js +9 -3
- package/dist/sqlite-telemetry.js +26 -14
- package/dist/statement-cache.js +137 -0
- package/dist/store.js +86 -14
- package/dist/structured-output.js +0 -1
- package/dist/style-asset.js +20 -7
- package/dist/tailnet.js +0 -3
- package/dist/task-control.js +5 -0
- package/dist/task-sizing.js +0 -1
- package/dist/task-status.js +1 -1
- package/dist/teams.js +9 -3
- package/dist/teardown-git.js +10 -1
- package/dist/telegram.js +4 -1
- package/dist/toolroll-update-cli.js +19 -3
- package/dist/toolroll-update-ui.js +2 -2
- package/dist/toolroll-update.js +95 -15
- package/dist/up-processes.js +16 -1
- package/dist/up-role-child.js +2 -0
- package/dist/wake-hub.js +15 -6
- package/dist/work-index.js +101 -44
- package/dist/work-reads.js +53 -9
- package/dist/work-snapshots.js +185 -0
- package/dist/worker-statement-cache.js +83 -0
- package/dist/workspace-revision.js +145 -21
- package/package.json +1 -1
- package/dist/companion/webauthn-test-support.js +0 -44
- package/dist/contracts/contract-test.js +0 -55
- package/dist/unfenced-test-support.js +0 -6
- /package/dist/browser/{terminal.css → terminal.4d1cf20c32ad7c2099df657358d540d5fd92bb55195a88121e74b28467238b42.css} +0 -0
package/dist/release.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { isNewer } from "./releases.js";
|
|
1
2
|
import { closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { personProof } from "./person-proof.js";
|
|
5
6
|
import { RELEASE_CI_RUNNING_WORDS as CI_RUNNING_WORDS } from "./release-ci-hold.js";
|
|
6
7
|
import { transientFailure } from "./release-net.js";
|
|
8
|
+
import { CheckoutBusy } from "./git-views.js";
|
|
9
|
+
import { NotYetPublished } from "./release-stops.js";
|
|
7
10
|
import { changelogHas, harnessChanges, mainJournalFile, mainResumeCommand, releaseBranchFor, sameRelease, VERSION_PATTERN } from "./release-main.js";
|
|
8
11
|
export const REQUIRED_PR_CHECKS = [
|
|
9
12
|
"node 24 · ubuntu-latest",
|
|
@@ -63,15 +66,19 @@ export const RELEASE_TAG_WORKFLOW = ".github/workflows/publish.yml";
|
|
|
63
66
|
export const RELEASE_STEPS = ["gate", "approval", "check", "complete", "quiet", "deploy", "link", "ci", "merge", "tree", "tag", "publish", "homebrew", "done"];
|
|
64
67
|
export const RELEASE_LIMITS = { gate: 60, approval: 24 * 60, check: 360, quiet: 60, deploy: 30, ci: 60, publish: 45, homebrew: 45 };
|
|
65
68
|
const POLL_MS = 15_000;
|
|
69
|
+
const RELINK_TRIES = 3;
|
|
70
|
+
const RELINK_PAUSE_MS = 15_000;
|
|
66
71
|
export const INFRA_RERUNS_PER_INCIDENT = 1;
|
|
67
72
|
export const INFRA_RERUNS_PER_CANDIDATE = 2;
|
|
68
73
|
class Stop extends Error {
|
|
69
74
|
reason;
|
|
70
75
|
build;
|
|
71
|
-
|
|
76
|
+
waited;
|
|
77
|
+
constructor(reason, message, build = false, waited = null) {
|
|
72
78
|
super(message);
|
|
73
79
|
this.reason = reason;
|
|
74
80
|
this.build = build;
|
|
81
|
+
this.waited = waited;
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
class HomebrewFailed extends Error {
|
|
@@ -205,30 +212,43 @@ export async function runRelease(options, adapters) {
|
|
|
205
212
|
delete j.intents.deploy;
|
|
206
213
|
save();
|
|
207
214
|
};
|
|
208
|
-
const waitFor = async (at, what, probe) => {
|
|
215
|
+
const waitFor = async (at, what, probe, atLimit) => {
|
|
209
216
|
const deadline = adapters.now().getTime() + limits[at] * 60_000;
|
|
210
|
-
let said = false, unreachable = null;
|
|
217
|
+
let said = false, unreachable = null, busy = false;
|
|
211
218
|
for (;;) {
|
|
212
219
|
let answer;
|
|
213
220
|
try {
|
|
214
221
|
answer = await probe();
|
|
215
222
|
unreachable = null;
|
|
223
|
+
busy = false;
|
|
216
224
|
}
|
|
217
225
|
catch (error) {
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
226
|
+
if (error instanceof CheckoutBusy) {
|
|
227
|
+
if (!busy)
|
|
228
|
+
say(" waiting for Toolroll's own git on this checkout (another of its git commands is still running)");
|
|
229
|
+
busy = true;
|
|
230
|
+
answer = null;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
if (!transientNetworkError(error))
|
|
234
|
+
throw error;
|
|
235
|
+
if (unreachable === null)
|
|
236
|
+
say(` GitHub didn't answer in time (${networkWords(error)}); asking again`);
|
|
237
|
+
unreachable = networkWords(error);
|
|
238
|
+
answer = null;
|
|
239
|
+
}
|
|
224
240
|
}
|
|
225
241
|
if (answer !== null) {
|
|
226
242
|
if (said && journal !== null)
|
|
227
243
|
mark(journal.step, "running");
|
|
228
244
|
return answer;
|
|
229
245
|
}
|
|
230
|
-
if (adapters.now().getTime() >= deadline)
|
|
231
|
-
|
|
246
|
+
if (adapters.now().getTime() >= deadline) {
|
|
247
|
+
const instead = atLimit?.() ?? null;
|
|
248
|
+
if (instead !== null)
|
|
249
|
+
throw instead;
|
|
250
|
+
throw new Stop("timeout", `Still waiting for ${what} after ${limits[at]} minutes${unreachable === null ? busy ? " (Toolroll's own git on this checkout was still busy)" : "" : ` (GitHub last didn't answer: ${unreachable})`}.`, false, at);
|
|
251
|
+
}
|
|
232
252
|
if (!said) {
|
|
233
253
|
say(` waiting for ${what} (up to ${limits[at]} min)`);
|
|
234
254
|
said = true;
|
|
@@ -238,20 +258,90 @@ export async function runRelease(options, adapters) {
|
|
|
238
258
|
await adapters.sleep(pollMs);
|
|
239
259
|
}
|
|
240
260
|
};
|
|
261
|
+
const writeTruth = async (what, read) => {
|
|
262
|
+
say(` GitHub's answer to ${what} was lost: reading GitHub's record of it`);
|
|
263
|
+
let looks = 0;
|
|
264
|
+
try {
|
|
265
|
+
return await waitFor("ci", `GitHub's record of ${what}`, async () => { const seen = await read(); return seen !== null ? { seen } : ++looks >= 2 ? { seen: null } : null; }).then(found => found.seen);
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
if (error instanceof Stop && error.reason === "timeout")
|
|
269
|
+
return null;
|
|
270
|
+
throw error;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const supersede = async (old) => {
|
|
274
|
+
const plane = adapters.release;
|
|
275
|
+
if (plane?.supersede === undefined)
|
|
276
|
+
return;
|
|
277
|
+
const keep = () => { old.updatedAt = adapters.now().toISOString(); writeJournal(file, old); };
|
|
278
|
+
if (old.superseding == null) {
|
|
279
|
+
old.superseding = { at: adapters.now().toISOString(), task: old.task.id, scopeDigest: old.task.scopeDigest, authority: old.authority ?? null,
|
|
280
|
+
apart: old.needsApproval === true || old.stopped?.reason === "check-failed" ? true : null, steps: [], done: null };
|
|
281
|
+
keep();
|
|
282
|
+
}
|
|
283
|
+
const record = old.superseding;
|
|
284
|
+
if (record.done !== null)
|
|
285
|
+
return;
|
|
286
|
+
if (record.apart === null) {
|
|
287
|
+
const head = old.mode === "main" ? old.candidate.sha : (await waitFor("quiet", `${old.branch}'s head on GitHub`, async () => ({ head: await adapters.repo.remoteHead(old.branch) }))).head;
|
|
288
|
+
record.apart = head !== old.candidate.sha;
|
|
289
|
+
keep();
|
|
290
|
+
}
|
|
291
|
+
if (!record.apart) {
|
|
292
|
+
record.done = adapters.now().toISOString();
|
|
293
|
+
keep();
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
let why = "";
|
|
297
|
+
const answer = await waitFor("quiet", `the earlier release task ${record.task} to stop`, async () => {
|
|
298
|
+
const step = await plane.supersede({ taskId: record.task, scopeDigest: record.scopeDigest, authority: record.authority, by: "toolroll release --new" });
|
|
299
|
+
if (step.state !== "refused" && step.steps.length > 0) {
|
|
300
|
+
record.steps = [...new Set([...record.steps, ...step.steps])];
|
|
301
|
+
keep();
|
|
302
|
+
}
|
|
303
|
+
if (step.state === "stopping") {
|
|
304
|
+
why = step.why;
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
return step;
|
|
308
|
+
}, () => new Stop("superseding", `The earlier release task ${record.task} hasn't stopped after ${limits.quiet} minutes (${why}). Nothing new was started.`));
|
|
309
|
+
if (answer.state === "refused") {
|
|
310
|
+
old.superseding = null;
|
|
311
|
+
keep();
|
|
312
|
+
const words = `The earlier release (task ${record.task}) can't be set aside: ${answer.why}. Nothing new was started; finish it with \`${resume}\`.`;
|
|
313
|
+
throw answer.merging ? new Stop("merging", words) : new Stop("release", words);
|
|
314
|
+
}
|
|
315
|
+
record.done = adapters.now().toISOString();
|
|
316
|
+
keep();
|
|
317
|
+
say(`Set aside the earlier release task ${record.task}${record.steps.length === 0 ? "" : ` (${record.steps.join(", ")})`}.`);
|
|
318
|
+
};
|
|
319
|
+
const writeUnknown = (what, error) => new Stop("write-unknown", `GitHub didn't answer ${what} (${networkWords(error)}), and GitHub's record doesn't show it happened. It wasn't asked again: check it on GitHub, then run \`${resume}\`.`);
|
|
241
320
|
try {
|
|
242
321
|
journal = readJournal(file);
|
|
243
|
-
if (journal !== null && options.fresh === true && journal.step !== "done") {
|
|
322
|
+
if (journal !== null && (options.fresh === true || journal.superseding != null) && journal.step !== "done") {
|
|
323
|
+
const theirs = journal;
|
|
324
|
+
const foreign = (stop) => { journal = null; return stop; };
|
|
325
|
+
if (theirs.checkout !== options.checkout)
|
|
326
|
+
throw foreign(new Stop("checkout", `This release runs in ${theirs.checkout}; nothing was set aside. Rerun with --repo ${theirs.checkout}.`));
|
|
327
|
+
if ((theirs.mode === "main") !== fromMain)
|
|
328
|
+
throw foreign(new Stop("usage", `This journal is ${theirs.mode === "main" ? `the release of ${theirs.packageVersion} from main` : "a branch release"}; nothing was set aside.`));
|
|
329
|
+
if (fromMain ? theirs.packageVersion !== options.version : theirs.branch !== options.branch)
|
|
330
|
+
throw foreign(new Stop("drift", `This journal is the release of ${fromMain ? theirs.packageVersion : theirs.branch}, not ${fromMain ? options.version : options.branch}; nothing was set aside.`));
|
|
331
|
+
if (await adapters.repo.github() !== theirs.github)
|
|
332
|
+
throw foreign(new Stop("drift", `This journal's release is in ${theirs.github}, not this checkout's repository; nothing was set aside.`));
|
|
244
333
|
if (journal.mode === "main" && (journal.intents.tag !== undefined || journal.tagged !== null))
|
|
245
334
|
throw new Stop("tagging", `The release of ${journal.candidate.sha.slice(0, 7)} already began tagging ${journal.tag}; finish it with \`${resume}\` instead of starting over.`);
|
|
246
335
|
if (journal.intents.merge !== undefined)
|
|
247
336
|
throw new Stop("merging", `The release of ${journal.candidate.sha.slice(0, 7)} already began merging; finish it with \`${resume}\` instead of starting over.`);
|
|
248
337
|
await recoverDeploy();
|
|
338
|
+
await supersede(journal);
|
|
249
339
|
const aside = file.replace(/\.json$/, `.superseded-${adapters.now().toISOString().replace(/[:.]/g, "-")}.json`);
|
|
250
340
|
renameSync(file, aside);
|
|
251
341
|
say(`Kept the earlier release journal at ${aside}.`);
|
|
252
342
|
freshApproval = journal.needsApproval === true;
|
|
253
343
|
supersededTask = journal.task.id;
|
|
254
|
-
if (journal.stopped?.reason === "check-failed")
|
|
344
|
+
if (journal.stopped?.reason === "check-failed" || journal.superseding?.apart === true)
|
|
255
345
|
stoppedCheck = journal.candidate.sha;
|
|
256
346
|
journal = null;
|
|
257
347
|
}
|
|
@@ -321,7 +411,17 @@ export async function runRelease(options, adapters) {
|
|
|
321
411
|
}
|
|
322
412
|
if (state.kind === "missing") {
|
|
323
413
|
intend("homebrew");
|
|
324
|
-
|
|
414
|
+
let proposed;
|
|
415
|
+
try {
|
|
416
|
+
proposed = await brew.propose(j.packageVersion);
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
if (error instanceof NotYetPublished)
|
|
420
|
+
return { state: "pending", why: error.message };
|
|
421
|
+
if (transientNetworkError(error))
|
|
422
|
+
throw writeUnknown(`proposing ${brew.repo}'s change for ${j.packageVersion}`, error);
|
|
423
|
+
throw error;
|
|
424
|
+
}
|
|
325
425
|
state = { kind: "proposed", ...proposed };
|
|
326
426
|
}
|
|
327
427
|
const proposed = state;
|
|
@@ -368,7 +468,15 @@ export async function runRelease(options, adapters) {
|
|
|
368
468
|
const verified = await brew.verified(proposed.pr, proposed.head, j.packageVersion);
|
|
369
469
|
if (!verified.ok)
|
|
370
470
|
return { state: "failed", why: verified.why };
|
|
371
|
-
|
|
471
|
+
try {
|
|
472
|
+
await brew.merge(proposed.pr, proposed.head);
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
if (!transientNetworkError(error))
|
|
476
|
+
throw error;
|
|
477
|
+
if (await writeTruth("the Homebrew merge", async () => (await brew.state(j.packageVersion)).kind === "current" ? true : null) === null)
|
|
478
|
+
throw writeUnknown(`merging ${brew.repo} #${proposed.pr}`, error);
|
|
479
|
+
}
|
|
372
480
|
return { state: "current", why: null };
|
|
373
481
|
};
|
|
374
482
|
const rel = adapters.release;
|
|
@@ -378,14 +486,52 @@ export async function runRelease(options, adapters) {
|
|
|
378
486
|
}
|
|
379
487
|
catch { } };
|
|
380
488
|
let lastCi = null;
|
|
489
|
+
let red = null;
|
|
381
490
|
const noteCi = async (runs, verdict) => {
|
|
491
|
+
if (verdict.state !== "failed")
|
|
492
|
+
red = null;
|
|
382
493
|
lastCi = { candidate: j.candidate.sha, state: verdict.state === "pending" ? "running" : verdict.state, failed: verdict.failed ?? [], runs: runs.filter(run => REQUIRED_PR_CHECKS.includes(run.name)) };
|
|
383
494
|
const seen = lastCi;
|
|
384
495
|
await tell(ready => ready.ci({ taskId: j.task.id, ...seen }));
|
|
385
496
|
};
|
|
386
497
|
const currentCi = () => lastCi;
|
|
498
|
+
const ciRed = async (runs, verdict) => {
|
|
499
|
+
const short = j.candidate.sha.slice(0, 7), words = verdict.failed.join(", ");
|
|
500
|
+
const attempts = verdict.attempts ?? [];
|
|
501
|
+
const runner = attempts.length > 0 && attempts.every(one => one.beforeTests === true && one.app === "github-actions" && typeof one.workflowRun === "number" && Number.isSafeInteger(one.workflowRun) && one.workflowRun > 0);
|
|
502
|
+
const suites = new Set(attempts.map(one => one.suite));
|
|
503
|
+
const inRerun = runs.filter(one => suites.has(one.suite));
|
|
504
|
+
const finished = runner && inRerun.length > 0 && inRerun.every(one => one.status === "completed");
|
|
505
|
+
const onlyRunner = finished && inRerun.every(one => one.conclusion === "success" || one.conclusion === "skipped" || one.conclusion === "neutral"
|
|
506
|
+
|| (one.beforeTests === true && one.app === "github-actions" && one.workflowRun === attempts.find(a => a.suite === one.suite).workflowRun));
|
|
507
|
+
const whole = onlyRunner && adapters.github.complete !== undefined && await adapters.github.complete(j.github, j.candidate.sha);
|
|
508
|
+
const already = j.ciRerun?.sha === j.candidate.sha;
|
|
509
|
+
if (runner && whole && !already && adapters.github.rerun !== undefined) {
|
|
510
|
+
const ids = [...new Set(attempts.map(one => one.workflowRun))];
|
|
511
|
+
j.ciRerun = { sha: j.candidate.sha, runs: ids, at: adapters.now().toISOString() };
|
|
512
|
+
save();
|
|
513
|
+
for (const id of ids) {
|
|
514
|
+
let asked;
|
|
515
|
+
try {
|
|
516
|
+
asked = await adapters.github.rerun(j.github, id);
|
|
517
|
+
}
|
|
518
|
+
catch (error) {
|
|
519
|
+
asked = { ok: false, why: String(error?.message ?? error).slice(0, 200) };
|
|
520
|
+
}
|
|
521
|
+
say(asked.ok ? ` GitHub's runner failed before the tests ran (${words}): Toolroll ran workflow run ${id} again, once, on ${short}`
|
|
522
|
+
: ` GitHub didn't run workflow run ${id} again (${asked.why}). Rerun the failed job on GitHub or push a fix; Toolroll waits for it.`);
|
|
523
|
+
}
|
|
524
|
+
red = `GitHub's checks failed on ${short}: ${words}.`;
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const now = `GitHub's checks failed on ${short}: ${words}.`;
|
|
528
|
+
if (red !== now)
|
|
529
|
+
say(` ${now} ${runner && already ? "Toolroll already ran it again once. " : ""}Rerun the failed job on GitHub or push a fix; Toolroll waits for it.`);
|
|
530
|
+
red = now;
|
|
531
|
+
};
|
|
532
|
+
const redAtLimit = (nothing) => () => red === null ? null : new Stop("ci-failed", `${red} ${nothing}. ${j.approval === null ? "" : `The approval covers ${j.candidate.sha.slice(0, 7)} only. `}Rerun the failed job on GitHub or push a fix, then run \`${resume}\`.`);
|
|
387
533
|
let epoch = null;
|
|
388
|
-
const owner = `${j.id}:${randomUUID()}`;
|
|
534
|
+
const owner = `${j.id}:${options.leaseOwner ?? randomUUID()}`;
|
|
389
535
|
const hold = async () => {
|
|
390
536
|
if (rel === undefined || !j.authority)
|
|
391
537
|
return;
|
|
@@ -398,8 +544,26 @@ export async function runRelease(options, adapters) {
|
|
|
398
544
|
const reconcile = async () => {
|
|
399
545
|
if (rel === undefined || !j.authority)
|
|
400
546
|
return;
|
|
401
|
-
for (
|
|
402
|
-
const inFlight = () => new Stop("operation-in-flight", `An earlier ${op.kind} (operation ${op.id})
|
|
547
|
+
for (let op of (await rel.operations(j.authority.id)).filter(one => one.state === "reserved" || one.state === "running" || one.state === "unknown")) {
|
|
548
|
+
const inFlight = (why = "was started by a process that may still be running") => new Stop("operation-in-flight", `An earlier ${op.kind} (operation ${op.id}) ${why}. Nothing was settled.`);
|
|
549
|
+
if (op.state !== "reserved" && !op.issuerGone && op.issuedHere !== true && !(op.kind === "deploy" && await served(adapters, builtHead()) !== null)) {
|
|
550
|
+
const authority = j.authority.id;
|
|
551
|
+
const waited = await waitFor("quiet", `the process that started the earlier ${op.kind} (operation ${op.id}) to end`, async () => {
|
|
552
|
+
if (epoch !== null && !await rel.renew(authority, owner, epoch))
|
|
553
|
+
throw new Stop("lease", "Another release coordinator took over this release.");
|
|
554
|
+
const now = (await rel.operations(authority)).find(one => one.id === op.id);
|
|
555
|
+
if (now === undefined || now.state === "succeeded" || now.state === "failed")
|
|
556
|
+
return { settled: true };
|
|
557
|
+
if (now.issuerGone)
|
|
558
|
+
return { settled: false, op: now };
|
|
559
|
+
if (now.issuedHere === true)
|
|
560
|
+
throw inFlight("was started by this process, and its answer was lost");
|
|
561
|
+
return null;
|
|
562
|
+
}, () => inFlight(`was started by a process still running after ${limits.quiet} minutes`));
|
|
563
|
+
if (waited.settled)
|
|
564
|
+
continue;
|
|
565
|
+
op = waited.op;
|
|
566
|
+
}
|
|
403
567
|
if (op.kind === "deploy") {
|
|
404
568
|
if (op.state === "reserved") {
|
|
405
569
|
await rel.finish(op.id, "failed", { detail: "the call never started" }, epoch);
|
|
@@ -410,7 +574,7 @@ export async function runRelease(options, adapters) {
|
|
|
410
574
|
continue;
|
|
411
575
|
}
|
|
412
576
|
if (!op.issuerGone)
|
|
413
|
-
throw inFlight();
|
|
577
|
+
throw inFlight(op.issuedHere === true ? "was started by this process, and its answer was lost" : undefined);
|
|
414
578
|
if (op.direct) {
|
|
415
579
|
if (!await adapters.toolroll.deploymentIdle(op.stage))
|
|
416
580
|
throw new Stop("deploy-recovery", `A person's deploy of this release (operation ${op.id}) ended without finishing${op.stage === null ? "" : `; its journal is in ${op.stage}`}. Recover it, then rerun.`);
|
|
@@ -427,7 +591,7 @@ export async function runRelease(options, adapters) {
|
|
|
427
591
|
else if (op.state === "reserved")
|
|
428
592
|
await rel.finish(op.id, "failed", { detail: "reconciled: the merge never started" }, epoch);
|
|
429
593
|
else if (!op.issuerGone)
|
|
430
|
-
throw inFlight();
|
|
594
|
+
throw inFlight(op.issuedHere === true ? "was started by this process, and its answer was lost" : undefined);
|
|
431
595
|
else if (pr?.state === "open" && pr.number === j.pr && pr.head === op.candidate)
|
|
432
596
|
await rel.finish(op.id, "failed", { detail: "reconciled: the merge's process ended and the pull request is still open at the gated head" }, epoch);
|
|
433
597
|
else
|
|
@@ -634,8 +798,10 @@ export async function runRelease(options, adapters) {
|
|
|
634
798
|
const verdict = prChecksVerdict(runs, j.candidate.sha, REQUIRED_PR_CHECKS, { workflow: REQUIRED_PR_CHECKS_WORKFLOW });
|
|
635
799
|
await noteCi(runs, verdict);
|
|
636
800
|
if (verdict.state === "failed") {
|
|
637
|
-
|
|
801
|
+
await ciRed(runs, verdict);
|
|
802
|
+
return false;
|
|
638
803
|
}
|
|
804
|
+
red = null;
|
|
639
805
|
if (verdict.state !== "passed")
|
|
640
806
|
return false;
|
|
641
807
|
await liftCiHold(ask, nothing);
|
|
@@ -653,12 +819,12 @@ export async function runRelease(options, adapters) {
|
|
|
653
819
|
await watch("deploy");
|
|
654
820
|
if (await ciWhileRunning("Nothing was deployed, merged, tagged or published", false))
|
|
655
821
|
return true;
|
|
656
|
-
if (!said) {
|
|
822
|
+
if (!said && red === null) {
|
|
657
823
|
say(` ${CI_RUNNING_WORDS}`);
|
|
658
824
|
said = true;
|
|
659
825
|
}
|
|
660
826
|
return null;
|
|
661
|
-
});
|
|
827
|
+
}, redAtLimit("Nothing was deployed, merged, tagged or published"));
|
|
662
828
|
};
|
|
663
829
|
const approved = async (gate, action = "dispatch") => {
|
|
664
830
|
if (gate.candidate !== j.candidate.sha || gate.scopeDigest !== j.task.scopeDigest)
|
|
@@ -757,7 +923,7 @@ export async function runRelease(options, adapters) {
|
|
|
757
923
|
j.task.scopeDigest = existing.scopeDigest;
|
|
758
924
|
}
|
|
759
925
|
else {
|
|
760
|
-
const settled = isMain ? true : await earlyChecks(adapters, j, (what, probe) => waitFor("gate", what, probe), { pendingIsEnough: true, seen: (runs, verdict) => noteCi(runs, verdict) });
|
|
926
|
+
const settled = isMain ? true : await earlyChecks(adapters, j, (what, probe) => waitFor("gate", what, probe), { pendingIsEnough: true, seen: (runs, verdict) => noteCi(runs, verdict), red: ciRed });
|
|
761
927
|
if (!settled)
|
|
762
928
|
await rel?.auto?.ciRunning?.(j.task.id, j.candidate.sha);
|
|
763
929
|
j.ciAhead = !settled;
|
|
@@ -812,8 +978,13 @@ export async function runRelease(options, adapters) {
|
|
|
812
978
|
say(` Not approved automatically: ${authorized.why}. A person approves it.`);
|
|
813
979
|
}
|
|
814
980
|
}
|
|
815
|
-
if (j.ciAhead === true)
|
|
816
|
-
await
|
|
981
|
+
if (j.ciAhead === true && !await ciWhileRunning("Nothing was deployed or merged", true) && red !== null) {
|
|
982
|
+
await waitFor("approval", `a rerun or a fix of the failed checks on ${j.candidate.sha.slice(0, 7)}`, async () => {
|
|
983
|
+
await watch("dispatch");
|
|
984
|
+
await ciWhileRunning("Nothing was deployed or merged", true);
|
|
985
|
+
return red === null ? true : null;
|
|
986
|
+
}, redAtLimit("Nothing was deployed or merged"));
|
|
987
|
+
}
|
|
817
988
|
await tell(ready => ready.asked(j.task.id));
|
|
818
989
|
say(` The release scope needs your approval: \`toolroll task approve ${j.task.id} --digest ${j.task.scopeDigest}\`, or open the task in the console.`);
|
|
819
990
|
say(` Or approve it from here: \`toolroll release approve ${isMain ? j.packageVersion : releaseBranchArg(j.branch)}\`.`);
|
|
@@ -830,7 +1001,7 @@ export async function runRelease(options, adapters) {
|
|
|
830
1001
|
if (!owner.ok && gate.approval !== null && owner.why !== "the approval is for different scope text")
|
|
831
1002
|
throw new Stop("approval", `Task ${j.task.id} was ${owner.why}; the release needs a person to approve it.`);
|
|
832
1003
|
return owner.ok ? owner : null;
|
|
833
|
-
});
|
|
1004
|
+
}, redAtLimit("Nothing was deployed or merged"));
|
|
834
1005
|
j.approval = { by: approved.by, at: approved.at };
|
|
835
1006
|
say(` approved by ${approved.by}`);
|
|
836
1007
|
if (rel !== undefined) {
|
|
@@ -909,7 +1080,7 @@ export async function runRelease(options, adapters) {
|
|
|
909
1080
|
if (j.auto?.state === "checking" && !j.authority) {
|
|
910
1081
|
if (j.ciAhead === true) {
|
|
911
1082
|
try {
|
|
912
|
-
await earlyChecks(adapters, j, (what, probe) => waitFor("gate", what, probe), { nothing: "Nothing was approved" });
|
|
1083
|
+
await earlyChecks(adapters, j, (what, probe) => waitFor("gate", what, probe), { nothing: "Nothing was approved", red: ciRed });
|
|
913
1084
|
await liftCiHold(false, "Nothing was approved");
|
|
914
1085
|
}
|
|
915
1086
|
catch (error) {
|
|
@@ -1023,6 +1194,9 @@ export async function runRelease(options, adapters) {
|
|
|
1023
1194
|
const result = await adapters.toolroll.deploy({ run: check.run, worktree: check.worktree, stage: j.deployAttempt.stage, ...(operation === undefined ? {} : { operation: { id: operation, secret } }) });
|
|
1024
1195
|
if (operation !== undefined)
|
|
1025
1196
|
await rel.finish(operation, result.ok ? "succeeded" : "failed", { detail: result.ok ? result.runtime : result.message.slice(0, 500) }, epoch);
|
|
1197
|
+
if (!result.ok && result.gate === undefined && result.message.includes("Current work must finish first") && await adapters.toolroll.deploymentIdle(j.deployAttempt.stage)) {
|
|
1198
|
+
throw new Stop("deploy-busy", `The deployment of run ${check.run} waited: ${result.message.replace(/\s*The deployment checks once[\s\S]*$/, "")} Nothing was changed.`);
|
|
1199
|
+
}
|
|
1026
1200
|
if (!result.ok)
|
|
1027
1201
|
throw deployStop("deploy", `The deployment of run ${check.run} stopped: ${result.message}`, result);
|
|
1028
1202
|
if (!/[\\/]dist$/.test(result.runtime))
|
|
@@ -1049,11 +1223,19 @@ export async function runRelease(options, adapters) {
|
|
|
1049
1223
|
j.links = await adapters.toolroll.cliLinks();
|
|
1050
1224
|
intend("link");
|
|
1051
1225
|
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1226
|
+
for (let attempt = 1;; attempt++) {
|
|
1227
|
+
try {
|
|
1228
|
+
await adapters.toolroll.switchLinks(j.links, join(runtime, "bin.js"), j.packageVersion);
|
|
1229
|
+
break;
|
|
1230
|
+
}
|
|
1231
|
+
catch (error) {
|
|
1232
|
+
if (attempt >= RELINK_TRIES)
|
|
1233
|
+
throw new Stop("link", `The CLI names were not moved to ${runtime} after ${RELINK_TRIES} tries (they point where they did): ${error.message}. The service already runs the new build; nothing else changed.`);
|
|
1234
|
+
say(` the CLI names didn't move to ${runtime} (${error.message}); they point where they did, and Toolroll tries again`);
|
|
1235
|
+
await adapters.sleep(RELINK_PAUSE_MS * attempt);
|
|
1236
|
+
if (await served(adapters, builtHead()) !== runtime)
|
|
1237
|
+
throw new Stop("drift", `The console and worker no longer run ${runtime}; the CLI names were not moved.`);
|
|
1238
|
+
}
|
|
1057
1239
|
}
|
|
1058
1240
|
const everywhere = await deployed(adapters, builtHead());
|
|
1059
1241
|
if (everywhere !== runtime)
|
|
@@ -1134,7 +1316,17 @@ export async function runRelease(options, adapters) {
|
|
|
1134
1316
|
catch (error) {
|
|
1135
1317
|
if (operation !== undefined)
|
|
1136
1318
|
await rel.finish(operation, "unknown", { detail: String(error?.message ?? error).slice(0, 500) }, epoch);
|
|
1137
|
-
|
|
1319
|
+
if (!transientNetworkError(error))
|
|
1320
|
+
throw error;
|
|
1321
|
+
const truth = await writeTruth("the merge", async () => {
|
|
1322
|
+
const pr = await adapters.github.pullRequest(j.github, j.branch);
|
|
1323
|
+
return pr?.state === "merged" && pr.number === j.pr && pr.head === j.candidate.sha && pr.base === "main" && pr.mergeCommit !== null ? pr.mergeCommit : null;
|
|
1324
|
+
});
|
|
1325
|
+
if (truth === null)
|
|
1326
|
+
throw writeUnknown(`merging pull request #${j.pr}`, error);
|
|
1327
|
+
if (operation !== undefined)
|
|
1328
|
+
await rel.finish(operation, "succeeded", { externalRef: truth, detail: "reconciled: GitHub shows it merged from the gated head" }, epoch);
|
|
1329
|
+
merged = truth;
|
|
1138
1330
|
}
|
|
1139
1331
|
if (operation !== undefined)
|
|
1140
1332
|
await rel.finish(operation, "succeeded", { externalRef: merged }, epoch);
|
|
@@ -1169,7 +1361,15 @@ export async function runRelease(options, adapters) {
|
|
|
1169
1361
|
await autoCiHolds("the tag");
|
|
1170
1362
|
await nightlyHolds("tag");
|
|
1171
1363
|
intend("tag");
|
|
1172
|
-
|
|
1364
|
+
try {
|
|
1365
|
+
await adapters.github.createTag(j.github, j.tag, merge.sha);
|
|
1366
|
+
}
|
|
1367
|
+
catch (error) {
|
|
1368
|
+
if (!transientNetworkError(error))
|
|
1369
|
+
throw error;
|
|
1370
|
+
if (await writeTruth("the tag", async () => (await adapters.github.tag(j.github, j.tag)) === merge.sha ? true : null) === null)
|
|
1371
|
+
throw writeUnknown(`creating ${j.tag}`, error);
|
|
1372
|
+
}
|
|
1173
1373
|
}
|
|
1174
1374
|
j.tagged = { sha: merge.sha };
|
|
1175
1375
|
advance("publish");
|
|
@@ -1232,9 +1432,12 @@ export async function runRelease(options, adapters) {
|
|
|
1232
1432
|
return { ok: true, journal: j, file };
|
|
1233
1433
|
}
|
|
1234
1434
|
catch (error) {
|
|
1235
|
-
const stop = error instanceof Stop ? error
|
|
1435
|
+
const stop = error instanceof Stop ? error
|
|
1436
|
+
: error instanceof CheckoutBusy ? new Stop("checkout-busy", `Toolroll's own git on ${options.checkout} was still busy (another of its git commands is still running). Nothing was changed.`)
|
|
1437
|
+
: transientNetworkError(error) ? new Stop("network", `GitHub didn't answer a read (${networkWords(error)}).`)
|
|
1438
|
+
: new Stop("error", String(error?.message ?? error));
|
|
1236
1439
|
if (journal !== null) {
|
|
1237
|
-
journal.stopped = { step: journal.step, reason: stop.reason, message: stop.message, at: adapters.now().toISOString() };
|
|
1440
|
+
journal.stopped = { step: journal.step, reason: stop.reason, message: stop.message, at: adapters.now().toISOString(), ...(stop.waited === null ? {} : { waited: stop.waited }) };
|
|
1238
1441
|
try {
|
|
1239
1442
|
save();
|
|
1240
1443
|
}
|
|
@@ -1248,7 +1451,7 @@ export async function runRelease(options, adapters) {
|
|
|
1248
1451
|
catch { }
|
|
1249
1452
|
}
|
|
1250
1453
|
}
|
|
1251
|
-
return { ok: false, reason: stop.reason, message: stop.message, step: journal?.step ?? step, journal, file, resume };
|
|
1454
|
+
return { ok: false, reason: stop.reason, message: stop.message, step: journal?.step ?? step, journal, file, resume, ...(stop.waited === null ? {} : { waited: stop.waited }) };
|
|
1252
1455
|
}
|
|
1253
1456
|
}
|
|
1254
1457
|
async function begin(options, adapters, now) {
|
|
@@ -1258,7 +1461,7 @@ async function begin(options, adapters, now) {
|
|
|
1258
1461
|
const installed = await adapters.toolroll.installed();
|
|
1259
1462
|
const runtimes = new Set([...installed.services, ...installed.clis.map(one => one.runtime ?? "(not linked)")]);
|
|
1260
1463
|
if (installed.services.length === 0 || runtimes.size !== 1) {
|
|
1261
|
-
throw new Stop("mixed-runtime",
|
|
1464
|
+
throw new Stop("mixed-runtime", mixedRuntimeWords(installed));
|
|
1262
1465
|
}
|
|
1263
1466
|
const github = await adapters.repo.github();
|
|
1264
1467
|
await adapters.repo.sync(branch);
|
|
@@ -1313,7 +1516,7 @@ async function beginMain(options, adapters, now) {
|
|
|
1313
1516
|
const installed = await adapters.toolroll.installed();
|
|
1314
1517
|
const runtimes = new Set([...installed.services, ...installed.clis.map(one => one.runtime ?? "(not linked)")]);
|
|
1315
1518
|
if (installed.services.length === 0 || runtimes.size !== 1) {
|
|
1316
|
-
throw new Stop("mixed-runtime",
|
|
1519
|
+
throw new Stop("mixed-runtime", mixedRuntimeWords(installed));
|
|
1317
1520
|
}
|
|
1318
1521
|
const github = await adapters.repo.github();
|
|
1319
1522
|
const nothing = "Nothing was checked, deployed, tagged or published";
|
|
@@ -1432,7 +1635,7 @@ async function earlyChecks(adapters, j, wait, options = {}) {
|
|
|
1432
1635
|
const nothing = options.nothing ?? "Nothing was filed or sent for approval";
|
|
1433
1636
|
const sha = j.candidate.sha.slice(0, 7);
|
|
1434
1637
|
const required = REQUIRED_PR_CHECKS;
|
|
1435
|
-
let named = "", unread = false;
|
|
1638
|
+
let named = "", unread = false, failing = null;
|
|
1436
1639
|
try {
|
|
1437
1640
|
return await wait(`the pull request checks on ${sha}`, async () => {
|
|
1438
1641
|
let runs;
|
|
@@ -1447,6 +1650,11 @@ async function earlyChecks(adapters, j, wait, options = {}) {
|
|
|
1447
1650
|
}
|
|
1448
1651
|
const verdict = prChecksVerdict(runs.filter(run => required.includes(run.name)), j.candidate.sha, required, { workflow: REQUIRED_PR_CHECKS_WORKFLOW });
|
|
1449
1652
|
await options.seen?.(runs, verdict);
|
|
1653
|
+
failing = verdict.state === "failed" ? verdict.failed : null;
|
|
1654
|
+
if (verdict.state === "failed" && options.red !== undefined) {
|
|
1655
|
+
await options.red(runs, verdict);
|
|
1656
|
+
return null;
|
|
1657
|
+
}
|
|
1450
1658
|
if (verdict.state === "failed") {
|
|
1451
1659
|
throw new Stop("ci-failed", `Pull request checks already failed on ${sha}: ${verdict.failed.join(", ")}. ${nothing}. Fix the branch, then release the new commit with \`toolroll release ${j.branch} --repo ${j.checkout} --new\` (or rerun the failed job on GitHub and run this command again).`);
|
|
1452
1660
|
}
|
|
@@ -1465,6 +1673,9 @@ async function earlyChecks(adapters, j, wait, options = {}) {
|
|
|
1465
1673
|
catch (error) {
|
|
1466
1674
|
if (!(error instanceof Stop) || error.reason !== "timeout")
|
|
1467
1675
|
throw error;
|
|
1676
|
+
const stillRed = failing;
|
|
1677
|
+
if (stillRed !== null)
|
|
1678
|
+
throw new Stop("ci-failed", `Pull request checks failed on ${sha}: ${stillRed.join(", ")}. ${nothing}. Rerun the failed job on GitHub or push a fix, then run this command again.`);
|
|
1468
1679
|
throw new Stop("ci-missing", `Pull request checks on ${sha} didn't all finish in time${named === "" ? (unread ? " (GitHub didn't answer)" : "") : `: ${named}`}. ${nothing}. Start or rerun them on GitHub, then run this command again.`);
|
|
1469
1680
|
}
|
|
1470
1681
|
}
|
|
@@ -1478,6 +1689,7 @@ function networkWords(error) {
|
|
|
1478
1689
|
}
|
|
1479
1690
|
export function prChecksVerdict(runs, head, required, options = {}) {
|
|
1480
1691
|
const failed = [], waiting = [], failures = [];
|
|
1692
|
+
const failedAttempts = [];
|
|
1481
1693
|
const valid = [];
|
|
1482
1694
|
for (const run of runs) {
|
|
1483
1695
|
const advisory = Object.hasOwn(ADVISORY_PR_CHECKS, run.name) ? ADVISORY_PR_CHECKS[run.name] : undefined;
|
|
@@ -1542,6 +1754,7 @@ export function prChecksVerdict(runs, head, required, options = {}) {
|
|
|
1542
1754
|
}
|
|
1543
1755
|
if (latest.conclusion !== "success") {
|
|
1544
1756
|
failed.push(`${name} (${latest.conclusion ?? "no conclusion"})`);
|
|
1757
|
+
failedAttempts.push(latest);
|
|
1545
1758
|
continue;
|
|
1546
1759
|
}
|
|
1547
1760
|
}
|
|
@@ -1568,7 +1781,7 @@ export function prChecksVerdict(runs, head, required, options = {}) {
|
|
|
1568
1781
|
if (!judged.has(name))
|
|
1569
1782
|
waiting.push(`${name} (not started)`);
|
|
1570
1783
|
if (failed.length > 0)
|
|
1571
|
-
return { state: "failed", failed };
|
|
1784
|
+
return failedAttempts.length === failed.length ? { state: "failed", failed, attempts: failedAttempts } : { state: "failed", failed };
|
|
1572
1785
|
return waiting.length > 0 ? { state: "pending", waiting } : { state: "passed", failures };
|
|
1573
1786
|
}
|
|
1574
1787
|
export function checkFailedWords(input) {
|
|
@@ -1596,3 +1809,13 @@ export function workflowIs(path, file) {
|
|
|
1596
1809
|
}
|
|
1597
1810
|
const RELEASE_WORDS = new Set(["status", "nightly", "carry", "revoke", "ask-every-commit", "unsandboxed-carry", "auto-approve", "publish-ok", "approve"]);
|
|
1598
1811
|
export function releaseBranchArg(branch) { return RELEASE_WORDS.has(branch) ? `--branch ${branch}` : branch; }
|
|
1812
|
+
export function mixedRuntimeWords(installed) {
|
|
1813
|
+
const version = (dist) => dist === null ? null : installed.versions?.[dist] ?? null;
|
|
1814
|
+
const named = (label, dist) => `${label} ${dist ?? "not linked"}${version(dist) === null ? "" : ` (${version(dist)})`}`;
|
|
1815
|
+
const list = [...installed.services.map(one => named("service", one)), ...installed.clis.map(one => named(one.name, one.runtime))].join("; ");
|
|
1816
|
+
const service = installed.services.map(version).find(one => one !== null) ?? null;
|
|
1817
|
+
const cli = installed.clis.map(one => version(one.runtime)).find(one => one !== null) ?? null;
|
|
1818
|
+
const newer = service !== null && cli !== null && isNewer(cli, service) ? ` \`toolroll\` is ${cli}, newer than the ${service} your service runs.` : "";
|
|
1819
|
+
const fix = installed.services.length === 0 ? " Update them to one verified build first." : " Run `toolroll update --yes` to bring them to one verified build, then release again.";
|
|
1820
|
+
return `The console, worker and CLI names don't run one build (${list}).${newer}${fix}`;
|
|
1821
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { ChatCore } from "./chat-core.js";
|
|
3
3
|
import { retireCompanionOnRestore } from "./companion/store.js";
|
|
4
|
+
import { cancelPhoneWork, PHONE_RESTORED } from "./companion/chat-origin.js";
|
|
4
5
|
import { CHAT_PROVIDERS } from "./contracts/chat-tables.js";
|
|
5
6
|
import { revokeCoordinator } from "./coordinator.js";
|
|
6
7
|
import { autoPublishHeld, holdAutoPublish, PUBLISH_ALLOWED_ACTION, PUBLISH_HELD_ACTION } from "./release-auto.js";
|
|
@@ -108,6 +109,7 @@ export function retireRestoredAuthority(store, options) {
|
|
|
108
109
|
for (const table of CHAT_DECIDE_TABLES)
|
|
109
110
|
store.handle.prepare(`UPDATE ${table} SET consumed_at = ? WHERE consumed_at IS NULL`).run(stamp);
|
|
110
111
|
store.handle.prepare("UPDATE chat_note_draft SET state = 'discarded' WHERE state IN ('pending', 'armed')").run();
|
|
112
|
+
cancelPhoneWork(store, { all: true }, PHONE_RESTORED, now);
|
|
111
113
|
retireCompanionOnRestore(store.handle);
|
|
112
114
|
const afterIdentity = store.workspaceIdentity();
|
|
113
115
|
if (afterIdentity.id !== identity.id || afterIdentity.recoveryGeneration !== nextGeneration || excluded.has(afterIdentity.recoveryGeneration)) {
|
|
@@ -132,7 +134,8 @@ export function retireRestoredAuthority(store, options) {
|
|
|
132
134
|
|| count(store, "SELECT count(*) AS n FROM chat_binding WHERE revoked IS NULL") !== 0
|
|
133
135
|
|| count(store, "SELECT count(*) AS n FROM chat_room WHERE revoked IS NULL") !== 0
|
|
134
136
|
|| count(store, "SELECT count(*) AS n FROM chat_pair WHERE consumed IS NULL") !== 0
|
|
135
|
-
|| openChatActions(store) !== 0
|
|
137
|
+
|| openChatActions(store) !== 0
|
|
138
|
+
|| count(store, "SELECT count(*) AS n FROM lead_queue WHERE origin = 'phone' AND status IN ('queued', 'running')") !== 0) {
|
|
136
139
|
throw new Error("Restored credential retirement postcondition failed");
|
|
137
140
|
}
|
|
138
141
|
return {
|
package/dist/result-review.js
CHANGED
|
@@ -97,9 +97,6 @@ export function evidenceProblemDetailsOf(input) {
|
|
|
97
97
|
missing("The no-change conclusion has no handoff record.");
|
|
98
98
|
return problems;
|
|
99
99
|
}
|
|
100
|
-
export function evidenceProblemsOf(input) {
|
|
101
|
-
return evidenceProblemDetailsOf(input).map(one => one.words);
|
|
102
|
-
}
|
|
103
100
|
export function evidenceHealthOf(problems) {
|
|
104
101
|
const health = { damaged: 0, shortened: 0, missing: 0 };
|
|
105
102
|
for (const one of problems)
|
package/dist/retention-ui.js
CHANGED
|
@@ -7,7 +7,7 @@ export const RETENTION_CSS = "";
|
|
|
7
7
|
const listWords = (parts) => parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
|
|
8
8
|
function nextWords(view) {
|
|
9
9
|
if (RETENTION_KINDS.every(({ kind }) => view.periods[kind] === null))
|
|
10
|
-
return "
|
|
10
|
+
return "Only settled progress updates and undeliverable old delivery records go (after 30 days); everything else is kept forever.";
|
|
11
11
|
const due = view.next.filter(one => one.count > 0);
|
|
12
12
|
if (due.length === 0)
|
|
13
13
|
return "Nothing is old enough to remove yet.";
|