next-issue 6.6.111 → 6.6.112
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 +6 -2
- package/dist/fix.mjs +23 -10
- package/dist/gate.mjs +1 -1
- package/dist/git.mjs +9 -0
- package/dist/ports.mjs +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -271,8 +271,12 @@ and comments the reason on the issue, when:
|
|
|
271
271
|
- the fixer reports that the checks fail for a reason the change did not cause,
|
|
272
272
|
such as a test already broken on the base branch or one that fails only under
|
|
273
273
|
load. It changes nothing and the reason reaches the issue, rather than
|
|
274
|
-
the fixer spending its whole budget on a failure it cannot fix.
|
|
275
|
-
|
|
274
|
+
the fixer spending its whole budget on a failure it cannot fix. The revert
|
|
275
|
+
of the change reuses the worktree, so a change the fixer leaves behind does
|
|
276
|
+
not stay there: its edits are committed with no hooks on top of any commit
|
|
277
|
+
of its own, that commit moves to a new local `<n>-dispute-<commit>` branch,
|
|
278
|
+
and the hand-over comment names that branch. The branch goes away with the
|
|
279
|
+
`<n>` branch when the issue is done;
|
|
276
280
|
- a fixer disputes or settles the findings and leaves a change behind, either
|
|
277
281
|
in the worktree or in a commit of its own. A dispute carries a reason, not a
|
|
278
282
|
diff, so the harness throws none of it away: an unclean worktree stays on
|
package/dist/fix.mjs
CHANGED
|
@@ -9,11 +9,16 @@ import { fallbackTitle, runRole } from './job.mjs';
|
|
|
9
9
|
import { fixPrompt, hookPrompt } from './prompts.mjs';
|
|
10
10
|
import { writeState } from './state.mjs';
|
|
11
11
|
import { keepTail } from './text.mjs';
|
|
12
|
-
export function escalateCheckFix(job, unrelated, checks, after = '') {
|
|
12
|
+
export function escalateCheckFix(job, unrelated, checks, after = '', aside) {
|
|
13
13
|
if (unrelated === undefined) {
|
|
14
14
|
return escalateAndFinish(job, `The fixer added no commit for the failed ${checks}.${after}`, 'no fix commit');
|
|
15
15
|
}
|
|
16
|
-
return escalateAndFinish(job, `The ${checks} fail for a reason this change did not cause: ${unrelated}${after}`, 'unrelated failure');
|
|
16
|
+
return escalateAndFinish(job, `The ${checks} fail for a reason this change did not cause: ${unrelated}${savedIn(aside)}${after}`, 'unrelated failure');
|
|
17
|
+
}
|
|
18
|
+
function savedIn(aside) {
|
|
19
|
+
return aside === undefined
|
|
20
|
+
? ''
|
|
21
|
+
: ` The fixer left a change behind; it is saved in the branch \`${aside}\`.`;
|
|
17
22
|
}
|
|
18
23
|
export async function fixRound(job, reason, detail, earlier, kind) {
|
|
19
24
|
const { context, issue, log, worktree } = job;
|
|
@@ -25,11 +30,11 @@ export async function fixRound(job, reason, detail, earlier, kind) {
|
|
|
25
30
|
}
|
|
26
31
|
const unrelated = parseUnrelated(text);
|
|
27
32
|
if (unrelated !== undefined) {
|
|
28
|
-
return disputedFix(job, before, reason, { unrelated });
|
|
33
|
+
return disputedFix(job, before, reason, { unrelated }, kind);
|
|
29
34
|
}
|
|
30
35
|
const resolved = kind === 'review' ? parseResolved(text) : undefined;
|
|
31
36
|
if (resolved !== undefined) {
|
|
32
|
-
return disputedFix(job, before, reason, { resolved });
|
|
37
|
+
return disputedFix(job, before, reason, { resolved }, kind);
|
|
33
38
|
}
|
|
34
39
|
const subject = parseCommitSubject(text, `fix: address feedback on issue #${issue.number}`);
|
|
35
40
|
const title = job.state.title;
|
|
@@ -54,20 +59,28 @@ export async function runFixer(job, reason, detail, earlier, kind) {
|
|
|
54
59
|
function fixBudget(job, kind) {
|
|
55
60
|
return budgetUse(job, kind === 'review' ? 'reviewRounds' : 'ciFixes');
|
|
56
61
|
}
|
|
57
|
-
async function disputedFix(job, before, reason, note) {
|
|
58
|
-
const { context, log, worktree, branch } = job;
|
|
62
|
+
async function disputedFix(job, before, reason, note, kind) {
|
|
63
|
+
const { context, issue, log, worktree, branch } = job;
|
|
59
64
|
const { ports } = context;
|
|
65
|
+
// The revert after a failed check reuses this worktree, so edits left there would be lost.
|
|
66
|
+
const saved = kind === 'checks' &&
|
|
67
|
+
(await ports.saveEdits(worktree, `fix: edits left by the check fixer\n\nRefs #${issue.number}`));
|
|
60
68
|
const disputed = await ports.revision(worktree);
|
|
61
69
|
const moved = disputed !== before;
|
|
62
70
|
if (moved) {
|
|
63
71
|
const aside = `${branch}-dispute-${disputed.slice(0, 7)}`;
|
|
64
72
|
await ports.setAside(worktree, before, aside);
|
|
65
|
-
log.event('fix.aside', { branch: aside }, 'quiet');
|
|
73
|
+
log.event('fix.aside', { branch: aside, saved }, 'quiet');
|
|
74
|
+
if (kind === 'checks') {
|
|
75
|
+
return disputedNote(job, reason, note, { stray: true, aside });
|
|
76
|
+
}
|
|
66
77
|
}
|
|
67
|
-
|
|
78
|
+
return disputedNote(job, reason, note, { stray: moved || (await ports.isDirty(worktree)) });
|
|
79
|
+
}
|
|
80
|
+
function disputedNote(job, reason, note, left) {
|
|
68
81
|
const event = 'unrelated' in note ? 'fix.unrelated' : 'fix.resolved';
|
|
69
|
-
log.event(event, { reason, note: Object.values(note)[0],
|
|
70
|
-
return { committed: false, ...note,
|
|
82
|
+
job.log.event(event, { reason, note: Object.values(note)[0], ...left }, 'quiet');
|
|
83
|
+
return { committed: false, ...note, ...left };
|
|
71
84
|
}
|
|
72
85
|
export async function commitWork(job, before, subject, role, commit) {
|
|
73
86
|
const { context, issue, log, state, worktree } = job;
|
package/dist/gate.mjs
CHANGED
|
@@ -121,7 +121,7 @@ async function failedChecksFix(job, sha) {
|
|
|
121
121
|
}
|
|
122
122
|
if (!fix.committed) {
|
|
123
123
|
const reverted = await revertOrReport(job);
|
|
124
|
-
return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted);
|
|
124
|
+
return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted, fix.aside);
|
|
125
125
|
}
|
|
126
126
|
job.repairing = true;
|
|
127
127
|
return GATE_FIXED;
|
package/dist/git.mjs
CHANGED
|
@@ -77,6 +77,15 @@ export async function resetHard(cwd, target) {
|
|
|
77
77
|
await git(cwd, ['reset', '--hard', target]);
|
|
78
78
|
await git(cwd, ['clean', '-fd']);
|
|
79
79
|
}
|
|
80
|
+
/** Commits every edit in the worktree, with no hooks, so a later checkout cannot throw it away. */
|
|
81
|
+
export async function saveEdits(cwd, commitMessage) {
|
|
82
|
+
if (!(await isDirty(cwd))) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
await git(cwd, ['add', '-A']);
|
|
86
|
+
await git(cwd, ['commit', '--no-verify', '-m', commitMessage]);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
80
89
|
export async function setAside(cwd, target, branch) {
|
|
81
90
|
await git(cwd, ['branch', branch]);
|
|
82
91
|
if (await isDirty(cwd)) {
|
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, setAside, } from './git.mjs';
|
|
7
|
+
import { 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';
|
|
@@ -50,6 +50,7 @@ export const PORTS = {
|
|
|
50
50
|
revision,
|
|
51
51
|
runAgent,
|
|
52
52
|
runSetup,
|
|
53
|
+
saveEdits,
|
|
53
54
|
setAside,
|
|
54
55
|
setLabel,
|
|
55
56
|
squashOnto,
|