next-issue 7.2.0 → 7.2.1
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 +5 -1
- package/dist/gate.mjs +34 -2
- package/dist/git.mjs +21 -0
- package/dist/ports.mjs +2 -1
- package/dist/prompts.mjs +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -312,7 +312,11 @@ and comments the reason on the issue, when:
|
|
|
312
312
|
not stay there: its edits are committed with no hooks on top of any commit
|
|
313
313
|
of its own, that commit moves to a new local `<n>-dispute-<commit>` branch,
|
|
314
314
|
and the hand-over comment names that branch. The branch goes away with the
|
|
315
|
-
`<n>` branch when the issue is done
|
|
315
|
+
`<n>` branch when the issue is done. For the checks on the base, a failure
|
|
316
|
+
in a file that the change added or changed is never unrelated: when the
|
|
317
|
+
failed logs name such a file (by its path, or by a tail of its path that
|
|
318
|
+
keeps a folder), the harness refuses the claim and gives the fixer another
|
|
319
|
+
round from `maxCiFixes`, with a note that names the file;
|
|
316
320
|
- a fixer disputes or settles the findings and leaves a change behind, either
|
|
317
321
|
in the worktree or in a commit of its own. A dispute carries a reason, not a
|
|
318
322
|
diff, and a retry of the issue cleans the worktree before the next review,
|
package/dist/gate.mjs
CHANGED
|
@@ -87,7 +87,7 @@ async function rerunFailed(job, sha) {
|
|
|
87
87
|
}
|
|
88
88
|
return restarted;
|
|
89
89
|
}
|
|
90
|
-
async function failedChecksFix(job, sha) {
|
|
90
|
+
async function failedChecksFix(job, sha, refused) {
|
|
91
91
|
const { context, log, state } = job;
|
|
92
92
|
const { repo, config, ports, base } = context;
|
|
93
93
|
const { round, limit } = budgetUse(job, 'ciFixes');
|
|
@@ -108,12 +108,26 @@ async function failedChecksFix(job, sha) {
|
|
|
108
108
|
log.event('main-checks.logs', { chars: logs.length });
|
|
109
109
|
let fix;
|
|
110
110
|
try {
|
|
111
|
-
fix = await refundOnKill(job, 'ciFixes', () => fixRound(job, `The checks on ${base} failed after the change landed there
|
|
111
|
+
fix = await refundOnKill(job, 'ciFixes', () => fixRound(job, `The checks on ${base} failed after the change landed there.${refusedNote(refused)}`, logs, [], 'checks'));
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
await refundStopped(job);
|
|
115
115
|
return escalateError(job, error, `The fixer for the failed checks on ${base} failed`, 'fixer error');
|
|
116
116
|
}
|
|
117
|
+
if (!fix.committed && fix.unrelated !== undefined) {
|
|
118
|
+
let files;
|
|
119
|
+
try {
|
|
120
|
+
files = await ports.changedFiles(job.worktree, state.landed ?? []);
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
return escalateError(job, error, 'The read of the files of the change failed', 'files error');
|
|
124
|
+
}
|
|
125
|
+
const named = namedFile(logs, files);
|
|
126
|
+
if (named !== undefined) {
|
|
127
|
+
log.event('fix.refused', { file: named }, 'quiet');
|
|
128
|
+
return failedChecksFix(job, sha, named);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
117
131
|
if (!fix.committed) {
|
|
118
132
|
const reverted = await revertOrReport(job);
|
|
119
133
|
return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted, fix.aside);
|
|
@@ -121,6 +135,24 @@ async function failedChecksFix(job, sha) {
|
|
|
121
135
|
job.repairing = true;
|
|
122
136
|
return GATE_FIXED;
|
|
123
137
|
}
|
|
138
|
+
function refusedNote(refused) {
|
|
139
|
+
return refused === undefined
|
|
140
|
+
? ''
|
|
141
|
+
: ` The last fixer called the failure unrelated, but the failed logs name \`${refused}\`, a file of this change, so the failure is not unrelated.`;
|
|
142
|
+
}
|
|
143
|
+
/** The first file of the change that the logs name, by its path or by a tail of its path that keeps a folder. */
|
|
144
|
+
function namedFile(logs, files) {
|
|
145
|
+
return files.find((file) => {
|
|
146
|
+
const parts = file.split('/');
|
|
147
|
+
const tails = parts.length === 1
|
|
148
|
+
? [file]
|
|
149
|
+
: parts.slice(0, -1).map((_, index) => parts.slice(index).join('/'));
|
|
150
|
+
return tails.some((tail) => new RegExp(`(?<![\\w.-])${escapeRegExp(tail)}(?![\\w.-])`).test(logs));
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function escapeRegExp(text) {
|
|
154
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
155
|
+
}
|
|
124
156
|
async function refundStopped(job) {
|
|
125
157
|
if (runStopped()) {
|
|
126
158
|
await refundBudget(job, 'ciFixes');
|
package/dist/git.mjs
CHANGED
|
@@ -59,6 +59,27 @@ export async function isDirty(cwd) {
|
|
|
59
59
|
export async function diff(cwd, base, remote) {
|
|
60
60
|
return git(cwd, ['diff', `${remoteRef(remote, base)}...HEAD`]);
|
|
61
61
|
}
|
|
62
|
+
/** The files that the commits added or changed, as paths from the repository root. */
|
|
63
|
+
export async function changedFiles(cwd, shas) {
|
|
64
|
+
if (shas.length === 0) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
const output = await git(cwd, [
|
|
68
|
+
'show',
|
|
69
|
+
'--no-renames',
|
|
70
|
+
'--diff-filter=d',
|
|
71
|
+
'--name-only',
|
|
72
|
+
'-z',
|
|
73
|
+
'--format=',
|
|
74
|
+
...shas,
|
|
75
|
+
]);
|
|
76
|
+
return [
|
|
77
|
+
...new Set(output
|
|
78
|
+
.split('\0')
|
|
79
|
+
.map((path) => path.trim())
|
|
80
|
+
.filter(Boolean)),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
62
83
|
export async function discardChanges(cwd, target, branch) {
|
|
63
84
|
const moved = branch !== undefined && (await currentBranch(cwd)) !== branch;
|
|
64
85
|
if (!moved &&
|
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 { deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, setAside, } from './git.mjs';
|
|
7
|
+
import { changedFiles, deleteBranch, diff, discardChanges, disputeBranches, isDirty, isLanded, isOnBase, latestSubject, push, resetToBase, revision, saveEdits, setAside, } from './git.mjs';
|
|
8
8
|
import { canWrite, closeIssue, commentOnIssue, 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';
|
|
@@ -22,6 +22,7 @@ export const PORTS = {
|
|
|
22
22
|
abortMerge,
|
|
23
23
|
addWorktree,
|
|
24
24
|
canWrite,
|
|
25
|
+
changedFiles,
|
|
25
26
|
closeIssue,
|
|
26
27
|
commentOnIssue,
|
|
27
28
|
commitAll,
|
package/dist/prompts.mjs
CHANGED
|
@@ -132,7 +132,10 @@ const CONFLICT_RULE = [
|
|
|
132
132
|
'Leave the merge in progress. The harness commits the merge and pushes it.',
|
|
133
133
|
].join('\n');
|
|
134
134
|
const KIND_RULES = {
|
|
135
|
-
checks:
|
|
135
|
+
checks: [
|
|
136
|
+
UNRELATED_RULE,
|
|
137
|
+
'A failure in a file that this change added or changed is never unrelated. When the failed logs name such a file, the harness refuses an `unrelated` line and gives you another round.',
|
|
138
|
+
].join('\n'),
|
|
136
139
|
local: UNRELATED_RULE,
|
|
137
140
|
review: [
|
|
138
141
|
DISPUTE_RULE,
|