spur-board 0.121.0 → 0.122.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.
package/dist/daemon.mjs CHANGED
@@ -15124,7 +15124,7 @@ function executorDone(column, facts, columns) {
15124
15124
  const onHead = facts.marks.filter((mark) => mark.headSha === head);
15125
15125
  if (onHead.some((mark) => mark.column === column)) return true;
15126
15126
  if (orchestratorOf$1(column, columns) !== "none") return false;
15127
- return onHead.some((mark) => mark.kind === "submit" && orchestratorOf$1(mark.column, columns) === "none");
15127
+ return onHead.some((mark) => mark.kind === "submit" && !(column === "dev" && mark.column === "qa") && orchestratorOf$1(mark.column, columns) === "none");
15128
15128
  }
15129
15129
  /**
15130
15130
  * The leftmost enabled column that requires resolved threads: `requireResolvedThreads`, by default
@@ -15374,9 +15374,9 @@ function nextColumn(project, column) {
15374
15374
  const group = groupOf(column);
15375
15375
  return project.columns.find((c) => c.enabled && indexOf$2(c.id) > indexOf$2(column) && (group === null || groupOf(c.id) !== group))?.id;
15376
15376
  }
15377
- /** A left move to `to` voids the submits of `to` and right of it; marks stay. */
15377
+ /** A left move voids visit submits of `to` and right of it; review marks and QA stay. */
15378
15378
  function dropSubmits(marks, to) {
15379
- return marks.filter((mark) => mark.kind === "mark" || indexOf$2(mark.column) < indexOf$2(to));
15379
+ return marks.filter((mark) => mark.kind === "mark" || mark.column === "qa" || indexOf$2(mark.column) < indexOf$2(to));
15380
15380
  }
15381
15381
  /** Whether work on the task started: it has an open PR, or a live worker and no reopen. */
