spur-board 0.169.0 → 0.170.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.
@@ -1,4 +1,4 @@
1
- import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-_tWJWhul.mjs";
1
+ import { d as tokenRequestStatusSchema, gt as errorEnvelopeSchema, ht as errorContextSchema, l as tokenRequestResultSchema, pt as ERRORS, vt as successEnvelopeSchema, x as renderJsonError } from "./chunk-Chj2wumn.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { request } from "node:http";
@@ -1406,7 +1406,7 @@ const ERRORS = {
1406
1406
  status: 409,
1407
1407
  exit: EXIT_CODES.refused,
1408
1408
  message: "The submission basis fields are inconsistent.",
1409
- hint: "Use from and a nonblank reason for carried, a nonblank reason for skipped, and from only with carried.",
1409
+ hint: "Use from and a nonblank reason for carried, a nonblank reason for skipped, and from only with carried; a submit without sha takes only a nonblank reason, no basis or from.",
1410
1410
  recovery: noRetry("Correct the basis fields and submit again.")
1411
1411
  }),
1412
1412
  submit_source_not_tested: spec("submit_source_not_tested", {
@@ -1416,6 +1416,13 @@ const ERRORS = {
1416
1416
  hint: "Choose a tested submission SHA on this task, or a carried SHA with a tested origin; otherwise test or explicitly skip with a reason.",
1417
1417
  recovery: noRetry("Choose a source with a tested origin on this task or change the basis.")
1418
1418
  }),
1419
+ submit_sha_required: spec("submit_sha_required", {
1420
+ status: 409,
1421
+ exit: EXIT_CODES.refused,
1422
+ message: "The submit needs a commit SHA.",
1423
+ hint: "Submit the pull request head; only a turn outside Dev on a task with no linked pull request closes without a commit.",
1424
+ recovery: noRetry("Submit the pull request head.")
1425
+ }),
1419
1426
  head_mismatch: spec("head_mismatch", {
1420
1427
  status: 409,
1421
1428
  exit: EXIT_CODES.refused,
@@ -2525,7 +2532,8 @@ const eventPayloadSchemas = {
2525
2532
  reason: S.optional(),
2526
2533
  turn: S.optional(),
2527
2534
  column: z.enum(COLUMN_IDS),
2528
- sha: S,
2535
+ /** Absent for a submit without a commit: a turn outside Dev on a task with no linked PR. */
2536
+ sha: S.optional(),
2529
2537
  /** The head was confirmed by the board's newest poll; GitHub did not answer the submit. */
2530
2538
  confirmedByPoll: z.literal(true).optional(),
2531
2539
  /** The board accepted the submit before it could confirm the head; it confirms it on a later poll. */
@@ -3234,6 +3242,12 @@ const taskWhySchema = z.strictObject({
3234
3242
  until: z.iso.datetime().describe("When the board stops waiting for a PR, ISO 8601 UTC; a linked PR is waited for until a poll observes it."),
3235
3243
  text: z.string().describe("The hold in words: submit pending confirmation of <sha7>.")
3236
3244
  }).optional().describe("The turn submit the board accepted pending; absent when no submit waits."),
3245
+ submittedWithoutCommit: z.strictObject({
3246
+ turn: turnIdSchema.describe("The closed turn."),
3247
+ at: z.iso.datetime().describe("When the turn closed, ISO 8601 UTC."),
3248
+ reason: z.string().describe("The reason the submit gave."),
3249
+ text: z.string().describe("The close in words: submitted without a commit: <reason>.")
3250
+ }).optional().describe("The current visit's turn closed by a submit without a commit; absent otherwise."),
3237
3251
  gates: z.array(z.strictObject({
3238
3252
  column: z.enum(COLUMN_IDS).describe("Board column."),
3239
3253
  enabled: z.boolean().describe("Whether the column is enabled in the project."),
@@ -3493,16 +3507,16 @@ const inboxAckOutputSchema = z.strictObject({
3493
3507
  });
3494
3508
  const taskSubmitInputSchema = z.strictObject({
3495
3509
  turn: z.union([turnIdSchema, taskKeyInputSchema]).describe("Turn ID you took (T4); while the project dispatcher is in shadow mode, the task key instead."),
3496
- sha: commitShaSchema.max(64).describe("Full commit SHA at the head of the pull request, lowercase."),
3497
- basis: z.enum(SUBMISSION_BASES).optional().describe("Testing provenance: tested (default), carried from a tested origin on this task, or skipped with a reason."),
3498
- from: commitShaSchema.max(64).optional().describe("Full lowercase source SHA on this task; required only for carried."),
3499
- reason: z.string().max(2e3).optional().describe("Literal nonblank explanation, up to 2000 UTF-16 units; required for carried and skipped.")
3510
+ sha: commitShaSchema.max(64).optional().describe("Full commit SHA at the head of the pull request, lowercase. Omit it only outside Dev on a task with no linked pull request, and give reason."),
3511
+ basis: z.enum(SUBMISSION_BASES).optional().describe("Testing provenance: tested (default), carried from a tested origin on this task, or skipped with a reason. Omit it for a submit without sha."),
3512
+ from: commitShaSchema.max(64).optional().describe("Full lowercase source SHA on this task; required only for carried. Omit it for a submit without sha."),
3513
+ reason: z.string().max(2e3).optional().describe("Literal nonblank explanation, up to 2000 UTF-16 units; required for carried and skipped, and for a submit without sha.")
3500
3514
  });
3501
3515
  const taskSubmitOutputSchema = z.strictObject({
3502
3516
  task: taskViewSchema,
3503
3517
  turn: turnIdSchema.nullable().describe("The closed turn; null for a submit by task key in shadow mode."),
3504
- sha: commitShaSchema.describe("The submitted commit SHA."),
3505
- status: z.enum(["confirmed", "pending"]).default("confirmed").describe("confirmed: the board saw the PR head at sha. pending: accepted, pending confirmation - the board confirms the head on its next polls and hands the turn back with the reason if it cannot; do not resubmit or raise a block.")
3518
+ sha: commitShaSchema.nullable().describe("The submitted commit SHA; null for a submit without a commit."),
3519
+ status: z.enum(["confirmed", "pending"]).default("confirmed").describe("confirmed: the board saw the PR head at sha, or the turn closed without a commit. pending: accepted, pending confirmation - the board confirms the head on its next polls and hands the turn back with the reason if it cannot; do not resubmit or raise a block.")
3506
3520
  });
3507
3521
  const taskReturnInputSchema = z.strictObject({
3508
3522
  turn: turnIdSchema,
@@ -5479,7 +5493,7 @@ const OPERATIONS = [
5479
5493
  kind: "mutation",
5480
5494
  description: "Submit the task's pull request head for a turn the caller took; the turn closes; a pending result is final.",
5481
5495
  mcp: {
5482
- whenToUse: "Hand in the work of a turn you took, at the pull request head. Declare tested (default), carried from a tested origin on this task, or skipped; carried requires from and reason, skipped requires reason. While the project dispatcher is in shadow mode no turn opens: the column executor submits with the task key.",
5496
+ whenToUse: "Hand in the work of a turn you took, at the pull request head. Declare tested (default), carried from a tested origin on this task, or skipped; carried requires from and reason, skipped requires reason. While the project dispatcher is in shadow mode no turn opens: the column executor submits with the task key. Outside Dev, on a task with no linked pull request, omit sha, basis and from, and give a nonblank reason to close the turn without a commit.",
5483
5497
  whenNotToUse: "Use task_return to send the task back to Dev instead."
5484
5498
  },
5485
5499
  input: taskSubmitInputSchema,
@@ -5496,6 +5510,7 @@ const OPERATIONS = [
5496
5510
  "task_archived",
5497
5511
  "turn_closed",
5498
5512
  "not_turn_taker",
5513
+ "submit_sha_required",
5499
5514
  "submit_basis_invalid",
5500
5515
  "submit_source_not_tested",
5501
5516
  "head_mismatch",
@@ -5570,6 +5585,22 @@ const OPERATIONS = [
5570
5585
  sha: submittedSha,
5571
5586
  status: "confirmed"
5572
5587
  }
5588
+ },
5589
+ {
5590
+ summary: "Close a Done wrap-up on a task with no pull request",
5591
+ input: {
5592
+ turn: "T5",
5593
+ reason: "Findings are in the ticket; no code change."
5594
+ },
5595
+ output: {
5596
+ task: {
5597
+ ...task,
5598
+ column: "done"
5599
+ },
5600
+ turn: "T5",
5601
+ sha: null,
5602
+ status: "confirmed"
5603
+ }
5573
5604
  }
5574
5605
  ]
5575
5606
  }),
@@ -1,5 +1,5 @@
1
- import { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-_tWJWhul.mjs";
2
- import { o as CliError, t as fetchCatalogVersion } from "./chunk-Bp_JzHSF.mjs";
1
+ import { Mt as plainHttpAllowed, g as OPERATIONS, kt as configSchema, m as buildCatalogSnapshot } from "./chunk-Chj2wumn.mjs";
2
+ import { o as CliError, t as fetchCatalogVersion } from "./chunk-BLaWsiXP.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";
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-_tWJWhul.mjs";
1
+ import { Ct as DEFAULT_STAND_PORT_RANGE, Ft as resolveWebOrigin, It as slackConfigured, Pt as requiredSecretKeys, Ut as SLACK_BOT_SCOPES, c as requestHashOf, ct as actorIdSchema, g as OPERATIONS, h as roleCanUseOperation, j as sortSkillFiles, k as skillReloadFileSchema, kt as configSchema, n as SLACK_OFF_FIX, o as remoteDoctorReportSchema, p as SYSTEMD_SERVICE_SETTINGS, pt as ERRORS, r as SLACK_PARTLY_FIX, vt as successEnvelopeSchema } from "./chunk-Chj2wumn.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-Bp_JzHSF.mjs";
4
- import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-BzKjwY-N.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-BLaWsiXP.mjs";
4
+ import { a as memoryVerdictCache, c as loadClientConfig, d as resolveDaemonAddress, f as tokenInFolder, i as fileVerdictCache, l as loadEnrollmentConfig, n as cliPackageVersion, o as configFile, s as dataDirectory, t as checkCatalog, u as readConfiguredPort } from "./chunk-DI3BTuEX.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";
@@ -2439,7 +2439,8 @@ function registerOptions(command, op) {
2439
2439
  for (const arg of op.cli.args) {
2440
2440
  const schema = fieldSchema(op, arg);
2441
2441
  if (!schema) throw new Error(`Catalog argument ${arg} is missing from ${op.id}.`);
2442
- command.argument(bareSchema(schema) instanceof z.ZodArray ? `<${arg}...>` : `<${arg}>`);
2442
+ if (bareSchema(schema) instanceof z.ZodArray) command.argument(`<${arg}...>`);
2443
+ else command.argument(schema instanceof z.ZodOptional ? `[${arg}]` : `<${arg}>`);
2443
2444
  }
2444
2445
  const modeValues = new Set(op.cli.modes?.flatMap((mode) => mode.value ? [mode.value] : []));
2445
2446
  const fields = /* @__PURE__ */ new Map();
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-Bp_JzHSF.mjs";
1
+ export { t as fetchCatalogVersion, n as fetchTokenStatus, r as requestOperation, i as requestSkillReload, a as requestTokenEnrollment } from "./chunk-BLaWsiXP.mjs";
package/dist/daemon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-_tWJWhul.mjs";
1
+ import { $ as prApprovalPairSchema, A as skillReloadFilesSchema, At as defaultAddressee, B as entityRefSchema, Bt as COLUMN_IDS, C as SPACE_IDS, D as messageRefSchema, Dt as columnTurnTimings, E as interactionRefSchema, Et as boardWideSpurProject, F as AdapterError, Ft as resolveWebOrigin, G as trackerSourceId, Gt as TODO_GROUP_COLUMN_IDS, H as prSourceId, Ht as ITEM_KINDS, I as MIRROR_FAILURES, It as slackConfigured, J as REVIEW_STATES, K as PR_STATES, Kt as VIAS, L as MIRROR_FAILURE_CODES, Lt as BLOCK_TYPES, M as EVENT_KINDS, Mt as plainHttpAllowed, N as GATE_REASONS, Nt as readyMirrorOf, O as userIdSchema, Ot as configBindings, P as eventPayloadSchemas, Pt as requiredSecretKeys, Q as parseRingMarker, R as batchSchema, Rt as COLUMNS, St as DEFAULT_SLACK_COMMAND, T as inboundEventSchema, Tt as approvalRuleOf, U as sessionTransitionSchema, Ut as SLACK_BOT_SCOPES, V as mirrorSourceId, Vt as DISPATCHER_MODES, W as sourceCursorSchema, Wt as TASK_HOLDS, X as SESSION_STATUSES, Y as SESSION_HEALTH_STATES, Z as isExternalAuthor, _ as defaultBranchViewSchema, _t as ok, a as doctorReportSchema, at as ticketFactsSchema, b as renderHttpProblem, bt as DEFAULT_LINK, c as requestHashOf, ct as actorIdSchema, d as tokenRequestStatusSchema, dt as parseActorId, et as prFactsSchema, f as BOARD_TICK_MS, ft as parseRef$1, g as OPERATIONS, h as roleCanUseOperation, i as SPUR_MIN_VERSION, it as sessionFactsSchema, j as sortSkillFiles, jt as externalQuietAfterMs, kt as configSchema, l as tokenRequestResultSchema, lt as encodeActorId, m as buildCatalogSnapshot, mt as err, n as SLACK_OFF_FIX, nt as prReviewRuleSchema, ot as JIRA_PROJECT_KEY, pt as ERRORS, q as REVIEW_DECISIONS, qt as isTodoGroupColumn, r as SLACK_PARTLY_FIX, rt as ringMarker, s as TOKEN_REQUEST_LIMITS, st as REF_NUMBER, t as assertNever, tt as prRefSchema, u as tokenRequestSchema, ut as errorCodeOf, v as inboxNoSessionSchema, vt as successEnvelopeSchema, w as conversationRefSchema, wt as RESERVED_PROJECT, y as turnHandedSchema, z as defaultBranchFactSchema, zt as COLUMN_GROUPS } from "./chunk-Chj2wumn.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";
@@ -22043,6 +22043,29 @@ function createItemMutations(deps) {
22043
22043
  // ../core/src/app/submissions.ts
22044
22044
  /** How long a submit waits for its on-demand PR read. */
22045
22045
  const SUBMIT_POLL_TIMEOUT_MS = 1e4;
22046
+ /** Ends a hint for a refusal that a later submit cannot fix. */
22047
+ const noRepeat = (step) => `repeating will not help; ask the operator to ${step}.`;
22048
+ /** The next step for an on-demand poll that answered nothing. */
22049
+ function pollErrorHint(error, pr) {
22050
+ switch (error.kind) {
22051
+ case "timeout": return `GitHub did not answer for ${pr} within ${String(SUBMIT_POLL_TIMEOUT_MS / 1e3)} s; wait a minute, then submit again.`;
22052
+ case "blind": return error.reason === "stale" ? `The board has no recent complete GitHub poll for ${pr}; submit again in a few minutes, once GitHub answers its polls.` : `The board cannot read ${pr} (${error.reason}); ${noRepeat("fix the GitHub access")}`;
22053
+ case "failed":
22054
+ if (error.adapterKind === "auth" || error.adapterKind === "config") return `The board cannot read ${pr} (${error.adapterKind}); ${noRepeat("fix the GitHub access")}`;
22055
+ return error.retryAt === void 0 ? `The GitHub poll of ${pr} failed (${error.adapterKind}); wait a minute, then submit again.` : `GitHub is throttled until ${error.retryAt}; submit again after that.`;
22056
+ case "stopped": return "The GitHub poller is not running; submit again once the daemon is up.";
22057
+ case "unknown_source": return `The repo of ${pr} is not in the project's repos; ${noRepeat("add it to the config")}`;
22058
+ case "unsupported": return `This daemon cannot poll a pull request on demand; ${noRepeat("update the daemon")}`;
22059
+ }
22060
+ }
22061
+ /** True when GitHub gave no answer this call and the last poll may stand in for it. */
22062
+ function pollMayConfirm(error) {
22063
+ return error.kind === "timeout" || error.kind === "failed" && (error.adapterKind === "transient" || error.adapterKind === "unexpected" || error.adapterKind === "throttled");
22064
+ }
22065
+ /** A failed poll that waiting can fix, beyond `pollMayConfirm`: a stale source, a stopped poller. */
22066
+ function submitAgain(error) {
22067
+ return error.kind === "blind" && error.reason === "stale" || error.kind === "stopped";
22068
+ }
22046
22069
  /** Polls the task's PR on demand for a submit; `skipped` when the task has none. */
22047
22070
  async function pollTaskPr(db, task, poll) {
22048
22071
  const pr = await taskPr(db, task.id);
@@ -22671,10 +22694,10 @@ const FIELDS = {
22671
22694
  };
22672
22695
  const checksSchema = z.tuple([prFactsSchema.shape.checks, prFactsSchema.shape.requiredChecks]);
22673
22696
  function payloadOf(kind, payloadText) {
22674
- const payload = eventPayloadSchemas[kind].safeParse(parsedJson(payloadText));
22697
+ const payload = eventPayloadSchemas[kind].safeParse(parsedJson$1(payloadText));
22675
22698
  return payload.success ? payload.data : null;
22676
22699
  }
22677
- function parsedJson(text) {
22700
+ function parsedJson$1(text) {
22678
22701
  try {
22679
22702
  return JSON.parse(text);
22680
22703
  } catch {
@@ -22791,7 +22814,7 @@ function factsSummary(entity, previous) {
22791
22814
  * the counted cancels whose run this poll confirmed, then the ones still waiting.
22792
22815
  */
22793
22816
  function checksSummary(payload) {
22794
- const lists = checksSchema.safeParse(parsedJson(payload.to));
22817
+ const lists = checksSchema.safeParse(parsedJson$1(payload.to));
22795
22818
  if (!lists.success) return null;
22796
22819
  const [checks, requiredChecks] = lists.data;
22797
22820
  const list = countedChecks({
@@ -22843,6 +22866,7 @@ const SUMMARIES = {
22843
22866
  link_added: (p) => linkSummary("Link added", p),
22844
22867
  link_removed: (p) => linkSummary("Link removed", p),
22845
22868
  task_submitted: (p) => {
22869
+ if (p.sha === void 0) return `Turn submitted without a commit: ${p.reason ?? ""}`;
22846
22870
  if (p.supersededByMerge !== void 0) return `Submit of ${p.sha.slice(0, 7)} superseded: PR merged at ${p.supersededByMerge.slice(0, 7)}`;
22847
22871
  return `Turn submitted${p.pending === true ? ", pending confirmation" : p.confirmedByPoll === true ? " on the head of the last poll" : ""}: ${p.sha}, basis ${p.basis ?? "tested"}${optional(", from ", p.from)}${optional(", tested origin ", p.testedOrigin)}${optional(" — ", p.reason)}`;
22848
22872
  }
@@ -22897,6 +22921,83 @@ function historyEvents(rows) {
22897
22921
  }];
22898
22922
  }).sort((left, right) => left.time - right.time || left.id - right.id).map(({ event }) => event);
22899
22923
  }
22924
+ // ../core/src/app/submit-without-commit.ts
22925
+ /**
22926
+ * The PR that keeps a submit without a commit out: the task's active link (any state), else its
22927
+ * merged one, else an unbanned open conflict link past the reopen floor. A closed conflict link
22928
+ * alone does not count. `head` is the PR's stored head, null before the board saw it.
22929
+ */
22930
+ async function linkedPrForSubmit(trx, taskId) {
22931
+ let pr = await taskPr(trx, taskId) ?? await taskMergedPr(trx, taskId);
22932
+ if (pr === null) {
22933
+ const conflict = await trx.selectFrom("link").select(["link.repo", "link.number"]).where("link.task_id", "=", taskId).where("link.entity", "=", "pr").where("link.pr_state", "=", "conflict").where("link.banned", "=", 0).where("link.pr_open", "=", 1).where(pastReopenFloor).orderBy("link.id", "desc").executeTakeFirst();
22934
+ if (conflict?.repo != null && conflict.number !== null) pr = {
22935
+ repo: conflict.repo,
22936
+ number: conflict.number
22937
+ };
22938
+ }
22939
+ if (pr === null) return null;
22940
+ const snapshot = await trx.selectFrom("pr_snapshot").select("head_sha").where(sql`lower(repo) = ${pr.repo.toLowerCase()}`).where("number", "=", pr.number).executeTakeFirst();
22941
+ return {
22942
+ ...pr,
22943
+ head: snapshot?.head_sha ?? null
22944
+ };
22945
+ }
22946
+ /**
22947
+ * Closes the taken turn by a submit without a commit and journals it, after the refusals in
22948
+ * order: a linked PR, a Dev turn (both `submit_sha_required`), then a missing or blank reason or
22949
+ * a basis or from (`submit_basis_invalid`). The caller dispatches the task after.
22950
+ */
22951
+ async function closeWithoutCommit(trx, input, { turn, task }, ctx, closer) {
22952
+ const pr = await linkedPrForSubmit(trx, task.id);
22953
+ if (pr !== null) throw new CommandError("submit_sha_required", `The task has pull request ${pr.repo}#${String(pr.number)} at head ${pr.head ?? "unknown"}; submit that head with \`board submit ${input.turn} <sha>\`.`);
22954
+ if (turn.column === "dev") throw new CommandError("submit_sha_required", `Dev needs a pull request: open one, then submit its head with \`board submit ${input.turn} <sha>\`; a task without code ends when its ticket is done and no worker is live.`);
22955
+ const { reason } = input;
22956
+ if (input.basis !== void 0 || input.from !== void 0 || reason === void 0 || reason.trim().length === 0) throw new CommandError("submit_basis_invalid", "A submit without a commit takes a nonblank reason and no basis or from.");
22957
+ await closeTurns(trx, {
22958
+ taskId: task.id,
22959
+ reason: "submitted",
22960
+ at: new Date(ctx.at),
22961
+ actor: closer
22962
+ });
22963
+ await emit(trx, "task_submitted", task.project, task.id, ctx.at, {
22964
+ turn: input.turn,
22965
+ column: turn.column,
22966
+ reason
22967
+ }, ctx.actor);
22968
+ }
22969
+ /**
22970
+ * The current visit's newest closed turn when a submit without a commit closed it: its
22971
+ * `task_submitted` carries a reason and no sha. Undefined once the task left the visit.
22972
+ */
22973
+ async function submittedWithoutCommit(trx, task) {
22974
+ const turn = await trx.selectFrom("turn").select([
22975
+ "id",
22976
+ "closed_at",
22977
+ "closed_reason"
22978
+ ]).where("task_id", "=", task.id).where("column", "=", task.column).where("epoch", "=", task.column_epoch).where("closed_at", "is not", null).orderBy("id", "desc").executeTakeFirst();
22979
+ if (turn?.closed_reason !== "submitted" || turn.closed_at === null) return void 0;
22980
+ const id = `T${String(turn.id)}`;
22981
+ const event = await trx.selectFrom("event").select("payload").where("task_id", "=", task.id).where("kind", "=", "task_submitted").where(sql`case when json_valid(payload) then json_extract(payload, '$.turn') end = ${id}`).orderBy("id", "desc").executeTakeFirst();
22982
+ if (event === void 0) return void 0;
22983
+ const payload = eventPayloadSchemas.task_submitted.safeParse(parsedJson(event.payload));
22984
+ if (!payload.success || payload.data.sha !== void 0) return void 0;
22985
+ const reason = payload.data.reason ?? "";
22986
+ return {
22987
+ turn: id,
22988
+ at: turn.closed_at,
22989
+ reason,
22990
+ text: `submitted without a commit: ${reason}`
22991
+ };
22992
+ }
22993
+ /** The payload as JSON, or undefined when it is not JSON, which no payload schema accepts. */
22994
+ function parsedJson(text) {
22995
+ try {
22996
+ return JSON.parse(text);
22997
+ } catch {
22998
+ return;
22999
+ }
23000
+ }
22900
23001
  // ../core/src/app/task-sessions.ts
22901
23002
  /** Current facts of the effective session links that task.get exposes. */
22902
23003
  async function taskSessions(trx, taskId) {
@@ -23048,10 +23149,12 @@ function createTaskQueries(deps) {
23048
23149
  const column = task.shadow_column ?? task.column;
23049
23150
  const open = await trx.selectFrom("turn").selectAll().where("task_id", "=", task.id).where("closed_at", "is", null).orderBy("id", "desc").executeTakeFirst();
23050
23151
  const project = config.projects.find((entry) => entry.id === task.project);
23152
+ const withoutCommit = await submittedWithoutCommit(trx, task);
23051
23153
  const shared = {
23052
23154
  column,
23053
23155
  turn: open === void 0 ? null : await turnView(trx, open, task, project),
23054
- moves: await moveViews(trx, task.id, { limit: WHY_MOVES })
23156
+ moves: await moveViews(trx, task.id, { limit: WHY_MOVES }),
23157
+ ...withoutCommit === void 0 ? {} : { submittedWithoutCommit: withoutCommit }
23055
23158
  };
23056
23159
  if (project === void 0) return {
23057
23160
  ...shared,
@@ -24269,29 +24372,6 @@ async function takenTurn(trx, id, ctx) {
24269
24372
  task
24270
24373
  };
24271
24374
  }
24272
- /** Ends a hint for a refusal that a later submit cannot fix. */
24273
- const noRepeat = (step) => `repeating will not help; ask the operator to ${step}.`;
24274
- /** The next step for an on-demand poll that answered nothing. */
24275
- function pollErrorHint(error, pr) {
24276
- switch (error.kind) {
24277
- case "timeout": return `GitHub did not answer for ${pr} within ${String(SUBMIT_POLL_TIMEOUT_MS / 1e3)} s; wait a minute, then submit again.`;
24278
- case "blind": return error.reason === "stale" ? `The board has no recent complete GitHub poll for ${pr}; submit again in a few minutes, once GitHub answers its polls.` : `The board cannot read ${pr} (${error.reason}); ${noRepeat("fix the GitHub access")}`;
24279
- case "failed":
24280
- if (error.adapterKind === "auth" || error.adapterKind === "config") return `The board cannot read ${pr} (${error.adapterKind}); ${noRepeat("fix the GitHub access")}`;
24281
- return error.retryAt === void 0 ? `The GitHub poll of ${pr} failed (${error.adapterKind}); wait a minute, then submit again.` : `GitHub is throttled until ${error.retryAt}; submit again after that.`;
24282
- case "stopped": return "The GitHub poller is not running; submit again once the daemon is up.";
24283
- case "unknown_source": return `The repo of ${pr} is not in the project's repos; ${noRepeat("add it to the config")}`;
24284
- case "unsupported": return `This daemon cannot poll a pull request on demand; ${noRepeat("update the daemon")}`;
24285
- }
24286
- }
24287
- /** True when GitHub gave no answer this call and the last poll may stand in for it. */
24288
- function pollMayConfirm(error) {
24289
- return error.kind === "timeout" || error.kind === "failed" && (error.adapterKind === "transient" || error.adapterKind === "unexpected" || error.adapterKind === "throttled");
24290
- }
24291
- /** A failed poll that waiting can fix, beyond `pollMayConfirm`: a stale source, a stopped poller. */
24292
- function submitAgain(error) {
24293
- return error.kind === "blind" && error.reason === "stale" || error.kind === "stopped";
24294
- }
24295
24375
  /**
24296
24376
  * How the PR head behind a submit is confirmed: `live` by this call's poll, `poll` by the
24297
24377
  * board's newest poll when GitHub did not answer. Throws `head_mismatch` when the confirmed head
@@ -24396,8 +24476,10 @@ function createTurnMutations(deps) {
24396
24476
  if (task.membership === "archived") throw new CommandError("task_archived", "Add the task again before changing it.");
24397
24477
  const column = shadowColumn(task);
24398
24478
  if (!await executesShadowColumn(trx, task, ctx.actor, config)) throw new CommandError("forbidden", `Only the executor of ${column} submits this task while the dispatcher is in shadow mode.`);
24479
+ if (input.sha === void 0) throw new CommandError("submit_sha_required", `A submit by task key needs the pull request head: \`board submit ${input.turn} <sha>\`.`);
24399
24480
  const { confirmed, event } = await insertSubmission(trx, {
24400
24481
  ...input,
24482
+ sha: input.sha,
24401
24483
  task,
24402
24484
  column,
24403
24485
  epoch: task.column_epoch
@@ -24420,6 +24502,7 @@ function createTurnMutations(deps) {
24420
24502
  id: "task.submit",
24421
24503
  resolveTargets: (trx, input) => isTurnId(input.turn) ? turnVisitTarget(trx, input.turn) : shadowTarget(trx, input.turn, config),
24422
24504
  async prepare(db, input, actor) {
24505
+ if (input.sha === void 0) return { kind: "skipped" };
24423
24506
  if (!isTurnId(input.turn)) {
24424
24507
  const task = await shadowTask(db, input.turn, config);
24425
24508
  if (task === void 0 || task.membership === "archived" || !await executesShadowColumn(db, task, actor, config)) return { kind: "skipped" };
@@ -24434,13 +24517,27 @@ function createTurnMutations(deps) {
24434
24517
  async run(trx, input, ctx) {
24435
24518
  if (!isTurnId(input.turn)) return submitShadow(trx, input, ctx);
24436
24519
  const { turn, task } = await takenTurn(trx, input.turn, ctx);
24520
+ const { sha } = input;
24521
+ if (sha === void 0) {
24522
+ await closeWithoutCommit(trx, input, {
24523
+ turn,
24524
+ task
24525
+ }, ctx, operatorCloser(task, ctx.actor));
24526
+ return {
24527
+ task: taskView(await dispatched(trx, task.id, ctx.at, ctx.actor)),
24528
+ turn: input.turn,
24529
+ sha: null,
24530
+ status: "confirmed"
24531
+ };
24532
+ }
24437
24533
  const { confirmed, event } = await insertSubmission(trx, {
24438
24534
  ...input,
24535
+ sha,
24439
24536
  task,
24440
24537
  column: turn.column,
24441
24538
  epoch: turn.epoch
24442
24539
  }, ctx, completeSince, config.projects.find((entry) => entry.id === task.project)?.dispatcher.submitConfirmMs);
24443
- if (confirmed !== "pending") await answerReturn(trx, task, turn, ctx, input.sha);
24540
+ if (confirmed !== "pending") await answerReturn(trx, task, turn, ctx, sha);
24444
24541
  await closeTurns(trx, {
24445
24542
  taskId: task.id,
24446
24543
  reason: "submitted",
@@ -24450,14 +24547,14 @@ function createTurnMutations(deps) {
24450
24547
  await emit(trx, "task_submitted", task.project, task.id, ctx.at, {
24451
24548
  turn: input.turn,
24452
24549
  column: turn.column,
24453
- sha: input.sha,
24550
+ sha,
24454
24551
  ...event,
24455
24552
  ...CONFIRMATION[confirmed]
24456
24553
  }, ctx.actor);
24457
24554
  return {
24458
24555
  task: taskView(await dispatched(trx, task.id, ctx.at, ctx.actor)),
24459
24556
  turn: input.turn,
24460
- sha: input.sha,
24557
+ sha,
24461
24558
  status: confirmed === "pending" ? "pending" : "confirmed"
24462
24559
  };
24463
24560
  }
package/dist/mcp.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-_tWJWhul.mjs";
2
- import { o as CliError, r as requestOperation } from "./chunk-Bp_JzHSF.mjs";
3
- import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-BzKjwY-N.mjs";
1
+ import { S as renderMcpError, g as OPERATIONS, pt as ERRORS } from "./chunk-Chj2wumn.mjs";
2
+ import { o as CliError, r as requestOperation } from "./chunk-BLaWsiXP.mjs";
3
+ import { a as memoryVerdictCache, c as loadClientConfig, r as compareCatalogs, t as checkCatalog } from "./chunk-DI3BTuEX.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { readFileSync } from "node:fs";
6
6
  import { z } from "zod";