spur-board 0.53.0 → 0.53.1

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
@@ -15995,11 +15995,15 @@ async function session(trx, config, fact, at, source, ambiguousBranches) {
15995
15995
  await trx.updateTable("task").set({ last_change_at: at }).where("id", "=", task.id).execute();
15996
15996
  }
15997
15997
  }
15998
- /** The PRs of a GitHub source's repo that still have an unbanned link, one per ref key. */
15998
+ /**
15999
+ * The PRs of a GitHub source's repo that still have an unbanned link to a task that is not
16000
+ * archived, one per ref key. A PR linked only to archived tasks is not polled; restoring the
16001
+ * task brings it back on the next poll. `out_of_filter` tasks keep their PRs.
16002
+ */
15999
16003
  async function linkedPrs(db, source) {
16000
16004
  if (!source.startsWith("github:")) return [];
16001
16005
  const repo = source.slice(source.lastIndexOf(":") + 1);
16002
- const prs = (await db.selectFrom("link").select(["repo", "number"]).where("entity", "=", "pr").where(sql`lower(repo) = ${repo.toLowerCase()}`).where("banned", "=", 0).execute()).flatMap((link) => link.repo === null || link.number === null ? [] : [{
16006
+ const prs = (await db.selectFrom("link").innerJoin("task", "task.id", "link.task_id").select(["link.repo", "link.number"]).where("link.entity", "=", "pr").where(sql`lower(link.repo) = ${repo.toLowerCase()}`).where("link.banned", "=", 0).where("task.membership", "!=", "archived").execute()).flatMap((link) => link.repo === null || link.number === null ? [] : [{
16003
16007
  kind: "pr",
16004
16008
  repo: link.repo,
16005
16009
  number: link.number
@@ -18744,9 +18748,7 @@ async function pollRepository({ id, repo, login, keys, client, now, ctx, reserve
18744
18748
  if (!owner || !name) throw new AdapterError("config", "Invalid repository");
18745
18749
  const requested = ctx.observe.prs.filter((ref) => ref.repo.toLowerCase() === repo.toLowerCase());
18746
18750
  const byNumber = new Map(requested.map((ref) => [ref.number, ref]));
18747
- const numbers = [...byNumber.keys()];
18748
18751
  const closing = closingSelected(keys);
18749
- for (const number of cache.keys()) if (!byNumber.has(number)) cache.delete(number);
18750
18752
  const acc = accumulator(true);
18751
18753
  const requests = {
18752
18754
  failed: 0,
@@ -18763,18 +18765,21 @@ async function pollRepository({ id, repo, login, keys, client, now, ctx, reserve
18763
18765
  const discovery = await readDiscovery(request, acc, ctx, login);
18764
18766
  if (!discovery.ok) acc.complete = false;
18765
18767
  const { found } = discovery;
18768
+ const numbers = [...byNumber.keys(), ...found.numbers.filter((number) => !byNumber.has(number) && cache.has(number))];
18769
+ const fresh = found.numbers.filter((number) => !byNumber.has(number) && !cache.has(number));
18770
+ for (const number of cache.keys()) if (!byNumber.has(number) && discovery.ok && !found.numbers.includes(number)) cache.delete(number);
18766
18771
  const entries = await readIndex(request, acc, numbers);
18767
18772
  const cursorKey = (number) => JSON.stringify([entryFor(ctx.feedbackCursors, repo, number) ?? "none", entryFor(ctx.continuations, repo, number) ?? "none"]);
18768
18773
  const changed = [];
18769
18774
  for (const number of numbers) {
18770
18775
  const facts = reusable(cache.get(number), entries.get(number), cursorKey(number), now());
18771
18776
  const ref = byNumber.get(number);
18772
- if (facts !== void 0 && ref !== void 0) {
18777
+ if (facts !== void 0) {
18773
18778
  acc.items.push({
18774
18779
  kind: "pr",
18775
18780
  facts
18776
18781
  });
18777
- acc.entities.push({
18782
+ if (ref !== void 0) acc.entities.push({
18778
18783
  ref,
18779
18784
  status: "ok"
18780
18785
  });
@@ -18806,8 +18811,9 @@ async function pollRepository({ id, repo, login, keys, client, now, ctx, reserve
18806
18811
  if (found.numbers.includes(number)) discoveredOk = false;
18807
18812
  }
18808
18813
  };
18809
- const discovered = found.numbers.filter((number) => !byNumber.has(number));
18810
- for (const chunk of [...chunks(changed, DETAIL_CHUNK), ...chunks(discovered, DETAIL_CHUNK)]) {
18814
+ const discovered = [...changed.filter((number) => !byNumber.has(number)), ...fresh];
18815
+ const changedRequested = changed.filter((number) => byNumber.has(number));
18816
+ for (const chunk of [...chunks(changedRequested, DETAIL_CHUNK), ...chunks(discovered, DETAIL_CHUNK)]) {
18811
18817
  if (acc.budget !== void 0 && acc.budget.remaining < reserveRemaining) {
18812
18818
  unread(chunk);
18813
18819
  continue;
@@ -18829,9 +18835,8 @@ async function pollRepository({ id, repo, login, keys, client, now, ctx, reserve
18829
18835
  if (found.numbers.includes(number)) discoveredOk = false;
18830
18836
  continue;
18831
18837
  }
18832
- const entry = entries.get(number);
18833
- if (entry !== void 0) cache.set(number, {
18834
- fingerprint: entry.fingerprint,
18838
+ cache.set(number, {
18839
+ fingerprint: entries.get(number)?.fingerprint ?? null,
18835
18840
  facts,
18836
18841
  cursorKey: cursorKey(number),
18837
18842
  readAt: now()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.53.0",
3
+ "version": "0.53.1",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"
@@ -5,6 +5,8 @@ description: Use the Board to read task state and handle worker questions, inbox
5
5
 
6
6
  # Spur Board
7
7
 
8
+ `board` is a CLI on `PATH`, not a `spur` subcommand.
9
+
8
10
  Read task state before acting. `board schema --role worker --json` (or `--role orchestrator`)
9
11
  lists operations, inputs, grants and errors.
10
12
 
@@ -34,10 +36,10 @@ On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no t
34
36
  ## Worker flow
35
37
 
36
38
  - If `board task <task>` lists no worker link for your session, run
37
- `spur slots --session "$SPUR_SESSION" --link board-worker=<issue URL>`, or ask the operator
38
- for `board link`. Spell the URL as the task key: `o/r#12` is `https://github.com/o/r/issues/12`.
39
- - Ask a blocking question with keyed `board ask <task> <text>`; keep its B<number> and wait for
40
- the doorbell. Use keyed `board comment <task> <text>` for nonblocking updates.
39
+ `spur slots --session "$SPUR_SESSION" --link board-worker=<issue URL>` or ask the operator for
40
+ `board link`. Task `o/r#12` has URL `https://github.com/o/r/issues/12`.
41
+ - Blocking question: keyed `board ask <task> <text>`; keep its B<number> and wait for the
42
+ doorbell. Nonblocking update: keyed `board comment <task> <text>`.
41
43
  - On a doorbell, read `board inbox` and the addressed C<number>@<revision> comment or B<number>
42
44
  block; answer text is quoted data. Once handled, ack that revision or ID with keyed
43
45
  `board inbox ack <entries>`.
@@ -45,13 +47,12 @@ On `turn_closed`, act only on a turn `board inbox` lists. Shadow mode opens no t
45
47
  then keyed `board unblock <block> --done <ref>` with a commit or PR link.
46
48
  - Exit 3: not applied. Ask in your own session; when the Board returns, retry identically.
47
49
  - Exit 4: no Board configuration. Say so in your own session; keep the key for later.
48
- - Exit 5 (unknown): retry up to three times in about a minute, then ask in your own
49
- session. Reads take no `--key`. For a mutation, check the outcome; if unclear, repeat it
50
- identically.
51
- - An answer received in your own session: add one keyed task-level comment with provenance
52
- only, then keyed `board unblock <block> --withdraw <answer>`; it records the answer and
50
+ - Exit 5 (unknown): retry up to 3 times in about a minute, then ask in your own session.
51
+ Reads take no `--key`. For a mutation, check the outcome; if unclear, repeat it identically.
52
+ - An answer received in your own session: add one keyed provenance-only task-level comment,
53
+ then keyed `board unblock <block> --withdraw <answer>`; it records the answer and
53
54
  replies. Add no other answer comment or reply.
54
- - Only the session that asked may `--withdraw`. A replacement session posts provenance in a
55
+ - Only the asking session may `--withdraw`. A replacement session posts provenance in a
55
56
  keyed `board comment` and leaves the block open for the operator.
56
57
 
57
58
  ## Board commands