spur-board 0.55.1 → 0.56.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,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-DfV3nwNC.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-aIvdot-z.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";
@@ -1955,7 +1955,12 @@ const taskWhySchema = z.strictObject({
1955
1955
  }).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
1956
  checksWaivedBy: z.literal("reposWithoutCi").nullable().describe("The config key that passed Dev's check condition for a repo without checks; null otherwise."),
1957
1957
  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.")
1958
+ moves: z.array(moveViewSchema).describe("The last 5 column moves, oldest first."),
1959
+ waiting: z.array(z.strictObject({
1960
+ reason: z.enum(GATE_REASONS).describe("The gate reason that waits on the fact."),
1961
+ head: commitShaSchema.describe("Head commit of the pull request the fact is about."),
1962
+ text: z.string().describe("The fact in one line, e.g. waiting for CI on <sha>.")
1963
+ }).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
1964
  }).describe("Why the task is in its column and what the dispatcher waits for.");
1960
1965
  const itemViewSchema = z.strictObject({
1961
1966
  id: itemIdSchema,
@@ -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-DfV3nwNC.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
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-DfV3nwNC.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-aIvdot-z.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-DeAk_J4r.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-aIvdot-z.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-DfV3nwNC.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";
@@ -13400,12 +13400,6 @@ async function getStatus(deps, options = {}) {
13400
13400
  hiddenUnlinkedSessions: sessionRows.length - unlinkedSessions.length
13401
13401
  };
13402
13402
  }
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
13403
  const HOLD_ONLY = /* @__PURE__ */ new Set([
13410
13404
  "mergeable_unknown",
13411
13405
  "checks_pending",
@@ -13631,7 +13625,8 @@ const STEP_BOUND = 2 * COLUMN_IDS.length;
13631
13625
  const NO_TURN = {
13632
13626
  visit: "none",
13633
13627
  open: false,
13634
- operatorUntaken: false
13628
+ operatorUntaken: false,
13629
+ headMoved: false
13635
13630
  };
13636
13631
  const indexOf$2 = (column) => COLUMN_IDS.indexOf(column);
13637
13632
  function orchestratorOf(project, column) {
@@ -13739,7 +13734,8 @@ function dispatch(input) {
13739
13734
  }
13740
13735
  const reasons = [...gate.reasons];
13741
13736
  if (gate.column !== column) {
13742
- if (cycleHeld || turn.open || reasons.every((reason) => HOLD_ONLY.has(reason))) return result(null);
13737
+ const held = turn.open && !turn.headMoved;
13738
+ if (cycleHeld || held || reasons.every((reason) => HOLD_ONLY.has(reason))) return result(null);
13743
13739
  move(gate.column, "gate_broken", reasons);
13744
13740
  continue;
13745
13741
  }
@@ -14505,13 +14501,23 @@ const MARK_COLUMNS = ["review", "product-review"];
14505
14501
  const indexOf = (column) => COLUMN_IDS.indexOf(column);
14506
14502
  /**
14507
14503
  * Sets `voided_at` on the unvoided submits of `columns`. Review and product-review marks are
14508
- * never voided.
14504
+ * not voided by a move; a new PR head voids them (`voidMarksOffHead`).
14509
14505
  */
14510
14506
  async function voidColumns(trx, taskId, columns, at) {
14511
14507
  const voided = columns.filter((column) => !MARK_COLUMNS.includes(column));
14512
14508
  if (voided.length === 0) return;
14513
14509
  await trx.updateTable("submission").set({ voided_at: at.toISOString() }).where("task_id", "=", taskId).where("voided_at", "is", null).where("column", "in", voided).execute();
14514
14510
  }
14511
+ /**
14512
+ * Sets `voided_at` on the unvoided Review and Product Review marks of PR `repo#number` that are
14513
+ * not on `head`, for the PR's new head: a mark lasts only while its head stays the PR's head, so
14514
+ * a head that comes back to an earlier commit needs fresh marks. Marks made before submissions
14515
+ * recorded their PR count for the tasks linked to the PR.
14516
+ */
14517
+ async function voidMarksOffHead(trx, input) {
14518
+ const repo = input.repo.toLowerCase();
14519
+ 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();
14520
+ }
14515
14521
  /** Voids the submits of `to` and every column right of it, as a left move does. */
14516
14522
  async function voidSubmits(trx, taskId, to, at) {
14517
14523
  await voidColumns(trx, taskId, COLUMN_IDS.filter((column) => indexOf(column) >= indexOf(to)), at);
@@ -14869,7 +14875,8 @@ async function readInput(trx, task, project, mode, blind, config) {
14869
14875
  turn: {
14870
14876
  visit: last === void 0 ? "none" : unclosed !== void 0 ? "unclosed" : last.closed_reason === "submitted" ? "submitted" : "none",
14871
14877
  open: unclosed?.acked_at != null,
14872
- operatorUntaken: unclosed?.role === "operator" && unclosed.acked_at === null
14878
+ operatorUntaken: unclosed?.role === "operator" && unclosed.acked_at === null,
14879
+ headMoved: unclosed !== void 0 && unclosed.head_sha !== null && pr !== null && unclosed.head_sha !== pr.headSha.toLowerCase()
14873
14880
  }
14874
14881
  },
14875
14882
  handed,
@@ -15041,6 +15048,12 @@ async function taskTurns(trx, task, detail) {
15041
15048
  //#region ../core/src/app/task-queries.ts
15042
15049
  /** How many of the last moves `task.get --why` shows. */
15043
15050
  const WHY_MOVES = 5;
15051
+ /** The fact each hold-only gate reason waits for, as `--why` names it. */
15052
+ const WAITING_FOR = {
15053
+ checks_pending: "waiting for CI",
15054
+ mergeable_unknown: "waiting for GitHub to compute mergeability",
15055
+ comment_history_incomplete: "waiting for the board to read the full PR comment history"
15056
+ };
15044
15057
  const EVENT_SUMMARIES = {
15045
15058
  head_moved: "Pull request head moved",
15046
15059
  pr_facts_changed: "Pull request facts changed",
@@ -15199,7 +15212,15 @@ function createTaskQueries(deps) {
15199
15212
  gates: [],
15200
15213
  checksWaivedBy: null
15201
15214
  };
15202
- const { gates, checksWaivedBy } = explainGates(read.input.facts, read.input.project);
15215
+ const { facts } = read.input;
15216
+ const { gates, checksWaivedBy } = explainGates(facts, read.input.project);
15217
+ const gate = evaluateGate(column, facts, read.input.project);
15218
+ const head = facts.pr?.headSha.toLowerCase();
15219
+ const waiting = gate.ok || head === void 0 ? [] : gate.reasons.filter((reason) => HOLD_ONLY.has(reason)).map((reason) => ({
15220
+ reason,
15221
+ head,
15222
+ text: `${WAITING_FOR[reason]} on ${head}`
15223
+ }));
15203
15224
  const holds = [...dispatchHolds(read.input), ...read.ticketUnconfirmed ? ["ticket_unconfirmed"] : []].sort((left, right) => TASK_HOLDS.indexOf(left) - TASK_HOLDS.indexOf(right));
15204
15225
  const heldBy = holds.includes("cycle_limit") ? await holdBlocks(trx, task.id) : [];
15205
15226
  return {
@@ -15208,7 +15229,8 @@ function createTaskQueries(deps) {
15208
15229
  holds,
15209
15230
  ...heldBy.length === 0 ? {} : { heldBy },
15210
15231
  gates,
15211
- checksWaivedBy
15232
+ checksWaivedBy,
15233
+ ...waiting.length === 0 ? {} : { waiting }
15212
15234
  };
15213
15235
  }
15214
15236
  /** The blocks of the active cycle-limit and course-check items that hold the task's turn. */
@@ -16116,6 +16138,12 @@ async function pr(trx, config, fact, at, source) {
16116
16138
  source,
16117
16139
  observed_at: at
16118
16140
  })).execute();
16141
+ if (old !== void 0 && old.head_sha.toLowerCase() !== fact.headSha.toLowerCase()) await voidMarksOffHead(trx, {
16142
+ repo: fact.repo,
16143
+ number: fact.number,
16144
+ head: fact.headSha,
16145
+ at
16146
+ });
16119
16147
  const project = projectForSource(config, source);
16120
16148
  if (project === void 0) return;
16121
16149
  for (const key of fact.ticketKeys) {
@@ -16734,6 +16762,7 @@ function whyLines(key, why, blocks) {
16734
16762
  return [
16735
16763
  line(`Task ${key} is in ${why.column}${mode}.`),
16736
16764
  ...why.holds.length === 0 ? [] : [line(`Held: ${why.holds.join(", ")}.`)],
16765
+ ...(why.waiting ?? []).map((entry) => line(`${entry.text.charAt(0).toUpperCase()}${entry.text.slice(1)}.`)),
16737
16766
  ...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
16767
  ...passing.length === 0 ? [] : [line(`Gates passing: ${passing.join(", ")}.`)],
16739
16768
  ...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-DfV3nwNC.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-aIvdot-z.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DeAk_J4r.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.56.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