spur-board 0.170.1 → 0.170.2

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/daemon.mjs CHANGED
@@ -28144,6 +28144,9 @@ function deniedReference(error) {
28144
28144
  function deniedBranchRule(error) {
28145
28145
  return (error.type === "FORBIDDEN" || error.type === "NOT_FOUND") && error.path?.[2] === "baseRef";
28146
28146
  }
28147
+ function deniedSuites(error) {
28148
+ return (error.type === "FORBIDDEN" || error.type === "NOT_FOUND") && error.path?.[2] === "statusCheckRollup" && error.path[3] === "commit";
28149
+ }
28147
28150
  const graphEnvelopeWire = z.object({
28148
28151
  errors: z.array(graphErrorWire).optional(),
28149
28152
  data: z.unknown()
@@ -28177,9 +28180,9 @@ const BRANCH_RULE_FIELDS = "refUpdateRule { pattern requiredApprovingReviewCount
28177
28180
  const prFields = (number, closing = false, reviewRule = false) => `id number url title updatedAt mergedAt closedAt state isDraft mergeable mergeStateStatus
28178
28181
  author { login } headRefName headRefOid${reviewRule ? `\n reviewDecision baseRef { ${BRANCH_RULE_FIELDS} }` : ""}
28179
28182
  statusCheckRollup { contexts(first: 100) { nodes {
28180
- ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt workflowRun { workflow { id } } app { id } } isRequired(pullRequestNumber: ${String(number)}) }
28183
+ ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt id workflowRun { event runNumber runAttempt workflow { id } } app { id } } isRequired(pullRequestNumber: ${String(number)}) }
28181
28184
  ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: ${String(number)}) }
28182
- } pageInfo { hasNextPage endCursor } } }
28185
+ } pageInfo { hasNextPage endCursor } } commit { checkSuites(first: 100) { nodes { id status createdAt workflowRun { event runNumber runAttempt workflow { id } } } pageInfo { hasNextPage } } } }
28183
28186
  reviews(first: 100) { nodes { ${REVIEW_FIELDS} } pageInfo { hasNextPage endCursor } }
28184
28187
  comments(last: 100) { ${COMMENT_FIELDS} }
28185
28188
  reviewThreads(first: 100) { nodes { ${THREAD_FIELDS} } pageInfo { hasNextPage endCursor } }
@@ -28207,7 +28210,7 @@ function detailQuery(numbers, closing = false, reviewRule = false) {
28207
28210
  function pageQuery(connection, bootstrap = false) {
28208
28211
  if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
28209
28212
  if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
28210
- return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt workflowRun { workflow { id } } app { id } } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
28213
+ return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt id workflowRun { event runNumber runAttempt workflow { id } } app { id } } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
28211
28214
  }
28212
28215
  const TREE_FIELDS = "tree { entries { name type mode oid } }";
28213
28216
  function commitsQuery() {
@@ -28313,6 +28316,12 @@ var GithubClient = class {
28313
28316
  }
28314
28317
  };
28315
28318
  // ../adapters/src/github/checks.ts
28319
+ const workflowRunWire = z.object({
28320
+ event: z.string().nullish(),
28321
+ runNumber: z.number().int().nullish(),
28322
+ runAttempt: z.number().int().nullish(),
28323
+ workflow: z.object({ id: z.string().min(1) })
28324
+ });
28316
28325
  const checkRunWire = z.object({
28317
28326
  __typename: z.literal("CheckRun"),
28318
28327
  name: z.string(),
@@ -28322,7 +28331,8 @@ const checkRunWire = z.object({
28322
28331
  completedAt: z.string().nullable(),
28323
28332
  checkSuite: z.object({
28324
28333
  createdAt: z.string(),
28325
- workflowRun: z.object({ workflow: z.object({ id: z.string().min(1) }) }).nullish(),
28334
+ id: z.string().nullish(),
28335
+ workflowRun: workflowRunWire.nullish(),
28326
28336
  app: z.object({ id: z.string().min(1) }).nullish()
28327
28337
  }).nullish(),
28328
28338
  isRequired: z.boolean().nullish()
@@ -28388,6 +28398,78 @@ function latestContexts(nodes) {
28388
28398
  }
28389
28399
  return [...latest.entries()].sort(([a, x], [b, y]) => contextName(x).localeCompare(contextName(y)) || a.localeCompare(b)).map(([, node]) => node);
28390
28400
  }
28401
+ /**
28402
+ * The head commit's check suites, read in the PR detail query. Actions creates a suite for each
28403
+ * workflow run when the run starts, before its jobs create check runs. A denied suite arrives as
28404
+ * a null node; a denied list or commit, or a list without nodes, arrives as null.
28405
+ */
28406
+ const suiteListWire = z.object({ checkSuites: z.object({
28407
+ nodes: z.array(z.object({
28408
+ id: z.string().nullish(),
28409
+ status: z.string(),
28410
+ createdAt: z.string(),
28411
+ workflowRun: workflowRunWire.nullable()
28412
+ }).nullable()).nullable(),
28413
+ pageInfo: z.object({ hasNextPage: z.boolean() })
28414
+ }).nullable() }).nullish();
28415
+ /**
28416
+ * What decides a required check run that reads skipped, as `latestContexts` keeps it. Of the
28417
+ * head's suites of its workflow and trigger event, from the suite list and the check runs and
28418
+ * joined by node id, only the newest decides, by creation time, then the workflow run's number
28419
+ * and attempt: its run of the same check (see `checkKey`) counts, finished or not; without one
28420
+ * the check is `pending` until that suite completes, then the skip stands. Older suites never
28421
+ * decide, and a run of another event, such as a manual dispatch, is not one of them. A missing,
28422
+ * denied or truncated suite list, a null suite in it, a missing event, a time that does not
28423
+ * parse, or a newest place the run number and attempt cannot break, decides nothing.
28424
+ */
28425
+ function skipDecision(node, nodes, commit) {
28426
+ if (node.__typename !== "CheckRun" || node.isRequired !== true) return void 0;
28427
+ if (checkState(node) !== "skipped") return void 0;
28428
+ const run = node.checkSuite?.workflowRun;
28429
+ const event = run?.event;
28430
+ const list = commit?.checkSuites;
28431
+ if (!run || !event || !list?.nodes || list.pageInfo.hasNextPage) return void 0;
28432
+ if (list.nodes.some((suite) => suite === null)) return void 0;
28433
+ const ofRun = (wire) => wire?.workflow.id === run.workflow.id && wire.event === event;
28434
+ const suites = [];
28435
+ const byId = /* @__PURE__ */ new Map();
28436
+ const add = (createdAt, id, wire, status) => {
28437
+ const known = id == null ? void 0 : byId.get(id);
28438
+ if (known !== void 0) {
28439
+ known.status ??= status;
28440
+ known.number ??= wire.runNumber ?? null;
28441
+ known.attempt ??= wire.runAttempt ?? null;
28442
+ return;
28443
+ }
28444
+ const suite = {
28445
+ at: Date.parse(createdAt),
28446
+ id: id ?? null,
28447
+ number: wire.runNumber ?? null,
28448
+ attempt: wire.runAttempt ?? null,
28449
+ status
28450
+ };
28451
+ suites.push(suite);
28452
+ if (suite.id !== null) byId.set(suite.id, suite);
28453
+ };
28454
+ for (const suite of list.nodes) if (suite !== null && ofRun(suite.workflowRun)) add(suite.createdAt, suite.id, suite.workflowRun, suite.status);
28455
+ for (const other of nodes) if (other.__typename === "CheckRun" && other.checkSuite && ofRun(other.checkSuite.workflowRun)) add(other.checkSuite.createdAt, other.checkSuite.id, other.checkSuite.workflowRun);
28456
+ if (suites.some((suite) => Number.isNaN(suite.at))) return void 0;
28457
+ const order = (a, b) => (a.number ?? 0) - (b.number ?? 0) || (a.attempt ?? 0) - (b.attempt ?? 0);
28458
+ suites.sort((a, b) => a.at - b.at || order(a, b));
28459
+ const newest = suites.at(-1);
28460
+ if (newest === void 0) return void 0;
28461
+ const tied = suites.filter((suite) => suite.at === newest.at);
28462
+ if (tied.length > 1) {
28463
+ if (tied.some((suite) => suite.number === null || suite.attempt === null)) return void 0;
28464
+ const next = tied.at(-2);
28465
+ if (next !== void 0 && order(next, newest) === 0) return void 0;
28466
+ }
28467
+ const key = checkKey(node);
28468
+ const [decider] = latestContexts(nodes.filter((other) => other.__typename === "CheckRun" && newest.id !== null && other.checkSuite?.id === newest.id && checkKey(other) === key));
28469
+ if (decider !== void 0) return decider;
28470
+ if (newest.status === void 0 || newest.status === "COMPLETED") return void 0;
28471
+ return "pending";
28472
+ }
28391
28473
  // ../adapters/src/github/discovery.ts
28392
28474
  const timestamp$1 = z.string().min(1).refine((value) => !Number.isNaN(Date.parse(value)));
28393
28475
  const discoveryNodeWire = z.object({
@@ -28693,7 +28775,10 @@ const prWire = z.object({
28693
28775
  author: actor,
28694
28776
  headRefName: z.string(),
28695
28777
  headRefOid: z.string(),
28696
- statusCheckRollup: z.object({ contexts: nodes(contextWire) }).nullish(),
28778
+ statusCheckRollup: z.object({
28779
+ contexts: nodes(contextWire),
28780
+ commit: suiteListWire
28781
+ }).nullish(),
28697
28782
  reviews: nodes(reviewWire),
28698
28783
  comments: nodes(commentWire),
28699
28784
  reviewThreads: nodes(threadWire),
@@ -28752,12 +28837,22 @@ function closingRefs(wire) {
28752
28837
  number: node.number
28753
28838
  }] : []);
28754
28839
  }
28755
- function latestChecks(nodes) {
28840
+ function latestChecks(nodes, commit) {
28841
+ const visible = (node) => ({
28842
+ state: checkState(node),
28843
+ completedAt: node.__typename === "StatusContext" ? null : node.completedAt
28844
+ });
28845
+ const shown = (node) => {
28846
+ const decided = skipDecision(node, nodes, commit);
28847
+ return decided === "pending" ? {
28848
+ state: "pending",
28849
+ completedAt: null
28850
+ } : visible(decided ?? node);
28851
+ };
28756
28852
  const values = latestContexts(nodes).map((node) => ({
28757
28853
  check: {
28758
28854
  name: contextName(node),
28759
- state: checkState(node),
28760
- completedAt: node.__typename === "StatusContext" ? null : node.completedAt
28855
+ ...shown(node)
28761
28856
  },
28762
28857
  required: node.isRequired === true
28763
28858
  }));
@@ -28928,7 +29023,7 @@ function reviewThread(node) {
28928
29023
  */
28929
29024
  function normalizePr(repo, value, rule, feedbackComplete, held = []) {
28930
29025
  const wire = parseWire(prWire, value, "Malformed GitHub PR response");
28931
- const checks = latestChecks(wire.statusCheckRollup?.contexts.nodes ?? []);
29026
+ const checks = latestChecks(wire.statusCheckRollup?.contexts.nodes ?? [], wire.statusCheckRollup?.commit);
28932
29027
  const state = wire.state === "MERGED" ? "merged" : wire.state === "CLOSED" ? "closed" : "open";
28933
29028
  const mergeable = wire.mergeable === "MERGEABLE" ? "mergeable" : wire.mergeable === "CONFLICTING" ? "conflicting" : "unknown";
28934
29029
  const rawMerge = wire.mergeStateStatus.toLowerCase();
@@ -29080,7 +29175,7 @@ const prPagingWire = z.looseObject({
29080
29175
  comments: backPagingWire,
29081
29176
  reviewThreads: pagingWire,
29082
29177
  reviewRequests: pagingWire,
29083
- statusCheckRollup: z.object({ contexts: pagingWire }).nullish(),
29178
+ statusCheckRollup: z.looseObject({ contexts: pagingWire }).nullish(),
29084
29179
  closingIssuesReferences: pagingWire.nullish()
29085
29180
  });
29086
29181
  const aliasWire = z.object({ pullRequest: prPagingWire.nullish() }).nullish();
@@ -29378,7 +29473,8 @@ function malformed(acc, error, ref) {
29378
29473
  }
29379
29474
  async function processPr(scope, acc, number, alias, data, scopedErrors, ref) {
29380
29475
  const ruleDenied = scopedErrors.some(deniedBranchRule);
29381
- const errors = withoutDeniedReferences(scopedErrors).filter((entry) => !deniedBranchRule(entry));
29476
+ const suitesDenied = scopedErrors.some(deniedSuites);
29477
+ const errors = withoutDeniedReferences(scopedErrors).filter((entry) => !deniedBranchRule(entry) && !deniedSuites(entry));
29382
29478
  requireCheckAccess(errors);
29383
29479
  const error = errors[0];
29384
29480
  if (error !== void 0) {
@@ -29421,12 +29517,17 @@ async function processPr(scope, acc, number, alias, data, scopedErrors, ref) {
29421
29517
  return;
29422
29518
  }
29423
29519
  const feedback = await readFeedback(scope, number, full.pr.comments, entryFor(scope.feedbackCursors, scope.repo, number), entryFor(scope.continuations, scope.repo, number), report);
29520
+ const rollup = full.pr.statusCheckRollup;
29424
29521
  const pr = {
29425
29522
  ...full.pr,
29426
29523
  comments: {
29427
29524
  ...full.pr.comments,
29428
29525
  nodes: feedback.nodes
29429
- }
29526
+ },
29527
+ ...suitesDenied && rollup ? { statusCheckRollup: {
29528
+ ...rollup,
29529
+ commit: null
29530
+ } } : {}
29430
29531
  };
29431
29532
  const facts = content(() => normalizePr(ref?.repo ?? scope.repo, pr, scope.keys, feedback.complete, feedback.held));
29432
29533
  if (facts instanceof AdapterError) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.170.1",
3
+ "version": "0.170.2",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -13,7 +13,9 @@ A submit needs no green checks. Running checks hold the task at the `checksGate`
13
13
  (Dev by default); red checks, a cancelled run included, return it to Dev with a new turn. With
14
14
  `checksGate` right of Dev, a cancelled run counts as running for about two GitHub poll intervals
15
15
  first. Only the latest run of each check counts, so a rerun on the same head replaces a
16
- cancelled run. When the PR has required checks, only those count, and the Board does not watch the
16
+ cancelled run. A required check skipped in one run follows the newest run of its
17
+ workflow for the same event on the head: that run's check counts if it has one; otherwise the
18
+ check counts as running until that run finishes, then it is red. When the PR has required checks, only those count, and the Board does not watch the
17
19
  others. While GitHub computes mergeability, the task waits where it is (at Dev's exit while in Dev); a conflict returns it to
18
20
  Dev with a new turn.
19
21