next-issue 6.6.70 → 6.6.72

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/dist/conflict.mjs CHANGED
@@ -3,6 +3,7 @@ import { spendBudget } from './budget.mjs';
3
3
  import { commitWork, runFixer } from './fix.mjs';
4
4
  import { escalateAndFinish } from './handover.mjs';
5
5
  import { fallbackTitle } from './job.mjs';
6
+ import { writeState } from './state.mjs';
6
7
  export async function rebase(job) {
7
8
  const { context, issue, log, state, worktree } = job;
8
9
  const { config, ports, base } = context;
@@ -22,12 +23,23 @@ export async function rebase(job) {
22
23
  state.title = title;
23
24
  }
24
25
  const merged = await ports.revision(worktree);
25
- const squashed = await commitWork(job, merged, title, 'fixer', (cwd, message) => ports.squashOnto(cwd, target, message));
26
+ const squashed = await commitWork(job, merged, title, 'fixer', (cwd, message) => squash(job, cwd, target, message));
26
27
  if (!squashed) {
27
28
  return escalateAndFinish(job, `The change holds nothing that ${config.remote}/${base} does not already hold.`, 'empty change');
28
29
  }
29
30
  return undefined;
30
31
  }
32
+ async function squash(job, cwd, target, message) {
33
+ const { context, state } = job;
34
+ state.squashing = await context.ports.revision(cwd);
35
+ await writeState(context.repo, state);
36
+ try {
37
+ return await context.ports.squashOnto(cwd, target, message);
38
+ }
39
+ finally {
40
+ state.squashing = undefined;
41
+ }
42
+ }
31
43
  async function mergeBase(job, merge) {
32
44
  const { before, files } = merge;
33
45
  const { context, worktree } = job;
@@ -11,6 +11,7 @@ export async function enterReview(job) {
11
11
  const { base } = context;
12
12
  return escalateAndFinish(job, `The run stopped during the revert of the change on ${base}. The harness reverted the change on ${base}.`, 'revert stopped');
13
13
  }
14
+ await settleSquash(job);
14
15
  const landed = state.landed?.at(-1);
15
16
  if (landed !== undefined) {
16
17
  return resumeLanding(job, landed);
@@ -37,6 +38,16 @@ async function settlePush(job) {
37
38
  state.pushing = undefined;
38
39
  await writeState(repo, state);
39
40
  }
41
+ async function settleSquash(job) {
42
+ const { context, state, worktree, branch } = job;
43
+ const sha = state.squashing;
44
+ if (sha === undefined) {
45
+ return;
46
+ }
47
+ await context.ports.discardChanges(worktree, sha, branch);
48
+ state.squashing = undefined;
49
+ await writeState(context.repo, state);
50
+ }
40
51
  async function settleRevert(job) {
41
52
  const { context, state, worktree, branch } = job;
42
53
  const { repo, config, ports, base } = context;
package/dist/skip.mjs CHANGED
@@ -1,6 +1,8 @@
1
+ import { runStopped } from './children.mjs';
1
2
  import { elapsedMs } from './durations.mjs';
2
3
  import { message } from './errors.mjs';
3
4
  import { handOverReply } from './hand-over-comments.mjs';
5
+ import { stopNow } from './handover.mjs';
4
6
  import { hasLabel } from './labels.mjs';
5
7
  export function skipReason(issue, config, resuming, answered = false) {
6
8
  const has = (name) => hasLabel(issue.labels, name);
@@ -26,7 +28,7 @@ export async function skipReport(context, log, issue, saved, started) {
26
28
  answered = await hasAnswer(context, issue);
27
29
  }
28
30
  catch (error) {
29
- return unclaimedError(log, issue, error, started);
31
+ return readError(log, issue, saved, error, started);
30
32
  }
31
33
  const skip = skipReason(issue, context.config, saved !== undefined, answered);
32
34
  if (skip !== undefined) {
@@ -41,7 +43,7 @@ export async function skipReport(context, log, issue, saved, started) {
41
43
  blockers = await context.ports.openBlockers(context.repo, issue.number);
42
44
  }
43
45
  catch (error) {
44
- return unclaimedError(log, issue, error, started);
46
+ return readError(log, issue, saved, error, started);
45
47
  }
46
48
  if (blockers.length > 0) {
47
49
  log.event('issue.skip', { title: issue.title, reason: 'blocked', blockers });
@@ -55,6 +57,16 @@ async function hasAnswer(context, issue) {
55
57
  }
56
58
  return (await handOverReply(context, issue.number)).length > 0;
57
59
  }
60
+ function readError(log, issue, saved, error, started) {
61
+ if (!runStopped()) {
62
+ return unclaimedError(log, issue, error, started);
63
+ }
64
+ if (saved !== undefined) {
65
+ return stopNow(log, issue, saved, started);
66
+ }
67
+ log.event('issue.stop', {}, 'quiet');
68
+ return { ...skipped(issue), outcome: 'stopped', ms: elapsedMs(started) };
69
+ }
58
70
  export function unclaimedError(log, issue, error, started) {
59
71
  const { reason, ms } = logIssueError(log, error, started);
60
72
  return { ...skipped(issue), outcome: 'error', reason, ms };
package/dist/state.mjs CHANGED
@@ -59,6 +59,7 @@ function isState(value) {
59
59
  (value.landed === undefined || isLanded(value.landed)) &&
60
60
  isOptional(value.pushing, 'string') &&
61
61
  isOptional(value.reverting, 'string') &&
62
+ isOptional(value.squashing, 'string') &&
62
63
  isOptional(value.rerun, 'string') &&
63
64
  isOptional(value.reviewing, 'string') &&
64
65
  typeof value.reviewRounds === 'number' &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.70",
3
+ "version": "6.6.72",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",