next-issue 7.8.15 → 7.8.16

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 CHANGED
@@ -401,7 +401,8 @@ A halt that leaves a commit on the base, or a push or revert that may be on
401
401
  it, with checks nobody awaited (`checks error`, `push unknown`,
402
402
  `main checks timeout`, `main checks cancelled`, an error or a failed setup
403
403
  on such a resume before the base is checked, or a stop or kill while the run
404
- pushes a change to the base or waits for the checks of a commit it landed) is
404
+ pushes a change to the base, waits for the checks of a commit it landed, or
405
+ fixes the failed checks of that commit before the fix lands) is
405
406
  saved in the state file of its issue. A stopped issue resumes in the next
406
407
  run; any other waits for a person, so later runs skip it. Either way, no
407
408
  later run lands another change meanwhile: an issue that reaches the landing
package/dist/gate.mjs CHANGED
@@ -5,7 +5,7 @@ import { asError, message } from './errors.mjs';
5
5
  import { escalateCheckFix, fixRound } from './fix.mjs';
6
6
  import { escalateAndFinish } from './handover.mjs';
7
7
  import { GATE_FIXED, GATE_PASSED } from './job.mjs';
8
- import { revertOrReport, sentence } from './revert.mjs';
8
+ import { revertFailedChecks, revertOrReport, sentence } from './revert.mjs';
9
9
  import { writeState } from './state.mjs';
10
10
  import { HALT_NOTE } from './unsettled.mjs';
11
11
  export async function checkGate(job, sha) {
@@ -20,13 +20,12 @@ export async function checkGate(job, sha) {
20
20
  }
21
21
  return unreadChecks(job, error);
22
22
  }
23
- // Checks that finished leave the base known, so an earlier halt on this issue no longer holds back other landings.
24
- const finished = checks === 'pass' || checks === 'none' || checks === 'fail';
25
- if (finished && job.state.halted === true) {
26
- delete job.state.halted;
27
- await writeState(job.context.repo, job.state);
28
- }
23
+ // Checks that passed leave the base known, so an earlier halt on this issue no longer holds back other landings.
29
24
  if (checks === 'pass' || checks === 'none') {
25
+ if (job.state.halted === true) {
26
+ delete job.state.halted;
27
+ await writeState(job.context.repo, job.state);
28
+ }
30
29
  return GATE_PASSED;
31
30
  }
32
31
  job.mainBroken = true;
@@ -40,6 +39,9 @@ export async function checkGate(job, sha) {
40
39
  if (checks !== 'fail') {
41
40
  return escalateAndFinish(job, `The checks on ${base} did not finish in time. ${HALT_NOTE}`, 'main checks timeout');
42
41
  }
42
+ // Failed checks leave the base broken until the fix lands, so a stop or kill before then keeps other landings back.
43
+ job.state.halted = true;
44
+ await writeState(job.context.repo, job.state);
43
45
  return failedChecksFix(job, sha);
44
46
  }
45
47
  async function waitForChecks(job, sha, fields = {}, restarted = []) {
@@ -96,7 +98,7 @@ async function failedChecksFix(job, sha, refused) {
96
98
  const { repo, config, ports, base } = context;
97
99
  const { round, limit } = budgetUse(job, 'ciFixes');
98
100
  if (round >= limit) {
99
- const reverted = await revertOrReport(job);
101
+ const reverted = await revertFailedChecks(job);
100
102
  return escalateAndFinish(job, `The checks on ${base} failed and the limit of ${limit} check fixes was reached.${reverted}`, 'check budget');
101
103
  }
102
104
  state.ciFixes += 1;
@@ -133,7 +135,7 @@ async function failedChecksFix(job, sha, refused) {
133
135
  }
134
136
  }
135
137
  if (!fix.committed) {
136
- const reverted = await revertOrReport(job);
138
+ const reverted = await revertFailedChecks(job);
137
139
  return escalateCheckFix(job, fix.unrelated, `checks on ${base}`, reverted, fix.aside);
138
140
  }
139
141
  job.repairing = true;
@@ -188,6 +190,6 @@ export async function escalateError(job, error, note, reason) {
188
190
  if (runStopped()) {
189
191
  throw error;
190
192
  }
191
- const reverted = await revertOrReport(job);
193
+ const reverted = await revertFailedChecks(job);
192
194
  return escalateAndFinish(job, `${note}: ${sentence(message(error))}${reverted}`, reason);
193
195
  }
package/dist/revert.mjs CHANGED
@@ -7,6 +7,15 @@ export async function revertFailedFix(job) {
7
7
  return '';
8
8
  }
9
9
  job.repairing = false;
10
+ return revertFailedChecks(job);
11
+ }
12
+ /** Hands over a fix of failed checks; with no stop, its saved halt gives way, so the run halt alone holds back other landings. */
13
+ export async function revertFailedChecks(job) {
14
+ const { context, state } = job;
15
+ if (state.halted === true && state.pushing === undefined && !runStopped()) {
16
+ delete state.halted;
17
+ await writeState(context.repo, state);
18
+ }
10
19
  return revertOrReport(job);
11
20
  }
12
21
  export async function revertOrReport(job) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.15",
3
+ "version": "7.8.16",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",