spur-board 0.148.0 → 0.149.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
@@ -11632,14 +11632,21 @@ function executorDone(column, facts) {
11632
11632
  }
11633
11633
  /**
11634
11634
  * The leftmost enabled column that requires resolved threads: `requireResolvedThreads`, by default
11635
- * true on Ready to Merge only. Undefined when no enabled column requires them.
11635
+ * true on Ready to Merge only. Under `approvalRule: github-rules`, a review rule GitHub blocks on
11636
+ * unresolved threads (`facts.reviewRule`) also requires them from External Review on, whatever
11637
+ * `requireResolvedThreads` says. Undefined when no column requires them.
11636
11638
  */
11637
- function threadsFrom(project) {
11638
- return project.columns.find((c) => c.enabled && (c.requireResolvedThreads ?? c.id === "ready-to-merge"))?.id;
11639
+ function threadsFrom(project, facts) {
11640
+ const from = project.columns.find((c) => c.enabled && (c.requireResolvedThreads ?? c.id === "ready-to-merge"))?.id;
11641
+ if (facts?.reviewRule?.decision !== "unresolved_threads" || approvalRuleOf(project) !== "github-rules") return from;
11642
+ return from !== void 0 && COLUMN_IDS.indexOf(from) < COLUMN_IDS.indexOf("external-review") ? from : "external-review";
11639
11643
  }
11640
- /** Whether any enabled column of the project requires resolved review threads. */
11641
- function threadsGated(project) {
11642
- return threadsFrom(project) !== void 0;
11644
+ /**
11645
+ * Whether any column of the project requires resolved review threads, with `facts` as
11646
+ * `threadsFrom` reads them.
11647
+ */
11648
+ function threadsGated(project, facts) {
11649
+ return threadsFrom(project, facts) !== void 0;
11643
11650
  }
11644
11651
  /**
11645
11652
  * Dev's failing reasons. `threads` adds the resolved-threads condition: it holds for the gate of
@@ -11665,7 +11672,7 @@ function gateCheckReasons(facts, waived) {
11665
11672
  * The failing reasons of one column's exit condition. Only Dev's resolved-threads condition depends
11666
11673
  * on the column asked: `threads` says whether it counts. A `gate_broken` move re-evaluates at Dev,
11667
11674
  * where that condition may not count, so a reason or hand-over that must survive it keys on the
11668
- * facts and `threadsGated(project)` (`withThreads`, `turnThreads`), and `explainGates` takes
11675
+ * facts and `threadsGated(project, facts)` (`withThreads`, `turnThreads`), and `explainGates` takes
11669
11676
  * `blockedIn` from `evaluateGate`.
11670
11677
  */
11671
11678
  function columnCondition(column, facts, project, waived, threads) {
@@ -11758,14 +11765,15 @@ function describeConditions(column, project) {
11758
11765
  * Evaluates the exit conditions of every enabled column from To Do up to and including `column`,
11759
11766
  * and returns the leftmost one that fails. A column absent from the project's columns or disabled
11760
11767
  * passes through. A merged pull request passes every column. Dev's resolved-threads condition
11761
- * counts when `column` is at or right of the leftmost enabled column requiring resolved threads.
11768
+ * counts when `column` is at or right of the leftmost column requiring resolved threads
11769
+ * (`threadsFrom`).
11762
11770
  * Once Dev is evaluated with its check condition passed by `reposWithoutCi`, the result carries
11763
11771
  * `checksWaivedBy`.
11764
11772
  */
11765
11773
  function evaluateGate(column, facts, project) {
11766
11774
  if (facts.pr?.state === "merged") return { ok: true };
11767
11775
  const waived = noCiWaives(facts.pr, project);
11768
- const from = threadsFrom(project);
11776
+ const from = threadsFrom(project, facts);
11769
11777
  const threads = from !== void 0 && COLUMN_IDS.indexOf(from) <= COLUMN_IDS.indexOf(column);
11770
11778
  let marker = {};
11771
11779
  for (const id of COLUMN_IDS.slice(0, COLUMN_IDS.indexOf(column) + 1)) {
@@ -11855,14 +11863,15 @@ const CONDITION_OF = {
11855
11863
  const STOPS_DEV = /* @__PURE__ */ new Set(["no_pr", "pr_closed"]);
11856
11864
  /**
11857
11865
  * Every column's own exit conditions with their state, and where its cumulative gate blocks, as
11858
- * `evaluateGate` decides it for each column. Dev's own conditions count resolved threads once any
11859
- * enabled column requires them. A merged pull request passes every column and every condition.
11866
+ * `evaluateGate` decides it for each column. Dev's own conditions count resolved threads once a
11867
+ * column requires them (`threadsGated`). A merged pull request passes every column and every
11868
+ * condition.
11860
11869
  * `checksWaivedBy` is the marker `evaluateGate('done')` carries, or null.
11861
11870
  */
11862
11871
  function explainGates(facts, project) {
11863
11872
  const merged = facts.pr?.state === "merged";
11864
11873
  const waived = noCiWaives(facts.pr, project);
11865
- const threads = threadsGated(project);
11874
+ const threads = threadsGated(project, facts);
11866
11875
  let checksWaivedBy = null;
11867
11876
  return {
11868
11877
  gates: COLUMN_IDS.map((column) => {
@@ -12090,7 +12099,7 @@ function dispatch(input) {
12090
12099
  };
12091
12100
  };
12092
12101
  const withThreads = (next) => {
12093
- if (next?.column !== "dev" || !threadsGated(project) || facts.unresolvedThreads === 0) return next;
12102
+ if (next?.column !== "dev" || !threadsGated(project, facts) || facts.unresolvedThreads === 0) return next;
12094
12103
  const { reasons } = next;
12095
12104
  if (reasons.some((r) => r === "no_pr" || r === "pr_closed" || r === "unresolved_threads")) return next;
12096
12105
  const added = /* @__PURE__ */ new Set([...reasons, "unresolved_threads"]);
@@ -14818,8 +14827,11 @@ async function storedReviewRule(trx, source, pr, agentLogin) {
14818
14827
  }
14819
14828
  const upper = (value) => value === null ? "null" : value.toUpperCase();
14820
14829
  /**
14821
- * The items of github-rules tasks in External Review whose head has stayed undecided for
14822
- * `REVIEW_RULE_UNDECIDED_MS` and whose gate, read as `readInput` reads it, still runs the clock: a
14830
+ * The items of github-rules tasks in External Review. A head GitHub blocks with every review thread
14831
+ * resolved, while the external approval is in place and External Review has no orchestrator, raises
14832
+ * one at once; its shown text carries GitHub's current values and nothing is written. Otherwise an
14833
+ * item comes for a head that has stayed undecided for `REVIEW_RULE_UNDECIDED_MS` and whose gate,
14834
+ * read as `readInput` reads it, still runs the clock: a
14823
14835
  * newer read of the head by another project's source can name someone to act first or carry
14824
14836
  * GitHub's answer, and then no item is raised or kept. GitHub's values are frozen in the row at
14825
14837
  * the first reconcile past the threshold and again when the cause changes, so a later poll or a
@@ -14838,9 +14850,24 @@ async function reviewRuleItems(trx, config, now, tasks) {
14838
14850
  const source = prSourceId(project.id, pr.repo);
14839
14851
  const gate = await gateRead(trx, source, project.checksGate === "dev" ? pr : await withUnconfirmedCancels(trx, source, pr), project.operatorGithubLogin);
14840
14852
  const row = gate.row;
14853
+ const ref = `${pr.repo.toLowerCase()}#${String(pr.number)}`;
14854
+ const executor = project.columns.find((column) => column.id === "external-review")?.orchestrator ?? "none";
14855
+ if (row !== null && gate.decision === "blocked" && gate.approved && !gate.changesRequested && executor === "none") {
14856
+ const what = `${task.key}: GitHub blocks the merge of ${ref} on ${row.headSha.slice(0, 7)} with every review thread resolved and the approval in place`;
14857
+ candidates.push({
14858
+ key: `${REVIEW_RULE_KEY}${String(task.id)}:${ref}:${row.headSha}`,
14859
+ kind: "board_observation",
14860
+ taskId: task.id,
14861
+ summary: `${what} (mergeStateStatus=${upper(pr.mergeState)}, mergeable=${upper(pr.mergeable)}, reviewDecision=${upper(row.reviewDecision)})`,
14862
+ hashedSummary: what,
14863
+ factAt: row.observedAt ?? null,
14864
+ source,
14865
+ priority: 4
14866
+ });
14867
+ continue;
14868
+ }
14841
14869
  if (row?.undecidedSince == null || !gate.clock) continue;
14842
14870
  if (now - Date.parse(row.undecidedSince) < REVIEW_RULE_UNDECIDED_MS) continue;
14843
- const ref = `${pr.repo.toLowerCase()}#${String(pr.number)}`;
14844
14871
  const what = gate.decision === "unreadable" ? `The GitHub review rule for the base branch of ${ref} could not be read` : `GitHub has not decided the review rule of ${ref}`;
14845
14872
  let raised = row.raised;
14846
14873
  if (raised === null || !raised.startsWith(what)) {
@@ -15807,7 +15834,11 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
15807
15834
  if (item.source === "spur" && spurHeld.has(item.item_key) || stillInError.has(item.item_key)) seen.add(item.item_key);
15808
15835
  }
15809
15836
  for (const item of existing) if (!seen.has(item.item_key)) await clearReconciled(trx, item, new Date(now));
15810
- const ended = (await trx.selectFrom("dismissal").select("item_key").where((eb) => eb.or([eb("item_key", "like", "pr-closed:%"), eb("item_key", "like", "ticket-closed:%")])).execute()).map((row) => row.item_key).filter((key) => !seen.has(key));
15837
+ const ended = (await trx.selectFrom("dismissal").select("item_key").where((eb) => eb.or([
15838
+ eb("item_key", "like", "pr-closed:%"),
15839
+ eb("item_key", "like", "ticket-closed:%"),
15840
+ eb("item_key", "like", `${REVIEW_RULE_KEY}%`)
15841
+ ])).execute()).map((row) => row.item_key).filter((key) => !seen.has(key));
15811
15842
  if (ended.length > 0) await trx.deleteFrom("dismissal").where("item_key", "in", ended).execute();
15812
15843
  for (const candidate of ordered) {
15813
15844
  const hash = fingerprint(candidate);
@@ -18888,11 +18919,13 @@ async function taskSessions(trx, taskId) {
18888
18919
  // ../core/src/app/turn-view.ts
18889
18920
  /**
18890
18921
  * The unresolved review threads a Dev turn lists, read live from the task's PR snapshot: only on a
18891
- * project requiring resolved threads and an open PR, and only threads with an id and a link (facts
18892
- * stored by an earlier version lack them). Undefined when none.
18922
+ * project requiring resolved threads, or for a turn whose reason names `unresolved_threads` (a
18923
+ * return GitHub's review rule caused), and an open PR, and only threads with an id and a link
18924
+ * (facts stored by an earlier version lack them). Undefined when none.
18893
18925
  */
18894
18926
  async function turnThreads(trx, taskId, project, turn) {
18895
- if (turn.column !== "dev" || project === void 0 || !threadsGated(project)) return void 0;
18927
+ if (turn.column !== "dev" || project === void 0) return void 0;
18928
+ if (!(turn.reason.split(": ")[1] ?? "").split(", ").includes("unresolved_threads") && !threadsGated(project)) return void 0;
18896
18929
  const pr = await prFacts(trx, taskId);
18897
18930
  if (pr?.state !== "open") return void 0;
18898
18931
  const threads = pr.reviewThreads.flatMap(({ resolved, id, url, outdated }) => resolved || id === void 0 || url === void 0 ? [] : [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.148.0",
3
+ "version": "0.149.0",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -25,18 +25,20 @@ Exact reason in events; one line in history.
25
25
  `--correct` repairs enabled non-Done columns then settles gates. Dev return:
26
26
  `board return <turn> <reason>`. QA: `board submit <turn> <sha>` records evidence.
27
27
 
28
- | Column | Position source | Who moves | Command |
29
- | ----------------- | ------------------------------ | ---------------------------- | ------------------------------------------------------------- |
30
- | `todo` | New/reopened; manual | Dispatcher/operator | `board move <task> todo --reason <text> --key <key>` |
31
- | `triage` | Manual | Operator | `board move <task> triage --reason <text> --key <key>` |
32
- | `ready-for-dev` | Manual or Project mirror | Operator/mirror | `board move <task> ready-for-dev --reason <text> --key <key>` |
33
- | `dev` | Work start/gate failure/return | Dispatcher/executor/operator | `board move <task> dev --correct --reason <text>` |
34
- | `review` | Gates: internal review | Dispatcher/operator | `board move <task> review --correct --reason <text>` |
35
- | `product-review` | Gates: product review | Dispatcher/operator | `board move <task> product-review --correct --reason <text>` |
36
- | `external-review` | Gates: external approval | Dispatcher/operator | `board move <task> external-review --correct --reason <text>` |
37
- | `qa` | Gates: QA confirmation | Dispatcher/operator | `board move <task> qa --correct --reason <text>` |
38
- | `ready-to-merge` | Gates: merge | Dispatcher/operator | `board move <task> ready-to-merge --correct --reason <text>` |
39
- | `done` | Completion: PR/ticket facts | Dispatcher | None (automatic) |
28
+ <!-- prettier-ignore-start -->
29
+ | Column | Position source | Who moves | Command |
30
+ | --- | --- | --- | --- |
31
+ | `todo` | New/reopened; manual | Dispatcher/operator | `board move <task> todo --reason <text> --key <key>` |
32
+ | `triage` | Manual | Operator | `board move <task> triage --reason <text> --key <key>` |
33
+ | `ready-for-dev` | Manual or Project mirror | Operator/mirror | `board move <task> ready-for-dev --reason <text> --key <key>` |
34
+ | `dev` | Work start/gate failure/return | Dispatcher/executor/operator | `board move <task> dev --correct --reason <text>` |
35
+ | `review` | Gates: internal review | Dispatcher/operator | `board move <task> review --correct --reason <text>` |
36
+ | `product-review` | Gates: product review | Dispatcher/operator | `board move <task> product-review --correct --reason <text>` |
37
+ | `external-review` | Gates: external approval | Dispatcher/operator | `board move <task> external-review --correct --reason <text>` |
38
+ | `qa` | Gates: QA confirmation | Dispatcher/operator | `board move <task> qa --correct --reason <text>` |
39
+ | `ready-to-merge` | Gates: merge | Dispatcher/operator | `board move <task> ready-to-merge --correct --reason <text>` |
40
+ | `done` | Completion: PR/ticket facts | Dispatcher | None (automatic) |
41
+ <!-- prettier-ignore-end -->
40
42
 
41
43
  Order: one per column, board-wide; arrivals go last. Operator:
42
44
  `board order <task> --before <task> --key <key>` (`--after`, `--top`, `--bottom`);
@@ -105,7 +107,9 @@ gates that column and those right of it: an unresolved review thread, outdated
105
107
  or by anyone, returns the task to Dev, whose turn lists each thread link. The
106
108
  worker fixes or answers, then resolves each; reviewers never do. A
107
109
  Dev submit on the same head moves right, keeping marks and approval. An
108
- approval's inline notes are threads; it still passes External Review.
110
+ approval's inline notes are threads; it still passes External Review. Under
111
+ `github-rules`, GitHub blocking on threads returns the task to Dev from
112
+ External Review on.
109
113
 
110
114
  Review/Product Review mark lasts across visits on the current head. QA submissions
111
115
  also survive returns and corrections to Dev on the same head. Other visit
@@ -26,7 +26,7 @@ Kinds of [operator inbox](how-board-works-blocks.md#operator-inbox) entries: wha
26
26
  | `board_observation` `filter:` | the ticket left the tracker filter but work is live | return the ticket to the filter, or finish or unlink the linked work (`board unlink <task> --pr <pr> --reason <reason>`) | attention | the ticket is back in the filter or no linked open PR or live session is left | stored target |
27
27
  | `board_observation` `health:` | a session health flag | check session `<session>` in Spur; a vanished worker: start a new one for the task, or archive it | attention | the flag ends; for a vanished worker also when the ticket is done | stored target |
28
28
  | `board_observation` `no-session:` | a named-orchestrator column's untaken turns have no live session to ring for its `noRecipientAfterMs` (default 10 min), timed from the later of the ring and the first end, absence or finished state (stopped, killed, errored, completed) of the last recipient session of the column's Spur project or the task's linked orchestrator; one item per project and column, on the oldest waiting turn's task, with the waiting count and minutes without a live session; doctor check `orchestrator.sessions` also warns `no live session` | start a session in Spur project `<spur>`, or take over its turns with an inbox ack | attention | a live session appears or the turns are taken or closed; a later full-length gap raises it again; once closed, it stays closed while the same oldest turn waits | stored target |
29
- | `board_observation` `review-rule:` | under `approvalRule: github-rules`, a task in External Review whose head has no stored decision and GitHub left undecided (merge state unknown or behind, or a rule the token cannot read) for 30 minutes, time outside External Review included, so a same-head return can raise it at once; one item per task, PR and undecided stretch of a head, naming the current cause with the raw `mergeStateStatus`, `mergeable` and `reviewDecision` of its first raise; once closed, it stays closed while its text is the same. A draft, a conflict, changes requested (GitHub's too, at any merge state) and a pending or missing required check have their own reasons and end the stretch | check the PR on GitHub: update the branch, let the token read the base branch rules or wait, then close the item | attention | GitHub decides the head, the state gets its own reason, a new head arrives or the task leaves | stored target |
29
+ | `board_observation` `review-rule:` | under `github-rules`, an External Review task whose head GitHub left undecided 30 min with no stored decision (unknown or behind merge state, unreadable rule), or blocks with every thread resolved, approval in place, External Review unbound (at once; threads return it to Dev); one per task, PR, head stretch, naming the cause and raw `mergeStateStatus`, `mergeable` and `reviewDecision` (undecided: first raise per cause; blocked: current). Undecided time elsewhere counts; a closed item stays closed in its stretch until its text (not a blocked item's raw values) changes. Drafts, conflicts, changes requested (GitHub's too) and pending or missing required checks have own reasons | check the PR and rules on GitHub: update the branch, let the token read rules or wait, then close it | attention | the head is decided otherwise, gets its own reason or is replaced, or the task leaves | stored target |
30
30
  | `board_observation` `external-quiet:` | a task with an open PR sat in External Review past its `quietAfterMs` with no new external review round; held while GitHub is blind or stale | request a new external review round or approve the PR by hand | attention | a new external review or head, or the task leaves | stored target |
31
31
  | `worker_ended` | an agent holding the current open non-Done turn ended for any reason, PRs or links aside; also a killed worker without a PR whose ticket is not done; a new item posts a feed line with Close; each complete Spur poll moves its fact time | start a new worker for the task, or archive the task; an operator turn: retake it (`board inbox ack`) | attention | the turn closes, its holder changes, the task leaves the column visit or is archived; a turnless worker: the health flag ends or the ticket is done | stored target |
32
32
  | `turn` | a turn is yours | listed as its `T…` entry | attention | the turn closes | absent |