spur-board 0.67.0 → 0.69.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/{chunk-BywmJyLe.mjs → chunk-CxD6ZAl9.mjs} +2 -2
- package/dist/{chunk-D4cCKVAP.mjs → chunk-a_l5UPaU.mjs} +357 -22
- package/dist/{chunk-DawDZw1u.mjs → chunk-eiqYso44.mjs} +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +234 -72
- package/dist/mcp.mjs +3 -3
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works.md +38 -28
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { $ as err, A as prSourceId, B as prFactsSchema, C as userIdSchema, D as AdapterError, E as eventPayloadSchemas, F as REVIEW_STATES, G as JIRA_PROJECT_KEY, H as ringMarker, I as SESSION_HEALTH_STATES, J as encodeActorId, K as REF_NUMBER, L as SESSION_STATUSES, M as sourceCursorSchema, N as trackerSourceId, O as batchSchema, P as PR_STATES, Q as ERRORS, R as isExternalAuthor, S as messageRefSchema, T as GATE_REASONS, U as sessionFactsSchema, V as prRefSchema, W as ticketFactsSchema, X as parseActorId, Y as errorCodeOf, Z as parseRef$1, _t as SLACK_BOT_SCOPES, a as requestHashOf, at as DEFAULT_LINK, b as inboundEventSchema, c as tokenRequestStatusSchema, ct as RESERVED_PROJECT, d as buildCatalogSnapshot, dt as configSchema, f as roleCanUseOperation, ft as defaultAddressee, gt as DISPATCHER_MODES, h as renderHttpProblem, ht as COLUMN_IDS, i as TOKEN_REQUEST_LIMITS, j as sessionTransitionSchema, k as entityRefSchema, l as BOARD_TICK_MS, lt as boardWideSpurProject, m as turnHandedSchema, mt as requiredSecretKeys, n as doctorReportSchema, nt as ok, o as tokenRequestResultSchema, p as OPERATIONS, pt as plainHttpAllowed, q as actorIdSchema, rt as successEnvelopeSchema, s as tokenRequestSchema, st as DEFAULT_SLACK_COMMAND, t as assertNever, ut as configBindings, v as SPACE_IDS, vt as TASK_HOLDS, w as EVENT_KINDS, x as interactionRefSchema, y as conversationRefSchema, z as parseRingMarker } from "./chunk-a_l5UPaU.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";
|
|
@@ -496,11 +496,24 @@ function projectTarget(project) {
|
|
|
496
496
|
}
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
|
-
/**
|
|
500
|
-
|
|
499
|
+
/**
|
|
500
|
+
* True for the operator token and for a session of an operator Spur project. Without a
|
|
501
|
+
* board-wide operator, every operator Spur project acts on every board project, as before
|
|
502
|
+
* top-level `spurProjects`. With one, a session acts as operator on `project` only when that
|
|
503
|
+
* project lists its Spur project as operator, and on no project (`null`) only for the
|
|
504
|
+
* board-wide operator.
|
|
505
|
+
*/
|
|
506
|
+
function isOperator(actor, config, project) {
|
|
501
507
|
if (actor === "operator") return true;
|
|
502
508
|
const parsed = parseActorId(actor);
|
|
503
|
-
|
|
509
|
+
if (parsed?.actor !== "agent") return false;
|
|
510
|
+
const name = parsed.actorRef.project;
|
|
511
|
+
const operatorIn = (entry) => entry.spurProjects.some((spur) => spur.name === name && spur.role === "operator");
|
|
512
|
+
const boardWide = config.spurProjects.find((entry) => entry.role === "operator");
|
|
513
|
+
if (boardWide === void 0) return config.projects.some(operatorIn);
|
|
514
|
+
if (project === null) return name === boardWide.name;
|
|
515
|
+
const target = config.projects.find((entry) => entry.id === project);
|
|
516
|
+
return target !== void 0 && operatorIn(target);
|
|
504
517
|
}
|
|
505
518
|
/** The Spur project that curates one board project, or null when it has none. */
|
|
506
519
|
function curatorProject(config, projectId) {
|
|
@@ -512,7 +525,7 @@ function worker(actor, target) {
|
|
|
512
525
|
}
|
|
513
526
|
function orchestrator$1(actor, target, config, column) {
|
|
514
527
|
const configured = config.projects.find((entry) => entry.id === target.project)?.columns.find((entry) => entry.id === column)?.orchestrator;
|
|
515
|
-
if (configured === "operator") return isOperator(actor, config);
|
|
528
|
+
if (configured === "operator") return isOperator(actor, config, target.project);
|
|
516
529
|
const parsed = parseActorId(actor);
|
|
517
530
|
return parsed?.actor === "agent" && configured !== "none" && configured === parsed.actorRef.project;
|
|
518
531
|
}
|
|
@@ -537,7 +550,7 @@ function blockAuthor(actor, target, config) {
|
|
|
537
550
|
function matches(rule, actor, target, config) {
|
|
538
551
|
const parsed = parseActorId(actor);
|
|
539
552
|
switch (rule.grant) {
|
|
540
|
-
case "operator": return isOperator(actor, config);
|
|
553
|
+
case "operator": return isOperator(actor, config, target.project);
|
|
541
554
|
case "project-agent": return parsed?.actor === "agent" && config.projects.find((project) => project.id === target.project)?.spurProjects.some((spur) => spur.name === parsed.actorRef.project) === true;
|
|
542
555
|
case "task-worker": return worker(actor, target);
|
|
543
556
|
case "column-orchestrator": return target.task !== null && orchestrator$1(actor, target, config, target.task.column);
|
|
@@ -547,7 +560,7 @@ function matches(rule, actor, target, config) {
|
|
|
547
560
|
if (spur !== null) return parsed?.actor === "agent" && parsed.actorRef.project === spur;
|
|
548
561
|
const addressee = parseAddressee(target.block.addressee_role);
|
|
549
562
|
switch (addressee.kind) {
|
|
550
|
-
case "operator": return isOperator(actor, config);
|
|
563
|
+
case "operator": return isOperator(actor, config, target.project);
|
|
551
564
|
case "curator": return parsed?.actor === "agent" && parsed.actorRef.project === curatorProject(config, target.project);
|
|
552
565
|
case "worker": return worker(actor, target);
|
|
553
566
|
case "orchestrator": return orchestrator$1(actor, target, config, addressee.column);
|
|
@@ -563,7 +576,7 @@ function authorize(grants, actor, state) {
|
|
|
563
576
|
const rules = grants.filter((rule) => rule.mode === void 0 || rule.mode === state.mode);
|
|
564
577
|
const hint = `Allowed role: ${[...new Set(rules.map((rule) => rule.grant))].join(", ") || "none"}.`;
|
|
565
578
|
if (state.target.kind === "missing") {
|
|
566
|
-
if (rules.some((rule) => rule.grant === "operator" && isOperator(actor, state.config))) return { status: "allowed" };
|
|
579
|
+
if (rules.some((rule) => rule.grant === "operator" && isOperator(actor, state.config, null))) return { status: "allowed" };
|
|
567
580
|
return rules.every((rule) => rule.grant === "operator") ? {
|
|
568
581
|
status: "denied",
|
|
569
582
|
hint
|
|
@@ -9529,9 +9542,8 @@ function orchestrator(config, task) {
|
|
|
9529
9542
|
* column, an agent is the curator or a worker.
|
|
9530
9543
|
*/
|
|
9531
9544
|
function authorRole(config, subject, actor) {
|
|
9532
|
-
if (actor
|
|
9545
|
+
if (isOperator(actor, config, subject.project)) return "operator";
|
|
9533
9546
|
const parsed = parseActorId(actor);
|
|
9534
|
-
if (parsed?.actor === "agent" && config.projects.some((project) => project.spurProjects.some((spur) => spur.name === parsed.actorRef.project && spur.role === "operator"))) return "operator";
|
|
9535
9547
|
if (parsed?.actor !== "agent") return "worker";
|
|
9536
9548
|
const { task } = subject;
|
|
9537
9549
|
if (task !== null && parsed.actorRef.project === orchestrator(config, task)) return `orchestrator:${task.column}`;
|
|
@@ -9679,7 +9691,7 @@ function feedTime(at, config, date = false) {
|
|
|
9679
9691
|
}
|
|
9680
9692
|
/** Who acted, for a non-system actor: an agent by its session, else the operator's mention. */
|
|
9681
9693
|
function actorInline(by, parsed, config) {
|
|
9682
|
-
return parsed.actor === "agent" && !isOperator(by, config) ? {
|
|
9694
|
+
return parsed.actor === "agent" && !isOperator(by, config, null) ? {
|
|
9683
9695
|
kind: "text",
|
|
9684
9696
|
text: `${parsed.actorRef.project}/${parsed.actorRef.session}`
|
|
9685
9697
|
} : {
|
|
@@ -11030,7 +11042,7 @@ function sessionActor(project, session, config) {
|
|
|
11030
11042
|
if (!actor.success) throw new CommandError("forbidden", "Invalid session identity.");
|
|
11031
11043
|
const matches = config.projects.filter((entry) => entry.spurProjects.some((spur) => spur.name === project));
|
|
11032
11044
|
if (matches.length === 0) throw new CommandError("forbidden", `Spur project "${project}" is not listed in any spurProjects in the Board's config.yaml (not Spur's spur.yaml), and inside a Spur session a token is not used. Ask the operator to add it under projects[].spurProjects there and restart the Board daemon, or run the command outside a Spur session.`);
|
|
11033
|
-
if (matches.length > 1) throw new CommandError("forbidden", `Spur project "${project}" is listed under several Board projects: ${matches.map((entry) => entry.id).join(", ")}. Ask the operator to keep it under one of them in the Board's config.yaml (not Spur's spur.yaml) and restart the Board daemon.`);
|
|
11045
|
+
if (matches.length > 1 && boardWideSpurProject(config, project) === void 0) throw new CommandError("forbidden", `Spur project "${project}" is listed under several Board projects: ${matches.map((entry) => entry.id).join(", ")}. Ask the operator to keep it under one of them in the Board's config.yaml (not Spur's spur.yaml) and restart the Board daemon.`);
|
|
11034
11046
|
return actor.data;
|
|
11035
11047
|
}
|
|
11036
11048
|
/** Resolve the caller at the HTTP boundary; a session header always outranks a token. */
|
|
@@ -12636,8 +12648,15 @@ function createMembershipMutations(config) {
|
|
|
12636
12648
|
return {
|
|
12637
12649
|
add: {
|
|
12638
12650
|
id: "task.add",
|
|
12639
|
-
resolveTargets() {
|
|
12640
|
-
|
|
12651
|
+
async resolveTargets(trx, input) {
|
|
12652
|
+
let canonical;
|
|
12653
|
+
try {
|
|
12654
|
+
canonical = canonicalKey(config, input.task);
|
|
12655
|
+
} catch {
|
|
12656
|
+
return [];
|
|
12657
|
+
}
|
|
12658
|
+
const task = await trx.selectFrom("task").selectAll().where("project", "=", canonical.project.id).where("key", "=", canonical.key).executeTakeFirst();
|
|
12659
|
+
return task === void 0 ? [] : [await authorizationTarget(trx, task)];
|
|
12641
12660
|
},
|
|
12642
12661
|
async run(trx, input, ctx) {
|
|
12643
12662
|
const { project, key } = canonicalKey(config, input.task);
|
|
@@ -13477,6 +13496,20 @@ async function deliveryTask(trx, item) {
|
|
|
13477
13496
|
if (row.kind !== "doorbell") return void 0;
|
|
13478
13497
|
return ringTask(trx, typeof payload.notificationId === "number" ? payload.notificationId : void 0, row.dedupe_key);
|
|
13479
13498
|
}
|
|
13499
|
+
/** The task an item belongs to: its own, else its delivery's; undefined for a board item. */
|
|
13500
|
+
async function itemOwner(trx, item) {
|
|
13501
|
+
return item.task_id === null ? deliveryTask(trx, item) : trx.selectFrom("task").selectAll().where("id", "=", item.task_id).executeTakeFirst();
|
|
13502
|
+
}
|
|
13503
|
+
/**
|
|
13504
|
+
* An item of a task is that task's project's; a board item or an unknown ID has no target, so
|
|
13505
|
+
* only the board-wide operator or the token may act on it, and `run` raises the unknown ID.
|
|
13506
|
+
*/
|
|
13507
|
+
async function itemTarget(trx, input) {
|
|
13508
|
+
const item = await trx.selectFrom("operator_item").selectAll().where("id", "=", Number(input.item.slice(1))).executeTakeFirst();
|
|
13509
|
+
if (item === void 0) return [];
|
|
13510
|
+
const owner = await itemOwner(trx, item);
|
|
13511
|
+
return owner === void 0 ? [] : [await authorizationTarget(trx, owner)];
|
|
13512
|
+
}
|
|
13480
13513
|
function view(item, task) {
|
|
13481
13514
|
return { item: {
|
|
13482
13515
|
id: `I${String(item.id)}`,
|
|
@@ -13525,7 +13558,7 @@ function createItemMutations(deps) {
|
|
|
13525
13558
|
return {
|
|
13526
13559
|
retry: {
|
|
13527
13560
|
id: "item.retry",
|
|
13528
|
-
resolveTargets:
|
|
13561
|
+
resolveTargets: itemTarget,
|
|
13529
13562
|
async run(trx, input, ctx) {
|
|
13530
13563
|
const { item, task } = await loadItem(trx, input.item);
|
|
13531
13564
|
if ((task ?? await deliveryTask(trx, item))?.membership === "archived") throw new CommandError("task_archived", "Add the task again before retrying its item.");
|
|
@@ -13536,7 +13569,7 @@ function createItemMutations(deps) {
|
|
|
13536
13569
|
},
|
|
13537
13570
|
close: {
|
|
13538
13571
|
id: "item.close",
|
|
13539
|
-
resolveTargets:
|
|
13572
|
+
resolveTargets: itemTarget,
|
|
13540
13573
|
async run(trx, input, ctx) {
|
|
13541
13574
|
const { item, task } = await loadItem(trx, input.item);
|
|
13542
13575
|
if (item.cleared_at === null) {
|
|
@@ -13871,6 +13904,7 @@ async function getStatus(deps, options = {}) {
|
|
|
13871
13904
|
const { store, config, clock, completeSince, gateways = [] } = deps;
|
|
13872
13905
|
const { project: projectId, visibleProjects, detail = false } = options;
|
|
13873
13906
|
const includeBoardItems = options.includeBoardItems ?? visibleProjects === void 0;
|
|
13907
|
+
const operatorProjects = options.operatorProjects ?? /* @__PURE__ */ new Set();
|
|
13874
13908
|
const projects = projectId === void 0 ? config.projects.filter((project) => visibleProjects === void 0 || visibleProjects.has(project.id)) : config.projects.filter((project) => project.id === projectId && (visibleProjects === void 0 || visibleProjects.has(project.id)));
|
|
13875
13909
|
if (projects.length === 0) throw new CommandError("not_found", "Check the project ID.");
|
|
13876
13910
|
const projectIds = new Set(projects.map((project) => project.id));
|
|
@@ -14018,7 +14052,17 @@ async function getStatus(deps, options = {}) {
|
|
|
14018
14052
|
});
|
|
14019
14053
|
const itemRows = await store.db.selectFrom("operator_item").selectAll().where("cleared_at", "is", null).execute();
|
|
14020
14054
|
const itemTasks = new Map(rows.map((task) => [task.id, task]));
|
|
14021
|
-
const
|
|
14055
|
+
const ownedProjects = /* @__PURE__ */ new Map();
|
|
14056
|
+
if (!includeBoardItems && operatorProjects.size > 0) for (const item of itemRows) {
|
|
14057
|
+
if (item.task_id !== null || item.source !== null) continue;
|
|
14058
|
+
const owner = await itemOwner(store.db, item);
|
|
14059
|
+
if (owner !== void 0) ownedProjects.set(item.id, owner.project);
|
|
14060
|
+
}
|
|
14061
|
+
const ownedBy = (item) => {
|
|
14062
|
+
const owner = ownedProjects.get(item.id) ?? "";
|
|
14063
|
+
return projectIds.has(owner) && operatorProjects.has(owner);
|
|
14064
|
+
};
|
|
14065
|
+
const items = itemRows.filter((item) => item.task_id !== null ? projectIds.has(itemTasks.get(item.task_id)?.project ?? "") : item.source !== null ? required.has(item.source) : includeBoardItems || ownedBy(item)).map((item) => {
|
|
14022
14066
|
const source = item.source === null ? null : sourceById.get(item.source);
|
|
14023
14067
|
const unconfirmed = item.fact_at !== null && item.source !== null && clock.now() - Date.parse(item.fact_at) > config.thresholds.staleMultiplier * interval(config, item.source) || item.text.includes("no_access") || source !== null && source !== void 0 && source.blind_reason !== null;
|
|
14024
14068
|
const time = item.fact_at === null ? null : new Date(item.fact_at).toISOString().slice(11, 16);
|
|
@@ -14066,7 +14110,8 @@ async function getStatus(deps, options = {}) {
|
|
|
14066
14110
|
unlinkedPrs,
|
|
14067
14111
|
unlinkedSessions,
|
|
14068
14112
|
hiddenUnlinkedPrs: prRows.length - unlinkedPrs.length,
|
|
14069
|
-
hiddenUnlinkedSessions: sessionRows.length - unlinkedSessions.length
|
|
14113
|
+
hiddenUnlinkedSessions: sessionRows.length - unlinkedSessions.length,
|
|
14114
|
+
bindings: configBindings(config, projectIds)
|
|
14070
14115
|
};
|
|
14071
14116
|
}
|
|
14072
14117
|
const HOLD_ONLY = /* @__PURE__ */ new Set([
|
|
@@ -14126,7 +14171,22 @@ function executorDone(column, facts, columns) {
|
|
|
14126
14171
|
if (orchestratorOf$1(column, columns) !== "none") return false;
|
|
14127
14172
|
return onHead.some((mark) => mark.kind === "submit" && orchestratorOf$1(mark.column, columns) === "none");
|
|
14128
14173
|
}
|
|
14129
|
-
|
|
14174
|
+
/**
|
|
14175
|
+
* The leftmost enabled column that requires resolved threads: `requireResolvedThreads`, by default
|
|
14176
|
+
* true on Ready to Merge only. Undefined when no enabled column requires them.
|
|
14177
|
+
*/
|
|
14178
|
+
function threadsFrom(project) {
|
|
14179
|
+
return project.columns.find((c) => c.enabled && (c.requireResolvedThreads ?? c.id === "ready-to-merge"))?.id;
|
|
14180
|
+
}
|
|
14181
|
+
/** Whether any enabled column of the project requires resolved review threads. */
|
|
14182
|
+
function threadsGated(project) {
|
|
14183
|
+
return threadsFrom(project) !== void 0;
|
|
14184
|
+
}
|
|
14185
|
+
/**
|
|
14186
|
+
* Dev's failing reasons. `threads` adds the resolved-threads condition: it holds for the gate of
|
|
14187
|
+
* every column at or right of the leftmost column requiring resolved threads.
|
|
14188
|
+
*/
|
|
14189
|
+
function devReasons(facts, columns, waived, threads) {
|
|
14130
14190
|
const { pr } = facts;
|
|
14131
14191
|
if (pr === null) return ["no_pr"];
|
|
14132
14192
|
if (pr.state === "closed") return ["pr_closed"];
|
|
@@ -14139,16 +14199,20 @@ function devReasons(facts, columns, waived) {
|
|
|
14139
14199
|
if (pr.mergeable === "unknown") reasons.push("mergeable_unknown");
|
|
14140
14200
|
if (facts.unhandledExternalComments > 0) reasons.push("external_comments");
|
|
14141
14201
|
if (facts.commentHistory === "incomplete") reasons.push("comment_history_incomplete");
|
|
14202
|
+
if (threads && facts.unresolvedThreads > 0) reasons.push("unresolved_threads");
|
|
14142
14203
|
if (!executorDone("dev", facts, columns)) reasons.push("no_submit_on_head");
|
|
14143
14204
|
return reasons;
|
|
14144
14205
|
}
|
|
14145
|
-
/**
|
|
14146
|
-
|
|
14206
|
+
/**
|
|
14207
|
+
* The failing reasons of one column's exit condition. Only Dev's resolved-threads condition depends
|
|
14208
|
+
* on the column asked: `threads` says whether it counts.
|
|
14209
|
+
*/
|
|
14210
|
+
function columnCondition(column, facts, columns, waived, threads) {
|
|
14147
14211
|
switch (column) {
|
|
14148
14212
|
case "todo":
|
|
14149
14213
|
case "ready-for-dev":
|
|
14150
14214
|
case "done": return [];
|
|
14151
|
-
case "dev": return devReasons(facts, columns, waived);
|
|
14215
|
+
case "dev": return devReasons(facts, columns, waived, threads);
|
|
14152
14216
|
case "review":
|
|
14153
14217
|
case "product-review": return executorDone(column, facts, columns) ? [] : ["no_review_on_head"];
|
|
14154
14218
|
case "external-review": return facts.externalReviewApproved ? [] : ["not_approved"];
|
|
@@ -14160,17 +14224,21 @@ function columnCondition(column, facts, columns, waived) {
|
|
|
14160
14224
|
/**
|
|
14161
14225
|
* Evaluates the exit conditions of every enabled column from To Do up to and including `column`,
|
|
14162
14226
|
* and returns the leftmost one that fails. A column absent from the project's columns or disabled
|
|
14163
|
-
* passes through. A merged pull request passes every column.
|
|
14164
|
-
*
|
|
14227
|
+
* passes through. A merged pull request passes every column. Dev's resolved-threads condition
|
|
14228
|
+
* counts when `column` is at or right of the leftmost enabled column requiring resolved threads.
|
|
14229
|
+
* Once Dev is evaluated with its check condition passed by `reposWithoutCi`, the result carries
|
|
14230
|
+
* `checksWaivedBy`.
|
|
14165
14231
|
*/
|
|
14166
14232
|
function evaluateGate(column, facts, project) {
|
|
14167
14233
|
if (facts.pr?.state === "merged") return { ok: true };
|
|
14168
14234
|
const waived = noCiWaives(facts.pr, project);
|
|
14235
|
+
const from = threadsFrom(project);
|
|
14236
|
+
const threads = from !== void 0 && COLUMN_IDS.indexOf(from) <= COLUMN_IDS.indexOf(column);
|
|
14169
14237
|
let marker = {};
|
|
14170
14238
|
for (const id of COLUMN_IDS.slice(0, COLUMN_IDS.indexOf(column) + 1)) {
|
|
14171
14239
|
if (project.columns.find((c) => c.id === id)?.enabled !== true) continue;
|
|
14172
14240
|
if (id === "dev" && waived) marker = { checksWaivedBy: "reposWithoutCi" };
|
|
14173
|
-
const [first, ...rest] = columnCondition(id, facts, project.columns, waived);
|
|
14241
|
+
const [first, ...rest] = columnCondition(id, facts, project.columns, waived, threads);
|
|
14174
14242
|
if (first !== void 0) return {
|
|
14175
14243
|
ok: false,
|
|
14176
14244
|
column: id,
|
|
@@ -14194,6 +14262,7 @@ const COLUMN_CONDITIONS = {
|
|
|
14194
14262
|
"no_conflict",
|
|
14195
14263
|
"external_comments_handled",
|
|
14196
14264
|
"comment_history_read",
|
|
14265
|
+
"threads_resolved",
|
|
14197
14266
|
"submit_on_head"
|
|
14198
14267
|
],
|
|
14199
14268
|
review: ["review_on_head"],
|
|
@@ -14214,6 +14283,7 @@ const CONDITION_OF = {
|
|
|
14214
14283
|
mergeable_unknown: "no_conflict",
|
|
14215
14284
|
external_comments: "external_comments_handled",
|
|
14216
14285
|
comment_history_incomplete: "comment_history_read",
|
|
14286
|
+
unresolved_threads: "threads_resolved",
|
|
14217
14287
|
no_submit_on_head: "submit_on_head",
|
|
14218
14288
|
no_review_on_head: "review_on_head",
|
|
14219
14289
|
not_approved: "approved",
|
|
@@ -14223,20 +14293,22 @@ const CONDITION_OF = {
|
|
|
14223
14293
|
const STOPS_DEV = /* @__PURE__ */ new Set(["no_pr", "pr_closed"]);
|
|
14224
14294
|
/**
|
|
14225
14295
|
* Every column's own exit conditions with their state, and where its cumulative gate blocks, as
|
|
14226
|
-
* `evaluateGate` decides it for each column.
|
|
14227
|
-
*
|
|
14296
|
+
* `evaluateGate` decides it for each column. Dev's own conditions count resolved threads once any
|
|
14297
|
+
* enabled column requires them. A merged pull request passes every column and every condition.
|
|
14298
|
+
* `checksWaivedBy` is the marker `evaluateGate('done')` carries, or null.
|
|
14228
14299
|
*/
|
|
14229
14300
|
function explainGates(facts, project) {
|
|
14230
14301
|
const merged = facts.pr?.state === "merged";
|
|
14231
14302
|
const waived = noCiWaives(facts.pr, project);
|
|
14232
|
-
|
|
14303
|
+
const threads = threadsGated(project);
|
|
14233
14304
|
let checksWaivedBy = null;
|
|
14234
14305
|
return {
|
|
14235
14306
|
gates: COLUMN_IDS.map((column) => {
|
|
14236
14307
|
const enabled = project.columns.find((c) => c.id === column)?.enabled === true;
|
|
14237
|
-
const reasons = merged ? [] : columnCondition(column, facts, project.columns, waived);
|
|
14308
|
+
const reasons = merged ? [] : columnCondition(column, facts, project.columns, waived, threads);
|
|
14238
14309
|
if (enabled && !merged && column === "dev" && waived) checksWaivedBy = "reposWithoutCi";
|
|
14239
|
-
|
|
14310
|
+
const gate = evaluateGate(column, facts, project);
|
|
14311
|
+
const blockedIn = gate.ok ? null : gate.column;
|
|
14240
14312
|
const stopped = reasons.some((reason) => STOPS_DEV.has(reason));
|
|
14241
14313
|
const conditions = COLUMN_CONDITIONS[column].map((condition) => {
|
|
14242
14314
|
const reason = reasons.find((r) => CONDITION_OF[r] === condition) ?? null;
|
|
@@ -14267,6 +14339,7 @@ const COUNTED = {
|
|
|
14267
14339
|
executor: true,
|
|
14268
14340
|
changes_requested: true,
|
|
14269
14341
|
external_comments: true,
|
|
14342
|
+
unresolved_threads: true,
|
|
14270
14343
|
conflict: false,
|
|
14271
14344
|
checks_red: false,
|
|
14272
14345
|
draft: false
|
|
@@ -14361,7 +14434,7 @@ function dispatch(input) {
|
|
|
14361
14434
|
};
|
|
14362
14435
|
const result = (next) => {
|
|
14363
14436
|
const deferred = next !== null && input.spurBlind && orchestratorOf(project, next.column) === "none";
|
|
14364
|
-
const opened = cycleHeld || deferred ? null : next;
|
|
14437
|
+
const opened = cycleHeld || deferred ? null : withThreads(next);
|
|
14365
14438
|
const handsOver = opened?.column === "dev" && facts.commentHistory === "complete" && facts.unhandledExternalComments > 0;
|
|
14366
14439
|
return opened !== null && (opened.kind === "after_submit" || handsOver) ? {
|
|
14367
14440
|
moves,
|
|
@@ -14372,6 +14445,16 @@ function dispatch(input) {
|
|
|
14372
14445
|
turn: opened
|
|
14373
14446
|
};
|
|
14374
14447
|
};
|
|
14448
|
+
const withThreads = (next) => {
|
|
14449
|
+
if (next?.column !== "dev" || !threadsGated(project) || facts.unresolvedThreads === 0) return next;
|
|
14450
|
+
const { reasons } = next;
|
|
14451
|
+
if (reasons.some((r) => r === "no_pr" || r === "pr_closed" || r === "unresolved_threads")) return next;
|
|
14452
|
+
const added = /* @__PURE__ */ new Set([...reasons, "unresolved_threads"]);
|
|
14453
|
+
return {
|
|
14454
|
+
...next,
|
|
14455
|
+
reasons: GATE_REASONS.filter((reason) => added.has(reason))
|
|
14456
|
+
};
|
|
14457
|
+
};
|
|
14375
14458
|
for (let step = 0; step < STEP_BOUND; step++) {
|
|
14376
14459
|
const merged = facts.pr?.state === "merged";
|
|
14377
14460
|
if (column === "done") {
|
|
@@ -14437,7 +14520,8 @@ const CAUSE_OF = {
|
|
|
14437
14520
|
checks_red: "checks_red",
|
|
14438
14521
|
conflict: "conflict",
|
|
14439
14522
|
pr_draft: "draft",
|
|
14440
|
-
external_comments: "external_comments"
|
|
14523
|
+
external_comments: "external_comments",
|
|
14524
|
+
unresolved_threads: "unresolved_threads"
|
|
14441
14525
|
};
|
|
14442
14526
|
/**
|
|
14443
14527
|
* The cycle causes of a return to Dev: `executor` when the column executor returned it with a
|
|
@@ -15852,6 +15936,7 @@ async function readInput(trx, task, project, mode, blind, config, clock) {
|
|
|
15852
15936
|
externalReviewApproved: pr !== null && externalApproval(pr, project.operatorGithubLogin),
|
|
15853
15937
|
commentHistory: pr?.feedbackComplete === true ? "complete" : "incomplete",
|
|
15854
15938
|
unhandledExternalComments: unhandled.length,
|
|
15939
|
+
unresolvedThreads: pr === null ? 0 : pr.reviewThreads.filter((thread) => !thread.resolved).length,
|
|
15855
15940
|
marks
|
|
15856
15941
|
},
|
|
15857
15942
|
reopened: mergedOpen === void 0 && await trx.selectFrom("link").select("id").where("task_id", "=", task.id).where("reopen_hidden_at", "is not", null).executeTakeFirst() !== void 0,
|
|
@@ -16095,6 +16180,43 @@ async function taskSessions(trx, taskId) {
|
|
|
16095
16180
|
});
|
|
16096
16181
|
}
|
|
16097
16182
|
//#endregion
|
|
16183
|
+
//#region ../core/src/app/turn-view.ts
|
|
16184
|
+
/**
|
|
16185
|
+
* The unresolved review threads a Dev turn lists, read live from the task's PR snapshot: only on a
|
|
16186
|
+
* project requiring resolved threads and an open PR, and only threads with an id and a link (facts
|
|
16187
|
+
* stored by an earlier version lack them). Undefined when none.
|
|
16188
|
+
*/
|
|
16189
|
+
async function turnThreads(trx, taskId, project, turn) {
|
|
16190
|
+
if (turn.column !== "dev" || project === void 0 || !threadsGated(project)) return void 0;
|
|
16191
|
+
const pr = await prFacts(trx, taskId);
|
|
16192
|
+
if (pr?.state !== "open") return void 0;
|
|
16193
|
+
const threads = pr.reviewThreads.flatMap(({ resolved, id, url, outdated }) => resolved || id === void 0 || url === void 0 ? [] : [{
|
|
16194
|
+
id,
|
|
16195
|
+
url,
|
|
16196
|
+
outdated: outdated ?? false
|
|
16197
|
+
}]);
|
|
16198
|
+
return threads.length === 0 ? void 0 : threads;
|
|
16199
|
+
}
|
|
16200
|
+
/** A turn as the worker and `task.get --why` read it, with the threads of a Dev turn. */
|
|
16201
|
+
async function turnView(trx, turn, task, project) {
|
|
16202
|
+
const threads = await turnThreads(trx, task.id, project, turn);
|
|
16203
|
+
return {
|
|
16204
|
+
id: `T${String(turn.id)}`,
|
|
16205
|
+
task: task.key,
|
|
16206
|
+
column: turn.column,
|
|
16207
|
+
addressee: turn.role,
|
|
16208
|
+
reason: turn.reason,
|
|
16209
|
+
handed: turnHanded(turn),
|
|
16210
|
+
head: turn.head_sha,
|
|
16211
|
+
at: turn.created_at,
|
|
16212
|
+
taken: turn.acked_by === null || turn.acked_at === null ? null : {
|
|
16213
|
+
by: turn.acked_by,
|
|
16214
|
+
at: turn.acked_at
|
|
16215
|
+
},
|
|
16216
|
+
...threads === void 0 ? {} : { threads }
|
|
16217
|
+
};
|
|
16218
|
+
}
|
|
16219
|
+
//#endregion
|
|
16098
16220
|
//#region ../core/src/app/task-queries.ts
|
|
16099
16221
|
/** How many of the last moves `task.get --why` shows. */
|
|
16100
16222
|
const WHY_MOVES = 5;
|
|
@@ -16208,22 +16330,6 @@ async function taskByKey(trx, key) {
|
|
|
16208
16330
|
if (task === void 0) throw new CommandError("not_found", "Check the task key.");
|
|
16209
16331
|
return task;
|
|
16210
16332
|
}
|
|
16211
|
-
function turnView(turn, key) {
|
|
16212
|
-
return {
|
|
16213
|
-
id: `T${String(turn.id)}`,
|
|
16214
|
-
task: key,
|
|
16215
|
-
column: turn.column,
|
|
16216
|
-
addressee: turn.role,
|
|
16217
|
-
reason: turn.reason,
|
|
16218
|
-
handed: turnHanded(turn),
|
|
16219
|
-
head: turn.head_sha,
|
|
16220
|
-
at: turn.created_at,
|
|
16221
|
-
taken: turn.acked_by === null || turn.acked_at === null ? null : {
|
|
16222
|
-
by: turn.acked_by,
|
|
16223
|
-
at: turn.acked_at
|
|
16224
|
-
}
|
|
16225
|
-
};
|
|
16226
|
-
}
|
|
16227
16333
|
function createTaskQueries(deps) {
|
|
16228
16334
|
const { config, clock, completeSince } = deps;
|
|
16229
16335
|
const taskKey = (key) => {
|
|
@@ -16238,12 +16344,12 @@ function createTaskQueries(deps) {
|
|
|
16238
16344
|
async function why(trx, task) {
|
|
16239
16345
|
const column = task.shadow_column ?? task.column;
|
|
16240
16346
|
const open = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is", null).orderBy("id", "desc").executeTakeFirst();
|
|
16347
|
+
const project = config.projects.find((entry) => entry.id === task.project);
|
|
16241
16348
|
const shared = {
|
|
16242
16349
|
column,
|
|
16243
|
-
turn: open === void 0 ? null : turnView(open, task
|
|
16350
|
+
turn: open === void 0 ? null : await turnView(trx, open, task, project),
|
|
16244
16351
|
moves: await moveViews(trx, task.id, { limit: WHY_MOVES })
|
|
16245
16352
|
};
|
|
16246
|
-
const project = config.projects.find((entry) => entry.id === task.project);
|
|
16247
16353
|
if (project === void 0) return {
|
|
16248
16354
|
...shared,
|
|
16249
16355
|
dispatcher: null,
|
|
@@ -16362,7 +16468,7 @@ function createTaskQueries(deps) {
|
|
|
16362
16468
|
*/
|
|
16363
16469
|
async function inboxTurns(trx, projects, actor) {
|
|
16364
16470
|
if (parseActorId(actor)?.actor !== "agent" || projects.size === 0) return [];
|
|
16365
|
-
const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").selectAll("turn").select("task.key").where("task.project", "in", [...projects]).where("turn.closed_at", "is", null).where("turn.role", "!=", "operator").orderBy("turn.id").execute();
|
|
16471
|
+
const rows = await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").selectAll("turn").select(["task.key", "task.project"]).where("task.project", "in", [...projects]).where("turn.closed_at", "is", null).where("turn.role", "!=", "operator").orderBy("turn.id").execute();
|
|
16366
16472
|
const turns = [];
|
|
16367
16473
|
for (const turn of rows) {
|
|
16368
16474
|
if (turn.acked_by !== actor) {
|
|
@@ -16370,7 +16476,11 @@ function createTaskQueries(deps) {
|
|
|
16370
16476
|
const mayTake = turn.acked_at === null ? notice?.acked_at === null : turn.role.startsWith("orchestrator:");
|
|
16371
16477
|
if (notice === void 0 || !mayTake || !await notificationAddressedTo(trx, notice, actor, config)) continue;
|
|
16372
16478
|
}
|
|
16373
|
-
|
|
16479
|
+
const project = config.projects.find((entry) => entry.id === turn.project);
|
|
16480
|
+
turns.push(await turnView(trx, turn, {
|
|
16481
|
+
id: turn.task_id,
|
|
16482
|
+
key: turn.key
|
|
16483
|
+
}, project));
|
|
16374
16484
|
}
|
|
16375
16485
|
return turns;
|
|
16376
16486
|
}
|
|
@@ -16865,6 +16975,10 @@ function createOperationRegistry(deps) {
|
|
|
16865
16975
|
config,
|
|
16866
16976
|
target: { kind: "missing" }
|
|
16867
16977
|
}).status === "allowed",
|
|
16978
|
+
operatorProjects: new Set(config.projects.filter((project) => authorize([{ grant: "operator" }], actor, {
|
|
16979
|
+
config,
|
|
16980
|
+
target: projectTarget(project.id)
|
|
16981
|
+
}).status === "allowed").map((project) => project.id)),
|
|
16868
16982
|
detail: input.detail
|
|
16869
16983
|
});
|
|
16870
16984
|
}
|
|
@@ -16924,12 +17038,16 @@ async function curatorSessions(db, config) {
|
|
|
16924
17038
|
});
|
|
16925
17039
|
return entries;
|
|
16926
17040
|
}
|
|
16927
|
-
/**
|
|
17041
|
+
/**
|
|
17042
|
+
* Configured orchestrators, where each binding comes from, and the same live session selected
|
|
17043
|
+
* for their rings.
|
|
17044
|
+
*/
|
|
16928
17045
|
async function orchestratorSessions(db, config) {
|
|
16929
17046
|
const entries = [];
|
|
16930
17047
|
for (const project of config.projects) for (const spur of project.spurProjects.filter((entry) => entry.role === "orchestrator")) entries.push({
|
|
16931
17048
|
project: project.id,
|
|
16932
17049
|
orchestrator: spur.name,
|
|
17050
|
+
source: boardWideSpurProject(config, spur.name) === void 0 ? "project" : "board-wide",
|
|
16933
17051
|
session: (await bestProjectSession(db, spur.name))?.id ?? null,
|
|
16934
17052
|
columns: project.columns.filter((column) => column.orchestrator !== "none" && column.orchestrator !== "operator" && column.orchestrator === spur.name).map((column) => column.id)
|
|
16935
17053
|
});
|
|
@@ -18057,19 +18175,18 @@ function commandReply(id, value, input) {
|
|
|
18057
18175
|
function addressOperatorMessage(text, config) {
|
|
18058
18176
|
const spurByShortName = /* @__PURE__ */ new Map();
|
|
18059
18177
|
for (const project of config.projects) for (const spur of project.spurProjects) if (spur.shortName !== void 0) spurByShortName.set(spur.shortName, spur.name);
|
|
18060
|
-
if (spurByShortName.size === 0) return null;
|
|
18061
18178
|
const prefix = /^@(\S+)\s*/.exec(text);
|
|
18062
18179
|
const named = prefix?.[1] === void 0 ? void 0 : spurByShortName.get(prefix[1]);
|
|
18063
18180
|
if (prefix?.[1] !== void 0 && named !== void 0) return {
|
|
18064
18181
|
spur: named,
|
|
18065
18182
|
text: stripShortName(text, prefix[1])
|
|
18066
18183
|
};
|
|
18067
|
-
const fallback = config
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
spur: fallbackSpur,
|
|
18184
|
+
const fallback = defaultAddressee(config);
|
|
18185
|
+
if (fallback !== null) return {
|
|
18186
|
+
spur: fallback.spurProject,
|
|
18071
18187
|
text
|
|
18072
18188
|
};
|
|
18189
|
+
if (spurByShortName.size === 0) return null;
|
|
18073
18190
|
return { hint: `No addressee. Start with one of: ${[...spurByShortName.keys()].map((name) => `@${name}`).join(", ")}.` };
|
|
18074
18191
|
}
|
|
18075
18192
|
/**
|
|
@@ -18090,8 +18207,10 @@ async function namedTask(trx, config, project, text) {
|
|
|
18090
18207
|
return trx.selectFrom("task").selectAll().where("key", "=", key).where("project", "=", project).where("membership", "!=", "archived").executeTakeFirst();
|
|
18091
18208
|
}
|
|
18092
18209
|
/**
|
|
18093
|
-
* Opens the conversation an operator's new message starts, or posts the hint in its thread.
|
|
18094
|
-
*
|
|
18210
|
+
* Opens the conversation an operator's new message starts, or posts the hint in its thread. The
|
|
18211
|
+
* block goes on the task its text names in the first board project listing the addressee that
|
|
18212
|
+
* has that task, else on the first such project. Returns false, and writes nothing, when no short
|
|
18213
|
+
* name and no default addressee exist.
|
|
18095
18214
|
*/
|
|
18096
18215
|
async function openOperatorConversation(trx, input) {
|
|
18097
18216
|
const { config } = input;
|
|
@@ -18105,11 +18224,16 @@ async function openOperatorConversation(trx, input) {
|
|
|
18105
18224
|
});
|
|
18106
18225
|
return true;
|
|
18107
18226
|
}
|
|
18108
|
-
const
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
const
|
|
18112
|
-
|
|
18227
|
+
const candidates = config.projects.filter((entry) => entry.spurProjects.some((spur) => spur.name === address.spur));
|
|
18228
|
+
const first = candidates[0];
|
|
18229
|
+
if (first === void 0) return false;
|
|
18230
|
+
const role = first.spurProjects.find((spur) => spur.name === address.spur)?.role === "curator" ? "curator" : "worker";
|
|
18231
|
+
let task;
|
|
18232
|
+
for (const candidate of candidates) {
|
|
18233
|
+
task = await namedTask(trx, config, candidate.id, address.text);
|
|
18234
|
+
if (task !== void 0) break;
|
|
18235
|
+
}
|
|
18236
|
+
const subject = task === void 0 ? projectSubject(first.id) : taskSubject(task);
|
|
18113
18237
|
const ctx = {
|
|
18114
18238
|
actor: "operator",
|
|
18115
18239
|
at: input.at
|
|
@@ -19393,6 +19517,7 @@ function teamScopeDenied(error, query) {
|
|
|
19393
19517
|
const REVIEWER_FIELDS = "requestedReviewer { __typename ... on Bot { login } ... on Mannequin { login } ... on User { login } ... on Team { slug } ... on EnterpriseTeam { slug } } asCodeOwner";
|
|
19394
19518
|
const REVIEW_FIELDS = "id author { __typename login } state commit { oid } submittedAt";
|
|
19395
19519
|
const COMMENT_FIELDS = "nodes { id author { __typename login } createdAt body } pageInfo { hasPreviousPage startCursor }";
|
|
19520
|
+
const THREAD_FIELDS = "id isResolved isOutdated comments(first: 1) { nodes { url } }";
|
|
19396
19521
|
const CLOSING_FIELDS = "nodes { number repository { nameWithOwner } } pageInfo { hasNextPage endCursor }";
|
|
19397
19522
|
const prFields = (number, closing = false) => `id number url title updatedAt mergedAt closedAt state isDraft mergeable mergeStateStatus
|
|
19398
19523
|
author { login } headRefName headRefOid
|
|
@@ -19402,7 +19527,7 @@ const prFields = (number, closing = false) => `id number url title updatedAt mer
|
|
|
19402
19527
|
} pageInfo { hasNextPage endCursor } } }
|
|
19403
19528
|
reviews(first: 100) { nodes { ${REVIEW_FIELDS} } pageInfo { hasNextPage endCursor } }
|
|
19404
19529
|
comments(last: 100) { ${COMMENT_FIELDS} }
|
|
19405
|
-
reviewThreads(first: 100) { nodes {
|
|
19530
|
+
reviewThreads(first: 100) { nodes { ${THREAD_FIELDS} } pageInfo { hasNextPage endCursor } }
|
|
19406
19531
|
reviewRequests(first: 100) { nodes { ${REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }${closing ? `\n closingIssuesReferences(first: 100) { ${CLOSING_FIELDS} }` : ""}`;
|
|
19407
19532
|
const DISCOVERY_FIELDS = `nodes { number updatedAt author { login } state } pageInfo { hasNextPage endCursor }`;
|
|
19408
19533
|
const INDEX_FIELDS = `number updatedAt state isDraft mergeable mergeStateStatus headRefOid statusCheckRollup { state contexts(first: 100) { totalCount nodes { ... on CheckRun { __typename name status conclusion completedAt } ... on StatusContext { __typename context state } } } } reviews(first: 100) { totalCount nodes { id state } } reviewThreads(first: 100) { totalCount nodes { isResolved } } reviewRequests(first: 100) { totalCount nodes { ${REVIEWER_FIELDS} } } comments(last: 1) { totalCount nodes { id } }`;
|
|
@@ -19425,7 +19550,7 @@ function detailQuery(numbers, closing = false) {
|
|
|
19425
19550
|
function pageQuery(connection, bootstrap = false) {
|
|
19426
19551
|
if (connection === "comments") return `query PrPage($owner: String!, $repo: String!, $number: Int!, $before: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { comments(last: 100, before: $before) { ${COMMENT_FIELDS} } } } }`;
|
|
19427
19552
|
if (connection === "pullRequests") return `query DiscoveryPage($owner: String!, $repo: String!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, after: $after, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} } } }`;
|
|
19428
|
-
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ?
|
|
19553
|
+
return `query PrPage($owner: String!, $repo: String!, $number: Int!, $after: String!) { rateLimit { cost remaining resetAt } repository(owner: $owner, name: $repo) { pullRequest(number: $number) { ${connection === "closingIssuesReferences" ? `closingIssuesReferences(first: 100, after: $after) { ${CLOSING_FIELDS} }` : connection === "contexts" ? `statusCheckRollup { contexts(first: 100, after: $after) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt checkSuite { createdAt } isRequired(pullRequestNumber: $number) } ... on StatusContext { __typename context state createdAt isRequired(pullRequestNumber: $number) } } pageInfo { hasNextPage endCursor } } }` : `${connection}(first: 100, after: $after) { nodes { ${connection === "reviews" ? REVIEW_FIELDS : connection === "reviewThreads" ? THREAD_FIELDS : REVIEWER_FIELDS} } pageInfo { hasNextPage endCursor } }`} } } }`;
|
|
19429
19554
|
}
|
|
19430
19555
|
/**
|
|
19431
19556
|
* The failure that GraphQL `errors` mean for the whole request, in rule order: a rate limit is
|
|
@@ -19640,7 +19765,12 @@ const prWire = z.object({
|
|
|
19640
19765
|
statusCheckRollup: z.object({ contexts: nodes(contextWire) }).nullish(),
|
|
19641
19766
|
reviews: nodes(reviewWire),
|
|
19642
19767
|
comments: nodes(commentWire),
|
|
19643
|
-
reviewThreads: nodes(z.object({
|
|
19768
|
+
reviewThreads: nodes(z.object({
|
|
19769
|
+
id: z.string().optional(),
|
|
19770
|
+
isResolved: z.boolean(),
|
|
19771
|
+
isOutdated: z.boolean().optional(),
|
|
19772
|
+
comments: nodes(z.object({ url: z.string() })).optional()
|
|
19773
|
+
})),
|
|
19644
19774
|
reviewRequests: nodes(z.object({
|
|
19645
19775
|
requestedReviewer: reviewerWire,
|
|
19646
19776
|
asCodeOwner: z.boolean()
|
|
@@ -19878,6 +20008,15 @@ function reviewer(wire) {
|
|
|
19878
20008
|
default: return assertNever(wire);
|
|
19879
20009
|
}
|
|
19880
20010
|
}
|
|
20011
|
+
function reviewThread(node) {
|
|
20012
|
+
const url = node.comments?.nodes[0]?.url;
|
|
20013
|
+
return {
|
|
20014
|
+
resolved: node.isResolved,
|
|
20015
|
+
...node.id === void 0 ? {} : { id: node.id },
|
|
20016
|
+
...url === void 0 ? {} : { url },
|
|
20017
|
+
...node.isOutdated === void 0 ? {} : { outdated: node.isOutdated }
|
|
20018
|
+
};
|
|
20019
|
+
}
|
|
19881
20020
|
/**
|
|
19882
20021
|
* `feedbackComplete` says whether the comments in `value`, with the `held` comments an earlier
|
|
19883
20022
|
* poll read, reach back to the cursor or start.
|
|
@@ -19913,7 +20052,7 @@ function normalizePr(repo, value, rule, feedbackComplete, held = []) {
|
|
|
19913
20052
|
mergeState,
|
|
19914
20053
|
...checks,
|
|
19915
20054
|
reviews: latestReviews(wire.reviews.nodes),
|
|
19916
|
-
reviewThreads: wire.reviewThreads.nodes.map(
|
|
20055
|
+
reviewThreads: wire.reviewThreads.nodes.map(reviewThread),
|
|
19917
20056
|
reviewRequests: wire.reviewRequests.nodes.flatMap(({ requestedReviewer, asCodeOwner }) => requestedReviewer === null ? [] : [{
|
|
19918
20057
|
...reviewer(requestedReviewer),
|
|
19919
20058
|
asCodeOwner
|
|
@@ -23969,10 +24108,10 @@ function curatorSessionsCheck(entries) {
|
|
|
23969
24108
|
return warning(id, fitFix([...segments.filter((entry) => entry.problem), ...segments.filter((entry) => !entry.problem)], ` ${CURATOR_TAIL}`, `${String(missing)} curators have no live session. Start a Spur session of each.`));
|
|
23970
24109
|
}
|
|
23971
24110
|
function orchestratorSessionsCheck(entries) {
|
|
23972
|
-
const segments = entries.map(({ project, orchestrator, session, columns }) => ({
|
|
24111
|
+
const segments = entries.map(({ project, orchestrator, source, session, columns }) => ({
|
|
23973
24112
|
problem: session === null || columns.length === 0,
|
|
23974
24113
|
unmatched: false,
|
|
23975
|
-
text: () => `${project}: orchestrator ${orchestrator}, ${session === null ? "no live session" : `session ${session}`}, ${columns.length === 0 ? "unused by columns" : `columns ${columns.join(", ")}`}`
|
|
24114
|
+
text: () => `${project}: orchestrator ${orchestrator} (${source}), ${session === null ? "no live session" : `session ${session}`}, ${columns.length === 0 ? "unused by columns" : `columns ${columns.join(", ")}`}`
|
|
23976
24115
|
}));
|
|
23977
24116
|
const problems = segments.filter((entry) => entry.problem);
|
|
23978
24117
|
const fix = fitFix([...problems, ...segments.filter((entry) => !entry.problem)], problems.length === 0 ? "" : " Assign a column and start a live session for each orchestrator.", `${String(entries.length)} orchestrators; ${String(problems.length)} need a column or live session.`);
|
|
@@ -23983,6 +24122,24 @@ function orchestratorSessionsCheck(entries) {
|
|
|
23983
24122
|
fix
|
|
23984
24123
|
} : warning("orchestrator.sessions", fix);
|
|
23985
24124
|
}
|
|
24125
|
+
/** Each project's operator Spur projects with their source, then the default Slack addressee. */
|
|
24126
|
+
function operatorBindingsText(config) {
|
|
24127
|
+
const bindings = configBindings(config, new Set(config.projects.map((project) => project.id)));
|
|
24128
|
+
const segments = config.projects.flatMap((project) => {
|
|
24129
|
+
const rows = bindings.operators.filter((row) => row.project === project.id);
|
|
24130
|
+
if (rows.length === 0) return [];
|
|
24131
|
+
const names = rows.map((row) => `${row.operator} (${row.source})`).join(", ");
|
|
24132
|
+
return [{
|
|
24133
|
+
problem: false,
|
|
24134
|
+
unmatched: false,
|
|
24135
|
+
text: () => `${project.id}: operator ${names}`
|
|
24136
|
+
}];
|
|
24137
|
+
});
|
|
24138
|
+
const addressee = bindings.defaultAddressee;
|
|
24139
|
+
const tail = addressee === null ? "" : ` Default Slack addressee: ${addressee.spurProject} (${addressee.source}).`;
|
|
24140
|
+
const count = `${String(segments.length)} projects have an operator Spur project.`;
|
|
24141
|
+
return fitFix(segments, tail, `${count}${tail}`.length <= 300 ? `${count}${tail}` : count);
|
|
24142
|
+
}
|
|
23986
24143
|
function check(id, ok, fix) {
|
|
23987
24144
|
return {
|
|
23988
24145
|
id,
|
|
@@ -24120,7 +24277,12 @@ async function runDaemonDoctor(ctx, productVersion, fetcher = fetch, { deadlineM
|
|
|
24120
24277
|
}
|
|
24121
24278
|
const operatorProject = config.projects.some((project) => project.spurProjects.some((spurProject) => spurProject.role === "operator"));
|
|
24122
24279
|
const token = operatorProject ? void 0 : await ctx.store.db.selectFrom("operator_token").select("id").where("status", "=", "approved").executeTakeFirst();
|
|
24123
|
-
checks.push(
|
|
24280
|
+
checks.push(operatorProject ? {
|
|
24281
|
+
id: "operator.path",
|
|
24282
|
+
status: "pass",
|
|
24283
|
+
blocking: false,
|
|
24284
|
+
fix: operatorBindingsText(config)
|
|
24285
|
+
} : check("operator.path", token !== void 0, "Configure a Spur project with the operator role or approve a named operator token."));
|
|
24124
24286
|
checks.push(await operatorTokensCheck(ctx, config));
|
|
24125
24287
|
checks.push(curatorSessionsCheck(await curatorSessions(ctx.store.db, config)));
|
|
24126
24288
|
checks.push(orchestratorSessionsCheck(await orchestratorSessions(ctx.store.db, config)));
|