15382
15382
  function workStarted(input) {
@@ -16623,20 +16623,22 @@ const modeSchema = z.enum(DISPATCHER_MODES);
16623
16623
  /** Columns whose submissions are marks: they last for their head across visits. */
16624
16624
  const MARK_COLUMNS = COLUMNS.filter((c) => c.marks).map((c) => c.id);
16625
16625
  const isMarkColumn = (column) => MARK_COLUMNS.includes(column);
16626
+ /** Evidence that lasts for its head across visits. QA remains a submit. */
16627
+ const HEAD_COLUMNS = [...MARK_COLUMNS, "qa"];
16626
16628
  const indexOf = (column) => COLUMN_IDS.indexOf(column);
16627
16629
  /**
16628
- * Sets `voided_at` on the unvoided submits of `columns`. Review and product-review marks are
16629
- * not voided by a move; a new PR head voids them (`voidMarksOffHead`). A pending submit is never
16630
+ * Sets `voided_at` on the unvoided submits of `columns`. Review marks and QA submits are
16631
+ * not voided by an ordinary move; a new PR head voids them (`voidMarksOffHead`). A pending submit is never
16630
16632
  * voided here: it settles only when its hand-back turn opens, as confirmed, or as superseded by
16631
16633
  * a merge (`readPendingSubmit`), and counts as no mark until then.
16632
16634
  */
16633
16635
  async function voidColumns(trx, taskId, columns, at) {
16634
- const voided = columns.filter((column) => !MARK_COLUMNS.includes(column));
16636
+ const voided = columns.filter((column) => !HEAD_COLUMNS.includes(column));
16635
16637
  if (voided.length === 0) return;
16636
16638
  await trx.updateTable("submission").set({ voided_at: at.toISOString() }).where("task_id", "=", taskId).where("voided_at", "is", null).where("pending_until", "is", null).where("column", "in", voided).execute();
16637
16639
  }
16638
16640
  /**
16639
- * Sets `voided_at` on the unvoided Review and Product Review marks of PR `repo#number` that are
16641
+ * Sets `voided_at` on the unvoided Review/Product Review marks and QA submits of PR `repo#number` that are
16640
16642
  * not on `head`, for the PR's new head: a mark lasts only while its head stays the PR's head, so
16641
16643
  * a head that comes back to an earlier commit needs fresh marks. Marks made before submissions
16642
16644
  * recorded their PR count for the tasks linked to the PR. A pending mark is left to the
@@ -16644,7 +16646,7 @@ async function voidColumns(trx, taskId, columns, at) {
16644
16646
  */
16645
16647
  async function voidMarksOffHead(trx, input) {
16646
16648
  const repo = input.repo.toLowerCase();
16647
- await trx.updateTable("submission").set({ voided_at: input.at }).where("voided_at", "is", null).where("column", "in", MARK_COLUMNS).where("pending_until", "is", null).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();
16649
+ await trx.updateTable("submission").set({ voided_at: input.at }).where("voided_at", "is", null).where("column", "in", HEAD_COLUMNS).where("pending_until", "is", null).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();
16648
16650
  }
16649
16651
  /** Voids the submits of `to` and every column right of it, as a left move does. */
16650
16652
  async function voidSubmits(trx, taskId, to, at) {
@@ -16776,7 +16778,8 @@ async function syncModes(trx, config, at) {
16776
16778
  * The operator's correction of a task's column to `to`, as a new visit of `to`. It first applies
16777
16779
  * a pending dispatcher mode switch, so the switch cannot overwrite the correction. In `on` mode it
16778
16780
  * sets the column and bumps `column_epoch`, voids the submits of `to` and right of it, closes the
16779
- * task's turns as `corrected` and journals `task_corrected`; in shadow mode it sets only the shadow
16781
+ * task's turns as `corrected` and journals `task_corrected`; correction into QA also voids
16782
+ * confirmed and pending QA evidence. In shadow mode it sets only the shadow
16780
16783
  * column. The feedback a closed untaken turn handed over counts as unhandled again
16781
16784
  * (`turnFeedbackCursors`), so the next Dev turn hands it over, whenever it opens. It is
16782
16785
  * not a dispatcher move: no `task_moved`, no `left_moves` and no cycle count. The caller settles
@@ -16798,6 +16801,7 @@ async function correctColumn(trx, input) {
16798
16801
  last_change_at: taskChangeAt(at.toISOString())
16799
16802
  }).where("id", "=", task.id).execute();
16800
16803
  await voidSubmits(trx, task.id, to, at);
16804
+ if (to === "qa") await trx.updateTable("submission").set({ voided_at: at.toISOString() }).where("task_id", "=", task.id).where("column", "=", "qa").where("voided_at", "is", null).execute();
16801
16805
  if (!shadow) await closeTurns(trx, {
16802
16806
  taskId: task.id,
16803
16807
  reason: "corrected",
@@ -20883,9 +20887,23 @@ async function loadFiles(root) {
20883
20887
  }
20884
20888
  return files;
20885
20889
  }
20890
+ function escapeHtml(value) {
20891
+ return value.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
20892
+ }
20893
+ /** Names the daemon version in the page right after its first `<head>` tag; no `<head>`, no change. */
20894
+ function stampVersion(index, version) {
20895
+ const html = index.toString("utf8");
20896
+ const head = /<head(?:\s[^>]*)?>/i.exec(html);
20897
+ if (head === null) return index;
20898
+ const end = head.index + head[0].length;
20899
+ return Buffer.from(`${html.slice(0, end)}<meta name="board-version" content="${escapeHtml(version)}">${html.slice(end)}`);
20900
+ }
20886
20901
  /** Independent browser transport; the caller owns listening and shutdown. */
20887
20902
  async function createWebServer(options) {
20888
20903
  const files = await loadFiles(options.webRoot);
20904
+ const { productVersion } = options;
20905
+ const index = files.get("/index.html");
20906
+ if (productVersion !== void 0 && index !== void 0) files.set("/index.html", stampVersion(index, productVersion));
20889
20907
  const app = Fastify({
20890
20908
  logger: false,
20891
20909
  genReqId: () => randomUUID(),
@@ -20930,6 +20948,7 @@ async function createWebServer(options) {
20930
20948
  reply.header("x-frame-options", "DENY");
20931
20949
  reply.header("x-content-type-options", "nosniff");
20932
20950
  reply.header("referrer-policy", "no-referrer");
20951
+ if (productVersion !== void 0) reply.header("x-board-version", productVersion);
20933
20952
  }
20934
20953
  const audited = /* @__PURE__ */ new WeakSet();
20935
20954
  function audit(request, reply) {
@@ -26783,7 +26802,8 @@ function createWebModule(ctx, options) {
26783
26802
  step
26784
26803
  }, "event stream read failed");
26785
26804
  },
26786
- ...options.instance === void 0 ? {} : { instance: options.instance }
26805
+ ...options.instance === void 0 ? {} : { instance: options.instance },
26806
+ ...options.productVersion === void 0 ? {} : { productVersion: options.productVersion }
26787
26807
  });
26788
26808
  if (aborted()) return;
26789
26809
  const address = await server.listen({
@@ -27186,6 +27206,7 @@ function createDaemonModules(ctxFor, ports = {}) {
27186
27206
  firstPollDone: () => firstPollDone(board.store.db, board.config, core.completeSince),
27187
27207
  ...ports.afterOperation === void 0 ? {} : { afterOperation: ports.afterOperation },
27188
27208
  ...ports.webRoot === void 0 ? {} : { webRoot: ports.webRoot },
27209
+ ...ports.productVersion === void 0 ? {} : { productVersion: ports.productVersion },
27189
27210
  onListening: (address) => {
27190
27211
  webPort = listenerPort(address);
27191
27212
  ports.onWebListening?.(address);