spur-board 0.55.1 → 0.57.0

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.
@@ -1,4 +1,4 @@
1
- import { $ as errorContextSchema, S as renderJsonError, Z as ERRORS, c as tokenRequestStatusSchema, et as errorEnvelopeSchema, nt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-DsCpUW6q.mjs";
1
+ import { $ as errorContextSchema, S as renderJsonError, Z as ERRORS, c as tokenRequestStatusSchema, et as errorEnvelopeSchema, nt as successEnvelopeSchema, o as tokenRequestResultSchema } from "./chunk-CTXzapf8.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -304,7 +304,8 @@ const columnConfig = z.strictObject({
304
304
  enabled: z.boolean().default(true).describe("false skips the column: tasks move past it and its exit condition is not checked. todo, dev and done cannot be disabled."),
305
305
  orchestrator: nonEmpty.default("none").describe("Who takes the column's turns. none: the task's live worker session, else the operator. operator: the operator, who also gets the questions asked in the column. Otherwise the name of a spurProjects entry whose sessions orchestrate the column and get the questions others ask in it."),
306
306
  cycleLimit: z.int().min(1).default(DEFAULT_CYCLE_LIMIT).describe("How many times a task may return to Dev from this column before the board stops it for the operator. Returns by the column executor, changes requested and external comments count; a conflict, red CI and a draft do not."),
307
- courseCheck: z.int().min(0).default(DEFAULT_COURSE_CHECK).describe("How many returns to Dev from this column, counted as for cycleLimit, before the board holds the task and asks the curator, or the operator when the project has no curator, to check its course. The answer resets the count and reaches the worker as a task comment. 0 turns the check off; cycleLimit is checked first.")
307
+ courseCheck: z.int().min(0).default(DEFAULT_COURSE_CHECK).describe("How many returns to Dev from this column, counted as for cycleLimit, before the board holds the task and asks courseCheckTo (by default the curator, or the operator when the project has no curator) to check its course. The answer resets the count and reaches the worker as a task comment. 0 turns the check off; cycleLimit is checked first."),
308
+ courseCheckTo: nonEmpty.optional().describe("Who answers this column's course check: operator, the curator's name, or the name of a column orchestrator. Without it, the curator, or the operator when the project has no curator. When the addressee has no live session the question moves to the operator; a conductor that is rung and does not answer keeps it, and the operator gets an item.")
308
309
  });
309
310
  /** The board rules: required columns present and enabled, built-ins in canonical order. */
310
311
  function checkBoard(items, ctx) {
@@ -409,6 +410,23 @@ const projectSchema = z.strictObject({
409
410
  message: `Unknown orchestrator ${JSON.stringify(orchestrator)}: use none, operator or a spurProjects name`
410
411
  });
411
412
  });
413
+ const curator = project.spurProjects.find((p) => p.role === "curator")?.name;
414
+ const orchestrators = new Set(project.columns.map((column) => column.orchestrator).filter((name) => name !== "none" && name !== "operator"));
415
+ project.columns.forEach(({ courseCheckTo }, j) => {
416
+ if (courseCheckTo === void 0 || courseCheckTo === "operator") return;
417
+ const known = spurNames.has(courseCheckTo);
418
+ if (known && (courseCheckTo === curator || orchestrators.has(courseCheckTo))) return;
419
+ const name = JSON.stringify(courseCheckTo);
420
+ ctx.addIssue({
421
+ code: "custom",
422
+ path: [
423
+ "columns",
424
+ j,
425
+ "courseCheckTo"
426
+ ],
427
+ message: known ? `courseCheckTo ${name} is not the curator and orchestrates no column: use operator, the curator or a column orchestrator` : `Unknown courseCheckTo ${name}: use operator or a spurProjects name`
428
+ });
429
+ });
412
430
  });
413
431
  /** A duration in integer milliseconds. Every duration key ends in `Ms`. */
