next-issue 6.6.101 → 6.6.103

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
@@ -321,12 +321,19 @@ on such a resume before the base is checked) is saved in the state file of
321
321
  its issue. The issue waits for a person, so later runs skip it, but no
322
322
  later run lands another change meanwhile: an issue that reaches the
323
323
  landing ends `stopped` with the reason `base unchecked`, keeps its state,
324
- branch and labels, and halts that run too; the log holds a
325
- `land.blocked` event with the waiting issues. Once a person answers or
324
+ branch and labels, and the run claims no more issues; the log holds a
325
+ `land.blocked` event with the waiting issues. Runs take such a halted issue
326
+ before the others, and a running one still resumes, so an older issue that
327
+ reaches the landing first does not keep it from checking the base. Once a person answers or
326
328
  takes the label off, the issue resumes, checks the base and waits for the
327
329
  checks of its commit; when those are known (the issue is done, or its
328
330
  commits are reverted or found not on the base), the next run lands the
329
- held issues again. Such a resume is not held back
331
+ held issues again. A person who gives such an issue up instead (the `skip`
332
+ label, which **Give up** in pi adds) releases the block: the next run skips
333
+ the issue, drops its halt from the state and logs a `land.released` event,
334
+ so other issues land again on a base whose last checks nobody read. The state
335
+ keeps the commits, so taking the `skip` label off later resumes the issue
336
+ and checks them. Such a resume is not held back
330
337
  by another halted issue while it only checks its commit already on the
331
338
  base; a fix it has to land waits like any other change. The hand-over
332
339
  comment says so.
package/dist/land.mjs CHANGED
@@ -49,14 +49,14 @@ function inLandingLock(job, work) {
49
49
  }
50
50
  /** Runs a step that lands a change, unless an earlier run halted with a commit on the base whose checks nobody read. */
51
51
  async function unblocked(job, work) {
52
- const { context, log } = job;
52
+ const { log } = job;
53
53
  const unchecked = await uncheckedIssues(job);
54
54
  if (unchecked.length === 0) {
55
55
  return work();
56
56
  }
57
- // Landing now would build on a commit whose checks nobody read.
57
+ // Landing now would build on a commit whose checks nobody read. The run claims no more issues, but it does not
58
+ // set `context.halted`: a blocking issue already running must still resume and check its commit on the base.
58
59
  log.event('land.blocked', { issues: unchecked }, 'quiet');
59
- context.halted = true;
60
60
  const held = await holdBack(job, 'base unchecked');
61
61
  return { ...held, report: { ...held.report, halt: true } };
62
62
  }
package/dist/pending.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { message } from './errors.mjs';
2
2
  import { readState, savedIssues } from './state.mjs';
3
+ import { blocksLanding } from './unsettled.mjs';
3
4
  export async function pendingIssues(context) {
4
5
  const { repo, config, ports } = context;
5
6
  const { ready, inProgress, inReview } = config.labels;
@@ -7,7 +8,8 @@ export async function pendingIssues(context) {
7
8
  const issues = await ports.openIssues(repo, config.issueLimit, labels);
8
9
  const listed = new Set(issues.map((issue) => issue.number));
9
10
  let openCount = issues.length;
10
- for (const number of await savedIssues(repo)) {
11
+ const saved = await savedIssues(repo);
12
+ for (const number of saved) {
11
13
  if (listed.has(number)) {
12
14
  continue;
13
15
  }
@@ -20,7 +22,21 @@ export async function pendingIssues(context) {
20
22
  }
21
23
  }
22
24
  context.recorder.event('issues', { open: openCount }, 'quiet');
23
- return issues.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
25
+ const blocking = await blockingIssues(context, saved);
26
+ // An issue that blocks every landing goes first, so its resume can lift the block before an older issue reaches the landing.
27
+ return issues.sort((a, b) => Number(blocking.has(b.number)) - Number(blocking.has(a.number)) ||
28
+ a.createdAt.localeCompare(b.createdAt));
29
+ }
30
+ async function blockingIssues(context, saved) {
31
+ const { repo, base } = context;
32
+ const blocking = new Set();
33
+ for (const number of saved) {
34
+ const state = await readState(repo, number).catch(() => undefined);
35
+ if (state !== undefined && blocksLanding(state, base)) {
36
+ blocking.add(number);
37
+ }
38
+ }
39
+ return blocking;
24
40
  }
25
41
  async function savedIssue(context, number) {
26
42
  const { repo, ports } = context;
package/dist/skip.mjs CHANGED
@@ -4,6 +4,8 @@ import { message } from './errors.mjs';
4
4
  import { handOverReply } from './hand-over-comments.mjs';
5
5
  import { stopNow } from './handover.mjs';
6
6
  import { hasLabel } from './labels.mjs';
7
+ import { writeState } from './state.mjs';
8
+ import { heldOnBase } from './unsettled.mjs';
7
9
  export function skipReason(issue, config, resuming, answered = false) {
8
10
  const has = (name) => hasLabel(issue.labels, name);
9
11
  const names = config.labels;
@@ -33,6 +35,14 @@ export async function skipReport(context, log, issue, saved, started) {
33
35
  const skip = skipReason(issue, context.config, saved !== undefined, answered);
34
36
  if (skip !== undefined) {
35
37
  log.event('issue.skip', { title: issue.title, reason: skip });
38
+ if (saved?.halted === true && hasLabel(issue.labels, context.config.labels.skip)) {
39
+ try {
40
+ await release(context, log, saved);
41
+ }
42
+ catch (error) {
43
+ return readError(log, issue, saved, error, started);
44
+ }
45
+ }
36
46
  return skipped(issue);
37
47
  }
38
48
  if (saved !== undefined) {
@@ -51,6 +61,15 @@ export async function skipReport(context, log, issue, saved, started) {
51
61
  }
52
62
  return undefined;
53
63
  }
64
+ /**
65
+ * A person gave up on a halted issue: it never resumes to check the base while it has the skip label, so its halt
66
+ * stops blocking the landings of other issues. The state keeps what is on the base for a later resume.
67
+ */
68
+ async function release(context, log, saved) {
69
+ delete saved.halted;
70
+ await writeState(context.repo, saved);
71
+ log.event('land.released', { held: heldOnBase(saved, context.base) });
72
+ }
54
73
  async function hasAnswer(context, issue, saved) {
55
74
  if (!hasLabel(issue.labels, context.config.labels.needsHuman)) {
56
75
  return false;
@@ -13,7 +13,7 @@ export function heldOnBase(state, base) {
13
13
  .join(', ');
14
14
  }
15
15
  /** What a halt with an unchecked commit on the base means for the next runs. */
16
- export const HALT_NOTE = 'The run halts, and no run lands another change until this issue resumes (after an answer or once the label is off) and checks the base.';
16
+ export const HALT_NOTE = 'The run halts, and no run lands another change until this issue resumes (after an answer or once the label is off) and checks the base, or a person gives it up with the skip label.';
17
17
  /** Whether this state keeps every run from landing: it halted with a commit on the base whose checks are still unknown. */
18
18
  export function blocksLanding(state, base) {
19
19
  return state.halted === true && state.closing !== true && heldOnBase(state, base) !== '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.101",
3
+ "version": "6.6.103",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",