next-issue 8.2.0 → 8.2.2
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 +16 -7
- package/dist/gate.mjs +2 -2
- package/dist/git.mjs +3 -7
- package/dist/local-checks.mjs +22 -5
- package/dist/ports.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -163,9 +163,16 @@ the run handles one issue. For each issue:
|
|
|
163
163
|
`merge conflict`. When `checks` lists commands, the harness then runs
|
|
164
164
|
the setup command again in the worktree, so the checks use the
|
|
165
165
|
dependencies of the merged base. It runs the setup after it makes the
|
|
166
|
-
change one commit, and
|
|
167
|
-
it,
|
|
168
|
-
|
|
166
|
+
change one commit, and commits what the setup writes, unless git
|
|
167
|
+
ignores it, on top of that commit without hooks. Every check runs on
|
|
168
|
+
that setup commit. After the checks, the harness puts the branch back
|
|
169
|
+
at the change commit, so what this setup writes does not land on the
|
|
170
|
+
base; after a stop or kill during the checks, the next run puts the
|
|
171
|
+
branch back first. What the first setup writes, before the
|
|
172
|
+
implementer, is part of the implementer's commit and lands. When this
|
|
173
|
+
setup rewrites such a file, for example a lock file, the checks run on
|
|
174
|
+
the rewritten file, but the base gets the file of the change.
|
|
175
|
+
A change that
|
|
169
176
|
the base already holds is an `empty change` before the setup runs. A
|
|
170
177
|
setup that fails or does not finish in `setupTimeoutMinutes` keeps the
|
|
171
178
|
merged commit, stops the landing before the push and hands the
|
|
@@ -368,10 +375,12 @@ and comments the reason on the issue, when:
|
|
|
368
375
|
`<n>` branch when the issue is done. For the checks on the base, a failure
|
|
369
376
|
in a file that the change added or changed is never unrelated: when the
|
|
370
377
|
failed logs name such a file (by its path, or by a tail of its path that
|
|
371
|
-
keeps a folder
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
378
|
+
keeps a folder and has no folder before it, so `packages/a/src/index.ts`
|
|
379
|
+
does not name `packages/b/src/index.ts`), the harness refuses the claim
|
|
380
|
+
and gives the fixer another round from `maxCiFixes`, with a note that
|
|
381
|
+
names the file. A later hand-over comment of the same run, such as for a
|
|
382
|
+
fix that fails its checks too or fails to land, still names the dispute
|
|
383
|
+
branch of each refused round;
|
|
375
384
|
- a fixer disputes or settles the findings and leaves a change behind, either
|
|
376
385
|
in the worktree or in a commit of its own. A dispute carries a reason, not a
|
|
377
386
|
diff, and a retry of the issue cleans the worktree before the next review,
|
package/dist/gate.mjs
CHANGED
|
@@ -149,14 +149,14 @@ function refusedNote(refused) {
|
|
|
149
149
|
? ''
|
|
150
150
|
: ` The last fixer called the failure unrelated, but the failed logs name \`${refused}\`, a file of this change, so the failure is not unrelated.`;
|
|
151
151
|
}
|
|
152
|
-
/** The first file of the change that the logs name, by its path or by a tail of its path that keeps a folder. */
|
|
152
|
+
/** The first file of the change that the logs name, by its path or by a tail of its path that keeps a folder and has no folder before it. */
|
|
153
153
|
function namedFile(logs, files) {
|
|
154
154
|
return files.find((file) => {
|
|
155
155
|
const parts = file.split('/');
|
|
156
156
|
const tails = parts.length === 1
|
|
157
157
|
? [file]
|
|
158
158
|
: parts.slice(0, -1).map((_, index) => parts.slice(index).join('/'));
|
|
159
|
-
return tails.some((tail) => new RegExp(`(?<![\\w
|
|
159
|
+
return tails.some((tail) => new RegExp(`(?<![\\w.${tail === file ? '' : '/'}-])${escapeRegExp(tail)}(?![\\w.-])`).test(logs));
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
function escapeRegExp(text) {
|
package/dist/git.mjs
CHANGED
|
@@ -107,13 +107,9 @@ export async function saveEdits(cwd, commitMessage) {
|
|
|
107
107
|
await git(cwd, ['commit', '--no-verify', '-m', commitMessage]);
|
|
108
108
|
return true;
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
export async function
|
|
112
|
-
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
await git(cwd, ['add', '-A']);
|
|
116
|
-
await git(cwd, ['commit', '--amend', '--no-edit', '--no-verify']);
|
|
110
|
+
/** Commits what the setup wrote on top of the change, with no hooks, so every check sees it. */
|
|
111
|
+
export async function saveSetupOutput(cwd) {
|
|
112
|
+
await saveEdits(cwd, 'chore: setup output');
|
|
117
113
|
}
|
|
118
114
|
export async function setAside(cwd, target, branch) {
|
|
119
115
|
await git(cwd, ['branch', branch]);
|
package/dist/local-checks.mjs
CHANGED
|
@@ -14,16 +14,33 @@ const COMMENT_OUTPUT_CHARS = 3000;
|
|
|
14
14
|
* or the finished hand-over.
|
|
15
15
|
*/
|
|
16
16
|
export async function localChecks(job) {
|
|
17
|
-
const { context,
|
|
18
|
-
const { config, ports } = context;
|
|
17
|
+
const { context, state, worktree } = job;
|
|
18
|
+
const { config, ports, repo } = context;
|
|
19
19
|
if (config.checks.length === 0) {
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
|
+
const change = await ports.revision(worktree);
|
|
22
23
|
const setup = await setUpBeforeChecks(job);
|
|
23
24
|
if (setup !== undefined) {
|
|
24
25
|
return setup;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
state.squashing = change;
|
|
28
|
+
await writeState(repo, state);
|
|
29
|
+
await ports.saveSetupOutput(worktree);
|
|
30
|
+
let failed;
|
|
31
|
+
try {
|
|
32
|
+
failed = await runChecks(job);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await evenWhenStopped(() => ports.discardChanges(worktree, change));
|
|
36
|
+
state.squashing = undefined;
|
|
37
|
+
await writeState(repo, state);
|
|
38
|
+
}
|
|
39
|
+
return failed === undefined ? true : failedCheck(job, failed.command, failed.result);
|
|
40
|
+
}
|
|
41
|
+
async function runChecks(job) {
|
|
42
|
+
const { context, log, worktree } = job;
|
|
43
|
+
const { config, ports } = context;
|
|
27
44
|
const head = await ports.revision(worktree);
|
|
28
45
|
for (const command of config.checks) {
|
|
29
46
|
const result = await log.step('check', { cmd: command }, () => ports.runCheck(command, worktree, minutesToMs(config.checksTimeoutMinutes), config.logMaxChars));
|
|
@@ -32,10 +49,10 @@ export async function localChecks(job) {
|
|
|
32
49
|
refuseWhenStopped();
|
|
33
50
|
log.event('check.output', { cmd: command, code: result.code, timedOut: result.timedOut, output: result.output }, 'verbose');
|
|
34
51
|
if (!succeeded(result) || result.timedOut) {
|
|
35
|
-
return
|
|
52
|
+
return { command, result };
|
|
36
53
|
}
|
|
37
54
|
}
|
|
38
|
-
return
|
|
55
|
+
return undefined;
|
|
39
56
|
}
|
|
40
57
|
function failure(job, command, result) {
|
|
41
58
|
return result.timedOut
|
package/dist/ports.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { run } from './exec.mjs';
|
|
|
4
4
|
import { commitAll } from './git-commit.mjs';
|
|
5
5
|
import { pushToBase, reapplyRevert, revertOnBase, squashOnto } from './git-land.mjs';
|
|
6
6
|
import { abortMerge, commitMerge, startMerge } from './git-merge.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, saveSetupOutput, setAside, } from './git.mjs';
|
|
8
8
|
import { canWrite, closeIssue, commentOnIssue, editIssueBody, issueComments, openBlockers, openIssues, reopenIssue, repositorySlug, threadComments, viewIssue, } from './github.mjs';
|
|
9
9
|
import { huntWorktree } from './hunt.mjs';
|
|
10
10
|
import { ensureLabel, setLabel } from './labels.mjs';
|
|
@@ -20,7 +20,6 @@ async function runCheck(command, cwd, timeoutMs, tailChars) {
|
|
|
20
20
|
}
|
|
21
21
|
export const PORTS = {
|
|
22
22
|
abortMerge,
|
|
23
|
-
amendEdits,
|
|
24
23
|
addWorktree,
|
|
25
24
|
canWrite,
|
|
26
25
|
changedFiles,
|
|
@@ -60,6 +59,7 @@ export const PORTS = {
|
|
|
60
59
|
runCheck,
|
|
61
60
|
runSetup,
|
|
62
61
|
saveEdits,
|
|
62
|
+
saveSetupOutput,
|
|
63
63
|
setAside,
|
|
64
64
|
setLabel,
|
|
65
65
|
squashOnto,
|