next-issue 7.8.16 → 7.8.18

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
@@ -118,8 +118,10 @@ the run handles one issue. For each issue:
118
118
  checked out, the harness checks out the issue branch again at its commit
119
119
  from before the review. It does the same when the reviewer times out or
120
120
  fails. The state file keeps that commit while the reviewer runs, so when
121
- the run stops during the review, the resumed review first puts the issue
122
- branch back at that commit, and the diff it reads holds no reviewer commit.
121
+ the run stops during the review, the next run that resumes the issue first
122
+ puts the issue branch back at that commit, before the setup command, and
123
+ the diff it reads holds no reviewer commit. A commit that a person adds to
124
+ the branch after a hand-over stays on it.
123
125
  The first reviewer also gets the reply of the implementer, and raises a
124
126
  finding when a behaviour change has no failing run of its test. A later
125
127
  reviewer gets the reply of the last review fixer instead, who quotes the
@@ -402,7 +404,8 @@ it, with checks nobody awaited (`checks error`, `push unknown`,
402
404
  `main checks timeout`, `main checks cancelled`, an error or a failed setup
403
405
  on such a resume before the base is checked, or a stop or kill while the run
404
406
  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
407
+ fixes the failed checks of that commit before the fix lands or the revert of
408
+ that commit ends) is
406
409
  saved in the state file of its issue. A stopped issue resumes in the next
407
410
  run; any other waits for a person, so later runs skip it. Either way, no
408
411
  later run lands another change meanwhile: an issue that reaches the landing
package/dist/pipeline.mjs CHANGED
@@ -4,7 +4,7 @@ import { runStopped } from './children.mjs';
4
4
  import { claimedError, dropClosed, finishClosing, stop, stopNow } from './handover.mjs';
5
5
  import { implement } from './implement.mjs';
6
6
  import { openJob } from './open-job.mjs';
7
- import { reviewRound } from './review.mjs';
7
+ import { reviewRound, settleReview } from './review.mjs';
8
8
  import { skipReport, unclaimedError } from './skip.mjs';
9
9
  import { hasLabel } from './labels.mjs';
10
10
  import { newState, readState, resetState, } from './state.mjs';
@@ -71,6 +71,7 @@ function startState(context, issue, saved, handedOver) {
71
71
  async function work(context, issue, log, state, start, handedOver, pending) {
72
72
  const { job, setup } = await beforeBaseSettled(state, context.base, async () => {
73
73
  const opened = await openJob(context, issue, log, state, start, handedOver, pending);
74
+ await settleReview(opened);
74
75
  return { job: opened, setup: await setUp(opened) };
75
76
  });
76
77
  if (setup.done) {
package/dist/revert.mjs CHANGED
@@ -9,14 +9,18 @@ export async function revertFailedFix(job) {
9
9
  job.repairing = false;
10
10
  return revertFailedChecks(job);
11
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. */
12
+ /** Hands over a fix of failed checks; once the revert ends with no stop, its saved halt gives way, so the run halt alone holds back other landings. */
13
13
  export async function revertFailedChecks(job) {
14
+ const reverted = await revertOrReport(job);
14
15
  const { context, state } = job;
15
- if (state.halted === true && state.pushing === undefined && !runStopped()) {
16
+ if (state.halted === true &&
17
+ state.pushing === undefined &&
18
+ state.reverting === undefined &&
19
+ !runStopped()) {
16
20
  delete state.halted;
17
21
  await writeState(context.repo, state);
18
22
  }
19
- return revertOrReport(job);
23
+ return reverted;
20
24
  }
21
25
  export async function revertOrReport(job) {
22
26
  try {
package/dist/review.mjs CHANGED
@@ -71,11 +71,9 @@ function recordVerdict(job, verdict, open) {
71
71
  async function runReviewer(job, earlier) {
72
72
  const { context, issue, log, state, worktree, comments } = job;
73
73
  const { config, ports } = context;
74
- const before = state.reviewing ?? (await ports.revision(worktree));
75
- if (state.reviewing === undefined) {
76
- state.reviewing = before;
77
- await writeState(context.repo, state);
78
- }
74
+ const before = await ports.revision(worktree);
75
+ state.reviewing = before;
76
+ await writeState(context.repo, state);
79
77
  if (await ports.discardChanges(worktree, before, job.branch)) {
80
78
  log.event('review.clean', { round: state.reviewRounds }, 'quiet');
81
79
  }
@@ -103,6 +101,11 @@ async function runReviewer(job, earlier) {
103
101
  }
104
102
  return review.text;
105
103
  }
104
+ export async function settleReview(job) {
105
+ if (job.state.reviewing !== undefined) {
106
+ await undoReview(job, job.state.reviewing);
107
+ }
108
+ }
106
109
  async function undoReview(job, before) {
107
110
  const { context, log, state, worktree } = job;
108
111
  if (await context.ports.discardChanges(worktree, before, job.branch)) {
package/dist/state.mjs CHANGED
@@ -87,13 +87,16 @@ export function newState(issue, branch) {
87
87
  return { issue, phase: 'claimed', branch, ciFixes: 0, reviewRounds: 0, reviewLog: [] };
88
88
  }
89
89
  /**
90
- * Drops the budgets and findings; a hand-over (`handedOver`) also cancels an approval and the closing mark,
90
+ * Drops the budgets and findings; a hand-over (`handedOver`) also cancels an approval, the closing mark and the review start,
91
91
  * so a resume that stops before it finishes is resumed again rather than closed as done.
92
92
  */
93
93
  export function resetState(state, handedOver = false) {
94
- const { handedOver: _handedOver, pendingHandOver: _pending, closing, ...rest } = state;
94
+ const { handedOver: _handedOver, pendingHandOver: _pending, closing, reviewing, ...rest } = state;
95
95
  const phase = handedOver && rest.phase === 'approved' ? 'review' : rest.phase;
96
- const kept = !handedOver && closing !== undefined ? { closing } : {};
96
+ const kept = {
97
+ ...(!handedOver && closing !== undefined ? { closing } : {}),
98
+ ...(!handedOver && reviewing !== undefined ? { reviewing } : {}),
99
+ };
97
100
  return { ...rest, ...kept, phase, ciFixes: 0, commitFixes: 0, reviewRounds: 0, reviewLog: [] };
98
101
  }
99
102
  export async function writeState(repo, state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "7.8.16",
3
+ "version": "7.8.18",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",