@kitman-sh/software-engineering 0.10.69 → 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 +515 -128
- package/dist/declarations.json +206 -22
- package/package.json +3 -3
- package/src/build.ts +10 -1
- package/src/change-request-body.ts +73 -5
- package/src/errand.ts +16 -4
- package/src/hillclimb.ts +26 -3
- package/src/plan.ts +26 -6
- package/src/review.ts +103 -36
- package/src/shepherd-output.ts +12 -1
- package/src/shepherd.ts +453 -104
- package/src/sweep.ts +16 -3
- package/src/tidy.ts +3 -0
package/dist/bundle.js
CHANGED
|
@@ -13787,6 +13787,12 @@ var RunWaiting = Union2([
|
|
|
13787
13787
|
name: String5.check(isMinLength(1)),
|
|
13788
13788
|
verificationId: Id
|
|
13789
13789
|
}),
|
|
13790
|
+
Struct({
|
|
13791
|
+
kind: Literal2("claim"),
|
|
13792
|
+
name: String5.check(isMinLength(1)),
|
|
13793
|
+
resource: String5.check(isMinLength(1)),
|
|
13794
|
+
holder: optionalKey2(Struct({ runId: Id, loopId: String5 }))
|
|
13795
|
+
}),
|
|
13790
13796
|
Struct({
|
|
13791
13797
|
kind: Literal2("queue"),
|
|
13792
13798
|
name: String5.check(isMinLength(1)),
|
|
@@ -13808,6 +13814,8 @@ var RunEvidence = Struct({
|
|
|
13808
13814
|
durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
|
|
13809
13815
|
outputTail: String5,
|
|
13810
13816
|
fileIds: optionalKey2(ArraySchema(String5)),
|
|
13817
|
+
skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
|
|
13818
|
+
newNotRun: optionalKey2(ArraySchema(String5)),
|
|
13811
13819
|
recordedAt: Timestamp
|
|
13812
13820
|
});
|
|
13813
13821
|
var ApprovedVerification = Struct({
|
|
@@ -18777,7 +18785,9 @@ var EvidenceCheck = Struct({
|
|
|
18777
18785
|
durationMs: Finite,
|
|
18778
18786
|
evidenceId: String5,
|
|
18779
18787
|
outputTail: optionalKey2(String5),
|
|
18780
|
-
suggested: optionalKey2(Boolean3)
|
|
18788
|
+
suggested: optionalKey2(Boolean3),
|
|
18789
|
+
skippedSinceBaseline: optionalKey2(ArraySchema(String5)),
|
|
18790
|
+
newNotRun: optionalKey2(ArraySchema(String5))
|
|
18781
18791
|
});
|
|
18782
18792
|
var VerifyResult = Struct({
|
|
18783
18793
|
revision: String5,
|
|
@@ -18789,6 +18799,16 @@ var VerifyResult = Struct({
|
|
|
18789
18799
|
var verdict = (reasons) => reasons.length === 0 ? { settled: true } : { settled: false, reasons };
|
|
18790
18800
|
var missing2 = (side) => `No verification evidence for the ${side}`;
|
|
18791
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
|
+
]);
|
|
18792
18812
|
var allPass = (side, result) => {
|
|
18793
18813
|
if (result === undefined)
|
|
18794
18814
|
return [missing2(side)];
|
|
@@ -18831,6 +18851,11 @@ var scopeReasons = (scope) => {
|
|
|
18831
18851
|
return scope.unmet.length === 0 ? ["Review found the scope unmet"] : scope.unmet.map((item) => `Review found the scope unmet: ${item}`);
|
|
18832
18852
|
};
|
|
18833
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) => {
|
|
18834
18859
|
switch (input.outcome) {
|
|
18835
18860
|
case "feature":
|
|
18836
18861
|
return verdict([...allPass("head", input.head), ...scopeReasons(input.review)]);
|
|
@@ -19249,7 +19274,10 @@ var PipelineStatus = Struct({
|
|
|
19249
19274
|
source: Literals(["forge", "reported"]),
|
|
19250
19275
|
jobs: ArraySchema(PipelineJob),
|
|
19251
19276
|
readAt: optionalKey2(String5),
|
|
19252
|
-
runnerChecks: optionalKey2(ArraySchema(String5))
|
|
19277
|
+
runnerChecks: optionalKey2(ArraySchema(String5)),
|
|
19278
|
+
approved: optionalKey2(String5),
|
|
19279
|
+
repository: optionalKey2(String5),
|
|
19280
|
+
target: optionalKey2(Struct({ branch: String5, head: String5, jobs: ArraySchema(PipelineJob) }))
|
|
19253
19281
|
});
|
|
19254
19282
|
var ReviewThread = Struct({
|
|
19255
19283
|
id: String5,
|
|
@@ -19681,6 +19709,11 @@ var claim = (name, request) => gen2(function* () {
|
|
|
19681
19709
|
return taken;
|
|
19682
19710
|
return yield* new StepFailed({ step: name, reason: `${request.resource} is kept by ${holderName(taken.holder)}` });
|
|
19683
19711
|
});
|
|
19712
|
+
var letGo = (name, held) => takeStep(name, "let_go", "claim", gen2(function* () {
|
|
19713
|
+
const deferred = letGoDeferred(name);
|
|
19714
|
+
yield* launch(deferred, (host, token) => host.claimResource({ step: name, resource: held.resource, action: "let_go", token }));
|
|
19715
|
+
yield* await_2(deferred);
|
|
19716
|
+
}));
|
|
19684
19717
|
|
|
19685
19718
|
// ../../packages/core/src/repo-binding.ts
|
|
19686
19719
|
var ForgeKinds = ["github", "gitlab", "forgejo", "gitea", "gitee", "bitbucket", "azure-devops"];
|
|
@@ -19777,6 +19810,26 @@ var NetworkHostQuery = Struct({
|
|
|
19777
19810
|
repoBindingId: optionalKey2(Id)
|
|
19778
19811
|
});
|
|
19779
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
|
+
|
|
19780
19833
|
// ../../packages/core/src/secret.ts
|
|
19781
19834
|
var SecretName2 = String5.check(isPattern2(new RegExp("^[A-Za-z_][A-Za-z0-9_]*$", "u")), isMinLength(1), isMaxLength(128));
|
|
19782
19835
|
var SecretScope = Union2([Literal2("workspace"), Literal2("team")]);
|
|
@@ -19983,7 +20036,8 @@ var CheckEvidence = Struct({
|
|
|
19983
20036
|
exitCode: optionalKey2(Int),
|
|
19984
20037
|
durationMs: Int.check(isGreaterThanOrEqualTo2(0)),
|
|
19985
20038
|
outputTail: String5.check(isMaxLength(8000)),
|
|
19986
|
-
fileIds: optionalKey2(ArraySchema(String5).check(isMaxLength(51)))
|
|
20039
|
+
fileIds: optionalKey2(ArraySchema(String5).check(isMaxLength(51))),
|
|
20040
|
+
tests: optionalKey2(CheckTests)
|
|
19987
20041
|
});
|
|
19988
20042
|
var TreeEvidence = Struct({
|
|
19989
20043
|
revision: String5.check(isMinLength(1), isMaxLength(240)),
|
|
@@ -20277,7 +20331,7 @@ var scriptedHost = (script, engine, agentLaunches, childLaunches, waits, verifyL
|
|
|
20277
20331
|
});
|
|
20278
20332
|
return resolve(eventDeferred(launch.step), launch.token, event === undefined ? fail5(new WaitTimedOut({ step: launch.step, event: launch.event })) : succeed4(event));
|
|
20279
20333
|
},
|
|
20280
|
-
claimResource: (launch) => launch.action === "let_go" ? resolve(letGoDeferred(launch.step), launch.token, succeed4(null)) : resolve(claimDeferred(launch.step), launch.token, succeed4(script.claims?.[launch.step] ?? { status: "granted", resource: launch.resource })),
|
|
20334
|
+
claimResource: (launch) => flatMap3(script.claimed?.({ step: launch.step, resource: launch.resource, action: launch.action }) ?? undefined_2, (settled) => launch.action === "let_go" ? resolve(letGoDeferred(launch.step), launch.token, succeed4(null)) : resolve(claimDeferred(launch.step), launch.token, succeed4(settled ?? script.claims?.[launch.step] ?? { status: "granted", resource: launch.resource }))),
|
|
20281
20335
|
startVerification: (launch) => {
|
|
20282
20336
|
const scripted = script.verifications?.[launch.step];
|
|
20283
20337
|
if (launch.measure === undefined)
|
|
@@ -20566,6 +20620,11 @@ var scopeFindings = (scope) => (scope?.unmet ?? []).map((item) => ({
|
|
|
20566
20620
|
seats: ["code-review"]
|
|
20567
20621
|
}));
|
|
20568
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
|
+
})));
|
|
20569
20628
|
var isCheckFinding = (id) => id.startsWith("check: ");
|
|
20570
20629
|
var checkFindings = (head) => brokenChecks(head).map((check) => ({
|
|
20571
20630
|
id: `check: ${check.name}`,
|
|
@@ -20585,18 +20644,43 @@ var unsettledItems = (settled, decision) => decision.unsettled.filter((id) => !i
|
|
|
20585
20644
|
return `Dispute stands on ${id}: ${standing.finding.detail} (rebutted: ${standing.rebuttal.reason})`;
|
|
20586
20645
|
return `Unresolved ${settled.open.find((finding) => finding.id === id)?.severity ?? "blocker"} at ${id}: ${settled.open.find((finding) => finding.id === id)?.detail ?? ""}`;
|
|
20587
20646
|
});
|
|
20588
|
-
var
|
|
20589
|
-
|
|
20590
|
-
|
|
20591
|
-
|
|
20592
|
-
|
|
20593
|
-
|
|
20594
|
-
|
|
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:",
|
|
20595
20654
|
"",
|
|
20596
|
-
|
|
20597
|
-
]
|
|
20598
|
-
|
|
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(`
|
|
20599
20682
|
`);
|
|
20683
|
+
};
|
|
20600
20684
|
var changeRequestBody = (build) => [
|
|
20601
20685
|
build.summary,
|
|
20602
20686
|
"## Evidence",
|
|
@@ -20606,7 +20690,7 @@ var changeRequestBody = (build) => [
|
|
|
20606
20690
|
"What the agent says and Kitman has not checked.",
|
|
20607
20691
|
...build.claims.length === 0 ? ["None."] : build.claims.map((claim) => `- ${claim}`),
|
|
20608
20692
|
"## Unsettled",
|
|
20609
|
-
...build.unsettled
|
|
20693
|
+
...unsettledLines(build.unsettled, build.head),
|
|
20610
20694
|
...build.later === undefined || build.later.length === 0 ? [] : ["## Left for later", ...build.later.map((item) => `- ${item}`)],
|
|
20611
20695
|
"## Review",
|
|
20612
20696
|
`${build.rounds} review round${build.rounds === 1 ? "" : "s"}; the rally stopped: ${build.stopped.replaceAll("_", " ")}.`
|
|
@@ -20635,18 +20719,24 @@ var Input = Struct({
|
|
|
20635
20719
|
head: optional2(String5),
|
|
20636
20720
|
files: optional2(ArraySchema(String5)),
|
|
20637
20721
|
since: optional2(String5),
|
|
20722
|
+
approved: optional2(String5),
|
|
20638
20723
|
rebuttals: optional2(ArraySchema(Rebuttal)),
|
|
20639
20724
|
outcome: optional2(LoopOutcome),
|
|
20640
20725
|
claims: optional2(ArraySchema(String5)),
|
|
20641
20726
|
earlier: optional2(ArraySchema(MergedFinding)),
|
|
20642
20727
|
failing: optional2(ArraySchema(String5)),
|
|
20728
|
+
notRun: optional2(ArraySchema(String5)),
|
|
20643
20729
|
next: optional2(Literals(choices))
|
|
20644
20730
|
});
|
|
20645
20731
|
var FollowUpStatus = Literals(["fixed", "changed", "still_there"]);
|
|
20646
20732
|
var FollowUp = Struct({ id: String5, status: FollowUpStatus });
|
|
20733
|
+
var SeatFinding = Struct({
|
|
20734
|
+
...Finding.fields,
|
|
20735
|
+
approvedCode: optional2(Boolean3)
|
|
20736
|
+
});
|
|
20647
20737
|
var SeatOutput = Struct({
|
|
20648
20738
|
summary: String5,
|
|
20649
|
-
findings: ArraySchema(
|
|
20739
|
+
findings: ArraySchema(SeatFinding),
|
|
20650
20740
|
verdicts: optional2(ArraySchema(RebuttalVerdict)),
|
|
20651
20741
|
scope: optional2(ScopeJudgement),
|
|
20652
20742
|
followUps: optional2(ArraySchema(FollowUp))
|
|
@@ -20654,6 +20744,7 @@ var SeatOutput = Struct({
|
|
|
20654
20744
|
var Output = Struct({
|
|
20655
20745
|
summary: String5,
|
|
20656
20746
|
findings: ArraySchema(MergedFinding),
|
|
20747
|
+
approvedFindings: optional2(ArraySchema(MergedFinding)),
|
|
20657
20748
|
followUps: ArraySchema(FollowUp),
|
|
20658
20749
|
verdicts: ArraySchema(RebuttalVerdict),
|
|
20659
20750
|
blocking: Boolean3,
|
|
@@ -20670,6 +20761,13 @@ class ReviewTargetMissing extends TaggedError3()("ReviewTargetMissing", {
|
|
|
20670
20761
|
var targetOf = (input, head) => {
|
|
20671
20762
|
if (input.changeRequestId !== undefined)
|
|
20672
20763
|
return `ChangeRequest ${input.changeRequestId} at revision ${head}. Read it with \`kitman.changeRequests.get("${input.changeRequestId}")\` through Kitman's MCP, fetch its source branch, and review the diff of revision ${head} against its target branch, even if the branch has moved since. If the Runner cannot fetch that revision (a fork, say), report exactly that as your only finding, a blocker, and stop.`;
|
|
20764
|
+
if (input.base !== undefined && input.head !== undefined && input.files === undefined && input.approved !== undefined)
|
|
20765
|
+
return [
|
|
20766
|
+
`only what the change gained or lost since it was approved at ${input.approved}: compare \`git diff ${input.base}...${input.approved}\`, the change as approved, with \`git diff ${input.base}...${input.head}\`, the change now, in your checkout. The rest was reviewed and approved before.`,
|
|
20767
|
+
"Report a problem in code the change already had at the approved head only if it matters, with `approvedCode` set to true: such findings are kept apart and do not block."
|
|
20768
|
+
].join(`
|
|
20769
|
+
|
|
20770
|
+
`);
|
|
20673
20771
|
if (input.base !== undefined && input.head !== undefined)
|
|
20674
20772
|
return input.files === undefined ? `the change \`git diff ${input.base}...${input.head}\` in your checkout.` : [
|
|
20675
20773
|
`only these files of the change \`git diff ${input.base}...${input.head}\` in your checkout; the rest of it was reviewed and approved before:`,
|
|
@@ -20679,6 +20777,7 @@ var targetOf = (input, head) => {
|
|
|
20679
20777
|
`);
|
|
20680
20778
|
return;
|
|
20681
20779
|
};
|
|
20780
|
+
var wholeChange = (input) => input.files === undefined && input.approved === undefined;
|
|
20682
20781
|
var scopePrompt = (input) => [
|
|
20683
20782
|
"If your brief has a Task, judge its scope and give it as `scope`: does the change do what the Task's description and each of its Acceptance Criteria ask? Set `met` to true only if it does all of it, and list in `unmet` one line for each criterion or part of the description that is not done. If your brief has no Task, leave `scope` out.",
|
|
20684
20783
|
...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
|
|
@@ -20694,16 +20793,23 @@ var earlierPrompt = (earlier) => [
|
|
|
20694
20793
|
...earlier.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`)
|
|
20695
20794
|
].join(`
|
|
20696
20795
|
`);
|
|
20697
|
-
var promptFor = (seat, target, input) => [
|
|
20796
|
+
var promptFor = (seat, target, input, failing, notRun) => [
|
|
20698
20797
|
`You are one of two reviewers. Follow your \`${seats[seat].skill}\` skill; if you do not have it: ${seats[seat].focus}`,
|
|
20699
20798
|
`Review ${target}`,
|
|
20700
20799
|
"Give `summary`: one sentence on whether it can merge and what matters most.",
|
|
20701
20800
|
"Report each problem as a finding: severity blocker (must not ship), major (fix before merge) or minor (optional); the file path from the repository root; the line; and the detail. When it is one instance of a class of bug, name every other instance in the diff in its detail. Report nothing you have not checked in the code.",
|
|
20702
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.",
|
|
20703
|
-
...seat === scopeSeat && input
|
|
20802
|
+
...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
|
|
20704
20803
|
...input.earlier === undefined || input.earlier.length === 0 ? [] : [earlierPrompt(input.earlier)],
|
|
20705
|
-
...
|
|
20706
|
-
`These checks fail on this head and pass on the base: ${
|
|
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
|
+
`)
|
|
20707
20813
|
],
|
|
20708
20814
|
...input.rebuttals === undefined || input.rebuttals.length === 0 ? [] : [
|
|
20709
20815
|
"The implementer disputes these findings. For each, give a verdict: accepted if the rebuttal is right and the finding should be dropped.",
|
|
@@ -20720,12 +20826,16 @@ var followUpsOf = (earlier, answers) => earlier.map((finding) => {
|
|
|
20720
20826
|
status: statuses.length === 0 ? "still_there" : statuses.reduce((worst, status) => rank2[status] < rank2[worst] ? status : worst)
|
|
20721
20827
|
};
|
|
20722
20828
|
});
|
|
20723
|
-
var
|
|
20829
|
+
var findingLines = (findings) => findings.map((finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail} _(${finding.seats.join(", ")})_`).join(`
|
|
20830
|
+
`);
|
|
20831
|
+
var reviewText = (summary, findings, followUps, approvedFindings, notRun) => [
|
|
20724
20832
|
`**Kitman review.** ${summary}`,
|
|
20725
|
-
...
|
|
20726
|
-
|
|
20727
|
-
`)
|
|
20728
|
-
],
|
|
20833
|
+
...notRun.length === 0 ? [] : [`Verify never ran these tests, so they are unverified:
|
|
20834
|
+
${notRun.map((item) => `- ${item}`).join(`
|
|
20835
|
+
`)}`],
|
|
20836
|
+
...findings.length === 0 ? [] : [findingLines(findings)],
|
|
20837
|
+
...approvedFindings.length === 0 ? [] : [`In code approved before, not blocking:
|
|
20838
|
+
${findingLines(approvedFindings)}`],
|
|
20729
20839
|
...followUps.length === 0 ? [] : [
|
|
20730
20840
|
`Earlier findings:
|
|
20731
20841
|
${followUps.map((entry) => `- \`${entry.id}\` ${entry.status.replace("_", " ")}`).join(`
|
|
@@ -20741,7 +20851,7 @@ var fixBrief = (changeRequestId, findings) => [
|
|
|
20741
20851
|
`);
|
|
20742
20852
|
var review_default = defineLoop({
|
|
20743
20853
|
id: "review",
|
|
20744
|
-
version: "3.
|
|
20854
|
+
version: "3.5.0",
|
|
20745
20855
|
title: "Review",
|
|
20746
20856
|
input: Input,
|
|
20747
20857
|
output: Output,
|
|
@@ -20769,9 +20879,12 @@ var review_default = defineLoop({
|
|
|
20769
20879
|
const target = targetOf(input, head);
|
|
20770
20880
|
if (target === undefined)
|
|
20771
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])];
|
|
20772
20885
|
const outputs = yield* forEach2(seatNames, (seat) => agentWork(`review:${seat}`, {
|
|
20773
20886
|
agent: seat,
|
|
20774
|
-
prompt: promptFor(seat, target, input),
|
|
20887
|
+
prompt: promptFor(seat, target, input, failing, notRun),
|
|
20775
20888
|
output: SeatOutput
|
|
20776
20889
|
}).pipe(map8((output) => [seat, output])), { concurrency: "unbounded" });
|
|
20777
20890
|
const earlier = input.earlier ?? [];
|
|
@@ -20786,22 +20899,24 @@ var review_default = defineLoop({
|
|
|
20786
20899
|
};
|
|
20787
20900
|
const carried = earlier.filter((finding) => standing.has(finding.id) && !withdrawn(finding.id));
|
|
20788
20901
|
const followUps = answered.filter((entry) => !withdrawn(entry.id));
|
|
20789
|
-
const
|
|
20902
|
+
const sinceApproval = input.approved !== undefined && input.files === undefined;
|
|
20903
|
+
const merged = (approvedCode) => mergeFindings(Object.fromEntries(outputs.map(([seat, output]) => [
|
|
20790
20904
|
seat,
|
|
20791
|
-
output.findings.filter((finding) => !earlierIds.has(`${finding.file}:${finding.line}`))
|
|
20905
|
+
output.findings.filter((finding) => !earlierIds.has(`${finding.file}:${finding.line}`) && (sinceApproval && finding.approvedCode === true) === approvedCode)
|
|
20792
20906
|
])));
|
|
20907
|
+
const fresh = merged(false);
|
|
20908
|
+
const approvedFindings = sinceApproval ? merged(true) : [];
|
|
20793
20909
|
const findings = [...carried, ...fresh];
|
|
20794
20910
|
const blockers = findings.filter(isBlocking);
|
|
20795
|
-
const scope = input
|
|
20796
|
-
const
|
|
20797
|
-
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 ? "No findings: nothing stands in the way of merging." : ["Can merge: nothing blocks it.", ...outputs.map(([, output]) => output.summary)].join(" ");
|
|
20911
|
+
const scope = wholeChange(input) ? outputs.find(([seat]) => seat === scopeSeat)?.[1].scope : undefined;
|
|
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(" ");
|
|
20798
20913
|
const freshIds = new Set(fresh.map((finding) => finding.id));
|
|
20799
|
-
const text = reviewText(summary, findings, followUps);
|
|
20914
|
+
const text = reviewText(summary, findings, followUps, approvedFindings, notRun);
|
|
20800
20915
|
const stored = yield* artifact("findings", {
|
|
20801
20916
|
kind: "review-findings",
|
|
20802
20917
|
title: "Review findings",
|
|
20803
20918
|
text,
|
|
20804
|
-
data: { findings, followUps }
|
|
20919
|
+
data: { findings, followUps, ...approvedFindings.length === 0 ? undefined : { approvedFindings } }
|
|
20805
20920
|
});
|
|
20806
20921
|
const reviewed = {
|
|
20807
20922
|
summary,
|
|
@@ -20810,12 +20925,13 @@ var review_default = defineLoop({
|
|
|
20810
20925
|
verdicts,
|
|
20811
20926
|
blocking: findings.some(isBlocking),
|
|
20812
20927
|
artifactId: stored.artifactId,
|
|
20928
|
+
...approvedFindings.length === 0 ? undefined : { approvedFindings },
|
|
20813
20929
|
...scope === undefined ? undefined : { scope }
|
|
20814
20930
|
};
|
|
20815
20931
|
const changeRequestId = input.changeRequestId;
|
|
20816
20932
|
if (changeRequestId === undefined || head === undefined)
|
|
20817
20933
|
return reviewed;
|
|
20818
|
-
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 }));
|
|
20819
20935
|
const answer = input.next ?? (yield* ask("next", {
|
|
20820
20936
|
prompt: `${summary}
|
|
20821
20937
|
|
|
@@ -20826,8 +20942,8 @@ What next?`,
|
|
|
20826
20942
|
{ value: "Build from it", description: "A Build fixes them in a new ChangeRequest." },
|
|
20827
20943
|
{ value: "Done", description: "Keeps the review as an artifact and stops." }
|
|
20828
20944
|
],
|
|
20829
|
-
recommended: reviewed.blocking ? "Fix here" : "Done",
|
|
20830
|
-
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.",
|
|
20831
20947
|
default: "Done",
|
|
20832
20948
|
timeout: "1 hour"
|
|
20833
20949
|
}));
|
|
@@ -21209,23 +21325,31 @@ ${drafted.notes}`,
|
|
|
21209
21325
|
|
|
21210
21326
|
// src/shepherd-output.ts
|
|
21211
21327
|
var ShepherdOutput = Struct({
|
|
21212
|
-
status: Literals(["merged", "ready", "needs_you"]),
|
|
21328
|
+
status: Literals(["merged", "ready", "needs_you", "handed_back"]),
|
|
21213
21329
|
reason: String5,
|
|
21214
21330
|
fixRounds: Int,
|
|
21215
21331
|
replies: Int,
|
|
21216
|
-
release: optional2(Struct({ runStatus: String5, reason: String5, tag: optional2(String5) }))
|
|
21332
|
+
release: optional2(Struct({ runStatus: String5, reason: String5, tag: optional2(String5) })),
|
|
21333
|
+
handBack: optional2(Struct({
|
|
21334
|
+
changeRequestId: String5,
|
|
21335
|
+
words: String5,
|
|
21336
|
+
taskId: optional2(String5),
|
|
21337
|
+
branch: optional2(String5)
|
|
21338
|
+
}))
|
|
21217
21339
|
});
|
|
21218
21340
|
|
|
21219
21341
|
// src/shepherd.ts
|
|
21220
21342
|
var reviewLoop = () => ({ id: "review", input: Input, output: Output });
|
|
21221
21343
|
var stepBudget = "45 minutes";
|
|
21344
|
+
var roundLimits = { "ci-fix": 1, "head-fix": 2 };
|
|
21345
|
+
var handBackAnswer = "Hand back to Build";
|
|
21222
21346
|
var Input3 = Struct({
|
|
21223
21347
|
changeRequestId: String5,
|
|
21224
21348
|
taskId: optional2(String5),
|
|
21225
21349
|
merge: optional2(Boolean3),
|
|
21350
|
+
notRun: optional2(ArraySchema(String5)),
|
|
21226
21351
|
branch: optional2(String5),
|
|
21227
21352
|
continuing: optional2(Continuing),
|
|
21228
|
-
maxFixRounds: optional2(Int),
|
|
21229
21353
|
maxCycles: optional2(Int)
|
|
21230
21354
|
});
|
|
21231
21355
|
var Output3 = ShepherdOutput;
|
|
@@ -21243,24 +21367,39 @@ var Replies = Struct({
|
|
|
21243
21367
|
var failedJobs = (pipeline) => pipeline.jobs.flatMap((job) => job.status === "failed" ? [`### ${job.name}${job.url === undefined ? "" : ` (${job.url})`}
|
|
21244
21368
|
|
|
21245
21369
|
${job.logTail ?? "No log was served."}`] : []);
|
|
21246
|
-
var
|
|
21247
|
-
|
|
21248
|
-
|
|
21249
|
-
|
|
21250
|
-
|
|
21251
|
-
|
|
21252
|
-
|
|
21370
|
+
var failingJobs = (pipeline) => pipeline.jobs.flatMap((job) => job.status === "failed" ? [job.name] : []);
|
|
21371
|
+
var ciFixPrompt = (pipeline, target, onTarget) => {
|
|
21372
|
+
const unknown = failingJobs(pipeline).filter((name) => !onTarget.failed.includes(name) && !onTarget.passed.includes(name));
|
|
21373
|
+
return [
|
|
21374
|
+
`The pipeline at ${pipeline.head} failed. These jobs failed, with the end of each log:`,
|
|
21375
|
+
...failedJobs(pipeline),
|
|
21376
|
+
"Run the failing job once more here to rule out a flake; if it passes, change nothing and answer flaky.",
|
|
21377
|
+
...onTarget.passed.length === 0 ? [] : [
|
|
21378
|
+
`Kitman ran ${onTarget.passed.join(", ")} at the head of \`origin/${target}\` and they passed there, so do not run them on the target branch.`
|
|
21379
|
+
],
|
|
21380
|
+
...onTarget.failed.length === 0 ? [] : [
|
|
21381
|
+
`${onTarget.failed.join(", ")} fail at the head of \`origin/${target}\` too: they are the target's to fix, so leave them as they are.`
|
|
21382
|
+
],
|
|
21383
|
+
...unknown.length === 0 ? [] : [
|
|
21384
|
+
`Run ${unknown.join(", ")} on the target branch (a worktree of \`origin/${target}\`, which Kitman fetched just before this Step; do not fetch). If every failing job fails there too, the branch did not cause it: change nothing and answer pre_existing.`
|
|
21385
|
+
],
|
|
21386
|
+
"Otherwise it is this branch's own failure: write or fix a test that shows it first, then fix it, and answer fixed. Kitman pushes what you leave."
|
|
21387
|
+
].join(`
|
|
21253
21388
|
|
|
21254
21389
|
`);
|
|
21390
|
+
};
|
|
21391
|
+
var turnResource = (target, repository) => `merge:${repository === undefined ? "" : `${repository}:`}${target}`.toLowerCase().replace(/[^a-z0-9._:-]+/g, "-").slice(0, 128);
|
|
21255
21392
|
var threadLine = (thread) => [
|
|
21256
21393
|
`### Thread ${thread.id}${thread.path === undefined ? "" : ` on ${thread.path}${thread.line === undefined ? "" : `:${thread.line}`}`}`,
|
|
21257
21394
|
...thread.comments.map((entry) => `${entry.author ?? "someone"}: ${entry.body}`)
|
|
21258
21395
|
].join(`
|
|
21259
21396
|
`);
|
|
21260
21397
|
var ReviewFix = Struct({ summary: String5 });
|
|
21398
|
+
var findingLines2 = (findings) => findings.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`).join(`
|
|
21399
|
+
`);
|
|
21261
21400
|
var reviewFixPrompt = (reviewed, findings) => [
|
|
21262
21401
|
`A review of ${reviewed} found these. Fix each blocker and major finding, with a test that shows it where one can. Kitman pushes what you leave.`,
|
|
21263
|
-
|
|
21402
|
+
findingLines2(findings)
|
|
21264
21403
|
].join(`
|
|
21265
21404
|
`);
|
|
21266
21405
|
var catchUpVerdict = (catchUp) => {
|
|
@@ -21282,7 +21421,7 @@ var repliesPrompt = (threads) => [
|
|
|
21282
21421
|
var threadKey = (thread) => `${thread.id}:${thread.comments.length}`;
|
|
21283
21422
|
var shepherd_default = defineLoop({
|
|
21284
21423
|
id: "shepherd",
|
|
21285
|
-
version: "1.
|
|
21424
|
+
version: "1.3.0",
|
|
21286
21425
|
title: "Shepherd",
|
|
21287
21426
|
input: Input3,
|
|
21288
21427
|
output: Output3,
|
|
@@ -21297,9 +21436,11 @@ var shepherd_default = defineLoop({
|
|
|
21297
21436
|
"call",
|
|
21298
21437
|
"write_back",
|
|
21299
21438
|
"ask",
|
|
21300
|
-
"verify"
|
|
21439
|
+
"verify",
|
|
21440
|
+
"claim"
|
|
21301
21441
|
],
|
|
21302
21442
|
calls: () => [review_default, release_default],
|
|
21443
|
+
offers: [{ id: "build", title: "Hand back to Build", loop: "build", from: "handBack" }],
|
|
21303
21444
|
run: (input) => {
|
|
21304
21445
|
const changeRequestId = input.changeRequestId;
|
|
21305
21446
|
const target = input.continuing?.targetBranch ?? input.branch ?? "HEAD";
|
|
@@ -21308,7 +21449,9 @@ var shepherd_default = defineLoop({
|
|
|
21308
21449
|
const ranOnRunner = new Set;
|
|
21309
21450
|
const leftToPerson = new Set;
|
|
21310
21451
|
let headFindings = [];
|
|
21311
|
-
|
|
21452
|
+
const unranAt = new Map;
|
|
21453
|
+
const rounds = { "ci-fix": 0, "head-fix": 0 };
|
|
21454
|
+
const allowed = { "ci-fix": 0, "head-fix": 0 };
|
|
21312
21455
|
let replies = 0;
|
|
21313
21456
|
let stalledAt;
|
|
21314
21457
|
let stalls = 0;
|
|
@@ -21316,7 +21459,65 @@ var shepherd_default = defineLoop({
|
|
|
21316
21459
|
let notCarried;
|
|
21317
21460
|
let behind = false;
|
|
21318
21461
|
let pushed;
|
|
21319
|
-
|
|
21462
|
+
let turn;
|
|
21463
|
+
let turns = 0;
|
|
21464
|
+
let passes = 0;
|
|
21465
|
+
let repository;
|
|
21466
|
+
let redTarget;
|
|
21467
|
+
const fixRounds = () => rounds["ci-fix"] + rounds["head-fix"];
|
|
21468
|
+
const done = (status, reason) => ({
|
|
21469
|
+
status,
|
|
21470
|
+
reason,
|
|
21471
|
+
fixRounds: fixRounds(),
|
|
21472
|
+
replies
|
|
21473
|
+
});
|
|
21474
|
+
const handBack = (reason, open) => ({
|
|
21475
|
+
...done("handed_back", reason),
|
|
21476
|
+
handBack: {
|
|
21477
|
+
changeRequestId,
|
|
21478
|
+
words: `Shepherd handed ChangeRequest ${changeRequestId} back: ${reason}. Fix it forward on its branch:
|
|
21479
|
+
${open}`,
|
|
21480
|
+
...input.taskId === undefined ? undefined : { taskId: input.taskId },
|
|
21481
|
+
...target === "HEAD" ? undefined : { branch: target }
|
|
21482
|
+
}
|
|
21483
|
+
});
|
|
21484
|
+
const takeTurn = () => gen2(function* () {
|
|
21485
|
+
if (turn !== undefined)
|
|
21486
|
+
return;
|
|
21487
|
+
return yield* claim(`turn:${++turns}`, { resource: turnResource(target, repository) }).pipe(map8((granted) => {
|
|
21488
|
+
turn = granted;
|
|
21489
|
+
return;
|
|
21490
|
+
}), catchTag2("StepFailed", (error) => succeed7(error.reason)));
|
|
21491
|
+
});
|
|
21492
|
+
const passTurn = () => gen2(function* () {
|
|
21493
|
+
if (turn === undefined)
|
|
21494
|
+
return;
|
|
21495
|
+
const held = turn;
|
|
21496
|
+
turn = undefined;
|
|
21497
|
+
yield* letGo(`pass-turn:${++passes}`, held);
|
|
21498
|
+
});
|
|
21499
|
+
const mayFix = (kind, cycle, open) => gen2(function* () {
|
|
21500
|
+
if (rounds[kind] < roundLimits[kind] + allowed[kind])
|
|
21501
|
+
return true;
|
|
21502
|
+
const answer = yield* ask(`rounds:${cycle}`, {
|
|
21503
|
+
prompt: `Shepherd has run ${rounds[kind]} ${kind} rounds, its limit, and ${open} still stands. Hand the ChangeRequest back to Build?`,
|
|
21504
|
+
options: [
|
|
21505
|
+
{
|
|
21506
|
+
value: handBackAnswer,
|
|
21507
|
+
description: "Stops here; the ChangeRequest stays open, with a Build offer that carries what is open."
|
|
21508
|
+
},
|
|
21509
|
+
{ value: "One more round", description: `Runs one more ${kind} round here.` }
|
|
21510
|
+
],
|
|
21511
|
+
recommended: handBackAnswer,
|
|
21512
|
+
recommendationReason: "More rounds here have not settled it, and Build fixes and reviews the change as a whole.",
|
|
21513
|
+
default: handBackAnswer,
|
|
21514
|
+
auto: handBackAnswer,
|
|
21515
|
+
timeout: "1 hour"
|
|
21516
|
+
});
|
|
21517
|
+
if (answer !== handBackAnswer)
|
|
21518
|
+
allowed[kind]++;
|
|
21519
|
+
return answer !== handBackAnswer;
|
|
21520
|
+
});
|
|
21320
21521
|
const runOnRunner = (step, cycle, head, checks) => gen2(function* () {
|
|
21321
21522
|
const verification = `pipeline-${step}:${cycle}`;
|
|
21322
21523
|
const failed = yield* verify(verification, { revision: head, checks }).pipe(as2(undefined), catchTag2("StepFailed", (error) => succeed7(error.reason)));
|
|
@@ -21327,6 +21528,86 @@ var shepherd_default = defineLoop({
|
|
|
21327
21528
|
});
|
|
21328
21529
|
return failed;
|
|
21329
21530
|
});
|
|
21531
|
+
const checkTarget = (cycle, pipeline) => gen2(function* () {
|
|
21532
|
+
const failing = failingJobs(pipeline);
|
|
21533
|
+
const onForge = (pipeline.target?.jobs ?? []).filter((job) => failing.includes(job.name));
|
|
21534
|
+
const failed = onForge.flatMap((job) => job.status === "failed" ? [job.name] : []);
|
|
21535
|
+
const passed = onForge.flatMap((job) => job.status === "success" ? [job.name] : []);
|
|
21536
|
+
const onRunner = failing.filter((name) => !failed.includes(name) && !passed.includes(name) && (pipeline.runnerChecks ?? []).includes(name));
|
|
21537
|
+
if (onRunner.length === 0)
|
|
21538
|
+
return { failed, passed };
|
|
21539
|
+
const atTarget = yield* verify(`target-check:${cycle}`, {
|
|
21540
|
+
revision: `origin/${target}`,
|
|
21541
|
+
checks: onRunner
|
|
21542
|
+
}).pipe(catchTag2("StepFailed", () => undefined_2));
|
|
21543
|
+
const ran = atTarget?.checks.filter((check) => onRunner.includes(check.name)) ?? [];
|
|
21544
|
+
return {
|
|
21545
|
+
failed: [...failed, ...ran.flatMap((check) => check.status === "failed" ? [check.name] : [])],
|
|
21546
|
+
passed: [...passed, ...ran.flatMap((check) => check.status === "passed" ? [check.name] : [])]
|
|
21547
|
+
};
|
|
21548
|
+
});
|
|
21549
|
+
const waitOutTarget = (cycle, pipeline, why) => gen2(function* () {
|
|
21550
|
+
yield* passTurn();
|
|
21551
|
+
yield* note(`target-red:${cycle}`, {
|
|
21552
|
+
text: `Shepherd is waiting for ${target} to change instead of fixing ${pipeline.head}: ${why}`
|
|
21553
|
+
}).pipe(catchTag2("StepFailed", () => void_3));
|
|
21554
|
+
const woke = yield* waitFor(`target-moved:${cycle}`, {
|
|
21555
|
+
event: "change_request.closed",
|
|
21556
|
+
filter: {
|
|
21557
|
+
merged: true,
|
|
21558
|
+
...target === "HEAD" ? undefined : { targetBranch: target },
|
|
21559
|
+
...repository === undefined ? undefined : { repository }
|
|
21560
|
+
},
|
|
21561
|
+
or: [{ event: "change_request.closed", filter: { changeRequestId } }],
|
|
21562
|
+
timeout: "1 hour",
|
|
21563
|
+
...pipeline.readAt === undefined ? undefined : { since: pipeline.readAt }
|
|
21564
|
+
}).pipe(catchTag2("WaitTimedOut", () => undefined_2));
|
|
21565
|
+
if (woke?.payload.changeRequestId === changeRequestId)
|
|
21566
|
+
return woke.payload.merged === true ? done("merged", "Someone else merged the ChangeRequest") : done("needs_you", "The ChangeRequest was closed");
|
|
21567
|
+
redTarget = { head: pipeline.head, targetHead: pipeline.target?.head, moved: woke !== undefined };
|
|
21568
|
+
return;
|
|
21569
|
+
});
|
|
21570
|
+
const catchUp = (cycle) => gen2(function* () {
|
|
21571
|
+
const refused = yield* takeTurn();
|
|
21572
|
+
if (refused !== undefined)
|
|
21573
|
+
return done("needs_you", `The turn to merge into ${target} was refused: ${refused}`);
|
|
21574
|
+
const synced = yield* syncBase(`sync:${cycle}`, { agent: "implementer", target });
|
|
21575
|
+
if (synced.status === "conflict")
|
|
21576
|
+
return done("needs_you", `Merging ${target} in conflicts on ${synced.files.join(", ")}: ${synced.reason}`);
|
|
21577
|
+
if (synced.status !== "merged")
|
|
21578
|
+
return;
|
|
21579
|
+
const caught = synced.catchUp;
|
|
21580
|
+
const verdict = caught === undefined ? { kind: "changed", why: "its Runner did not report what it did to the branch" } : catchUpVerdict(caught);
|
|
21581
|
+
if (verdict.kind === "changed") {
|
|
21582
|
+
unreviewed = undefined;
|
|
21583
|
+
notCarried = `merging ${target} in changed it: ${verdict.why}`;
|
|
21584
|
+
} else if (caught !== undefined && unreviewed !== undefined) {
|
|
21585
|
+
const files = [...new Set([...unreviewed.files, ...verdict.kind === "review" ? verdict.files : []])];
|
|
21586
|
+
unreviewed = caught.from === unreviewed.synced ? { ...unreviewed, files, synced: caught.head } : { ...unreviewed, files };
|
|
21587
|
+
} else if (caught !== undefined && verdict.kind === "review") {
|
|
21588
|
+
notCarried = undefined;
|
|
21589
|
+
unreviewed = { files: verdict.files, synced: caught.head, sync: `sync:${cycle}`, earlier: [] };
|
|
21590
|
+
} else if (caught !== undefined) {
|
|
21591
|
+
notCarried = undefined;
|
|
21592
|
+
const carried = yield* approveChangeRequest(`carry:${cycle}`, {
|
|
21593
|
+
changeRequestId,
|
|
21594
|
+
head: caught.head,
|
|
21595
|
+
summary: `Merging ${target} in left the branch's own diff as it was approved.`,
|
|
21596
|
+
carries: `sync:${cycle}`
|
|
21597
|
+
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
|
|
21598
|
+
if (!carried.approved)
|
|
21599
|
+
notCarried = `the approval was not carried: ${carried.reason}`;
|
|
21600
|
+
}
|
|
21601
|
+
if (caught !== undefined) {
|
|
21602
|
+
pushed = { head: caught.head, stale: 0 };
|
|
21603
|
+
yield* waitFor(`pushed:${cycle}`, {
|
|
21604
|
+
event: "change_request.mergeable",
|
|
21605
|
+
filter: { changeRequestId, head: caught.head },
|
|
21606
|
+
timeout: "5 minutes"
|
|
21607
|
+
}).pipe(catchTag2("WaitTimedOut", () => void_3));
|
|
21608
|
+
}
|
|
21609
|
+
return;
|
|
21610
|
+
});
|
|
21330
21611
|
return gen2(function* () {
|
|
21331
21612
|
for (let cycle = 1;; cycle++) {
|
|
21332
21613
|
if (cycle > (input.maxCycles ?? 20)) {
|
|
@@ -21342,6 +21623,7 @@ var shepherd_default = defineLoop({
|
|
|
21342
21623
|
return done("needs_you", `Stopped after ${cycle - 1} looks without landing it`);
|
|
21343
21624
|
}
|
|
21344
21625
|
const pipeline = yield* pipelineStatus(`pipeline:${cycle}`, { changeRequestId });
|
|
21626
|
+
repository = pipeline.repository ?? repository;
|
|
21345
21627
|
if (pushed !== undefined && pipeline.head !== pushed.head) {
|
|
21346
21628
|
if (++pushed.stale > 5)
|
|
21347
21629
|
return done("needs_you", `The forge still shows ${pipeline.head}, not ${pushed.head} that the catch-up pushed`);
|
|
@@ -21368,24 +21650,61 @@ var shepherd_default = defineLoop({
|
|
|
21368
21650
|
continue;
|
|
21369
21651
|
}
|
|
21370
21652
|
if (pipeline.status === "failed" || pipeline.status === "canceled") {
|
|
21653
|
+
const targetMoved = redTarget?.head === pipeline.head && (redTarget.targetHead !== undefined && pipeline.target !== undefined ? pipeline.target.head !== redTarget.targetHead : redTarget.moved);
|
|
21654
|
+
if (targetMoved) {
|
|
21655
|
+
redTarget = undefined;
|
|
21656
|
+
const stopped = yield* catchUp(cycle);
|
|
21657
|
+
if (stopped !== undefined)
|
|
21658
|
+
return stopped;
|
|
21659
|
+
continue;
|
|
21660
|
+
}
|
|
21661
|
+
const onTarget = yield* checkTarget(cycle, pipeline);
|
|
21662
|
+
const failing = failingJobs(pipeline);
|
|
21663
|
+
if (failing.length > 0 && failing.every((name) => onTarget.failed.includes(name))) {
|
|
21664
|
+
const stopped = yield* waitOutTarget(cycle, pipeline, `${target} fails ${failing.join(", ")} at its own head too, so no fix here can mend it`);
|
|
21665
|
+
if (stopped !== undefined)
|
|
21666
|
+
return stopped;
|
|
21667
|
+
continue;
|
|
21668
|
+
}
|
|
21669
|
+
if (onTarget.passed.length > 0 && redTarget?.head === pipeline.head) {
|
|
21670
|
+
redTarget = undefined;
|
|
21671
|
+
const stopped = yield* catchUp(cycle);
|
|
21672
|
+
if (stopped !== undefined)
|
|
21673
|
+
return stopped;
|
|
21674
|
+
continue;
|
|
21675
|
+
}
|
|
21676
|
+
if (redTarget?.head === pipeline.head) {
|
|
21677
|
+
const stopped = yield* waitOutTarget(cycle, pipeline, `${target} still fails as ${pipeline.head} does`);
|
|
21678
|
+
if (stopped !== undefined)
|
|
21679
|
+
return stopped;
|
|
21680
|
+
continue;
|
|
21681
|
+
}
|
|
21371
21682
|
if (stalledAt === pipeline.head)
|
|
21372
21683
|
stalls++;
|
|
21373
21684
|
else
|
|
21374
21685
|
stalls = 0;
|
|
21375
21686
|
if (stalls >= 2)
|
|
21376
21687
|
return done("needs_you", `Two fixes pushed nothing new; the pipeline at ${pipeline.head} still fails`);
|
|
21377
|
-
if (
|
|
21378
|
-
return
|
|
21379
|
-
|
|
21688
|
+
if (!(yield* mayFix("ci-fix", cycle, `the failing pipeline at ${pipeline.head}`)))
|
|
21689
|
+
return handBack(`The pipeline at ${pipeline.head} still fails after ${rounds["ci-fix"]} ci-fix rounds`, failedJobs(pipeline).join(`
|
|
21690
|
+
|
|
21691
|
+
`));
|
|
21380
21692
|
stalledAt = pipeline.head;
|
|
21693
|
+
yield* passTurn();
|
|
21381
21694
|
const fixed = yield* agentWork(`ci-fix:${cycle}`, {
|
|
21382
21695
|
agent: "implementer",
|
|
21383
|
-
prompt: ciFixPrompt(pipeline, target),
|
|
21696
|
+
prompt: ciFixPrompt(pipeline, target, onTarget),
|
|
21384
21697
|
output: CiFix,
|
|
21385
21698
|
timeout: stepBudget
|
|
21386
21699
|
});
|
|
21387
|
-
if (fixed.verdict === "
|
|
21388
|
-
|
|
21700
|
+
if (fixed.verdict === "fixed")
|
|
21701
|
+
rounds["ci-fix"]++;
|
|
21702
|
+
if (fixed.verdict === "pre_existing") {
|
|
21703
|
+
const stopped = yield* waitOutTarget(cycle, pipeline, `the failure is pre-existing on the target branch: ${fixed.summary}`);
|
|
21704
|
+
if (stopped !== undefined)
|
|
21705
|
+
return stopped;
|
|
21706
|
+
continue;
|
|
21707
|
+
}
|
|
21389
21708
|
if (fixed.verdict === "flaky") {
|
|
21390
21709
|
if (pipeline.source === "reported") {
|
|
21391
21710
|
if (pipeline.runnerChecks === undefined)
|
|
@@ -21406,8 +21725,10 @@ var shepherd_default = defineLoop({
|
|
|
21406
21725
|
}
|
|
21407
21726
|
continue;
|
|
21408
21727
|
}
|
|
21728
|
+
redTarget = undefined;
|
|
21409
21729
|
const threads = (yield* reviewThreads(`threads:${cycle}`, { changeRequestId })).threads.filter((thread) => !answered.has(threadKey(thread)));
|
|
21410
21730
|
if (threads.length > 0) {
|
|
21731
|
+
yield* passTurn();
|
|
21411
21732
|
const answers = yield* agentWork(`comments:${cycle}`, {
|
|
21412
21733
|
agent: "implementer",
|
|
21413
21734
|
prompt: repliesPrompt(threads),
|
|
@@ -21442,47 +21763,16 @@ var shepherd_default = defineLoop({
|
|
|
21442
21763
|
continue;
|
|
21443
21764
|
if (mergeable.payload.mergeable === false || behind) {
|
|
21444
21765
|
behind = false;
|
|
21445
|
-
const
|
|
21446
|
-
if (
|
|
21447
|
-
return
|
|
21448
|
-
if (synced.status === "merged") {
|
|
21449
|
-
const caught = synced.catchUp;
|
|
21450
|
-
const verdict = caught === undefined ? { kind: "changed", why: "its Runner did not report what it did to the branch" } : catchUpVerdict(caught);
|
|
21451
|
-
if (verdict.kind === "changed") {
|
|
21452
|
-
unreviewed = undefined;
|
|
21453
|
-
notCarried = `merging ${target} in changed it: ${verdict.why}`;
|
|
21454
|
-
} else if (caught !== undefined && unreviewed !== undefined) {
|
|
21455
|
-
const files = [...new Set([...unreviewed.files, ...verdict.kind === "review" ? verdict.files : []])];
|
|
21456
|
-
unreviewed = caught.from === unreviewed.synced ? { ...unreviewed, files, synced: caught.head } : { ...unreviewed, files };
|
|
21457
|
-
} else if (caught !== undefined && verdict.kind === "review") {
|
|
21458
|
-
notCarried = undefined;
|
|
21459
|
-
unreviewed = { files: verdict.files, synced: caught.head, sync: `sync:${cycle}`, earlier: [] };
|
|
21460
|
-
} else if (caught !== undefined) {
|
|
21461
|
-
notCarried = undefined;
|
|
21462
|
-
const carried = yield* approveChangeRequest(`carry:${cycle}`, {
|
|
21463
|
-
changeRequestId,
|
|
21464
|
-
head: caught.head,
|
|
21465
|
-
summary: `Merging ${target} in left the branch's own diff as it was approved.`,
|
|
21466
|
-
carries: `sync:${cycle}`
|
|
21467
|
-
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
|
|
21468
|
-
if (!carried.approved)
|
|
21469
|
-
notCarried = `the approval was not carried: ${carried.reason}`;
|
|
21470
|
-
}
|
|
21471
|
-
if (caught !== undefined) {
|
|
21472
|
-
pushed = { head: caught.head, stale: 0 };
|
|
21473
|
-
yield* waitFor(`pushed:${cycle}`, {
|
|
21474
|
-
event: "change_request.mergeable",
|
|
21475
|
-
filter: { changeRequestId, head: caught.head },
|
|
21476
|
-
timeout: "5 minutes"
|
|
21477
|
-
}).pipe(catchTag2("WaitTimedOut", () => void_3));
|
|
21478
|
-
}
|
|
21479
|
-
}
|
|
21766
|
+
const stopped = yield* catchUp(cycle);
|
|
21767
|
+
if (stopped !== undefined)
|
|
21768
|
+
return stopped;
|
|
21480
21769
|
continue;
|
|
21481
21770
|
}
|
|
21482
21771
|
let reviewedHere = false;
|
|
21483
21772
|
if (unreviewed !== undefined) {
|
|
21484
21773
|
const files = unreviewed;
|
|
21485
21774
|
const head = pipeline.head;
|
|
21775
|
+
yield* passTurn();
|
|
21486
21776
|
const reviewed = yield* call(`review:${cycle}`, reviewLoop(), {
|
|
21487
21777
|
base: `origin/${target}`,
|
|
21488
21778
|
head,
|
|
@@ -21492,9 +21782,9 @@ var shepherd_default = defineLoop({
|
|
|
21492
21782
|
});
|
|
21493
21783
|
if (reviewed.blocking) {
|
|
21494
21784
|
const blocking = reviewed.findings.filter(isBlocking);
|
|
21495
|
-
if (
|
|
21496
|
-
return
|
|
21497
|
-
|
|
21785
|
+
if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
|
|
21786
|
+
return handBack(`The review of the catch-up merge's files still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, findingLines2(blocking));
|
|
21787
|
+
rounds["head-fix"]++;
|
|
21498
21788
|
yield* agentWork(`review-fix:${cycle}`, {
|
|
21499
21789
|
agent: "implementer",
|
|
21500
21790
|
prompt: reviewFixPrompt("the files the catch-up merge changed", blocking),
|
|
@@ -21540,73 +21830,102 @@ var shepherd_default = defineLoop({
|
|
|
21540
21830
|
}).pipe(map8((woke) => woke.type === "change_request.approval" && woke.payload.source !== "kitman" ? undefined : woke), catchTag2("WaitTimedOut", () => undefined_2));
|
|
21541
21831
|
if (!reviewedHere && approved === undefined) {
|
|
21542
21832
|
const head = pipeline.head;
|
|
21833
|
+
const since = pipeline.approved === undefined || pipeline.approved === head ? undefined : pipeline.approved;
|
|
21543
21834
|
const reviewIt = leftToPerson.has(head) ? "Wait" : yield* ask(`unapproved:${cycle}`, {
|
|
21544
21835
|
prompt: `Nobody has approved ${head}, the head whose pipeline passed. Have Kitman review it?`,
|
|
21545
21836
|
options: [
|
|
21546
21837
|
{
|
|
21547
21838
|
value: "Review",
|
|
21548
|
-
description: "Kitman's Review reads the whole change at this head and approves it if nothing blocks."
|
|
21839
|
+
description: since === undefined ? "Kitman's Review reads the whole change at this head and approves it if nothing blocks." : `Kitman's Review reads what changed since ${since}, the last approved head, and approves it if nothing there blocks.`
|
|
21549
21840
|
},
|
|
21550
21841
|
{ value: "Wait", description: "Waits for a person to approve this head." }
|
|
21551
21842
|
],
|
|
21552
21843
|
recommended: "Review",
|
|
21553
|
-
recommendationReason: "A passing Review of the
|
|
21844
|
+
recommendationReason: "A passing Review of the change is what approved the head Build shipped.",
|
|
21554
21845
|
default: "Wait",
|
|
21555
21846
|
auto: "Review",
|
|
21556
21847
|
timeout: "1 hour"
|
|
21557
21848
|
});
|
|
21849
|
+
yield* passTurn();
|
|
21558
21850
|
if (reviewIt === "Wait") {
|
|
21559
21851
|
leftToPerson.add(head);
|
|
21560
21852
|
approved = yield* waitFor(`approval:${cycle}`, { ...approval, timeout: "7 days" });
|
|
21561
21853
|
} else {
|
|
21854
|
+
const { notRun: headNotRun } = yield* verifyHead(`head-verify:${cycle}`, head);
|
|
21855
|
+
const notRun = [...new Set([...input.notRun ?? [], ...headNotRun])];
|
|
21562
21856
|
const reviewed = yield* call(`head-review:${cycle}`, reviewLoop(), {
|
|
21563
21857
|
base: `origin/${target}`,
|
|
21564
21858
|
head,
|
|
21859
|
+
...notRun.length === 0 ? undefined : { notRun },
|
|
21860
|
+
...since === undefined ? undefined : { approved: since },
|
|
21565
21861
|
...headFindings.length === 0 ? undefined : { earlier: headFindings }
|
|
21566
21862
|
});
|
|
21567
21863
|
if (reviewed.blocking) {
|
|
21568
21864
|
const blocking = reviewed.findings.filter(isBlocking);
|
|
21569
|
-
if (
|
|
21570
|
-
return
|
|
21571
|
-
|
|
21865
|
+
if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
|
|
21866
|
+
return handBack(`The review of ${head} still finds ${blocking.map((finding) => finding.id).join(", ")} after ${rounds["head-fix"]} head-fix rounds`, findingLines2(blocking));
|
|
21867
|
+
rounds["head-fix"]++;
|
|
21572
21868
|
yield* agentWork(`head-fix:${cycle}`, {
|
|
21573
21869
|
agent: "implementer",
|
|
21574
|
-
prompt: reviewFixPrompt(`the change at ${head}`, blocking),
|
|
21870
|
+
prompt: reviewFixPrompt(since === undefined ? `the change at ${head}` : `what changed between ${since} and ${head}`, blocking),
|
|
21575
21871
|
output: ReviewFix,
|
|
21576
21872
|
timeout: stepBudget
|
|
21577
21873
|
});
|
|
21578
21874
|
headFindings = reviewed.findings;
|
|
21579
21875
|
continue;
|
|
21580
21876
|
}
|
|
21581
|
-
const recorded = yield* approveChangeRequest(`head-approve:${cycle}`, {
|
|
21582
|
-
changeRequestId,
|
|
21583
|
-
head,
|
|
21584
|
-
summary: `A review of the whole change at ${head} passed with nothing blocking.`,
|
|
21585
|
-
review: `head-review:${cycle}`
|
|
21586
|
-
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason })));
|
|
21587
|
-
if (!recorded.approved)
|
|
21588
|
-
return done("needs_you", `The review of ${head} passed, but did not approve it: ${recorded.reason}`);
|
|
21589
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
|
+
}
|
|
21590
21890
|
}
|
|
21591
21891
|
}
|
|
21592
21892
|
if (approved !== undefined && approved.type !== "change_request.approval")
|
|
21593
21893
|
continue;
|
|
21594
21894
|
if (pipeline.source === "reported" && approved !== undefined && approved.payload.head !== pipeline.head)
|
|
21595
21895
|
continue;
|
|
21596
|
-
const
|
|
21597
|
-
|
|
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?`,
|
|
21598
21904
|
options: [
|
|
21599
21905
|
{ value: "Merge", description: "Merges the head whose pipeline passed." },
|
|
21600
21906
|
{ value: "Wait", description: "Leaves the merge to a person." }
|
|
21601
21907
|
],
|
|
21602
|
-
recommended: "Merge",
|
|
21603
|
-
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.",
|
|
21604
21910
|
default: "Wait",
|
|
21605
|
-
auto: "Merge",
|
|
21911
|
+
...notRun.length === 0 ? { auto: "Merge" } : undefined,
|
|
21606
21912
|
timeout: "1 hour"
|
|
21607
21913
|
});
|
|
21608
21914
|
if (merge === "Wait")
|
|
21609
|
-
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
|
+
}
|
|
21926
|
+
const refused = yield* takeTurn();
|
|
21927
|
+
if (refused !== undefined)
|
|
21928
|
+
return done("needs_you", `The turn to merge into ${target} was refused: ${refused}`);
|
|
21610
21929
|
const merged = yield* mergeChangeRequest(`merge-change-request:${cycle}`, {
|
|
21611
21930
|
changeRequestId,
|
|
21612
21931
|
head: pipeline.head
|
|
@@ -21615,6 +21934,7 @@ var shepherd_default = defineLoop({
|
|
|
21615
21934
|
behind = true;
|
|
21616
21935
|
if (merged.status !== "merged")
|
|
21617
21936
|
continue;
|
|
21937
|
+
yield* passTurn();
|
|
21618
21938
|
yield* writeBack("write-back", { milestone: "merged" });
|
|
21619
21939
|
const ship = yield* ask("ship", {
|
|
21620
21940
|
prompt: `Merged at ${merged.revision}. Release it now?`,
|
|
@@ -21729,6 +22049,7 @@ var BuildOutput = Struct({
|
|
|
21729
22049
|
rounds: Int,
|
|
21730
22050
|
stopped: Literals(["settled", "dispute_stands", "findings_returned", "round_cap"]),
|
|
21731
22051
|
criteria: ArraySchema(CriterionAnswer),
|
|
22052
|
+
notRun: optional2(ArraySchema(String5)),
|
|
21732
22053
|
approval: optional2(ApproveChangeRequestResult),
|
|
21733
22054
|
landed: optional2(ShepherdOutput),
|
|
21734
22055
|
next: Struct({ changeRequestId: String5 })
|
|
@@ -21837,6 +22158,7 @@ var rally = (input) => gen2(function* () {
|
|
|
21837
22158
|
conflicts
|
|
21838
22159
|
};
|
|
21839
22160
|
const failing = brokenChecks(head).map((check) => check.name);
|
|
22161
|
+
const notRun = testsNotRunReasons(head);
|
|
21840
22162
|
const reviewed = yield* call(`review:${round}`, review_default, {
|
|
21841
22163
|
base: input.base,
|
|
21842
22164
|
head: head.revision,
|
|
@@ -21844,6 +22166,7 @@ var rally = (input) => gen2(function* () {
|
|
|
21844
22166
|
...earlier.length === 0 ? undefined : { earlier },
|
|
21845
22167
|
...input.outcome === undefined ? undefined : { outcome: input.outcome },
|
|
21846
22168
|
...failing.length === 0 ? undefined : { failing },
|
|
22169
|
+
...notRun.length === 0 ? undefined : { notRun },
|
|
21847
22170
|
claims: [...claims]
|
|
21848
22171
|
});
|
|
21849
22172
|
const checks = checkFindings(head);
|
|
@@ -21881,7 +22204,7 @@ var rally = (input) => gen2(function* () {
|
|
|
21881
22204
|
});
|
|
21882
22205
|
var build_default = defineLoop({
|
|
21883
22206
|
id: "build",
|
|
21884
|
-
version: "2.
|
|
22207
|
+
version: "2.3.0",
|
|
21885
22208
|
title: "Build",
|
|
21886
22209
|
input: BuildInput,
|
|
21887
22210
|
output: BuildOutput,
|
|
@@ -21946,6 +22269,7 @@ var build_default = defineLoop({
|
|
|
21946
22269
|
...implemented.documented === undefined ? undefined : { documented: implemented.documented },
|
|
21947
22270
|
...implemented.rollback === undefined ? undefined : { rollback: implemented.rollback }
|
|
21948
22271
|
});
|
|
22272
|
+
const lastNotRun = testsNotRunReasons(last.head);
|
|
21949
22273
|
const unsettled = [
|
|
21950
22274
|
...new Set([
|
|
21951
22275
|
...verdict.settled ? [] : verdict.reasons,
|
|
@@ -21977,6 +22301,7 @@ var build_default = defineLoop({
|
|
|
21977
22301
|
}).pipe(catchTag2("StepFailed", (error) => succeed7({ approved: false, reason: error.reason }))) : undefined;
|
|
21978
22302
|
const landed = input.land !== false && unsettled.length === 0 ? yield* call("land", shepherd_default, {
|
|
21979
22303
|
changeRequestId: opened.id,
|
|
22304
|
+
...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
|
|
21980
22305
|
...input.taskId === undefined ? undefined : { taskId: input.taskId },
|
|
21981
22306
|
...input.branch === undefined ? undefined : { branch: input.branch }
|
|
21982
22307
|
}) : undefined;
|
|
@@ -21997,6 +22322,7 @@ var build_default = defineLoop({
|
|
|
21997
22322
|
rounds: last.round,
|
|
21998
22323
|
stopped: last.decision.reason,
|
|
21999
22324
|
criteria,
|
|
22325
|
+
...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
|
|
22000
22326
|
...approval === undefined ? undefined : { approval },
|
|
22001
22327
|
...landed === undefined ? undefined : { landed },
|
|
22002
22328
|
next: { changeRequestId: opened.id }
|
|
@@ -22059,17 +22385,24 @@ var errand_default = defineLoop({
|
|
|
22059
22385
|
if (done.status !== "done" || !done.changed)
|
|
22060
22386
|
return { status: done.status, summary: done.summary };
|
|
22061
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
|
+
`)}`;
|
|
22062
22393
|
const answer = yield* ask("next", {
|
|
22063
22394
|
prompt: `${done.summary}
|
|
22064
22395
|
|
|
22065
|
-
|
|
22396
|
+
${checksSay}
|
|
22397
|
+
|
|
22398
|
+
What next?`,
|
|
22066
22399
|
options: [
|
|
22067
22400
|
{ value: "Open a ChangeRequest", description: "Deliver it as it is, unreviewed." },
|
|
22068
22401
|
{ value: "Hand to Build for a full review", description: "Build reviews and verifies it before delivering." },
|
|
22069
22402
|
{ value: "Discard", description: "Drop the change." }
|
|
22070
22403
|
],
|
|
22071
|
-
recommended:
|
|
22072
|
-
recommendationReason:
|
|
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.",
|
|
22073
22406
|
default: "Open a ChangeRequest",
|
|
22074
22407
|
timeout: "1 hour"
|
|
22075
22408
|
});
|
|
@@ -22236,6 +22569,10 @@ ${input.discovery.opportunities.map((entry) => `- ${entry.title} (${entry.eviden
|
|
|
22236
22569
|
].join(`
|
|
22237
22570
|
|
|
22238
22571
|
`);
|
|
22572
|
+
var notRunOf = (head) => {
|
|
22573
|
+
const notRun = testsNotRunReasons(head);
|
|
22574
|
+
return notRun.length === 0 ? undefined : { notRun };
|
|
22575
|
+
};
|
|
22239
22576
|
var steadier = (plan) => {
|
|
22240
22577
|
const counter = plan.metrics.find((metric) => metric.lowVariance === true && metric.role !== "primary");
|
|
22241
22578
|
return counter === undefined ? undefined : {
|
|
@@ -22370,10 +22707,12 @@ var hillclimb_default = defineLoop({
|
|
|
22370
22707
|
`The measurement is valid: ${harness.summary}`,
|
|
22371
22708
|
...kept.map((entry) => entry.summary)
|
|
22372
22709
|
];
|
|
22710
|
+
let head = checked;
|
|
22373
22711
|
let reviewed = yield* call("review", review_default, {
|
|
22374
22712
|
base: baseline,
|
|
22375
22713
|
head: checked.revision,
|
|
22376
22714
|
outcome: "performance",
|
|
22715
|
+
...notRunOf(checked),
|
|
22377
22716
|
claims
|
|
22378
22717
|
});
|
|
22379
22718
|
for (let round = 1;round <= 2 && reviewed.findings.some(isBlocking); round++) {
|
|
@@ -22391,14 +22730,18 @@ var hillclimb_default = defineLoop({
|
|
|
22391
22730
|
final = yield* measure(`measure:fix:${round}`, { plan, base: baseline, head: fixed.revision, ...limits });
|
|
22392
22731
|
if (final.verdict !== "gain")
|
|
22393
22732
|
return yield* ending("gain_gone", `The review's fixes cost the gain: ${final.reason}`, final);
|
|
22733
|
+
head = fixed;
|
|
22394
22734
|
reviewed = yield* call(`review:${round + 1}`, review_default, {
|
|
22395
22735
|
base: baseline,
|
|
22396
22736
|
head: fixed.revision,
|
|
22397
22737
|
outcome: "performance",
|
|
22738
|
+
...notRunOf(fixed),
|
|
22398
22739
|
claims,
|
|
22399
22740
|
earlier: blocking
|
|
22400
22741
|
});
|
|
22401
22742
|
}
|
|
22743
|
+
const notRun = testsNotRunReasons(head);
|
|
22744
|
+
const notVerified = notVerifiedSection(head);
|
|
22402
22745
|
const unsettled = [
|
|
22403
22746
|
...[...reviewed.findings, ...scopeFindings(reviewed.scope)].flatMap((finding) => isBlocking(finding) ? [`${finding.id}: ${finding.detail}`] : []),
|
|
22404
22747
|
...synced.status === "conflict" ? [`Merging the base in conflicts on ${synced.files.join(", ")}`] : []
|
|
@@ -22418,6 +22761,7 @@ ${kept.map((entry) => `- ${entry.summary}: ${entry.reason}`).join(`
|
|
|
22418
22761
|
${harness.summary}
|
|
22419
22762
|
|
|
22420
22763
|
\`${plan.command}\``,
|
|
22764
|
+
...notVerified === undefined ? [] : [notVerified],
|
|
22421
22765
|
...unsettled.length + caveats.length === 0 ? [] : [`## Unsettled
|
|
22422
22766
|
|
|
22423
22767
|
${[...unsettled, ...caveats].map((entry) => `- ${entry}`).join(`
|
|
@@ -22427,7 +22771,11 @@ ${[...unsettled, ...caveats].map((entry) => `- ${entry}`).join(`
|
|
|
22427
22771
|
`)
|
|
22428
22772
|
});
|
|
22429
22773
|
yield* writeBack("write-back", { milestone: "change_request_opened", changeRequestUrl: opened.url });
|
|
22430
|
-
return {
|
|
22774
|
+
return {
|
|
22775
|
+
...yield* ending("improved", final.reason, final),
|
|
22776
|
+
changeRequest: opened,
|
|
22777
|
+
unsettled: [...unsettled, ...notRun]
|
|
22778
|
+
};
|
|
22431
22779
|
})
|
|
22432
22780
|
});
|
|
22433
22781
|
|
|
@@ -22770,11 +23118,30 @@ An earlier Build of this failed. ${retry.steer}` };
|
|
|
22770
23118
|
}).pipe(catchTag2("ChildFailed", (failure) => succeed7(failure)));
|
|
22771
23119
|
if (built instanceof ChildFailed)
|
|
22772
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
|
+
}
|
|
22773
23141
|
const merged = yield* mergeChangeRequest(`merge:${name}${suffix}`, {
|
|
22774
23142
|
changeRequestId: built.changeRequest.id,
|
|
22775
23143
|
head: built.revision
|
|
22776
23144
|
});
|
|
22777
|
-
const delivered = { repoBindingId: head.repoBindingId, changeRequest: built.changeRequest };
|
|
22778
23145
|
if (merged.status === "merged")
|
|
22779
23146
|
return settled(ticket, { status: "merged", ...delivered });
|
|
22780
23147
|
const choice = yield* ask(`conflict:${name}${suffix}`, {
|
|
@@ -22888,7 +23255,7 @@ var implement = (input, plan, revision, filed) => gen2(function* () {
|
|
|
22888
23255
|
});
|
|
22889
23256
|
var plan_default = defineLoop({
|
|
22890
23257
|
id: "plan",
|
|
22891
|
-
version: "2.
|
|
23258
|
+
version: "2.1.0",
|
|
22892
23259
|
title: "Plan",
|
|
22893
23260
|
input: Input7,
|
|
22894
23261
|
output: Output8,
|
|
@@ -23477,7 +23844,7 @@ var reportText = (landing, left, heading) => [
|
|
|
23477
23844
|
`);
|
|
23478
23845
|
var sweep_default = defineLoop({
|
|
23479
23846
|
id: "sweep",
|
|
23480
|
-
version: "1.
|
|
23847
|
+
version: "1.1.0",
|
|
23481
23848
|
title: "Sweep",
|
|
23482
23849
|
input: Input11,
|
|
23483
23850
|
output: Output12,
|
|
@@ -23490,9 +23857,12 @@ var sweep_default = defineLoop({
|
|
|
23490
23857
|
const authors = input.authors ?? defaultAuthors;
|
|
23491
23858
|
const [earlier] = (yield* ownChangeRequests("earlier")).changeRequests;
|
|
23492
23859
|
if (earlier !== undefined) {
|
|
23860
|
+
const { head } = yield* pipelineStatus("earlier-head", { changeRequestId: earlier.id });
|
|
23861
|
+
const { notRun } = yield* verifyHead("earlier-verify", head);
|
|
23493
23862
|
const landed = yield* call("land", shepherd_default, {
|
|
23494
23863
|
changeRequestId: earlier.id,
|
|
23495
|
-
merge:
|
|
23864
|
+
merge: notRun.length === 0,
|
|
23865
|
+
...notRun.length === 0 ? undefined : { notRun },
|
|
23496
23866
|
...input.branch === undefined ? undefined : { branch: input.branch }
|
|
23497
23867
|
});
|
|
23498
23868
|
const summary = `${earlier.url}, from an earlier Sweep, is still open; Sweep took it on instead of batching again: ${landed.status}. ${landed.reason}`;
|
|
@@ -23579,10 +23949,12 @@ var sweep_default = defineLoop({
|
|
|
23579
23949
|
const failing = checked.checks.filter((check) => check.status === "failed").map((check) => check.name);
|
|
23580
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" }))]);
|
|
23581
23951
|
}
|
|
23952
|
+
const notVerified = notVerifiedSection(checked);
|
|
23582
23953
|
const opened = yield* changeRequest("change-request", {
|
|
23583
23954
|
title: `Update ${landing.length} ${landing.length === 1 ? "dependency" : "dependencies"}`,
|
|
23584
23955
|
body: [
|
|
23585
23956
|
batched.summary,
|
|
23957
|
+
...notVerified === undefined ? [] : [notVerified],
|
|
23586
23958
|
supersedes,
|
|
23587
23959
|
...landing.map(supersededLine),
|
|
23588
23960
|
...left.length === 0 ? [] : ["Left for a person:", ...left.map((update) => `- !${update.number} ${update.title}: ${update.reason}`)]
|
|
@@ -23592,7 +23964,8 @@ var sweep_default = defineLoop({
|
|
|
23592
23964
|
});
|
|
23593
23965
|
const landed = yield* call("land", shepherd_default, {
|
|
23594
23966
|
changeRequestId: opened.id,
|
|
23595
|
-
merge:
|
|
23967
|
+
merge: notVerified === undefined,
|
|
23968
|
+
...notVerified === undefined ? undefined : { notRun: testsNotRunReasons(checked) },
|
|
23596
23969
|
...input.branch === undefined ? undefined : { branch: input.branch }
|
|
23597
23970
|
});
|
|
23598
23971
|
const merged = landed.status === "merged";
|
|
@@ -23707,10 +24080,12 @@ var tidy_default = defineLoop({
|
|
|
23707
24080
|
return { status: "nothing_worth_it", summary: improvement.summary };
|
|
23708
24081
|
const base = yield* verify("verify:base", { revision: start });
|
|
23709
24082
|
const head = yield* verify("verify", {});
|
|
24083
|
+
const notRun = testsNotRunReasons(head);
|
|
23710
24084
|
const reviewed = yield* call("review", review_default, {
|
|
23711
24085
|
base: start,
|
|
23712
24086
|
head: head.revision,
|
|
23713
24087
|
outcome: "refactor",
|
|
24088
|
+
...notRun.length === 0 ? undefined : { notRun },
|
|
23714
24089
|
claims: improvement.claims
|
|
23715
24090
|
});
|
|
23716
24091
|
const settled = settleRound({ findings: reviewed.findings, rebuttals: [], verdicts: reviewed.verdicts });
|
|
@@ -26671,7 +27046,19 @@ class RunnerCapabilityRpcs extends make30(make29("PutQuestion", {
|
|
|
26671
27046
|
logTail: optionalKey2(String5)
|
|
26672
27047
|
})),
|
|
26673
27048
|
readAt: optionalKey2(String5),
|
|
26674
|
-
runnerChecks: optionalKey2(ArraySchema(String5))
|
|
27049
|
+
runnerChecks: optionalKey2(ArraySchema(String5)),
|
|
27050
|
+
approved: optionalKey2(String5),
|
|
27051
|
+
repository: optionalKey2(String5),
|
|
27052
|
+
target: optionalKey2(Struct({
|
|
27053
|
+
branch: String5,
|
|
27054
|
+
head: String5,
|
|
27055
|
+
jobs: ArraySchema(Struct({
|
|
27056
|
+
name: String5,
|
|
27057
|
+
status: Literals(["running", "success", "failed", "skipped"]),
|
|
27058
|
+
url: optionalKey2(String5),
|
|
27059
|
+
logTail: optionalKey2(String5)
|
|
27060
|
+
}))
|
|
27061
|
+
}))
|
|
26675
27062
|
}),
|
|
26676
27063
|
error: RunnerRpcError
|
|
26677
27064
|
}), make29("ReportPipeline", {
|
|
@@ -29538,4 +29925,4 @@ var runKit = (config, identity, packages) => {
|
|
|
29538
29925
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
29539
29926
|
};
|
|
29540
29927
|
// .kitman-build-entry.ts
|
|
29541
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.
|
|
29928
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.10.71" }, []);
|