414
432
  function durationMs(fallback, description) {
@@ -1955,7 +1973,12 @@ const taskWhySchema = z.strictObject({
1955
1973
  }).describe("The gate of one column.")).describe("The gate of every column, To Do to Done; empty when the pull request facts are missing."),
1956
1974
  checksWaivedBy: z.literal("reposWithoutCi").nullable().describe("The config key that passed Dev's check condition for a repo without checks; null otherwise."),
1957
1975
  turn: turnViewSchema.nullable().describe("The open turn of the task; null when none is open."),
1958
- moves: z.array(moveViewSchema).describe("The last 5 column moves, oldest first.")
1976
+ moves: z.array(moveViewSchema).describe("The last 5 column moves, oldest first."),
1977
+ waiting: z.array(z.strictObject({
1978
+ reason: z.enum(GATE_REASONS).describe("The gate reason that waits on the fact."),
1979
+ head: commitShaSchema.describe("Head commit of the pull request the fact is about."),
1980
+ text: z.string().describe("The fact in one line, e.g. waiting for CI on <sha>.")
1981
+ }).describe("One fact the task waits for.")).min(1).optional().describe("Facts the task waits for that GitHub has not settled yet; absent when none.")
1959
1982
  }).describe("Why the task is in its column and what the dispatcher waits for.");
