spur-board 0.171.2 → 0.171.4
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-d9D_ohWO.mjs → chunk-BuHn-rfD.mjs} +2 -2
- package/dist/{chunk-BYzkU1Kt.mjs → chunk-Bx3YMBLb.mjs} +1 -1
- package/dist/{chunk-DD_jEQTA.mjs → chunk-DQnJirZ1.mjs} +16 -15
- package/dist/cli.mjs +3 -3
- package/dist/client.mjs +1 -1
- package/dist/daemon.mjs +113 -47
- package/dist/mcp.mjs +3 -3
- package/dist/migrations/0031_merge_observation.sql +3 -0
- package/dist/migrations/0032_confirmed_issue_miss.sql +1 -0
- package/dist/web/assets/{index-CqfuJHHS.js → index-DlU7jT5n.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/skills/spur-board/references/how-board-works-done.md +7 -0
- package/skills/spur-board/references/how-board-works-inbox.md +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { At as configSchema, Lt as slackConfigured, Nt as plainHttpAllowed, g as OPERATIONS, m as buildCatalogSnapshot } from "./chunk-
|
|
2
|
-
import { o as CliError, t as fetchCatalogVersion } from "./chunk-
|
|
1
|
+
import { At as configSchema, Lt as slackConfigured, Nt as plainHttpAllowed, g as OPERATIONS, m as buildCatalogSnapshot } from "./chunk-DQnJirZ1.mjs";
|
|
2
|
+
import { o as CliError, t as fetchCatalogVersion } from "./chunk-Bx3YMBLb.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { closeSync, constants, fstatSync, lstatSync, mkdirSync, openSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as errorEnvelopeSchema, d as tokenRequestStatusSchema, gt as errorContextSchema, l as tokenRequestResultSchema, mt as ERRORS, x as renderJsonError, yt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { _t as errorEnvelopeSchema, d as tokenRequestStatusSchema, gt as errorContextSchema, l as tokenRequestResultSchema, mt as ERRORS, x as renderJsonError, yt as successEnvelopeSchema } from "./chunk-DQnJirZ1.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { request } from "node:http";
|
|
@@ -2182,23 +2182,24 @@ function itemAnswersRef(item, ref) {
|
|
|
2182
2182
|
if (ref.kind === "ticket" && item.kind === "ticket") return item.facts.trackerId === ref.trackerId && (ref.id === void 0 ? item.facts.key === ref.key : item.facts.id === ref.id);
|
|
2183
2183
|
return itemIdentity(item) === refIdentity(ref);
|
|
2184
2184
|
}
|
|
2185
|
-
const
|
|
2185
|
+
const defaultBranchCommit = {
|
|
2186
2186
|
branch: z.string().min(1).describe("Name of the default branch."),
|
|
2187
|
-
sha: commitShaSchema.describe("
|
|
2187
|
+
sha: commitShaSchema.describe("Newest commit with counted checks in the default-branch read.")
|
|
2188
2188
|
};
|
|
2189
2189
|
/**
|
|
2190
|
-
* The colour of
|
|
2190
|
+
* The colour of the newest checked commit in the default-branch read. Push workflow checks and
|
|
2191
2191
|
* commit statuses count; scheduled and other runs, and check runs outside workflows, never do.
|
|
2192
|
+
* A push workflow suite with no check runs holds the read on that commit without a verdict.
|
|
2192
2193
|
*/
|
|
2193
2194
|
const defaultBranchFactSchema = z.discriminatedUnion("state", [z.strictObject({
|
|
2194
|
-
state: z.literal("green").describe("Every counted check finished
|
|
2195
|
-
...
|
|
2195
|
+
state: z.literal("green").describe("Every counted check finished as success, neutral or skipped."),
|
|
2196
|
+
...defaultBranchCommit
|
|
2196
2197
|
}), z.strictObject({
|
|
2197
|
-
state: z.literal("red").describe("At least one counted check
|
|
2198
|
-
...
|
|
2198
|
+
state: z.literal("red").describe("At least one counted check has a completed result other than success, neutral or skipped."),
|
|
2199
|
+
...defaultBranchCommit,
|
|
2199
2200
|
check: z.string().min(1).nullable().describe("Name of the first failing check, if known."),
|
|
2200
2201
|
url: webUrl.nullable().describe("Web URL of the failing run, or null when unknown.")
|
|
2201
|
-
})]).describe("Colour of the default-branch
|
|
2202
|
+
})]).describe("Colour of the newest checked commit in the default-branch read.");
|
|
2202
2203
|
const batchSchema = z.strictObject({
|
|
2203
2204
|
source: z.string().min(1).describe("Id of the adapter that produced the batch."),
|
|
2204
2205
|
observedAt: z.iso.datetime().describe("When the poll started (A2)."),
|
|
@@ -2225,7 +2226,7 @@ const batchSchema = z.strictObject({
|
|
|
2225
2226
|
limit: z.int().positive().optional().describe("Full budget the source restores at reset; omitted when it reports none."),
|
|
2226
2227
|
resetAt: z.iso.datetime().describe("When the source restores the full budget.")
|
|
2227
2228
|
}).optional().describe("Request budget the source reported on this poll; omitted when it reports none."),
|
|
2228
|
-
defaultBranch: defaultBranchFactSchema.optional().describe("Colour of the default-branch
|
|
2229
|
+
defaultBranch: defaultBranchFactSchema.optional().describe("Colour of the newest checked commit in the default-branch read. Omitted when the poll found no settled colour."),
|
|
2229
2230
|
mirror: z.strictObject({
|
|
2230
2231
|
title: z.string().min(1).describe("Title of the GitHub Project read."),
|
|
2231
2232
|
readiness: z.array(z.strictObject({
|
|
@@ -3450,16 +3451,16 @@ const inboxEntrySchema = z.strictObject({
|
|
|
3450
3451
|
/** An operator inbox entry cleared, answered or closed in the last 24 hours. */
|
|
3451
3452
|
const inboxHandledSchema = inboxEntrySchema.extend({ handledAt: z.iso.datetime().describe("When it was cleared, answered or closed, ISO 8601 UTC.") }).describe("An operator inbox entry handled in the last 24 hours.");
|
|
3452
3453
|
// ../contracts/src/ops/source-view-schema.ts
|
|
3453
|
-
/** The stored colour of a repository's default
|
|
3454
|
+
/** The stored colour of a repository's default branch, as status.get shows it. */
|
|
3454
3455
|
const defaultBranchViewSchema = z.strictObject({
|
|
3455
3456
|
branch: z.string().min(1).describe("Name of the default branch."),
|
|
3456
|
-
state: z.enum(["red", "green"]).describe("
|
|
3457
|
-
sha: commitShaSchema.describe("
|
|
3457
|
+
state: z.enum(["red", "green"]).describe("Last settled colour read for the default branch."),
|
|
3458
|
+
sha: commitShaSchema.describe("Checked commit when this colour was first read. While red, the first red commit."),
|
|
3458
3459
|
since: z.iso.datetime().describe("When the board first read this colour."),
|
|
3459
|
-
confirmedAt: z.iso.datetime().describe("When a poll last read this colour
|
|
3460
|
+
confirmedAt: z.iso.datetime().describe("When a poll last read this colour, including via a checked parent of an unchecked head. A poll without a settled result keeps this time."),
|
|
3460
3461
|
check: z.string().min(1).nullable().describe("Name of the first failing check, or null."),
|
|
3461
3462
|
url: webUrl.nullable().describe("Web URL of the failing run, or null.")
|
|
3462
|
-
}).describe("Colour of the default-branch head.
|
|
3463
|
+
}).describe("Colour of the newest commit with a commit status or push-triggered workflow among the default-branch head and its seven nearest first parents. A push suite counts before its check runs appear. Red means a failed commit status or a latest push-workflow check with a completed result other than success, neutral or skipped. Scheduled, manual and non-workflow checks are ignored, and branch protection is not read. A poll without a settled result keeps the stored colour and operator item.");
|
|
3463
3464
|
const sourceViewSchema = z.strictObject({
|
|
3464
3465
|
pointsLastHour: z.int().nonnegative().optional().describe("Reported source points consumed during the preceding hour."),
|
|
3465
3466
|
source: z.string().min(1).describe("Adapter source identifier."),
|
|
@@ -3485,7 +3486,7 @@ const sourceViewSchema = z.strictObject({
|
|
|
3485
3486
|
waitsForBudget: z.boolean().describe("Whether the daemon's adapter runner has put off this source's next regular poll for a rate limit: the last regular poll in this daemon run either reported a budget under github.reserveRemaining (GitHub sources, complete or not) or failed as throttled, with or without a retry time (any source), or failed in any other way while the last budget a poll of this run reported, an on-demand refresh included, is under github.reserveRemaining with a future reset (this case also ends at that reset), and the paused poll has not started yet. Held in memory, so false after a restart until a poll pauses again; a stored budget or an on-demand refresh never sets it."),
|
|
3486
3487
|
healthySince: z.iso.datetime().nullable().describe("When this source became usable (not blind) in this daemon run: its first non-blind observation since daemon start or since it was last blind. Stale, warming-up or budget-wait spells that did not make it blind do not move it. Null while blind or before that observation. Resets when the daemon restarts; compare with daemon.startedAt."),
|
|
3487
3488
|
warmingUp: z.boolean().describe("Whether this source needs a complete poll in this daemon run."),
|
|
3488
|
-
defaultBranch: defaultBranchViewSchema.nullable().optional().describe("GitHub pull request sources only
|
|
3489
|
+
defaultBranch: defaultBranchViewSchema.nullable().optional().describe("GitHub pull request sources only. The stored default-branch colour from the newest checked commit in the poll window, or null until a poll reads a settled result.")
|
|
3489
3490
|
}).describe("Freshness and availability of one source.");
|
|
3490
3491
|
// ../contracts/src/ops/move-schemas.ts
|
|
3491
3492
|
const taskMoveInputSchema = z.discriminatedUnion("mode", [z.strictObject({
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { At as configSchema, Ft as requiredSecretKeys, It as resolveWebOrigin, Lt as slackConfigured, Wt as SLACK_BOT_SCOPES, c as requestHashOf, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, lt as actorIdSchema, mt as ERRORS, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, r as SLACK_PARTLY_FIX, wt as DEFAULT_STAND_PORT_RANGE, yt as successEnvelopeSchema } from "./chunk-
|
|
1
|
+
import { At as configSchema, Ft as requiredSecretKeys, It as resolveWebOrigin, Lt as slackConfigured, Wt as SLACK_BOT_SCOPES, c as requestHashOf, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, lt as actorIdSchema, mt as ERRORS, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, r as SLACK_PARTLY_FIX, wt as DEFAULT_STAND_PORT_RANGE, yt as successEnvelopeSchema } from "./chunk-DQnJirZ1.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
|
-
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-
|
|
4
|
-
import { a as memoryVerdictCache, c as dataDirectory, d as readConfiguredPort, f as resolveDaemonAddress, i as fileVerdictCache, l as loadClientConfig, n as cliPackageVersion, o as boardSlackState, p as tokenInFolder, s as configFile, t as checkCatalog, u as loadEnrollmentConfig } from "./chunk-
|
|
3
|
+
import { a as requestTokenEnrollment, c as renderCliError, i as requestSkillReload, l as escapeTerminalControls, n as fetchTokenStatus, o as CliError, r as requestOperation, s as errorExitCode } from "./chunk-Bx3YMBLb.mjs";
|
|
4
|
+
import { a as memoryVerdictCache, c as dataDirectory, d as readConfiguredPort, f as resolveDaemonAddress, i as fileVerdictCache, l as loadClientConfig, n as cliPackageVersion, o as boardSlackState, p as tokenInFolder, s as configFile, t as checkCatalog, u as loadEnrollmentConfig } from "./chunk-BuHn-rfD.mjs";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import { accessSync, chmodSync, closeSync, constants, cpSync, existsSync, ftruncateSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
|
|
7
7
|
import { homedir, hostname, tmpdir, userInfo } from "node:os";
|
package/dist/client.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-
|
|
1
|
+
export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-Bx3YMBLb.mjs";
|
package/dist/daemon.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as parseRingMarker, A as skillReloadFilesSchema, At as configSchema, B as defaultBranchFactSchema, Bt as COLUMN_GROUPS, C as SPACE_IDS, Ct as DEFAULT_SLACK_COMMAND, D as messageRefSchema, Dt as boardWideSpurProject, E as interactionRefSchema, Et as approvalRuleOf, F as AdapterError, Ft as requiredSecretKeys, G as sourceCursorSchema, Gt as TASK_HOLDS, H as mirrorSourceId, Ht as DISPATCHER_MODES, I as MIRROR_FAILURES, It as resolveWebOrigin, J as REVIEW_DECISIONS, Jt as isTodoGroupColumn, K as trackerSourceId, Kt as TODO_GROUP_COLUMN_IDS, L as MIRROR_FAILURE_CODES, Lt as slackConfigured, M as EVENT_KINDS, Mt as externalQuietAfterMs, N as GATE_REASONS, Nt as plainHttpAllowed, O as userIdSchema, Ot as columnTurnTimings, P as eventPayloadSchemas, Pt as readyMirrorOf, Q as isExternalAuthor, R as SPUR_REQUEST_TIMEOUT, Rt as BLOCK_TYPES, T as inboundEventSchema, Tt as RESERVED_PROJECT, U as prSourceId, Ut as ITEM_KINDS, V as entityRefSchema, Vt as COLUMN_IDS, W as sessionTransitionSchema, Wt as SLACK_BOT_SCOPES, X as SESSION_HEALTH_STATES, Y as REVIEW_STATES, Z as SESSION_STATUSES, _ as defaultBranchViewSchema, a as doctorReportSchema, at as sessionFactsSchema, b as renderHttpProblem, c as requestHashOf, ct as REF_NUMBER, d as tokenRequestStatusSchema, dt as errorCodeOf, et as prApprovalPairSchema, f as BOARD_TICK_MS, ft as parseActorId, g as OPERATIONS, h as roleCanUseOperation, ht as err, i as SPUR_MIN_VERSION, it as ringMarker, j as sortSkillFiles, jt as defaultAddressee, kt as configBindings, l as tokenRequestResultSchema, lt as actorIdSchema, m as buildCatalogSnapshot, mt as ERRORS, n as SLACK_OFF_FIX, nt as prRefSchema, ot as ticketFactsSchema, pt as parseRef$1, q as PR_STATES, qt as VIAS, r as SLACK_PARTLY_FIX, rt as prReviewRuleSchema, s as TOKEN_REQUEST_LIMITS, st as JIRA_PROJECT_KEY, t as assertNever, tt as prFactsSchema, u as tokenRequestSchema, ut as encodeActorId, v as inboxNoSessionSchema, vt as ok, w as conversationRefSchema, xt as DEFAULT_LINK, y as turnHandedSchema, yt as successEnvelopeSchema, z as batchSchema, zt as COLUMNS } from "./chunk-
|
|
1
|
+
import { $ as parseRingMarker, A as skillReloadFilesSchema, At as configSchema, B as defaultBranchFactSchema, Bt as COLUMN_GROUPS, C as SPACE_IDS, Ct as DEFAULT_SLACK_COMMAND, D as messageRefSchema, Dt as boardWideSpurProject, E as interactionRefSchema, Et as approvalRuleOf, F as AdapterError, Ft as requiredSecretKeys, G as sourceCursorSchema, Gt as TASK_HOLDS, H as mirrorSourceId, Ht as DISPATCHER_MODES, I as MIRROR_FAILURES, It as resolveWebOrigin, J as REVIEW_DECISIONS, Jt as isTodoGroupColumn, K as trackerSourceId, Kt as TODO_GROUP_COLUMN_IDS, L as MIRROR_FAILURE_CODES, Lt as slackConfigured, M as EVENT_KINDS, Mt as externalQuietAfterMs, N as GATE_REASONS, Nt as plainHttpAllowed, O as userIdSchema, Ot as columnTurnTimings, P as eventPayloadSchemas, Pt as readyMirrorOf, Q as isExternalAuthor, R as SPUR_REQUEST_TIMEOUT, Rt as BLOCK_TYPES, T as inboundEventSchema, Tt as RESERVED_PROJECT, U as prSourceId, Ut as ITEM_KINDS, V as entityRefSchema, Vt as COLUMN_IDS, W as sessionTransitionSchema, Wt as SLACK_BOT_SCOPES, X as SESSION_HEALTH_STATES, Y as REVIEW_STATES, Z as SESSION_STATUSES, _ as defaultBranchViewSchema, a as doctorReportSchema, at as sessionFactsSchema, b as renderHttpProblem, c as requestHashOf, ct as REF_NUMBER, d as tokenRequestStatusSchema, dt as errorCodeOf, et as prApprovalPairSchema, f as BOARD_TICK_MS, ft as parseActorId, g as OPERATIONS, h as roleCanUseOperation, ht as err, i as SPUR_MIN_VERSION, it as ringMarker, j as sortSkillFiles, jt as defaultAddressee, kt as configBindings, l as tokenRequestResultSchema, lt as actorIdSchema, m as buildCatalogSnapshot, mt as ERRORS, n as SLACK_OFF_FIX, nt as prRefSchema, ot as ticketFactsSchema, pt as parseRef$1, q as PR_STATES, qt as VIAS, r as SLACK_PARTLY_FIX, rt as prReviewRuleSchema, s as TOKEN_REQUEST_LIMITS, st as JIRA_PROJECT_KEY, t as assertNever, tt as prFactsSchema, u as tokenRequestSchema, ut as encodeActorId, v as inboxNoSessionSchema, vt as ok, w as conversationRefSchema, xt as DEFAULT_LINK, y as turnHandedSchema, yt as successEnvelopeSchema, z as batchSchema, zt as COLUMNS } from "./chunk-DQnJirZ1.mjs";
|
|
2
2
|
import { t as apiBaseUrl } from "./chunk-Bzb7aI8R.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -19186,6 +19186,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19186
19186
|
const tasks = await trx.selectFrom("task").selectAll().where("membership", "!=", "archived").execute();
|
|
19187
19187
|
const taskById = new Map(tasks.map((task) => [task.id, task]));
|
|
19188
19188
|
const endedHolders = await endedTurnItems(trx, taskById, candidates, new Date(now), sourceById.get("spur")?.last_complete_at ?? null);
|
|
19189
|
+
const confirmedIssueMisses = /* @__PURE__ */ new Map();
|
|
19189
19190
|
const misses = await trx.selectFrom("source_miss").selectAll().execute();
|
|
19190
19191
|
for (const miss of misses) {
|
|
19191
19192
|
if (miss.gone !== 1) continue;
|
|
@@ -19213,6 +19214,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19213
19214
|
continue;
|
|
19214
19215
|
}
|
|
19215
19216
|
if (ref.kind !== "ticket") continue;
|
|
19217
|
+
if (miss.confirmed_missing_at !== null) confirmedIssueMisses.set(miss.ref_key, miss.confirmed_missing_at);
|
|
19216
19218
|
const task = tasks.find((entry) => entry.key === ref.key);
|
|
19217
19219
|
if (task === void 0) continue;
|
|
19218
19220
|
candidates.push({
|
|
@@ -19294,19 +19296,21 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19294
19296
|
"pr_snapshot.state",
|
|
19295
19297
|
"pr_snapshot.source",
|
|
19296
19298
|
"pr_snapshot.observed_at",
|
|
19299
|
+
"pr_snapshot.merged_seen_at",
|
|
19297
19300
|
"pr_snapshot.detail"
|
|
19298
19301
|
]).where("link.entity", "=", "pr").where("link.banned", "=", 0).where(pastReopenFloor).execute();
|
|
19299
|
-
const tickets = await trx.selectFrom("ticket_snapshot").select([
|
|
19302
|
+
const tickets = new Map((await trx.selectFrom("ticket_snapshot").select([
|
|
19300
19303
|
"task_id",
|
|
19301
19304
|
"status",
|
|
19302
19305
|
"detail",
|
|
19303
19306
|
"source",
|
|
19304
|
-
"observed_at"
|
|
19305
|
-
|
|
19307
|
+
"observed_at",
|
|
19308
|
+
"last_read_at"
|
|
19309
|
+
]).execute()).map((ticket) => [ticket.task_id, ticket]));
|
|
19306
19310
|
const taskPrs = {};
|
|
19307
19311
|
for (const task of tasks) {
|
|
19308
19312
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
19309
|
-
const ticket = tickets.
|
|
19313
|
+
const ticket = tickets.get(task.id);
|
|
19310
19314
|
taskPrs[String(task.id)] = {
|
|
19311
19315
|
hasOpenPr: false,
|
|
19312
19316
|
hasMergedPr: false,
|
|
@@ -19319,6 +19323,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19319
19323
|
return facts === null ? NaN : Date.parse(facts.closedAt ?? facts.updatedAt);
|
|
19320
19324
|
};
|
|
19321
19325
|
const mergedAt = /* @__PURE__ */ new Map();
|
|
19326
|
+
const mergedSeenAt = /* @__PURE__ */ new Map();
|
|
19322
19327
|
const newestMerge = /* @__PURE__ */ new Map();
|
|
19323
19328
|
const judged = /* @__PURE__ */ new Map();
|
|
19324
19329
|
const mergedByTask = /* @__PURE__ */ new Map();
|
|
@@ -19327,6 +19332,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19327
19332
|
if (state === void 0) continue;
|
|
19328
19333
|
if (pr.state === "open") state.hasOpenPr = true;
|
|
19329
19334
|
if (pr.state !== "merged") continue;
|
|
19335
|
+
mergedSeenAt.set(pr.task_id, latest$1([mergedSeenAt.get(pr.task_id), pr.merged_seen_at]));
|
|
19330
19336
|
const facts = parsePr(pr.detail ?? void 0);
|
|
19331
19337
|
const at = facts === null ? null : facts.mergedAt ?? facts.updatedAt;
|
|
19332
19338
|
const newest = mergedAt.get(pr.task_id) ?? null;
|
|
@@ -19368,7 +19374,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19368
19374
|
const closedAt = Math.max(...closed.map((pr) => pr.closedAt));
|
|
19369
19375
|
const key = `pr-closed:${String(task.id)}`;
|
|
19370
19376
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
19371
|
-
if (Number.isFinite(mergedSince) && project !== void 0 && !seenOpenSince(project, config, tickets.
|
|
19377
|
+
if (Number.isFinite(mergedSince) && project !== void 0 && !seenOpenSince(project, config, tickets.get(task.id), task.manual_include === 1, mergedSince) || state.prCompleteAt === null || !(state.prCompleteAt >= closedAt)) {
|
|
19372
19378
|
prClosed.set(task.id, {
|
|
19373
19379
|
held: true,
|
|
19374
19380
|
key
|
|
@@ -19398,7 +19404,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19398
19404
|
const task = taskById.get(taskId);
|
|
19399
19405
|
if (state === void 0 || task === void 0) continue;
|
|
19400
19406
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
19401
|
-
const ticket = tickets.
|
|
19407
|
+
const ticket = tickets.get(taskId);
|
|
19402
19408
|
const storedMerge = latest$1([facts?.mergedAt, newestMerge.get(taskId)]);
|
|
19403
19409
|
const judgement = facts === null || project === void 0 ? "unconfirmed" : mergedTicket(project, config, ticket, task.manual_include === 1, {
|
|
19404
19410
|
...facts,
|
|
@@ -19424,7 +19430,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19424
19430
|
for (const task of tasks) {
|
|
19425
19431
|
const state = taskPrs[String(task.id)];
|
|
19426
19432
|
const project = config.projects.find((entry) => entry.id === task.project);
|
|
19427
|
-
const ticket = tickets.
|
|
19433
|
+
const ticket = tickets.get(task.id);
|
|
19428
19434
|
const closedWhileLive = state !== void 0 && project !== void 0 && ticket !== void 0 && ticketDone(project, ticket.status) && (state.hasOpenPr || liveSessionTasks.has(String(task.id))) && !state.hasMergedPr && !prs.some((pr) => pr.task_id === task.id && pr.state === "merged");
|
|
19429
19435
|
if (task.membership === "out_of_filter" && !closedWhileLive) candidates.push({
|
|
19430
19436
|
key: `filter:${String(task.id)}`,
|
|
@@ -19598,7 +19604,7 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19598
19604
|
value: toJson(episodeSchema, health.episode)
|
|
19599
19605
|
}).onConflict((oc) => oc.column("key").doUpdateSet({ value: toJson(episodeSchema, health.episode) })).execute();
|
|
19600
19606
|
const resting = await restingHolders(trx, config, now);
|
|
19601
|
-
const
|
|
19607
|
+
const skipIdle = (task, flag) => flag.kind === "worker_idle" && (task.column === "done" || resting.has(`${flag.taskId}:${flag.sessionId}`));
|
|
19602
19608
|
const turnTasks = new Set(turns.map((turn) => turn.task_id));
|
|
19603
19609
|
const latestDoneTurns = new Map((await trx.selectFrom("turn").innerJoin("task", "task.id", "turn.task_id").select([
|
|
19604
19610
|
"turn.task_id",
|
|
@@ -19616,9 +19622,20 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19616
19622
|
const stoppedInDone = new Set(subjects.filter((subject) => subject.role === "worker" && subject.lifecycle === "stopped" && subject.endedAt === null && addressed.has(`${subject.taskId}:${subject.id}`)).map((subject) => `${subject.taskId}:${subject.id}`));
|
|
19617
19623
|
const stoppedRetained = (flag) => ["stuck_worker", "needs_input"].includes(flag.kind) && stoppedInDone.has(`${flag.taskId}:${flag.sessionId}`);
|
|
19618
19624
|
for (const flag of health.flags) {
|
|
19619
|
-
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag) || stoppedRetained(flag)) continue;
|
|
19620
19625
|
const task = taskById.get(Number(flag.taskId));
|
|
19621
|
-
if (task === void 0) continue;
|
|
19626
|
+
if (task === void 0 || endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || skipIdle(task, flag) || stoppedRetained(flag)) continue;
|
|
19627
|
+
if (flag.kind === "worker_idle" && task.tracker_kind === "github-issues") {
|
|
19628
|
+
const merged = mergedSeenAt.get(task.id);
|
|
19629
|
+
if (merged != null && now < Date.parse(merged) + 2 * config.adapters.githubIssues.intervalMs) {
|
|
19630
|
+
const project = config.projects.find((entry) => entry.id === task.project);
|
|
19631
|
+
const miss = project === void 0 ? void 0 : confirmedIssueMisses.get(`ticket:${trackerSourceId(project)}:${task.tracker_id ?? task.key}`);
|
|
19632
|
+
const checked = latest$1([tickets.get(task.id)?.last_read_at, miss]);
|
|
19633
|
+
if (checked === null || Date.parse(checked) <= Date.parse(merged)) {
|
|
19634
|
+
heldKeys.push(healthKey(task.id, flag));
|
|
19635
|
+
continue;
|
|
19636
|
+
}
|
|
19637
|
+
}
|
|
19638
|
+
}
|
|
19622
19639
|
const fact = subjects.find((subject) => subject.taskId === flag.taskId && subject.id === flag.sessionId);
|
|
19623
19640
|
if ([
|
|
19624
19641
|
"stuck_worker",
|
|
@@ -19677,9 +19694,9 @@ async function reconcileItems(trx, config, now, spurComplete, warnSkipped, spurC
|
|
|
19677
19694
|
const ordered = orderItems(candidates);
|
|
19678
19695
|
const seen = /* @__PURE__ */ new Set([...ordered.map((item) => item.key), ...heldKeys]);
|
|
19679
19696
|
for (const flag of health.held) {
|
|
19680
|
-
if (endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || restingIdle(flag) || stoppedRetained(flag)) continue;
|
|
19681
19697
|
const task = taskById.get(Number(flag.taskId));
|
|
19682
|
-
if (task
|
|
19698
|
+
if (task === void 0 || endedHolders.has(`${flag.taskId}:${flag.sessionId}`) || skipIdle(task, flag) || stoppedRetained(flag)) continue;
|
|
19699
|
+
if (!stalled.has(`${flag.taskId}:${flag.sessionId}`)) seen.add(healthKey(task.id, flag));
|
|
19683
19700
|
}
|
|
19684
19701
|
const existing = await trx.selectFrom("operator_item").selectAll().where("kind", "in", RECONCILED_KINDS).where("cleared_at", "is", null).execute();
|
|
19685
19702
|
const stillInError = new Set(health.hostLoad === null ? [] : subjects.filter((subject) => subject.endedAt === null && subject.health === "error" && subject.role !== "other" && !stalled.has(`${subject.taskId}:${subject.id}`) && !stoppedInDone.has(`${subject.taskId}:${subject.id}`)).map((subject) => healthKey(Number(subject.taskId), {
|
|
@@ -25535,13 +25552,15 @@ async function ticket(trx, config, fact, at, source) {
|
|
|
25535
25552
|
assignee: fact.assignee,
|
|
25536
25553
|
detail: toJson(ticketFactsSchema, fact),
|
|
25537
25554
|
source,
|
|
25538
|
-
observed_at: at
|
|
25555
|
+
observed_at: at,
|
|
25556
|
+
last_read_at: at
|
|
25539
25557
|
}).onConflict((oc) => oc.column("task_id").doUpdateSet({
|
|
25540
25558
|
status: fact.status,
|
|
25541
25559
|
assignee: fact.assignee,
|
|
25542
25560
|
detail: toJson(ticketFactsSchema, fact),
|
|
25543
25561
|
source,
|
|
25544
|
-
observed_at: at
|
|
25562
|
+
observed_at: at,
|
|
25563
|
+
last_read_at: at
|
|
25545
25564
|
})).execute();
|
|
25546
25565
|
if (previousFact === null || comparableFacts(previousFact, "updatedAt") !== comparableFacts(fact, "updatedAt")) {
|
|
25547
25566
|
if (previousFact?.status !== fact.status) {
|
|
@@ -25577,7 +25596,7 @@ function comparableFacts(facts, timestamp) {
|
|
|
25577
25596
|
* counted check's run (`countedChecks`, by name and completion time) with the checks unchanged
|
|
25578
25597
|
* still writes one, with `from` equal to `to`.
|
|
25579
25598
|
*/
|
|
25580
|
-
async function pr(trx, config, fact, at, source, scheduled, reviewRule) {
|
|
25599
|
+
async function pr(trx, config, fact, at, acceptedAt, source, scheduled, reviewRule) {
|
|
25581
25600
|
await trx.deleteFrom("source_miss").where("source", "=", source).where("ref_key", "=", refKey({
|
|
25582
25601
|
kind: "pr",
|
|
25583
25602
|
repo: fact.repo,
|
|
@@ -25585,6 +25604,7 @@ async function pr(trx, config, fact, at, source, scheduled, reviewRule) {
|
|
|
25585
25604
|
})).execute();
|
|
25586
25605
|
const old = await trx.selectFrom("pr_snapshot").selectAll().where(sql`lower(repo) = ${fact.repo.toLowerCase()}`).where("number", "=", fact.number).executeTakeFirst();
|
|
25587
25606
|
const previous = old === void 0 ? null : parseJson(prFactsSchema, old.detail);
|
|
25607
|
+
const mergedSeenAt = fact.state !== "merged" ? null : old?.state === "merged" ? old.merged_seen_at : acceptedAt;
|
|
25588
25608
|
const recheckAt = fact.state === "closed" ? new Date(Date.parse(at) + 216e5).toISOString() : null;
|
|
25589
25609
|
if (old !== void 0 && previous !== null && old.source !== source) await savePrPolling(trx, old.source, previous, old.closed_recheck_at, true);
|
|
25590
25610
|
await savePrPolling(trx, source, fact, recheckAt);
|
|
@@ -25601,9 +25621,11 @@ async function pr(trx, config, fact, at, source, scheduled, reviewRule) {
|
|
|
25601
25621
|
detail: toJson(prFactsSchema, fact),
|
|
25602
25622
|
source,
|
|
25603
25623
|
observed_at: at,
|
|
25604
|
-
closed_recheck_at: recheckAt
|
|
25624
|
+
closed_recheck_at: recheckAt,
|
|
25625
|
+
merged_seen_at: mergedSeenAt
|
|
25605
25626
|
}).onConflict((oc) => oc.columns(["repo", "number"]).doUpdateSet({
|
|
25606
25627
|
closed_recheck_at: recheckAt,
|
|
25628
|
+
merged_seen_at: mergedSeenAt,
|
|
25607
25629
|
head_sha: fact.headSha,
|
|
25608
25630
|
head_branch: fact.headBranch,
|
|
25609
25631
|
state: fact.state,
|
|
@@ -26062,7 +26084,9 @@ function createObservationCore(deps) {
|
|
|
26062
26084
|
async observe(source, observation) {
|
|
26063
26085
|
const { batch } = observation;
|
|
26064
26086
|
const now = clock.now();
|
|
26087
|
+
let acceptedAt;
|
|
26065
26088
|
await transact(async (trx) => {
|
|
26089
|
+
acceptedAt ??= new Date(clock.now()).toISOString();
|
|
26066
26090
|
const wasBlind = await blindReason(trx, source);
|
|
26067
26091
|
const previousSpur = source === "spur" ? await trx.selectFrom("source_state").select("last_complete_at").where("source", "=", source).executeTakeFirst() : void 0;
|
|
26068
26092
|
const spurGap = previousSpur?.last_complete_at != null && Date.parse(batch.observedAt) > Date.parse(previousSpur.last_complete_at) + config.adapters.spur.intervalMs * config.thresholds.staleMultiplier;
|
|
@@ -26087,19 +26111,25 @@ function createObservationCore(deps) {
|
|
|
26087
26111
|
}, recheckAt);
|
|
26088
26112
|
await trx.updateTable("pr_snapshot").set({ closed_recheck_at: recheckAt }).where("source", "=", source).where(sql`lower(repo) = ${probe.ref.repo.toLowerCase()}`).where("number", "=", probe.ref.number).where("state", "=", "closed").execute();
|
|
26089
26113
|
}
|
|
26114
|
+
const project = config.projects.find((entry) => trackerSourceId(entry) === source);
|
|
26090
26115
|
for (const outcome of observation.outcomes) {
|
|
26091
|
-
const
|
|
26116
|
+
const ref = outcome.ref;
|
|
26117
|
+
const answer = batch.entities.find((entity) => refKey(entity.ref) === refKey(ref));
|
|
26118
|
+
const confirmedMissingAt = project?.tracker.type === "github-issues" && ref.kind === "ticket" && ref.trackerId === source && batch.complete && outcome.gone && answer?.status === "not_found" ? batch.observedAt : null;
|
|
26092
26119
|
await trx.insertInto("source_miss").values({
|
|
26093
26120
|
source,
|
|
26094
|
-
ref_key: refKey(
|
|
26095
|
-
ref: toJson(entityRefSchema,
|
|
26121
|
+
ref_key: refKey(ref),
|
|
26122
|
+
ref: toJson(entityRefSchema, ref),
|
|
26096
26123
|
misses: outcome.misses,
|
|
26097
26124
|
gone: outcome.gone ? 1 : 0,
|
|
26098
|
-
outcome: answer?.status ?? null
|
|
26125
|
+
outcome: answer?.status ?? null,
|
|
26126
|
+
confirmed_missing_at: confirmedMissingAt
|
|
26099
26127
|
}).onConflict((oc) => oc.columns(["source", "ref_key"]).doUpdateSet({
|
|
26100
26128
|
misses: outcome.misses,
|
|
26101
26129
|
gone: outcome.gone ? 1 : 0,
|
|
26102
|
-
outcome: answer?.status ?? null
|
|
26130
|
+
outcome: answer?.status ?? null,
|
|
26131
|
+
...answer?.status === "ok" && { confirmed_missing_at: null },
|
|
26132
|
+
...confirmedMissingAt !== null && { confirmed_missing_at: sql`max(coalesce(source_miss.confirmed_missing_at, ${confirmedMissingAt}), ${confirmedMissingAt})` }
|
|
26103
26133
|
})).execute();
|
|
26104
26134
|
}
|
|
26105
26135
|
const branchCounts = /* @__PURE__ */ new Map();
|
|
@@ -26112,7 +26142,7 @@ function createObservationCore(deps) {
|
|
|
26112
26142
|
const confirmedCancels = [];
|
|
26113
26143
|
for (const item of orderedItems) if (item.kind === "ticket") await ticket(trx, config, item.facts, batch.observedAt, source);
|
|
26114
26144
|
else if (item.kind === "pr") {
|
|
26115
|
-
if (await pr(trx, config, item.facts, batch.observedAt, source, observation.effectiveComplete, item.reviewRule)) confirmedCancels.push(item.facts);
|
|
26145
|
+
if (await pr(trx, config, item.facts, batch.observedAt, acceptedAt, source, observation.effectiveComplete, item.reviewRule)) confirmedCancels.push(item.facts);
|
|
26116
26146
|
await holdContinuation(trx, source, item);
|
|
26117
26147
|
await recordApprovalPairs(trx, item.facts, item.approvalPairs);
|
|
26118
26148
|
} else await session(trx, config, item.facts, batch.observedAt, source, ambiguous, batch.sessionTransitions !== void 0);
|
|
@@ -26143,7 +26173,6 @@ function createObservationCore(deps) {
|
|
|
26143
26173
|
}
|
|
26144
26174
|
if (observation.effectiveComplete) await trx.updateTable("session_snapshot").set({ absent_since: batch.observedAt }).where("source", "=", source).where("absent_since", "is", null).where("last_seen", "<", batch.observedAt).execute();
|
|
26145
26175
|
if (observation.effectiveComplete) {
|
|
26146
|
-
const project = config.projects.find((entry) => trackerSourceId(entry) === source);
|
|
26147
26176
|
if (project !== void 0) {
|
|
26148
26177
|
const seen = new Set(batch.items.flatMap((item) => item.kind === "ticket" && item.facts.inFilter ? [item.facts.id] : []));
|
|
26149
26178
|
const unresolved = new Set(batch.entities.flatMap((entity) => entity.ref.kind === "ticket" && entity.status !== "ok" && !observation.outcomes.some((outcome) => refKey(outcome.ref) === refKey(entity.ref) && outcome.gone) ? [entity.ref.id ?? entity.ref.key] : []));
|
|
@@ -28404,7 +28433,12 @@ function aliases(numbers, fields) {
|
|
|
28404
28433
|
return numbers.map((number, i) => `pr${String(i)}: repository(owner: $owner, name: $repo) { pullRequest(number: ${String(number)}) { ${fields(number)} } }`).join("\n");
|
|
28405
28434
|
}
|
|
28406
28435
|
const discoveryStates = (bootstrap) => bootstrap ? "OPEN" : "OPEN, MERGED, CLOSED";
|
|
28407
|
-
const
|
|
28436
|
+
const BRANCH_COMMIT_FIELDS = "oid statusCheckRollup { contexts(first: 100) { nodes { ... on CheckRun { __typename name status conclusion startedAt completedAt detailsUrl checkSuite { createdAt workflowRun { event workflow { id } } } } ... on StatusContext { __typename context state createdAt targetUrl } } pageInfo { hasNextPage } } } checkSuites(first: 100) { nodes { workflowRun { event } } pageInfo { hasNextPage } }";
|
|
28437
|
+
const DEFAULT_BRANCH_READS = ["defaultBranchRef", ...Array.from({ length: 7 }, (_, index) => `defaultBranchParent${String(index + 1)}`)];
|
|
28438
|
+
const DEFAULT_BRANCH_FIELDS = DEFAULT_BRANCH_READS.map((alias, depth) => {
|
|
28439
|
+
if (depth === 0) return `${alias} { name target { __typename ... on Commit { ${BRANCH_COMMIT_FIELDS} } } }`;
|
|
28440
|
+
return `${alias}: defaultBranchRef { target { ... on Commit { ${`oid ${"parents(first: 1) { nodes { ".repeat(depth)}${BRANCH_COMMIT_FIELDS}${" } }".repeat(depth)}`} } } }`;
|
|
28441
|
+
}).join(" ");
|
|
28408
28442
|
function discoveryQuery(bootstrap = false) {
|
|
28409
28443
|
return `query PrBatch($owner: String!, $repo: String!) { rateLimit { cost limit remaining resetAt } repository(owner: $owner, name: $repo) { pullRequests(first: 100, states: [${discoveryStates(bootstrap)}], orderBy: {field: UPDATED_AT, direction: DESC}) { ${DISCOVERY_FIELDS} }${bootstrap ? " mergedBaseline: pullRequests(first: 1, states: [MERGED, CLOSED], orderBy: {field: UPDATED_AT, direction: DESC}) { nodes { updatedAt } }" : ""} ${DEFAULT_BRANCH_FIELDS} } }`;
|
|
28410
28444
|
}
|
|
@@ -28754,16 +28788,23 @@ const branchStatusWire = z.object({
|
|
|
28754
28788
|
targetUrl: z.string().nullish()
|
|
28755
28789
|
});
|
|
28756
28790
|
const branchContextWire = z.discriminatedUnion("__typename", [branchCheckRunWire, branchStatusWire]);
|
|
28757
|
-
const
|
|
28791
|
+
const branchCommitWire = z.object({
|
|
28792
|
+
oid: z.string(),
|
|
28793
|
+
checkSuites: z.unknown().optional(),
|
|
28794
|
+
statusCheckRollup: z.object({ contexts: z.object({
|
|
28795
|
+
nodes: z.array(branchContextWire),
|
|
28796
|
+
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28797
|
+
}) }).nullable()
|
|
28798
|
+
});
|
|
28799
|
+
const branchSuitesWire = z.object({
|
|
28800
|
+
nodes: z.array(z.object({ workflowRun: z.object({ event: z.string() }).nullable() })),
|
|
28801
|
+
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28802
|
+
});
|
|
28803
|
+
const branchParentsWire = z.object({ parents: z.object({ nodes: z.tuple([z.unknown()]) }) });
|
|
28804
|
+
const parentRefWire = z.object({ target: z.looseObject({ oid: z.string() }) });
|
|
28805
|
+
const defaultBranchWire$1 = z.looseObject({ defaultBranchRef: z.object({
|
|
28758
28806
|
name: z.string(),
|
|
28759
|
-
target: z.
|
|
28760
|
-
__typename: z.literal("Commit"),
|
|
28761
|
-
oid: z.string(),
|
|
28762
|
-
statusCheckRollup: z.object({ contexts: z.object({
|
|
28763
|
-
nodes: z.array(branchContextWire),
|
|
28764
|
-
pageInfo: z.object({ hasNextPage: z.boolean() })
|
|
28765
|
-
}) })
|
|
28766
|
-
})
|
|
28807
|
+
target: branchCommitWire.extend({ __typename: z.literal("Commit") })
|
|
28767
28808
|
}) });
|
|
28768
28809
|
function counted$1(node) {
|
|
28769
28810
|
return node.__typename === "StatusContext" || node.checkSuite?.workflowRun?.event === "push";
|
|
@@ -28774,19 +28815,45 @@ const PASSED = /* @__PURE__ */ new Set([
|
|
|
28774
28815
|
"skipped"
|
|
28775
28816
|
]);
|
|
28776
28817
|
const RUNNING = /* @__PURE__ */ new Set(["pending", "expected"]);
|
|
28818
|
+
function branchScoped(error) {
|
|
28819
|
+
return error.path?.[0] === "repository" && DEFAULT_BRANCH_READS.some((alias) => error.path?.[1] === alias);
|
|
28820
|
+
}
|
|
28821
|
+
function readBranchParent(reference, tip, depth) {
|
|
28822
|
+
const parsed = parentRefWire.safeParse(reference);
|
|
28823
|
+
if (!parsed.success || parsed.data.target.oid !== tip) return void 0;
|
|
28824
|
+
let commit = parsed.data.target;
|
|
28825
|
+
for (let hop = 0; hop < depth; hop += 1) commit = branchParentsWire.safeParse(commit).data?.parents.nodes[0];
|
|
28826
|
+
return commit;
|
|
28827
|
+
}
|
|
28828
|
+
function hasNoPushSuite(wire) {
|
|
28829
|
+
const suites = branchSuitesWire.safeParse(wire).data;
|
|
28830
|
+
return suites !== void 0 && !suites.pageInfo.hasNextPage && suites.nodes.every((suite) => suite.workflowRun?.event !== "push");
|
|
28831
|
+
}
|
|
28777
28832
|
/**
|
|
28778
|
-
* The colour of the
|
|
28779
|
-
*
|
|
28780
|
-
*
|
|
28781
|
-
* the latest run of each check decides (see `latestContexts`). A run URL that is not http(s)
|
|
28782
|
-
* becomes null.
|
|
28833
|
+
* The colour of the newest checked commit in the default branch's first-parent window. Walk
|
|
28834
|
+
* past a commit only when it has no counted checks or push suites. A push suite can precede
|
|
28835
|
+
* its first check run. Without a visible failure, an unsettled commit leaves the colour unknown.
|
|
28783
28836
|
*/
|
|
28784
|
-
function defaultBranchFact(repository) {
|
|
28837
|
+
function defaultBranchFact(repository, errors) {
|
|
28785
28838
|
const parsed = defaultBranchWire$1.safeParse(repository);
|
|
28786
28839
|
if (!parsed.success) return void 0;
|
|
28787
28840
|
const { name: branch, target } = parsed.data.defaultBranchRef;
|
|
28788
|
-
const
|
|
28789
|
-
|
|
28841
|
+
for (const [depth, alias] of DEFAULT_BRANCH_READS.entries()) {
|
|
28842
|
+
const readErrors = errors.filter((error) => error.path?.[1] === alias);
|
|
28843
|
+
if (readErrors.some((error) => !error.path?.includes("checkSuites"))) return void 0;
|
|
28844
|
+
const commit = depth === 0 ? target : readBranchParent(parsed.data[alias], target.oid, depth);
|
|
28845
|
+
const result = branchCommitWire.safeParse(commit);
|
|
28846
|
+
if (!result.success) return void 0;
|
|
28847
|
+
const { oid, statusCheckRollup, checkSuites } = result.data;
|
|
28848
|
+
const contexts = statusCheckRollup?.contexts;
|
|
28849
|
+
const kept = contexts?.nodes.filter(counted$1) ?? [];
|
|
28850
|
+
const truncated = contexts?.pageInfo.hasNextPage ?? false;
|
|
28851
|
+
if (kept.length > 0 || truncated) return branchColour(branch, oid, kept, truncated);
|
|
28852
|
+
if (readErrors.length > 0 || !hasNoPushSuite(checkSuites)) return void 0;
|
|
28853
|
+
}
|
|
28854
|
+
}
|
|
28855
|
+
function branchColour(branch, sha, nodes, truncated) {
|
|
28856
|
+
const kept = latestContexts(nodes).map((node) => ({
|
|
28790
28857
|
check: contextName(node),
|
|
28791
28858
|
node,
|
|
28792
28859
|
state: checkState(node)
|
|
@@ -28798,7 +28865,7 @@ function defaultBranchFact(repository) {
|
|
|
28798
28865
|
const red = {
|
|
28799
28866
|
state: "red",
|
|
28800
28867
|
branch,
|
|
28801
|
-
sha
|
|
28868
|
+
sha,
|
|
28802
28869
|
check,
|
|
28803
28870
|
url
|
|
28804
28871
|
};
|
|
@@ -28809,11 +28876,11 @@ function defaultBranchFact(repository) {
|
|
|
28809
28876
|
url: null
|
|
28810
28877
|
}).data;
|
|
28811
28878
|
}
|
|
28812
|
-
if (
|
|
28879
|
+
if (truncated || kept.some(({ state }) => !PASSED.has(state))) return void 0;
|
|
28813
28880
|
return defaultBranchFactSchema.safeParse({
|
|
28814
28881
|
state: "green",
|
|
28815
28882
|
branch,
|
|
28816
|
-
sha
|
|
28883
|
+
sha
|
|
28817
28884
|
}).data;
|
|
28818
28885
|
}
|
|
28819
28886
|
// ../adapters/src/github/branchRule.ts
|
|
@@ -29823,7 +29890,6 @@ function chunks(numbers, size) {
|
|
|
29823
29890
|
return out;
|
|
29824
29891
|
}
|
|
29825
29892
|
const aliasesOf = (numbers) => numbers.map((_, i) => `pr${String(i)}`);
|
|
29826
|
-
const branchScoped = (error) => error.path?.[1] === "defaultBranchRef";
|
|
29827
29893
|
/**
|
|
29828
29894
|
* Lists the repository's PRs since the cursor; a transient failure leaves `ok` false. The first
|
|
29829
29895
|
* response also gives the default-branch colour, whatever the PR listing's outcome.
|
|
@@ -29839,7 +29905,7 @@ async function readDiscovery(scope, acc, ctx, login) {
|
|
|
29839
29905
|
};
|
|
29840
29906
|
acc.budget = response.budget;
|
|
29841
29907
|
const errors = response.errors.filter((error) => !branchScoped(error));
|
|
29842
|
-
const defaultBranch =
|
|
29908
|
+
const defaultBranch = defaultBranchFact(response.data.repository, response.errors.filter(branchScoped));
|
|
29843
29909
|
rejectUnscoped(errors, ["repository"]);
|
|
29844
29910
|
let ok = scoped(errors, "repository").length === 0;
|
|
29845
29911
|
const first = ok ? parseWire(discoveryRootWire, response.data.repository, MALFORMED$3, ["data", "repository"]).pullRequests : void 0;
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as renderMcpError, g as OPERATIONS, mt as ERRORS } from "./chunk-
|
|
2
|
-
import { o as CliError, r as requestOperation } from "./chunk-
|
|
3
|
-
import { a as memoryVerdictCache, l as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-
|
|
1
|
+
import { S as renderMcpError, g as OPERATIONS, mt as ERRORS } from "./chunk-DQnJirZ1.mjs";
|
|
2
|
+
import { o as CliError, r as requestOperation } from "./chunk-Bx3YMBLb.mjs";
|
|
3
|
+
import { a as memoryVerdictCache, l as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BuHn-rfD.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE source_miss ADD COLUMN confirmed_missing_at TEXT;
|