@kitman-sh/software-engineering 0.10.70 → 0.10.71

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/bundle.js CHANGED
@@ -13814,6 +13814,8 @@ var RunEvidence = Struct({
13814
13814
  durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
13815
13815
  outputTail: String5,
13816
13816
  fileIds: optionalKey2(ArraySchema(String5)),
13817
+ skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
13818
+ newNotRun: optionalKey2(ArraySchema(String5)),
13817
13819
  recordedAt: Timestamp
13818
13820
  });
13819
13821
  var ApprovedVerification = Struct({
@@ -18783,7 +18785,9 @@ var EvidenceCheck = Struct({
18783
18785
  durationMs: Finite,
18784
18786
  evidenceId: String5,
18785
18787
  outputTail: optionalKey2(String5),
18786
- suggested: optionalKey2(Boolean3)
18788
+ suggested: optionalKey2(Boolean3),
18789
+ skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
18790
+ newNotRun: optionalKey2(ArraySchema(String5))
18787
18791
  });
18788
18792
  var VerifyResult = Struct({
18789
18793
  revision: String5,
@@ -18795,6 +18799,16 @@ var VerifyResult = Struct({
18795
18799
  var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
18796
18800
  var missing2 = (side) => `No verification evidence for the ${side}`;
18797
18801
  var failsOn = (side, name, tree) => `${name} fails on the ${side} tree ${tree}`;
18802
+ var shownTests = 10;
18803
+ var testList = (tests) => [...tests.slice(0, shownTests), ...tests.length > shownTests ? [`and ${tests.length - shownTests} more`] : []].join("; ");
18804
+ var testsNotRunReasons = (result) => result.checks.flatMap((check) => [
18805
+ ...check.newNotRun === undefined || check.newNotRun.length === 0 ? [] : [
18806
+ `${check.name} skipped ${check.newNotRun.length} new test${check.newNotRun.length === 1 ? "" : "s"} on the tree ${result.tree}, so verify never ran them: ${testList(check.newNotRun)}`
18807
+ ],
18808
+ ...check.skippedSinceBaseline === undefined || check.skippedSinceBaseline.length === 0 ? [] : [
18809
+ `${check.name} skipped ${check.skippedSinceBaseline.length} test${check.skippedSinceBaseline.length === 1 ? "" : "s"} on the tree ${result.tree} that ran on the baseline: ${testList(check.skippedSinceBaseline)}`
18810
+ ]
18811
+ ]);
18798
18812
  var allPass = (side, result) => {
18799
18813
  if (result === undefined)
18800
18814
  return [missing2(side)];
@@ -18837,6 +18851,11 @@ var scopeReasons = (scope) => {
18837
18851
  return scope.unmet.length === 0 ? ["Review found the scope unmet"] : scope.unmet.map((item) => `Review found the scope unmet: ${item}`);
18838
18852
  };
18839
18853
  var evidenceGate = (input) => {
18854
+ const gated = outcomeGate(input);
18855
+ const notRun = input.outcome === "investigation" || input.head === undefined ? [] : testsNotRunReasons(input.head);
18856
+ return verdict([...gated.settled ? [] : gated.reasons, ...notRun]);
18857
+ };
18858
+ var outcomeGate = (input) => {
18840
18859
  switch (input.outcome) {
18841
18860
  case "feature":
18842
18861
  return verdict([...allPass("head", input.head), ...scopeReasons(input.review)]);
@@ -19791,6 +19810,26 @@ var NetworkHostQuery = Struct({
19791
19810
  repoBindingId: optionalKey2(Id)
19792
19811
  });
19793
19812
 
19813
+ // ../../packages/core/src/test-report.ts
19814
+ var maxSkippedTests = 1e4;
19815
+ var maxRanDigests = 1e5;
19816
+ var TestId = String5.check(isMinLength(1), isMaxLength(1000));
19817
+ var CheckTests = Struct({
19818
+ reports: Int.check(isGreaterThanOrEqualTo2(0)),
19819
+ passed: Int.check(isGreaterThanOrEqualTo2(0)),
19820
+ failed: Int.check(isGreaterThanOrEqualTo2(0)),
19821
+ skipped: Int.check(isGreaterThanOrEqualTo2(0)),
19822
+ skippedTests: ArraySchema(TestId).check(isMaxLength(maxSkippedTests)),
19823
+ ranDigests: ArraySchema(String5.check(isMaxLength(16))).check(isMaxLength(maxRanDigests))
19824
+ });
19825
+ var entities = new Map([
19826
+ ["amp", "&"],
19827
+ ["lt", "<"],
19828
+ ["gt", ">"],
19829
+ ["quot", '"'],
19830
+ ["apos", "'"]
19831
+ ]);
19832
+
19794
19833
  // ../../packages/core/src/secret.ts
19795
19834
  var SecretName2 = String5.check(isPattern2(new RegExp("^[A-Za-z_][A-Za-z0-9_]*$", "u")), isMinLength(1), isMaxLength(128));
19796
19835
  var SecretScope = Union2([Literal2("workspace"), Literal2("team")]);
@@ -19997,7 +20036,8 @@ var CheckEvidence = Struct({
19997
20036
  exitCode: optionalKey2(Int),
19998
20037
  durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
19999
20038
  outputTail: String5.check(isMaxLength(8000)),
20000
- fileIds: optionalKey2(ArraySchema(String5).check(isMaxLength(51)))
20039
+ fileIds: optionalKey2(ArraySchema(String5).check(isMaxLength(51))),
20040
+ tests: optionalKey2(CheckTests)
20001
20041
  });
20002
20042
  var TreeEvidence = Struct({
20003
20043
  revision: String5.check(isMinLength(1), isMaxLength(240)),
@@ -20580,6 +20620,11 @@ var scopeFindings = (scope) => (scope?.unmet ?? []).map((item) => ({
20580
20620
  seats: ["code-review"]
20581
20621
  }));
20582
20622
  var brokenChecks = (head) => head.unchanged === true ? [] : head.checks.filter((check) => check.status === "failed" && !check.preExisting);
20623
+ var nothingToVerify = (reason) => reason.includes("has no approved verifications") || reason.includes("approved verifications are all pipeline checks");
20624
+ var verifyHead = (name, revision) => verify(name, { revision }).pipe(map8((head) => ({ failing: brokenChecks(head).map((check) => check.name), notRun: testsNotRunReasons(head) })), catchTag2("StepFailed", (failed) => succeed7({
20625
+ failing: [],
20626
+ notRun: nothingToVerify(failed.reason) ? [] : [`Kitman could not verify the head, so none of its tests count as run: ${failed.reason}`]
20627
+ })));
20583
20628
  var isCheckFinding = (id) => id.startsWith("check: ");
20584
20629
  var checkFindings = (head) => brokenChecks(head).map((check) => ({
20585
20630
  id: `check: ${check.name}`,
@@ -20599,18 +20644,43 @@ var unsettledItems = (settled, decision) => decision.unsettled.filter((id) => !i
20599
20644
  return `Dispute stands on ${id}: ${standing.finding.detail} (rebutted: ${standing.rebuttal.reason})`;
20600
20645
  return `Unresolved ${settled.open.find((finding) => finding.id === id)?.severity ?? "blocker"} at ${id}: ${settled.open.find((finding) => finding.id === id)?.detail ?? ""}`;
20601
20646
  });
20602
- var evidenceTable = (head) => [
20603
- `Collected by a Runner for revision \`${head.revision}\`, tree \`${head.tree}\`; it holds for any revision with this tree.`,
20604
- "",
20605
- "| Check | Command | Result |",
20606
- "| --- | --- | --- |",
20607
- ...head.checks.map((entry) => `| ${entry.name}${entry.suggested === true ? " (suggested by the agent)" : ""} | \`${entry.command}\` | ${entry.status}${entry.status === "failed" && (entry.preExisting || head.unchanged === true) ? " (also fails on the base branch)" : ""} |`),
20608
- ...head.checks.some((entry) => entry.suggested === true) ? [
20647
+ var notVerifiedSection = (head) => {
20648
+ const listed = head.checks.flatMap((entry) => [
20649
+ ...(entry.newNotRun ?? []).map((test) => `- ${entry.name}: \`${test}\` is new and was skipped`),
20650
+ ...(entry.skippedSinceBaseline ?? []).map((test) => `- ${entry.name}: \`${test}\` was skipped, and ran on the base branch`)
20651
+ ]);
20652
+ return listed.length === 0 ? undefined : [
20653
+ "**Not verified.** Verify never ran these tests, so their checks passing says nothing about them. Run them where they can run before trusting them:",
20609
20654
  "",
20610
- "The repository has no approved verifications, so these are the agent's suggestions; check them, and approve the ones to keep with `kitman verify add`."
20611
- ] : []
20612
- ].join(`
20655
+ ...listed
20656
+ ].join(`
20657
+ `);
20658
+ };
20659
+ var unsettledLines = (unsettled, head) => {
20660
+ const listed = new Set(testsNotRunReasons(head));
20661
+ const left = unsettled.filter((item) => !listed.has(item));
20662
+ if (left.length > 0)
20663
+ return left.map((item) => `- ${item}`);
20664
+ return [
20665
+ left.length === unsettled.length ? "Nothing is unsettled." : "Only the tests verify never ran, listed under Evidence."
20666
+ ];
20667
+ };
20668
+ var evidenceTable = (head) => {
20669
+ const notVerified = notVerifiedSection(head);
20670
+ return [
20671
+ `Collected by a Runner for revision \`${head.revision}\`, tree \`${head.tree}\`; it holds for any revision with this tree.`,
20672
+ "",
20673
+ "| Check | Command | Result |",
20674
+ "| --- | --- | --- |",
20675
+ ...head.checks.map((entry) => `| ${entry.name}${entry.suggested === true ? " (suggested by the agent)" : ""} | \`${entry.command}\` | ${entry.status}${entry.status === "failed" && (entry.preExisting || head.unchanged === true) ? " (also fails on the base branch)" : ""} |`),
20676
+ ...notVerified === undefined ? [] : ["", notVerified],
20677
+ ...head.checks.some((entry) => entry.suggested === true) ? [
20678
+ "",
20679
+ "The repository has no approved verifications, so these are the agent's suggestions; check them, and approve the ones to keep with `kitman verify add`."
20680
+ ] : []
20681
+ ].join(`
20613
20682
  `);
20683
+ };
20614
20684
  var changeRequestBody = (build) => [
20615
20685
  build.summary,
20616
20686
  "## Evidence",
@@ -20620,7 +20690,7 @@ var changeRequestBody = (build) => [
20620
20690
  "What the agent says and Kitman has not checked.",
20621
20691
  ...build.claims.length === 0 ? ["None."] : build.claims.map((claim) => `- ${claim}`),
20622
20692
  "## Unsettled",
20623
- ...build.unsettled.length === 0 ? ["Nothing is unsettled."] : build.unsettled.map((item) => `- ${item}`),
20693
+ ...unsettledLines(build.unsettled, build.head),
20624
20694
  ...build.later === undefined || build.later.length === 0 ? [] : ["## Left for later", ...build.later.map((item) => `- ${item}`)],
20625
20695
  "## Review",
20626
20696
  `${build.rounds} review round${build.rounds === 1 ? "" : "s"}; the rally stopped: ${build.stopped.replaceAll("_", " ")}.`
@@ -20655,6 +20725,7 @@ var Input = Struct({
20655
20725
  claims: optional2(ArraySchema(String5)),
20656
20726
  earlier: optional2(ArraySchema(MergedFinding)),
20657
20727
  failing: optional2(ArraySchema(String5)),
20728
+ notRun: optional2(ArraySchema(String5)),
20658
20729
  next: optional2(Literals(choices))
20659
20730
  });
20660
20731
  var FollowUpStatus = Literals(["fixed", "changed", "still_there"]);
@@ -20722,7 +20793,7 @@ var earlierPrompt = (earlier) => [
20722
20793
  ...earlier.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`)
20723
20794
  ].join(`
20724
20795
  `);
20725
- var promptFor = (seat, target, input) => [
20796
+ var promptFor = (seat, target, input, failing, notRun) => [
20726
20797
  `You are one of two reviewers. Follow your \`${seats[seat].skill}\` skill; if you do not have it: ${seats[seat].focus}`,
20727
20798
  `Review ${target}`,
20728
20799
  "Give `summary`: one sentence on whether it can merge and what matters most.",
@@ -20730,8 +20801,15 @@ var promptFor = (seat, target, input) => [
20730
20801
  "If the diff is too big to review in one go, review it directory by directory and say so in a finding on the first file you skipped.",
20731
20802
  ...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
20732
20803
  ...input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)],
20733
- ...input.failing === undefined || input.failing.length === 0 ? [] : [
20734
- `These checks fail on this head and pass on the base: ${input.failing.join(", ")}. The implementer has their output, so do not report them as findings, and do not say it can merge while they fail.`
20804
+ ...failing.length === 0 ? [] : [
20805
+ `These checks fail on this head and pass on the base: ${failing.join(", ")}. The implementer has their output, so do not report them as findings, and do not say it can merge while they fail.`
20806
+ ],
20807
+ ...notRun.length === 0 ? [] : [
20808
+ [
20809
+ "Verify never ran these tests: its checks passed with them skipped. Treat what they test as unverified, not as passing; read each in the code, report one that looks wrong as a finding, and do not say it can merge on their strength.",
20810
+ ...notRun.map((item) => `- ${item}`)
20811
+ ].join(`
20812
+ `)
20735
20813
  ],
20736
20814
  ...input.rebuttals === undefined || input.rebuttals.length === 0 ? [] : [
20737
20815
  "The implementer disputes these findings. For each, give a verdict: accepted if the rebuttal is right and the finding should be dropped.",
@@ -20750,8 +20828,11 @@ var followUpsOf = (earlier, answers) => earlier.map((finding) => {
20750
20828
  });
20751
20829
  var findingLines = (findings) => findings.map((finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail} _(${finding.seats.join(", ")})_`).join(`
20752
20830
  `);
20753
- var reviewText = (summary, findings, followUps, approvedFindings) => [
20831
+ var reviewText = (summary, findings, followUps, approvedFindings, notRun) => [
20754
20832
  `**Kitman review.** ${summary}`,
20833
+ ...notRun.length === 0 ? [] : [`Verify never ran these tests, so they are unverified:
20834
+ ${notRun.map((item) => `- ${item}`).join(`
20835
+ `)}`],
20755
20836
  ...findings.length === 0 ? [] : [findingLines(findings)],
20756
20837
  ...approvedFindings.length === 0 ? [] : [`In code approved before, not blocking:
20757
20838
  ${findingLines(approvedFindings)}`],
@@ -20770,7 +20851,7 @@ var fixBrief = (changeRequestId, findings) => [
20770
20851
  `);
20771
20852
  var review_default = defineLoop({
20772
20853
  id: "review",
20773
- version: "3.4.0",
20854
+ version: "3.5.0",
20774
20855
  title: "Review",
20775
20856
  input: Input,
20776
20857
  output: Output,
@@ -20798,9 +20879,12 @@ var review_default = defineLoop({
20798
20879
  const target = targetOf(input, head);
20799
20880
  if (target === undefined)
20800
20881
  return yield* new ReviewTargetMissing({ message: "Name a ChangeRequest, or both base and head revisions" });
20882
+ const verified = head === undefined ? { failing: [], notRun: [] } : yield* verifyHead("verify", head);
20883
+ const failing = [...new Set([...input.failing ?? [], ...verified.failing])];
20884
+ const notRun = [...new Set([...input.notRun ?? [], ...verified.notRun])];
20801
20885
  const outputs = yield* forEach2(seatNames, (seat) => agentWork(`review:${seat}`, {
20802
20886
  agent: seat,
20803
- prompt: promptFor(seat, target, input),
20887
+ prompt: promptFor(seat, target, input, failing, notRun),
20804
20888
  output: SeatOutput
20805
20889
  }).pipe(map8((output) => [seat, output])), { concurrency: "unbounded" });
20806
20890
  const earlier = input.earlier ?? [];
@@ -20825,10 +20909,9 @@ var review_default = defineLoop({
20825
20909
  const findings = [...carried, ...fresh];
20826
20910
  const blockers = findings.filter(isBlocking);
20827
20911
  const scope = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
20828
- const failing = input.failing ?? [];
20829
- const summary = blockers.length > 0 ? `Blocking: fix ${blockers.map((finding) => finding.id).join(", ")} before merging.` : scope?.met === false ? "Not ready: the change does not yet do what was asked." : failing.length > 0 ? `Not ready: ${failing.join(", ")} fails on this head.` : findings.length === 0 ? sinceApproval ? `No findings in what changed since ${input.approved}: nothing stands in the way of merging.` : "No findings: nothing stands in the way of merging." : ["Can merge: nothing blocks it.", ...outputs.map(([, output]) => output.summary)].join(" ");
20912
+ const summary = blockers.length > 0 ? `Blocking: fix ${blockers.map((finding) => finding.id).join(", ")} before merging.` : scope?.met === false ? "Not ready: the change does not yet do what was asked." : failing.length > 0 ? `Not ready: ${failing.join(", ")} fails on this head.` : notRun.length > 0 ? "Not ready: verify never ran some of its tests, so they are unverified." : findings.length === 0 ? sinceApproval ? `No findings in what changed since ${input.approved}: nothing stands in the way of merging.` : "No findings: nothing stands in the way of merging." : ["Can merge: nothing blocks it.", ...outputs.map(([, output]) => output.summary)].join(" ");
20830
20913
  const freshIds = new Set(fresh.map((finding) => finding.id));
20831
- const text = reviewText(summary, findings, followUps, approvedFindings);
20914
+ const text = reviewText(summary, findings, followUps, approvedFindings, notRun);
20832
20915
  const stored = yield* artifact("findings", {
20833
20916
  kind: "review-findings",
20834
20917
  title: "Review findings",
@@ -20848,7 +20931,7 @@ var review_default = defineLoop({
20848
20931
  const changeRequestId = input.changeRequestId;
20849
20932
  if (changeRequestId === undefined || head === undefined)
20850
20933
  return reviewed;
20851
- const approval = reviewed.blocking || scope?.met === false || failing.length > 0 ? undefined : yield* approveChangeRequest("approve", { changeRequestId, head, summary }).pipe(map8((result) => result.approved ? { head, approved: true } : { head, approved: false, reason: result.reason }));
20934
+ const approval = reviewed.blocking || scope?.met === false || failing.length > 0 || notRun.length > 0 ? undefined : yield* approveChangeRequest("approve", { changeRequestId, head, summary }).pipe(map8((result) => result.approved ? { head, approved: true } : { head, approved: false, reason: result.reason }));
20852
20935
  const answer = input.next ?? (yield* ask("next", {
20853
20936
  prompt: `${summary}
20854
20937
 
@@ -20859,8 +20942,8 @@ What next?`,
20859
20942
  { value: "Build from it", description: "A Build fixes them in a new ChangeRequest." },
20860
20943
  { value: "Done", description: "Keeps the review as an artifact and stops." }
20861
20944
  ],
20862
- recommended: reviewed.blocking ? "Fix here" : "Done",
20863
- recommendationReason: reviewed.blocking ? "A blocking finding stops the merge, and fixing it here is the shortest way through." : "Nothing blocks the merge, so the findings can wait in the Run.",
20945
+ recommended: reviewed.blocking ? "Fix here" : notRun.length > 0 ? "Post to the ChangeRequest" : "Done",
20946
+ recommendationReason: reviewed.blocking ? "A blocking finding stops the merge, and fixing it here is the shortest way through." : notRun.length > 0 ? "Verify never ran some of its tests, so whoever merges it needs to know to run them first." : "Nothing blocks the merge, so the findings can wait in the Run.",
20864
20947
  default: "Done",
20865
20948
  timeout: "1 hour"
20866
20949
  }));
@@ -21264,6 +21347,7 @@ var Input3 = Struct({
21264
21347
  changeRequestId: String5,
21265
21348
  taskId: optional2(String5),
21266
21349
  merge: optional2(Boolean3),
21350
+ notRun: optional2(ArraySchema(String5)),
21267
21351
  branch: optional2(String5),
21268
21352
  continuing: optional2(Continuing),
21269
21353
  maxCycles: optional2(Int)
@@ -21337,7 +21421,7 @@ var repliesPrompt = (threads) => [
21337
21421
  var threadKey = (thread) => `${thread.id}:${thread.comments.length}`;
21338
21422
  var shepherd_default = defineLoop({
21339
21423
  id: "shepherd",
21340
- version: "1.2.0",
21424
+ version: "1.3.0",
21341
21425
  title: "Shepherd",
21342
21426
  input: Input3,
21343
21427
  output: Output3,
@@ -21365,6 +21449,7 @@ var shepherd_default = defineLoop({
21365
21449
  const ranOnRunner = new Set;
21366
21450
  const leftToPerson = new Set;
21367
21451
  let headFindings = [];
21452
+ const unranAt = new Map;
21368
21453
  const rounds = { "ci-fix": 0, "head-fix": 0 };
21369
21454
  const allowed = { "ci-fix": 0, "head-fix": 0 };
21370
21455
  let replies = 0;
@@ -21766,9 +21851,12 @@ ${open}`,
21766
21851
  leftToPerson.add(head);
21767
21852
  approved = yield* waitFor(`approval:${cycle}`, { ...approval, timeout: "7 days" });
21768
21853
  } else {
21854
+ const { notRun: headNotRun } = yield* verifyHead(`head-verify:${cycle}`, head);
21855
+ const notRun = [...new Set([...input.notRun ?? [], ...headNotRun])];
21769
21856
  const reviewed = yield* call(`head-review:${cycle}`, reviewLoop(), {
21770
21857
  base: `origin/${target}`,
21771
21858
  head,
21859
+ ...notRun.length === 0 ? undefined : { notRun },
21772
21860
  ...since === undefined ? undefined : { approved: since },
21773
21861
  ...headFindings.length === 0 ? undefined : { earlier: headFindings }
21774
21862
  });
@@ -21786,35 +21874,55 @@ ${open}`,
21786
21874
  headFindings = reviewed.findings;
21787
21875
  continue;
21788
21876
  }
21789
- const recorded = yield* approveChangeRequest(`head-approve:${cycle}`, {
21790
- changeRequestId,
21791
- head,
21792
- summary: since === undefined ? `A review of the whole change at ${head} passed with nothing blocking.` : `A review of what changed between ${since}, the last approved head, and ${head} passed with nothing blocking.`,
21793
- review: `head-review:${cycle}`
21794
- }).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
21795
- if (!recorded.approved)
21796
- return done("needs_you", `The review of ${head} passed, but did not approve it: ${recorded.reason}`);
21797
21877
  headFindings = [];
21878
+ if (notRun.length > 0)
21879
+ unranAt.set(head, { notRun, review: `head-review:${cycle}` });
21880
+ else {
21881
+ const recorded = yield* approveChangeRequest(`head-approve:${cycle}`, {
21882
+ changeRequestId,
21883
+ head,
21884
+ summary: since === undefined ? `A review of the whole change at ${head} passed with nothing blocking.` : `A review of what changed between ${since}, the last approved head, and ${head} passed with nothing blocking.`,
21885
+ review: `head-review:${cycle}`
21886
+ }).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
21887
+ if (!recorded.approved)
21888
+ return done("needs_you", `The review of ${head} passed, but did not approve it: ${recorded.reason}`);
21889
+ }
21798
21890
  }
21799
21891
  }
21800
21892
  if (approved !== undefined && approved.type !== "change_request.approval")
21801
21893
  continue;
21802
21894
  if (pipeline.source === "reported" && approved !== undefined && approved.payload.head !== pipeline.head)
21803
21895
  continue;
21804
- const merge = input.merge === true ? "Merge" : yield* ask(`merge:${cycle}`, {
21805
- prompt: "The ChangeRequest is approved, green and mergeable. Merge now?",
21896
+ const unapproved = unranAt.get(pipeline.head);
21897
+ const notRun = unapproved?.notRun ?? input.notRun ?? [];
21898
+ const merge = input.merge === true && notRun.length === 0 ? "Merge" : yield* ask(`merge:${cycle}`, {
21899
+ prompt: notRun.length === 0 ? "The ChangeRequest is approved, green and mergeable. Merge now?" : `The ChangeRequest is ${unapproved === undefined ? "approved" : "reviewed with nothing blocking but not approved"}, green and mergeable, but verify never ran some of its tests:
21900
+ ${notRun.map((item) => `- ${item}`).join(`
21901
+ `)}
21902
+
21903
+ Merge now?`,
21806
21904
  options: [
21807
21905
  { value: "Merge", description: "Merges the head whose pipeline passed." },
21808
21906
  { value: "Wait", description: "Leaves the merge to a person." }
21809
21907
  ],
21810
- recommended: "Merge",
21811
- recommendationReason: "It is approved, green and mergeable, which is everything a merge waits for.",
21908
+ recommended: notRun.length === 0 ? "Merge" : "Wait",
21909
+ recommendationReason: notRun.length === 0 ? "It is approved, green and mergeable, which is everything a merge waits for." : "Nobody has seen those tests pass, so run them by hand before it lands.",
21812
21910
  default: "Wait",
21813
- auto: "Merge",
21911
+ ...notRun.length === 0 ? { auto: "Merge" } : undefined,
21814
21912
  timeout: "1 hour"
21815
21913
  });
21816
21914
  if (merge === "Wait")
21817
- return done("ready", "Approved, green and mergeable; left for a person to merge");
21915
+ return done("ready", unapproved === undefined ? "Approved, green and mergeable; left for a person to merge" : "Reviewed, green and mergeable, but verify never ran some of its tests; left for a person to merge");
21916
+ if (unapproved !== undefined) {
21917
+ const recorded = yield* approveChangeRequest(`head-approve:${cycle}`, {
21918
+ changeRequestId,
21919
+ head: pipeline.head,
21920
+ summary: `A review of ${pipeline.head} passed with nothing blocking; a person chose to merge it though verify never ran some of its tests.`,
21921
+ review: unapproved.review
21922
+ }).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
21923
+ if (!recorded.approved)
21924
+ return done("needs_you", `The review of ${pipeline.head} passed, but did not approve it: ${recorded.reason}`);
21925
+ }
21818
21926
  const refused = yield* takeTurn();
21819
21927
  if (refused !== undefined)
21820
21928
  return done("needs_you", `The turn to merge into ${target} was refused: ${refused}`);
@@ -21941,6 +22049,7 @@ var BuildOutput = Struct({
21941
22049
  rounds: Int,
21942
22050
  stopped: Literals(["settled", "dispute_stands", "findings_returned", "round_cap"]),
21943
22051
  criteria: ArraySchema(CriterionAnswer),
22052
+ notRun: optional2(ArraySchema(String5)),
21944
22053
  approval: optional2(ApproveChangeRequestResult),
21945
22054
  landed: optional2(ShepherdOutput),
21946
22055
  next: Struct({ changeRequestId: String5 })
@@ -22049,6 +22158,7 @@ var rally = (input) => gen2(function* () {
22049
22158
  conflicts
22050
22159
  };
22051
22160
  const failing = brokenChecks(head).map((check) => check.name);
22161
+ const notRun = testsNotRunReasons(head);
22052
22162
  const reviewed = yield* call(`review:${round}`, review_default, {
22053
22163
  base: input.base,
22054
22164
  head: head.revision,
@@ -22056,6 +22166,7 @@ var rally = (input) => gen2(function* () {
22056
22166
  ...earlier.length === 0 ? undefined : { earlier },
22057
22167
  ...input.outcome === undefined ? undefined : { outcome: input.outcome },
22058
22168
  ...failing.length === 0 ? undefined : { failing },
22169
+ ...notRun.length === 0 ? undefined : { notRun },
22059
22170
  claims: [...claims]
22060
22171
  });
22061
22172
  const checks = checkFindings(head);
@@ -22093,7 +22204,7 @@ var rally = (input) => gen2(function* () {
22093
22204
  });
22094
22205
  var build_default = defineLoop({
22095
22206
  id: "build",
22096
- version: "2.2.0",
22207
+ version: "2.3.0",
22097
22208
  title: "Build",
22098
22209
  input: BuildInput,
22099
22210
  output: BuildOutput,
@@ -22158,6 +22269,7 @@ var build_default = defineLoop({
22158
22269
  ...implemented.documented === undefined ? undefined : { documented: implemented.documented },
22159
22270
  ...implemented.rollback === undefined ? undefined : { rollback: implemented.rollback }
22160
22271
  });
22272
+ const lastNotRun = testsNotRunReasons(last.head);
22161
22273
  const unsettled = [
22162
22274
  ...new Set([
22163
22275
  ...verdict.settled ? [] : verdict.reasons,
@@ -22189,6 +22301,7 @@ var build_default = defineLoop({
22189
22301
  }).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason }))) : undefined;
22190
22302
  const landed = input.land !== false && unsettled.length === 0 ? yield* call("land", shepherd_default, {
22191
22303
  changeRequestId: opened.id,
22304
+ ...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
22192
22305
  ...input.taskId === undefined ? undefined : { taskId: input.taskId },
22193
22306
  ...input.branch === undefined ? undefined : { branch: input.branch }
22194
22307
  }) : undefined;
@@ -22209,6 +22322,7 @@ var build_default = defineLoop({
22209
22322
  rounds: last.round,
22210
22323
  stopped: last.decision.reason,
22211
22324
  criteria,
22325
+ ...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
22212
22326
  ...approval === undefined ? undefined : { approval },
22213
22327
  ...landed === undefined ? undefined : { landed },
22214
22328
  next: { changeRequestId: opened.id }
@@ -22271,17 +22385,24 @@ var errand_default = defineLoop({
22271
22385
  if (done.status !== "done" || !done.changed)
22272
22386
  return { status: done.status, summary: done.summary };
22273
22387
  const head = yield* verify("verify", { suggested: done.checks ?? [] });
22388
+ const notRun = testsNotRunReasons(head);
22389
+ const trusted = head.passed && notRun.length === 0;
22390
+ const checksSay = !head.passed ? "The checks fail." : notRun.length === 0 ? "The checks pass." : `The checks pass, but verify never ran some tests:
22391
+ ${notRun.map((item) => `- ${item}`).join(`
22392
+ `)}`;
22274
22393
  const answer = yield* ask("next", {
22275
22394
  prompt: `${done.summary}
22276
22395
 
22277
- The checks ${head.passed ? "pass" : "fail"}. What next?`,
22396
+ ${checksSay}
22397
+
22398
+ What next?`,
22278
22399
  options: [
22279
22400
  { value: "Open a ChangeRequest", description: "Deliver it as it is, unreviewed." },
22280
22401
  { value: "Hand to Build for a full review", description: "Build reviews and verifies it before delivering." },
22281
22402
  { value: "Discard", description: "Drop the change." }
22282
22403
  ],
22283
- recommended: head.passed ? "Open a ChangeRequest" : "Hand to Build for a full review",
22284
- recommendationReason: head.passed ? "The checks pass, and an errand is small enough to review on the ChangeRequest." : "The checks fail, so it needs the fixes and review a Build gives before anyone merges it.",
22404
+ recommended: trusted ? "Open a ChangeRequest" : "Hand to Build for a full review",
22405
+ recommendationReason: trusted ? "The checks pass, and an errand is small enough to review on the ChangeRequest." : head.passed ? "Verify skipped tests it should have run, so it needs the review a Build gives before anyone merges it." : "The checks fail, so it needs the fixes and review a Build gives before anyone merges it.",
22285
22406
  default: "Open a ChangeRequest",
22286
22407
  timeout: "1 hour"
22287
22408
  });
@@ -22448,6 +22569,10 @@ ${input.discovery.opportunities.map((entry) => `- ${entry.title} (${entry.eviden
22448
22569
  ].join(`
22449
22570
 
22450
22571
  `);
22572
+ var notRunOf = (head) => {
22573
+ const notRun = testsNotRunReasons(head);
22574
+ return notRun.length === 0 ? undefined : { notRun };
22575
+ };
22451
22576
  var steadier = (plan) => {
22452
22577
  const counter = plan.metrics.find((metric) => metric.lowVariance === true && metric.role !== "primary");
22453
22578
  return counter === undefined ? undefined : {
@@ -22582,10 +22707,12 @@ var hillclimb_default = defineLoop({
22582
22707
  `The measurement is valid: ${harness.summary}`,
22583
22708
  ...kept.map((entry) => entry.summary)
22584
22709
  ];
22710
+ let head = checked;
22585
22711
  let reviewed = yield* call("review", review_default, {
22586
22712
  base: baseline,
22587
22713
  head: checked.revision,
22588
22714
  outcome: "performance",
22715
+ ...notRunOf(checked),
22589
22716
  claims
22590
22717
  });
22591
22718
  for (let round = 1;round <= 2 && reviewed.findings.some(isBlocking); round++) {
@@ -22603,14 +22730,18 @@ var hillclimb_default = defineLoop({
22603
22730
  final = yield* measure(`measure:fix:${round}`, { plan, base: baseline, head: fixed.revision, ...limits });
22604
22731
  if (final.verdict !== "gain")
22605
22732
  return yield* ending("gain_gone", `The review's fixes cost the gain: ${final.reason}`, final);
22733
+ head = fixed;
22606
22734
  reviewed = yield* call(`review:${round + 1}`, review_default, {
22607
22735
  base: baseline,
22608
22736
  head: fixed.revision,
22609
22737
  outcome: "performance",
22738
+ ...notRunOf(fixed),
22610
22739
  claims,
22611
22740
  earlier: blocking
22612
22741
  });
22613
22742
  }
22743
+ const notRun = testsNotRunReasons(head);
22744
+ const notVerified = notVerifiedSection(head);
22614
22745
  const unsettled = [
22615
22746
  ...[...reviewed.findings, ...scopeFindings(reviewed.scope)].flatMap((finding) => isBlocking(finding) ? [`${finding.id}: ${finding.detail}`] : []),
22616
22747
  ...synced.status === "conflict" ? [`Merging the base in conflicts on ${synced.files.join(", ")}`] : []
@@ -22630,6 +22761,7 @@ ${kept.map((entry) => `- ${entry.summary}: ${entry.reason}`).join(`
22630
22761
  ${harness.summary}
22631
22762
 
22632
22763
  \`${plan.command}\``,
22764
+ ...notVerified === undefined ? [] : [notVerified],
22633
22765
  ...unsettled.length + caveats.length === 0 ? [] : [`## Unsettled
22634
22766
 
22635
22767
  ${[...unsettled, ...caveats].map((entry) => `- ${entry}`).join(`
@@ -22639,7 +22771,11 @@ ${[...unsettled, ...caveats].map((entry) => `- ${entry}`).join(`
22639
22771
  `)
22640
22772
  });
22641
22773
  yield* writeBack("write-back", { milestone: "change_request_opened", changeRequestUrl: opened.url });
22642
- return { ...yield* ending("improved", final.reason, final), changeRequest: opened, unsettled };
22774
+ return {
22775
+ ...yield* ending("improved", final.reason, final),
22776
+ changeRequest: opened,
22777
+ unsettled: [...unsettled, ...notRun]
22778
+ };
22643
22779
  })
22644
22780
  });
22645
22781
 
@@ -22982,11 +23118,30 @@ An earlier Build of this failed. ${retry.steer}` };
22982
23118
  }).pipe(catchTag2("ChildFailed", (failure) => succeed7(failure)));
22983
23119
  if (built instanceof ChildFailed)
22984
23120
  return settled(ticket, { status: "failed", repoBindingId: head.repoBindingId, reason: built.reason });
23121
+ const delivered = { repoBindingId: head.repoBindingId, changeRequest: built.changeRequest };
23122
+ if (built.notRun !== undefined && built.notRun.length > 0) {
23123
+ const unverified = yield* ask(`unverified:${name}${suffix}`, {
23124
+ prompt: `Verify never ran some tests of the ChangeRequest for ${ticket.key} (${built.changeRequest.url}):
23125
+ ${built.notRun.map((item) => `- ${item}`).join(`
23126
+ `)}
23127
+
23128
+ Merge it once they pass by hand, or skip it and the tickets it blocks?`,
23129
+ options: [
23130
+ { value: "Skip", description: "Leaves it and the tickets it blocks unmerged." },
23131
+ { value: "Merge", description: "Merges it into the integration branch, for when the tests pass by hand." }
23132
+ ],
23133
+ recommended: "Skip",
23134
+ recommendationReason: "Nobody has seen these tests pass, so merging would land them as if they had.",
23135
+ default: "Skip",
23136
+ timeout: "1 day"
23137
+ });
23138
+ if (unverified === "Skip")
23139
+ return settled(ticket, { status: "skipped", ...delivered, reason: "Verify never ran some of its tests" });
23140
+ }
22985
23141
  const merged = yield* mergeChangeRequest(`merge:${name}${suffix}`, {
22986
23142
  changeRequestId: built.changeRequest.id,
22987
23143
  head: built.revision
22988
23144
  });
22989
- const delivered = { repoBindingId: head.repoBindingId, changeRequest: built.changeRequest };
22990
23145
  if (merged.status === "merged")
22991
23146
  return settled(ticket, { status: "merged", ...delivered });
22992
23147
  const choice = yield* ask(`conflict:${name}${suffix}`, {
@@ -23100,7 +23255,7 @@ var implement = (input, plan, revision, filed) => gen2(function* () {
23100
23255
  });
23101
23256
  var plan_default = defineLoop({
23102
23257
  id: "plan",
23103
- version: "2.0.0",
23258
+ version: "2.1.0",
23104
23259
  title: "Plan",
23105
23260
  input: Input7,
23106
23261
  output: Output8,
@@ -23689,7 +23844,7 @@ var reportText = (landing, left, heading) => [
23689
23844
  `);
23690
23845
  var sweep_default = defineLoop({
23691
23846
  id: "sweep",
23692
- version: "1.0.0",
23847
+ version: "1.1.0",
23693
23848
  title: "Sweep",
23694
23849
  input: Input11,
23695
23850
  output: Output12,
@@ -23702,9 +23857,12 @@ var sweep_default = defineLoop({
23702
23857
  const authors = input.authors ?? defaultAuthors;
23703
23858
  const [earlier] = (yield* ownChangeRequests("earlier")).changeRequests;
23704
23859
  if (earlier !== undefined) {
23860
+ const { head } = yield* pipelineStatus("earlier-head", { changeRequestId: earlier.id });
23861
+ const { notRun } = yield* verifyHead("earlier-verify", head);
23705
23862
  const landed = yield* call("land", shepherd_default, {
23706
23863
  changeRequestId: earlier.id,
23707
- merge: true,
23864
+ merge: notRun.length === 0,
23865
+ ...notRun.length === 0 ? undefined : { notRun },
23708
23866
  ...input.branch === undefined ? undefined : { branch: input.branch }
23709
23867
  });
23710
23868
  const summary = `${earlier.url}, from an earlier Sweep, is still open; Sweep took it on instead of batching again: ${landed.status}. ${landed.reason}`;
@@ -23791,10 +23949,12 @@ var sweep_default = defineLoop({
23791
23949
  const failing = checked.checks.filter((check) => check.status === "failed").map((check) => check.name);
23792
23950
  return yield* reported("reported", `The batch still fails ${failing.join(", ")} after ${maxFixRounds} rounds of fixing.`, [...left, ...landing.map(({ head: _head, ...update }) => ({ ...update, reason: "The batch did not pass" }))]);
23793
23951
  }
23952
+ const notVerified = notVerifiedSection(checked);
23794
23953
  const opened = yield* changeRequest("change-request", {
23795
23954
  title: `Update ${landing.length} ${landing.length === 1 ? "dependency" : "dependencies"}`,
23796
23955
  body: [
23797
23956
  batched.summary,
23957
+ ...notVerified === undefined ? [] : [notVerified],
23798
23958
  supersedes,
23799
23959
  ...landing.map(supersededLine),
23800
23960
  ...left.length === 0 ? [] : ["Left for a person:", ...left.map((update) => `- !${update.number} ${update.title}: ${update.reason}`)]
@@ -23804,7 +23964,8 @@ var sweep_default = defineLoop({
23804
23964
  });
23805
23965
  const landed = yield* call("land", shepherd_default, {
23806
23966
  changeRequestId: opened.id,
23807
- merge: true,
23967
+ merge: notVerified === undefined,
23968
+ ...notVerified === undefined ? undefined : { notRun: testsNotRunReasons(checked) },
23808
23969
  ...input.branch === undefined ? undefined : { branch: input.branch }
23809
23970
  });
23810
23971
  const merged = landed.status === "merged";
@@ -23919,10 +24080,12 @@ var tidy_default = defineLoop({
23919
24080
  return { status: "nothing_worth_it", summary: improvement.summary };
23920
24081
  const base = yield* verify("verify:base", { revision: start });
23921
24082
  const head = yield* verify("verify", {});
24083
+ const notRun = testsNotRunReasons(head);
23922
24084
  const reviewed = yield* call("review", review_default, {
23923
24085
  base: start,
23924
24086
  head: head.revision,
23925
24087
  outcome: "refactor",
24088
+ ...notRun.length === 0 ? undefined : { notRun },
23926
24089
  claims: improvement.claims
23927
24090
  });
23928
24091
  const settled = settleRound({ findings: reviewed.findings, rebuttals: [], verdicts: reviewed.verdicts });
@@ -29762,4 +29925,4 @@ var runKit = (config, identity, packages) => {
29762
29925
  runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
29763
29926
  };
29764
29927
  // .kitman-build-entry.ts
29765
- runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.70" }, []);
29928
+ runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.71" }, []);