1960
1983
  const itemViewSchema = z.strictObject({
1961
1984
  id: itemIdSchema,
@@ -1,5 +1,5 @@
1
- import { _ as buildCatalogSnapshot, ct as configSchema, lt as plainHttpAllowed, y as OPERATIONS } from "./chunk-DsCpUW6q.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-B2jz795d.mjs";
1
+ import { _ as buildCatalogSnapshot, ct as configSchema, lt as plainHttpAllowed, y as OPERATIONS } from "./chunk-CTXzapf8.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-BiDQ4g_3.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { G as actorIdSchema, Z as ERRORS, a as requestHashOf, ct as configSchema, nt as successEnvelopeSchema, pt as SLACK_BOT_SCOPES, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as requiredSecretKeys, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-DsCpUW6q.mjs";
1
+ import { G as actorIdSchema, Z as ERRORS, a as requestHashOf, ct as configSchema, nt as successEnvelopeSchema, pt as SLACK_BOT_SCOPES, r as remoteDoctorReportSchema, u as SYSTEMD_SERVICE_SETTINGS, ut as requiredSecretKeys, v as roleCanUseOperation, y as OPERATIONS } from "./chunk-CTXzapf8.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
- import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-B2jz795d.mjs";
4
- import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-hS9wN0vI.mjs";
3
+ import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-BiDQ4g_3.mjs";
4
+ import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-Fhr2daA8.mjs";
5
5
  import { createHash, randomBytes, randomUUID } from "node:crypto";
6
6
  import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
7
7
  import { homedir, hostname, userInfo } from "node:os";
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-B2jz795d.mjs";
1
+ import { a as requestTokenEnrollment, i as requestSkillReload, n as fetchTokenStatus, r as requestOperation, t as fetchCatalogVersion } from "./chunk-BiDQ4g_3.mjs";
2
2
  export { fetchCatalogVersion, fetchTokenStatus, requestOperation, requestSkillReload, requestTokenEnrollment };
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as EVENT_KINDS, B as ringMarker, D as interactionRefSchema, E as inboundEventSchema, F as SESSION_STATUSES, G as actorIdSchema, H as ticketFactsSchema, I as isExternalAuthor, J as parseActorId, K as encodeActorId, L as parseRingMarker, M as PR_STATES, N as REVIEW_STATES, O as messageRefSchema, P as SESSION_HEALTH_STATES, Q as err, R as prFactsSchema, T as conversationRefSchema, U as JIRA_PROJECT_KEY, V as sessionFactsSchema, W as REF_NUMBER, X as taskKeySchema, Y as parseRef$1, Z as ERRORS, _ as buildCatalogSnapshot, a as requestHashOf, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as configSchema, d as AdapterError, dt as COLUMN_IDS, f as batchSchema, ft as DISPATCHER_MODES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, it as DEFAULT_LINK, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as plainHttpAllowed, m as prSourceId, mt as TASK_HOLDS, n as doctorReportSchema, nt as successEnvelopeSchema, o as tokenRequestResultSchema, ot as DEFAULT_SLACK_COMMAND, p as entityRefSchema, pt as SLACK_BOT_SCOPES, q as errorCodeOf, s as tokenRequestSchema, st as RESERVED_PROJECT, t as assertNever, tt as ok, ut as requiredSecretKeys, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as prRefSchema } from "./chunk-DsCpUW6q.mjs";
1
+ import { A as EVENT_KINDS, B as ringMarker, D as interactionRefSchema, E as inboundEventSchema, F as SESSION_STATUSES, G as actorIdSchema, H as ticketFactsSchema, I as isExternalAuthor, J as parseActorId, K as encodeActorId, L as parseRingMarker, M as PR_STATES, N as REVIEW_STATES, O as messageRefSchema, P as SESSION_HEALTH_STATES, Q as err, R as prFactsSchema, T as conversationRefSchema, U as JIRA_PROJECT_KEY, V as sessionFactsSchema, W as REF_NUMBER, X as taskKeySchema, Y as parseRef$1, Z as ERRORS, _ as buildCatalogSnapshot, a as requestHashOf, b as turnHandedSchema, c as tokenRequestStatusSchema, ct as configSchema, d as AdapterError, dt as COLUMN_IDS, f as batchSchema, ft as DISPATCHER_MODES, g as trackerSourceId, h as sourceCursorSchema, i as TOKEN_REQUEST_LIMITS, it as DEFAULT_LINK, j as eventPayloadSchemas, k as userIdSchema, l as BOARD_TICK_MS, lt as plainHttpAllowed, m as prSourceId, mt as TASK_HOLDS, n as doctorReportSchema, nt as successEnvelopeSchema, o as tokenRequestResultSchema, ot as DEFAULT_SLACK_COMMAND, p as entityRefSchema, pt as SLACK_BOT_SCOPES, q as errorCodeOf, s as tokenRequestSchema, st as RESERVED_PROJECT, t as assertNever, tt as ok, ut as requiredSecretKeys, v as roleCanUseOperation, w as SPACE_IDS, x as renderHttpProblem, y as OPERATIONS, z as prRefSchema } from "./chunk-CTXzapf8.mjs";
2
2
  import { t as apiBaseUrl } from "./chunk-DAMwWWmT.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { createHash, randomUUID } from "node:crypto";
@@ -9978,16 +9978,17 @@ async function restartNotification(trx, sourceKey, at) {
9978
9978
  }).where("source_key", "=", sourceKey).where("acked_at", "is", null).where("exhausted_at", "is not", null).returning("id").executeTakeFirst() === void 0) throw new CommandError("retry_not_applicable", "The doorbell was read or is still ringing; close the item instead.");
9979
9979
  }
9980
9980
  /**
9981
- * Ends a notification's ring series. A curator block moves to the operator; a removal, a turn
9982
- * reminder or a ring with no session to name ends alone; anything else raises the operator item, whose Retry restarts
9983
- * the series (`restartNotification`). Every end journals `doorbell_undelivered`.
9981
+ * Ends a notification's ring series. A curator block, and a block that ended with no session
9982
+ * (`noRecipientEnd`), move to the operator; a removal, a turn reminder or another ring with no
9983
+ * session to name ends alone; anything else raises the operator item, whose Retry restarts the
9984
+ * series (`restartNotification`). Every end journals `doorbell_undelivered`.
9984
9985
  */
