spur-board 0.157.1 → 0.157.3

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.
Files changed (2) hide show
  1. package/dist/daemon.mjs +21 -14
  2. package/package.json +1 -1
package/dist/daemon.mjs CHANGED
@@ -13998,14 +13998,13 @@ function courseCounter(entry, project) {
13998
13998
  }
13999
13999
  const reviewsSchema = prFactsSchema.shape.reviews;
14000
14000
  /**
14001
- * The task's cycle events alone, as `courseRounds` gives them: its moves and limit resets, with
14002
- * no PR history read. Enough for a cycle limit, which counts returns and nothing else.
14001
+ * The task's journal replayed with no PR history read: its moves, resets and external rounds.
14002
+ * `cycle` is exact, enough for a cycle limit. `course` is an upper bound of each counter's count,
14003
+ * exact outside External Review: with no head known, no return is deduplicated against a counted
14004
+ * head. A bound below a course check rules it out; it never goes to `courseSummary`.
14003
14005
  */
14004
- async function cycleEvents(trx, taskId) {
14005
- return (await courseRounds(trx, taskId, {
14006
- columns: [],
14007
- operatorGithubLogin: ""
14008
- }, false)).cycle;
14006
+ function movesReplay(trx, taskId, project) {
14007
+ return courseRounds(trx, taskId, project, false);
14009
14008
  }
14010
14009
  /**
14011
14010
  * The task's journal replayed for its counts, in journal order: the cycle events, and the
@@ -14017,7 +14016,7 @@ async function cycleEvents(trx, taskId) {
14017
14016
  * bounces on is still unhandled and is the return's cause. External Review counts each head of
14018
14017
  * external feedback (rounds and such returns) once, resets ignored; a later one on a counted
14019
14018
  * head adds to the cycle events only. `externalHeads` are those heads. With `history` false it
14020
- * reads no PR history and gives the cycle events alone.
14019
+ * reads no PR history: every return's head is unknown, so only external rounds are deduplicated.
14021
14020
  */
14022
14021
  async function courseRounds(trx, taskId, project, history = true) {
14023
14022
  const prefixes = {
@@ -14047,7 +14046,11 @@ async function courseRounds(trx, taskId, project, history = true) {
14047
14046
  "from_you_cleared",
14048
14047
  "external_round",
14049
14048
  "pr_facts_changed"
14050
- ] : ["task_moved", "from_you_cleared"]).orderBy("id").execute();
14049
+ ] : [
14050
+ "task_moved",
14051
+ "from_you_cleared",
14052
+ "external_round"
14053
+ ]).orderBy("id").execute();
14051
14054
  /** Each PR's latest facts so far, with the id of its first facts row. */
14052
14055
  const prs = /* @__PURE__ */ new Map();
14053
14056
  /** The PR active now: the newest open one by first facts. */
@@ -14078,7 +14081,7 @@ async function courseRounds(trx, taskId, project, history = true) {
14078
14081
  kind: "limit_reset",
14079
14082
  column: reset.column
14080
14083
  });
14081
- else if (history) queue.push({
14084
+ else queue.push({
14082
14085
  entry: {
14083
14086
  kind: "reset",
14084
14087
  counter: reset.column
@@ -14098,7 +14101,7 @@ async function courseRounds(trx, taskId, project, history = true) {
14098
14101
  const event = moved.success ? counted$2(moved.data, moved.data.block !== void 0) : null;
14099
14102
  if (event?.kind !== "return") continue;
14100
14103
  replay.cycle.push(event);
14101
- if (!history || countCycles([event], event.column, Infinity).count === 0) continue;
14104
+ if (countCycles([event], event.column, Infinity).count === 0) continue;
14102
14105
  const counter = courseCounter(event, project);
14103
14106
  const external = counter === "external-review" && externalCause(event.causes);
14104
14107
  const pr = active();
@@ -14175,9 +14178,11 @@ function replayOnce(trx, taskId, project) {
14175
14178
  * open item, or null when nothing is due.
14176
14179
  */
14177
14180
  async function raiseCourseDue(trx, input) {
14178
- const { task, project, config, at, counter } = input;
14181
+ const { task, project, config, at, counter, bound } = input;
14179
14182
  const threshold = project.columns.find((column) => column.id === counter)?.courseCheck ?? 0;
14180
14183
  if (threshold <= 0) return null;
14184
+ const below = bound !== void 0 && roundsSince(bound.course, counter).length < threshold;
14185
+ if (input.replay === void 0 && below) return null;
14181
14186
  const replay = input.replay ?? await courseRounds(trx, task.id, project);
14182
14187
  const count = roundsSince(replay.course, counter).length;
14183
14188
  if (count < threshold) return null;
@@ -16337,7 +16342,8 @@ async function moveLeft(trx, input) {
16337
16342
  task: moved,
16338
16343
  limitReached: false
16339
16344
  };
16340
- if (countCycles(await cycleEvents(trx, task.id), task.column, Infinity).count >= column.cycleLimit) {
16345
+ const bound = await movesReplay(trx, task.id, project);
16346
+ if (countCycles(bound.cycle, task.column, Infinity).count >= column.cycleLimit) {
16341
16347
  await raiseCycleLimit(trx, {
16342
16348
  task: moved,
16343
16349
  column: task.column,
@@ -16360,7 +16366,8 @@ async function moveLeft(trx, input) {
16360
16366
  kind: "return",
16361
16367
  column: task.column,
16362
16368
  causes: returnCauses(gate ?? [], block !== void 0)
16363
- }, project)
16369
+ }, project),
16370
+ bound
16364
16371
  }) !== null
16365
16372
  };
16366
16373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spur-board",
3
- "version": "0.157.1",
3
+ "version": "0.157.3",
4
4
  "license": "MIT",
5
5
  "engines": {
6
6
  "node": "^24.12.0 || ^26.0.0"