next-issue 6.6.101 → 6.6.102

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,8 +321,10 @@ 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
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-issue",
3
- "version": "6.6.101",
3
+ "version": "6.6.102",
4
4
  "description": "Autonomous issue harness driven by the pi SDK",
5
5
  "keywords": [
6
6
  "github",