next-issue 6.6.18 → 6.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/dist/enter-review.mjs +21 -0
- package/dist/git-land.mjs +2 -1
- package/dist/prune-runs.mjs +13 -3
- package/dist/revert.mjs +6 -0
- package/dist/state.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,11 @@ the run handles one issue. For each issue:
|
|
|
138
138
|
push that the remote refuses, for example because the base moved, makes
|
|
139
139
|
the revert again on the new base, three times at most. A failed revert
|
|
140
140
|
push that the base holds after a fetch counts as landed, and a fetch that
|
|
141
|
-
fails leaves the revert reported as failed.
|
|
141
|
+
fails leaves the revert reported as failed. The state file holds the
|
|
142
|
+
revert commit during the push, so a run stopped meanwhile checks the base
|
|
143
|
+
on resume. When the base holds the revert, the harness drops the landed
|
|
144
|
+
commits from the state, waits for no checks, does not revert again, hands
|
|
145
|
+
the issue to a person with the reason `revert stopped` and halts. A resume
|
|
142
146
|
that stopped while the checks of a landed commit ran waits for them
|
|
143
147
|
again, even when more commits landed on the base since, and a fix that
|
|
144
148
|
was committed but not landed lands first. A problem that the reviewer
|
|
@@ -279,7 +283,9 @@ Every run has an id, `<timestamp>`, and writes these under `.next-issue/runs/`:
|
|
|
279
283
|
part of the file name.
|
|
280
284
|
|
|
281
285
|
At the start of a run, the harness deletes the files and folders under
|
|
282
|
-
`.next-issue/runs/` that are older than `keepRunDays`.
|
|
286
|
+
`.next-issue/runs/` that are older than `keepRunDays`. The age of a folder is
|
|
287
|
+
the time since the last change to it or to anything inside it, so the sessions
|
|
288
|
+
of a long run stay while it still writes them. Set the field to `0` to keep them all.
|
|
283
289
|
|
|
284
290
|
A short text summary of the same data goes to standard output. Use `--json` to
|
|
285
291
|
get the full summary object there instead, so the harness fits in a pipe. All
|
package/dist/enter-review.mjs
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { escalateAndFinish } from './handover.mjs';
|
|
1
2
|
import { ROUND_CONTINUE } from './job.mjs';
|
|
2
3
|
import { resumeLanding } from './land.mjs';
|
|
3
4
|
import { writeState } from './state.mjs';
|
|
4
5
|
export async function enterReview(job) {
|
|
5
6
|
const { context, state } = job;
|
|
6
7
|
await settlePush(job);
|
|
8
|
+
if (await settleRevert(job)) {
|
|
9
|
+
job.mainBroken = true;
|
|
10
|
+
const { base } = context;
|
|
11
|
+
return escalateAndFinish(job, `The run stopped during the revert of the change on ${base}. The harness reverted the change on ${base}.`, 'revert stopped');
|
|
12
|
+
}
|
|
7
13
|
const landed = state.landed?.at(-1);
|
|
8
14
|
if (landed !== undefined) {
|
|
9
15
|
return resumeLanding(job, landed);
|
|
@@ -25,3 +31,18 @@ async function settlePush(job) {
|
|
|
25
31
|
state.pushing = undefined;
|
|
26
32
|
await writeState(repo, state);
|
|
27
33
|
}
|
|
34
|
+
async function settleRevert(job) {
|
|
35
|
+
const { context, state, worktree } = job;
|
|
36
|
+
const { repo, config, ports, base } = context;
|
|
37
|
+
const sha = state.reverting;
|
|
38
|
+
if (sha === undefined) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const reverted = await ports.isOnBase(worktree, base, config.remote, sha);
|
|
42
|
+
if (reverted) {
|
|
43
|
+
state.landed = undefined;
|
|
44
|
+
}
|
|
45
|
+
state.reverting = undefined;
|
|
46
|
+
await writeState(repo, state);
|
|
47
|
+
return reverted;
|
|
48
|
+
}
|
package/dist/git-land.mjs
CHANGED
|
@@ -35,7 +35,7 @@ export async function revertOnBase(cwd, revert) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
async function pushRevert(cwd, revert) {
|
|
38
|
-
const { base, remote, branch, shas, message, reapply } = revert;
|
|
38
|
+
const { base, remote, branch, shas, message, reapply, pushing } = revert;
|
|
39
39
|
for (let attempt = 1; attempt <= PUSH_TRIES; attempt += 1) {
|
|
40
40
|
const target = await fetchBase(cwd, base, remote);
|
|
41
41
|
await git(cwd, ['checkout', '--force', '--detach', target]);
|
|
@@ -45,6 +45,7 @@ async function pushRevert(cwd, revert) {
|
|
|
45
45
|
}
|
|
46
46
|
await git(cwd, ['commit', '--no-verify', '-m', message]);
|
|
47
47
|
const reverted = await revision(cwd);
|
|
48
|
+
await pushing(reverted);
|
|
48
49
|
if ((await pushToBase(cwd, remote, base)) || (await isOnBase(cwd, base, remote, reverted))) {
|
|
49
50
|
await git(cwd, ['revert', '--no-commit', reverted]);
|
|
50
51
|
await git(cwd, ['commit', '--no-verify', '-m', reapply]);
|
package/dist/prune-runs.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rm, stat } from 'node:fs/promises';
|
|
1
|
+
import { readdir, rm, stat } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { daysToMs } from './durations.mjs';
|
|
4
4
|
import { listOrEmpty } from './files.mjs';
|
|
@@ -20,8 +20,7 @@ export async function pruneRuns(root, keepDays) {
|
|
|
20
20
|
}
|
|
21
21
|
async function dropIfOlder(path, cutoff) {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
if (info.mtimeMs >= cutoff) {
|
|
23
|
+
if ((await newestChange(path)) >= cutoff) {
|
|
25
24
|
return false;
|
|
26
25
|
}
|
|
27
26
|
await rm(path, { force: true, recursive: true });
|
|
@@ -31,3 +30,14 @@ async function dropIfOlder(path, cutoff) {
|
|
|
31
30
|
return false;
|
|
32
31
|
}
|
|
33
32
|
}
|
|
33
|
+
async function newestChange(path) {
|
|
34
|
+
const info = await stat(path);
|
|
35
|
+
if (!info.isDirectory()) {
|
|
36
|
+
return info.mtimeMs;
|
|
37
|
+
}
|
|
38
|
+
let newest = info.mtimeMs;
|
|
39
|
+
for (const name of await readdir(path)) {
|
|
40
|
+
newest = Math.max(newest, await newestChange(join(path, name)));
|
|
41
|
+
}
|
|
42
|
+
return newest;
|
|
43
|
+
}
|
package/dist/revert.mjs
CHANGED
|
@@ -34,8 +34,14 @@ export async function revert(job) {
|
|
|
34
34
|
shas,
|
|
35
35
|
message: `revert: issue #${issue.number}\n\nRefs #${issue.number}`,
|
|
36
36
|
reapply: `${state.title ?? `fix: resolve issue #${issue.number}`}\n\nRefs #${issue.number}`,
|
|
37
|
+
pushing: async (sha) => {
|
|
38
|
+
state.reverting = sha;
|
|
39
|
+
await writeState(repo, state);
|
|
40
|
+
},
|
|
37
41
|
}));
|
|
42
|
+
state.reverting = undefined;
|
|
38
43
|
if (!pushed) {
|
|
44
|
+
await writeState(repo, state);
|
|
39
45
|
return ` The revert of the change on ${base} failed, so the landed commits stay on ${base}.`;
|
|
40
46
|
}
|
|
41
47
|
state.landed = undefined;
|
package/dist/state.mjs
CHANGED
|
@@ -57,6 +57,7 @@ function isState(value) {
|
|
|
57
57
|
isOptional(value.commitFixes, 'number') &&
|
|
58
58
|
(value.landed === undefined || isLanded(value.landed)) &&
|
|
59
59
|
isOptional(value.pushing, 'string') &&
|
|
60
|
+
isOptional(value.reverting, 'string') &&
|
|
60
61
|
isOptional(value.rerun, 'string') &&
|
|
61
62
|
typeof value.reviewRounds === 'number' &&
|
|
62
63
|
Array.isArray(value.reviewLog) &&
|