9985
9986
  async function endNotification(trx, n, task, end) {
9986
9987
  const { session, reason, at, config } = end;
9987
9988
  await trx.updateTable("notification").set({ exhausted_at: at.toISOString() }).where("id", "=", n.id).execute();
9988
9989
  if (n.rings === 0) await releaseAfterCourseNote(trx, n, at);
9989
9990
  const addressee = parseAddressee(n.role);
9990
- if (n.kind === "block" && addressee.kind === "curator") await moveBlockToAddressee(trx, {
9991
+ if (n.kind === "block" && (addressee.kind === "curator" || session === null)) await moveBlockToAddressee(trx, {
9991
9992
  task,
9992
9993
  block: await trx.selectFrom("block").selectAll().where("id", "=", noticeBlockId(n)).executeTakeFirstOrThrow(),
9993
9994
  to: "operator",
@@ -10052,10 +10053,17 @@ async function ringUndelivered(trx, input) {
10052
10053
  config: input.config
10053
10054
  });
10054
10055
  }
10055
- /** Why a notification with no recipient ends now, or null when it stays due for a next session. */
10056
- function noRecipientEnd(n) {
10056
+ /**
10057
+ * Why a notification with no recipient ends now, or null when it stays due for a next session. A
10058
+ * curator block, and an orchestrator block of a course check, end with `session: null`, which
10059
+ * `endNotification` turns into a move to the operator.
10060
+ */
10061
+ async function noRecipientEnd(trx, n) {
10057
10062
  if (n.kind === "removed" || n.kind === "turn_reminder" || n.kind === "answer" && n.role === "operator") return "no live addressee";
10058
- return n.kind === "block" && n.role === "curator" ? "no live curator session" : null;
10063
+ if (n.kind !== "block") return null;
10064
+ if (n.role === "curator") return "no live curator session";
10065
+ if (parseAddressee(n.role).kind !== "orchestrator") return null;
10066
+ return await trx.selectFrom("operator_item").select("id").where("kind", "=", "course_check").where("block_id", "=", noticeBlockId(n)).executeTakeFirst() === void 0 ? null : "no live orchestrator session";
10059
10067
  }
10060
10068
  /** A ring never carries comment or reason text: only where to look. */
10061
10069
  async function ringText(trx, n, task, ring) {
@@ -10090,7 +10098,7 @@ async function reconcileDoorbells(trx, at, config) {
10090
10098
  const session = await selectNotificationRecipient(trx, n, config);
10091
10099
  const keepsRings = resolvedByProject(n.role);
10092
10100
  if (session === void 0) {
10093
- const reason = noRecipientEnd(n);
10101
+ const reason = await noRecipientEnd(trx, n);
10094
10102
  if (reason !== null) await endNotification(trx, n, await trx.selectFrom("task").selectAll().where("id", "=", n.task_id).executeTakeFirstOrThrow(), {
10095
10103
  session: null,
10096
10104
  reason,
@@ -13400,12 +13408,6 @@ async function getStatus(deps, options = {}) {
13400
13408
  hiddenUnlinkedSessions: sessionRows.length - unlinkedSessions.length
13401
13409
  };
13402
13410
  }
13403
- //#endregion
13404
- //#region ../core/src/domain/gates.ts
13405
- /**
13406
- * The hold-only reasons: a fact is not known yet, and waiting resolves it. See `GateResult` for
13407
- * the caller rule.
13408
- */
13409
13411
  const HOLD_ONLY = /* @__PURE__ */ new Set([
13410
13412
  "mergeable_unknown",
13411
13413
  "checks_pending",
@@ -13631,7 +13633,8 @@ const STEP_BOUND = 2 * COLUMN_IDS.length;
13631
13633
  const NO_TURN = {
13632
13634
  visit: "none",
13633
13635
  open: false,
13634
- operatorUntaken: false
13636
+ operatorUntaken: false,
13637
+ headMoved: false
13635
13638
  };
13636
13639
  const indexOf$2 = (column) => COLUMN_IDS.indexOf(column);
13637
13640
  function orchestratorOf(project, column) {
@@ -13739,7 +13742,8 @@ function dispatch(input) {
13739
13742
  }
13740
13743
  const reasons = [...gate.reasons];
13741
13744
  if (gate.column !== column) {
13742
- if (cycleHeld || turn.open || reasons.every((reason) => HOLD_ONLY.has(reason))) return result(null);
13745
+ const held = turn.open && !turn.headMoved;
13746
+ if (cycleHeld || held || reasons.every((reason) => HOLD_ONLY.has(reason))) return result(null);
13743
13747
  move(gate.column, "gate_broken", reasons);
13744
13748
  continue;
13745
13749
  }
@@ -13858,8 +13862,8 @@ async function returnCounts(trx, taskId, column) {
13858
13862
  }
13859
13863
  /**
13860
13864
  * Raises the course check of a task's column, once while it is open: a `system` question to the
13861
- * curator, or to the operator when the project has no curator, with the open findings in its
13862
- * reason. The answer to the block resets the course count.
13865
+ * column's `courseCheckTo` addressee (`courseAddressee`), with the open findings in its reason.
13866
+ * The answer to the block resets the course count.
13863
13867
  */
13864
13868
  async function raiseCourseCheck(trx, input) {
13865
13869
  const { task, column, count, at, config } = input;
@@ -13872,7 +13876,7 @@ async function raiseCourseCheck(trx, input) {
13872
13876
  reason: await courseSummary(trx, task, column, count, url),
13873
13877
  at: at.toISOString(),
13874
13878
  config,
13875
- addressee: curatorProject(config, task.project) === null ? "operator" : "curator"
13879
+ addressee: courseAddressee(config, task.project, column)
13876
13880
  });
13877
13881
  return raiseItem(trx, {
13878
13882
  itemKey,
@@ -13884,6 +13888,21 @@ async function raiseCourseCheck(trx, input) {
13884
13888
  at
13885
13889
  });
13886
13890
  }
13891
+ /**
13892
+ * Who a column's course check asks: `courseCheckTo` read as the operator, the curator, or the
13893
+ * orchestrator of this column or else of the first column it orchestrates. Without the key, or
13894
+ * with a name that no longer fits, the curator, or the operator when the project has none.
13895
+ */
13896
+ function courseAddressee(config, projectId, column) {
13897
+ const fallback = curatorProject(config, projectId) === null ? "operator" : "curator";
13898
+ const columns = config.projects.find((project) => project.id === projectId)?.columns ?? [];
13899
+ const to = columns.find((c) => c.id === column)?.courseCheckTo;
13900
+ if (to === void 0) return fallback;
13901
+ if (to === "operator") return "operator";
13902
+ if (to === curatorProject(config, projectId)) return "curator";
13903
+ const orchestrated = columns.find((c) => c.id === column && c.orchestrator === to) ?? columns.find((c) => c.orchestrator === to);
13904
+ return orchestrated === void 0 ? fallback : `orchestrator:${orchestrated.id}`;
13905
+ }
13887
13906
  /** The question of a course check: the count, the open findings and the links. */
13888
13907
  async function courseSummary(trx, task, column, count, url) {
13889
13908
  const pr = await prFacts(trx, task.id);
@@ -14505,13 +14524,23 @@ const MARK_COLUMNS = ["review", "product-review"];
14505
14524
  const indexOf = (column) => COLUMN_IDS.indexOf(column);
14506
14525
  /**
14507
14526
  * Sets `voided_at` on the unvoided submits of `columns`. Review and product-review marks are
14508
- * never voided.
14527
+ * not voided by a move; a new PR head voids them (`voidMarksOffHead`).
14509
14528
  */
14510
14529
  async function voidColumns(trx, taskId, columns, at) {
14511
14530
  const voided = columns.filter((column) => !MARK_COLUMNS.includes(column));
14512
14531
  if (voided.length === 0) return;
14513
14532
  await trx.updateTable("submission").set({ voided_at: at.toISOString() }).where("task_id", "=", taskId).where("voided_at", "is", null).where("column", "in", voided).execute();
14514
14533
  }
14534
+ /**
14535
+ * Sets `voided_at` on the unvoided Review and Product Review marks of PR `repo#number` that are
14536
+ * not on `head`, for the PR's new head: a mark lasts only while its head stays the PR's head, so
14537
+ * a head that comes back to an earlier commit needs fresh marks. Marks made before submissions
14538
+ * recorded their PR count for the tasks linked to the PR.
14539
+ */
14540
+ async function voidMarksOffHead(trx, input) {
14541
+ const repo = input.repo.toLowerCase();
14542
+ await trx.updateTable("submission").set({ voided_at: input.at }).where("voided_at", "is", null).where("column", "in", MARK_COLUMNS).where(sql`lower(commit_sha) != ${input.head.toLowerCase()}`).where((eb) => eb.or([eb.and([eb(sql`lower(pr_repo)`, "=", repo), eb("pr_number", "=", input.number)]), eb.and([eb("pr_repo", "is", null), eb("task_id", "in", eb.selectFrom("link").select("task_id").where("entity", "=", "pr").where(sql`lower(repo) = ${repo}`).where("number", "=", input.number))])])).execute();
14543
+ }
14515
14544
  /** Voids the submits of `to` and every column right of it, as a left move does. */
14516
14545
  async function voidSubmits(trx, taskId, to, at) {
14517
14546
  await voidColumns(trx, taskId, COLUMN_IDS.filter((column) => indexOf(column) >= indexOf(to)), at);
@@ -14869,7 +14898,8 @@ async function readInput(trx, task, project, mode, blind, config) {
14869
14898
  turn: {
14870
14899
  visit: last === void 0 ? "none" : unclosed !== void 0 ? "unclosed" : last.closed_reason === "submitted" ? "submitted" : "none",
14871
14900
  open: unclosed?.acked_at != null,
14872
- operatorUntaken: unclosed?.role === "operator" && unclosed.acked_at === null
14901
+ operatorUntaken: unclosed?.role === "operator" && unclosed.acked_at === null,
14902
+ headMoved: unclosed !== void 0 && unclosed.head_sha !== null && pr !== null && unclosed.head_sha !== pr.headSha.toLowerCase()
14873
14903
  }
14874
14904
  },
14875
14905
  handed,
@@ -15041,6 +15071,12 @@ async function taskTurns(trx, task, detail) {
15041
15071
  //#region ../core/src/app/task-queries.ts
15042
15072
  /** How many of the last moves `task.get --why` shows. */
15043
15073
  const WHY_MOVES = 5;
15074
+ /** The fact each hold-only gate reason waits for, as `--why` names it. */
15075
+ const WAITING_FOR = {
15076
+ checks_pending: "waiting for CI",
15077
+ mergeable_unknown: "waiting for GitHub to compute mergeability",
15078
+ comment_history_incomplete: "waiting for the board to read the full PR comment history"
15079
+ };
15044
15080
  const EVENT_SUMMARIES = {
15045
15081
  head_moved: "Pull request head moved",
15046
15082
  pr_facts_changed: "Pull request facts changed",
@@ -15199,7 +15235,15 @@ function createTaskQueries(deps) {
15199
15235
  gates: [],
15200
15236
  checksWaivedBy: null
15201
15237
  };
15202
- const { gates, checksWaivedBy } = explainGates(read.input.facts, read.input.project);
15238
+ const { facts } = read.input;
15239
+ const { gates, checksWaivedBy } = explainGates(facts, read.input.project);
15240
+ const gate = evaluateGate(column, facts, read.input.project);
15241
+ const head = facts.pr?.headSha.toLowerCase();
15242
+ const waiting = gate.ok || head === void 0 ? [] : gate.reasons.filter((reason) => HOLD_ONLY.has(reason)).map((reason) => ({
15243
+ reason,
15244
+ head,
15245
+ text: `${WAITING_FOR[reason]} on ${head}`
15246
+ }));
15203
15247
  const holds = [...dispatchHolds(read.input), ...read.ticketUnconfirmed ? ["ticket_unconfirmed"] : []].sort((left, right) => TASK_HOLDS.indexOf(left) - TASK_HOLDS.indexOf(right));
15204
15248
  const heldBy = holds.includes("cycle_limit") ? await holdBlocks(trx, task.id) : [];
15205
15249
  return {
@@ -15208,7 +15252,8 @@ function createTaskQueries(deps) {
15208
15252
  holds,
15209
15253
  ...heldBy.length === 0 ? {} : { heldBy },
15210
15254
  gates,
15211
- checksWaivedBy
15255
+ checksWaivedBy,
15256
+ ...waiting.length === 0 ? {} : { waiting }
15212
15257
  };
15213
15258
  }
15214
15259
  /** The blocks of the active cycle-limit and course-check items that hold the task's turn. */
@@ -16116,6 +16161,12 @@ async function pr(trx, config, fact, at, source) {
16116
16161
  source,
16117
16162
  observed_at: at
16118
16163
  })).execute();
16164
+ if (old !== void 0 && old.head_sha.toLowerCase() !== fact.headSha.toLowerCase()) await voidMarksOffHead(trx, {
16165
+ repo: fact.repo,
16166
+ number: fact.number,
16167
+ head: fact.headSha,
16168
+ at
16169
+ });
16119
16170
  const project = projectForSource(config, source);
16120
16171
  if (project === void 0) return;
16121
16172
  for (const key of fact.ticketKeys) {
@@ -16734,6 +16785,7 @@ function whyLines(key, why, blocks) {
16734
16785
  return [
16735
16786
  line(`Task ${key} is in ${why.column}${mode}.`),
16736
16787
  ...why.holds.length === 0 ? [] : [line(`Held: ${why.holds.join(", ")}.`)],
16788
+ ...(why.waiting ?? []).map((entry) => line(`${entry.text.charAt(0).toUpperCase()}${entry.text.slice(1)}.`)),
16737
16789
  ...why.gates.filter((gate) => gate.enabled && !gate.ok).map((gate) => line(`${gate.column}: ${gate.conditions.toSorted((a, b) => STATE_ORDER[a.state] - STATE_ORDER[b.state]).map((condition) => `${condition.condition} ${condition.state}${condition.reason === null ? "" : ` (${condition.reason})`}`).join(", ")}`)),
16738
16790
  ...passing.length === 0 ? [] : [line(`Gates passing: ${passing.join(", ")}.`)],
16739
16791
  ...here === void 0 ? [] : [line(here.blockedIn === null ? `The ${why.column} gate passes.` : `The ${why.column} gate is blocked at ${here.blockedIn}.`)],
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { C as renderMcpError, Z as ERRORS, y as OPERATIONS } from "./chunk-DsCpUW6q.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-B2jz795d.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-hS9wN0vI.mjs";
1
+ import { C as renderMcpError, Z as ERRORS, y as OPERATIONS } from "./chunk-CTXzapf8.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-BiDQ4g_3.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-Fhr2daA8.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.55.1",
3
+ "version": "0.57.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -20,8 +20,8 @@ reuse it only to retry the same action and input after an uncertain outcome you
20
20
  ## Turns
21
21
 
22
22
  A turn T<number> hands a column visit to its executor. Ack it first with keyed
23
- `board inbox ack <entries>`; only the session that acked may submit or return it. An unacked
24
- turn delays no return, e.g. on a new head, red CI, a draft, a conflict or external comments.
23
+ `board inbox ack <entries>`; only the session that acked may submit or return it. A new head
24
+ closes a turn outside Dev. Unacked turns delay no return: red CI, draft, conflict, comments.
25
25
  On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no turn:
26
26
  `board submit <task> <sha>`.
27
27