next-issue 16.5.3 → 16.7.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/switch-run.mjs
CHANGED
|
@@ -110,11 +110,25 @@ export function statusText(version, progress) {
|
|
|
110
110
|
lines.push(`stopping for an upgrade to ${progress.upgrade.to}`);
|
|
111
111
|
}
|
|
112
112
|
if (progress.issues.length === 0) {
|
|
113
|
-
lines.push(
|
|
113
|
+
lines.push(idleLine(progress));
|
|
114
114
|
}
|
|
115
115
|
lines.push(...progress.issues.map(issueLine));
|
|
116
116
|
return `${lines.join('\n')}\n`;
|
|
117
117
|
}
|
|
118
|
+
function idleLine(progress) {
|
|
119
|
+
if (progress.status !== 'running') {
|
|
120
|
+
return 'no issue is running';
|
|
121
|
+
}
|
|
122
|
+
const minutes = progress.nextLook === undefined
|
|
123
|
+
? 0
|
|
124
|
+
: Math.ceil((Date.parse(progress.nextLook) - Date.now()) / 60_000);
|
|
125
|
+
if (minutes > 0) {
|
|
126
|
+
return `looking again in ${minutes} ${minutes === 1 ? 'minute' : 'minutes'}`;
|
|
127
|
+
}
|
|
128
|
+
return progress.looking === true || progress.nextLook !== undefined
|
|
129
|
+
? 'looking for an issue'
|
|
130
|
+
: 'no issue is running';
|
|
131
|
+
}
|
|
118
132
|
function issueLine({ issue, step, round }) {
|
|
119
133
|
const roundText = round === undefined ? '' : ` (round ${round})`;
|
|
120
134
|
return `#${issue} ${step?.replaceAll('-', ' ') ?? 'starting'}${roundText}`;
|
package/dist/shared/watch.mjs
CHANGED
|
@@ -94,9 +94,9 @@ async function watchPasses(failed, watch) {
|
|
|
94
94
|
}
|
|
95
95
|
const minutes = backOffMinutes(step);
|
|
96
96
|
step += 1;
|
|
97
|
-
const woken = watch.watching?.changed();
|
|
97
|
+
const woken = AbortSignal.any([watch.watching?.changed(), watch.lookNow?.()].filter((signal) => signal !== undefined));
|
|
98
98
|
if (!(await watch.wait(minutes, woken))) {
|
|
99
|
-
if (woken
|
|
99
|
+
if (!woken.aborted || watch.stop() || !watching()) {
|
|
100
100
|
return { reports };
|
|
101
101
|
}
|
|
102
102
|
step = 0;
|
package/dist/worker/progress.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { minutesToMs } from '../shared/durations.mjs';
|
|
1
2
|
const STEPS = {
|
|
2
3
|
'implement.start': 'implementing',
|
|
3
4
|
'review.start': 'reviewing',
|
|
@@ -7,13 +8,22 @@ const STEPS = {
|
|
|
7
8
|
'ci-checks.start': 'waiting-for-checks',
|
|
8
9
|
};
|
|
9
10
|
export function startProgress(hunting = false) {
|
|
10
|
-
return { status: 'running', hunting, issues: [] };
|
|
11
|
+
return { status: 'running', hunting, issues: [], looking: true };
|
|
11
12
|
}
|
|
12
13
|
export function applyEvent(progress, record) {
|
|
13
14
|
const kind = record['kind'];
|
|
14
15
|
if (kind === 'issues.fail') {
|
|
15
16
|
return { ...progress, error: String(record['error']) };
|
|
16
17
|
}
|
|
18
|
+
if (kind === 'watch.wait' && typeof record['minutes'] === 'number') {
|
|
19
|
+
const ts = typeof record['ts'] === 'string' ? Date.parse(record['ts']) : Date.now();
|
|
20
|
+
const nextLook = new Date(ts + minutesToMs(record['minutes'])).toISOString();
|
|
21
|
+
return { ...progress, looking: false, nextLook };
|
|
22
|
+
}
|
|
23
|
+
if (kind === 'watch.wake') {
|
|
24
|
+
const { nextLook: _nextLook, ...rest } = progress;
|
|
25
|
+
return { ...rest, looking: true };
|
|
26
|
+
}
|
|
17
27
|
const issue = record['issue'];
|
|
18
28
|
if (typeof kind !== 'string' || typeof issue !== 'number') {
|
|
19
29
|
return progress;
|
package/dist/worker/run.mjs
CHANGED
|
@@ -75,15 +75,18 @@ export function watchRun(args, loop, context, controls, print) {
|
|
|
75
75
|
controls.onHunter?.(() => hunt.busy());
|
|
76
76
|
return watchIssues({
|
|
77
77
|
...loop,
|
|
78
|
-
wait: (minutes, woken) => {
|
|
78
|
+
wait: async (minutes, woken) => {
|
|
79
79
|
recorder.event('watch.wait', { minutes });
|
|
80
80
|
passStart = recorder.summary();
|
|
81
|
-
|
|
81
|
+
const slept = await interrupts.sleep(minutesToMs(minutes), woken);
|
|
82
|
+
recorder.record('watch.wake');
|
|
83
|
+
return slept;
|
|
82
84
|
},
|
|
83
85
|
passEnd: (issues) => print({ ...recorder.summary(passStart), issues }),
|
|
84
86
|
hunter: hunt,
|
|
85
87
|
hunting: controls.hunting ?? onOff(args.hunt),
|
|
86
88
|
watching: controls.watching,
|
|
89
|
+
lookNow: controls.lookNow,
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
92
|
function recordLoopEnd(recorder, stoppedAt, stopped, error) {
|
|
@@ -7,6 +7,7 @@ export function newRun(progress) {
|
|
|
7
7
|
return {
|
|
8
8
|
progress,
|
|
9
9
|
children: runChildren(),
|
|
10
|
+
lookNow: new AbortController(),
|
|
10
11
|
watching: onOff(progress.watching === true),
|
|
11
12
|
hunting: onOff(progress.hunting),
|
|
12
13
|
};
|
|
@@ -51,6 +52,8 @@ export function joinRun(run, given) {
|
|
|
51
52
|
if (given.hunt !== undefined) {
|
|
52
53
|
setHunting(run, given.hunt);
|
|
53
54
|
}
|
|
55
|
+
run.lookNow.abort();
|
|
56
|
+
run.lookNow = new AbortController();
|
|
54
57
|
return undefined;
|
|
55
58
|
}
|
|
56
59
|
export function stopPoint(after) {
|
|
@@ -137,6 +140,7 @@ export function runControls(run, update) {
|
|
|
137
140
|
interrupts: runInterrupts(run),
|
|
138
141
|
hunting: run.hunting,
|
|
139
142
|
watching: run.watching,
|
|
143
|
+
lookNow: () => run.lookNow.signal,
|
|
140
144
|
onEvent: (record) => update(applyEvent(run.progress, record)),
|
|
141
145
|
onHunter: (busy) => {
|
|
142
146
|
run.huntBusy = busy;
|