@kitman-sh/software-engineering 0.13.16 → 0.13.17
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/agents/implementer.md +1 -0
- package/agents/reviewer.md +3 -2
- package/dist/bundle.js +573 -87
- package/dist/declarations.json +1026 -58
- package/package.json +3 -3
- package/src/build.ts +124 -14
- package/src/change-request-body.ts +4 -0
- package/src/hillclimb.ts +7 -2
- package/src/out-of-scope.ts +35 -0
- package/src/review.ts +755 -77
- package/src/reviewed-scope.ts +18 -2
- package/src/shepherd-output.ts +2 -0
- package/src/shepherd.ts +17 -5
- package/src/tidy.ts +3 -1
package/dist/bundle.js
CHANGED
|
@@ -21101,6 +21101,25 @@ var readPlanReview = (answer, revision, markdown) => {
|
|
|
21101
21101
|
return { revision, comments: [{ id: "words", body: answer.trim() }] };
|
|
21102
21102
|
return { revision, comments: decoded.value.planReview.comments.map((comment) => placed(comment, markdown)) };
|
|
21103
21103
|
};
|
|
21104
|
+
// src/out-of-scope.ts
|
|
21105
|
+
var outOfScopeCase = { outOfScope: optional2(Int) };
|
|
21106
|
+
var listedCases = (cases) => (cases ?? []).filter((item) => item.trim() !== "");
|
|
21107
|
+
var caseOf = (cases, marked) => marked.outOfScope === undefined ? undefined : cases[marked.outOfScope - 1];
|
|
21108
|
+
var numberedCases = (cases) => cases.map((item, index) => `${index + 1}. ${item}`);
|
|
21109
|
+
var inCase = (text, item) => `${text} (Out of scope: ${item})`;
|
|
21110
|
+
var OutOfScopeFinding = Struct({
|
|
21111
|
+
...MergedFinding.fields,
|
|
21112
|
+
severity: Literals(["major", "minor"]),
|
|
21113
|
+
item: String5,
|
|
21114
|
+
problem: optionalKey2(String5)
|
|
21115
|
+
});
|
|
21116
|
+
var outOfScopeLines = (findings, scope) => [
|
|
21117
|
+
...findings.map((finding) => `${finding.id} (${finding.severity}): ${inCase(finding.detail, finding.item)}`),
|
|
21118
|
+
...(scope?.outOfScope ?? []).map(({ part, item }) => inCase(part, item))
|
|
21119
|
+
];
|
|
21120
|
+
var outOfScopeSection = (lines) => lines.length === 0 ? [] : ["## Out of scope", lines.map((line) => `- ${line}`).join(`
|
|
21121
|
+
`)];
|
|
21122
|
+
|
|
21104
21123
|
// src/change-request-body.ts
|
|
21105
21124
|
var scopeFindings = (scope) => (scope?.unmet ?? []).map((item) => ({
|
|
21106
21125
|
id: `scope: ${item}`,
|
|
@@ -21185,6 +21204,7 @@ var changeRequestBody = (build) => [
|
|
|
21185
21204
|
"## Unsettled",
|
|
21186
21205
|
...unsettledLines(build.unsettled, build.head),
|
|
21187
21206
|
...build.later === undefined || build.later.length === 0 ? [] : ["## Left for later", ...build.later.map((item) => `- ${item}`)],
|
|
21207
|
+
...outOfScopeSection(build.outOfScope ?? []),
|
|
21188
21208
|
"## Review",
|
|
21189
21209
|
`${build.rounds} review round${build.rounds === 1 ? "" : "s"}; the rally stopped: ${build.stopped.replaceAll("_", " ")}.`
|
|
21190
21210
|
].join(`
|
|
@@ -21221,9 +21241,16 @@ var deliveryLayerWords = {
|
|
|
21221
21241
|
};
|
|
21222
21242
|
|
|
21223
21243
|
// src/reviewed-scope.ts
|
|
21244
|
+
var CriterionDisposition = Struct({
|
|
21245
|
+
criterion: String5,
|
|
21246
|
+
status: Literals(["met", "open", "out_of_scope", "reported"]),
|
|
21247
|
+
item: optionalKey2(String5)
|
|
21248
|
+
});
|
|
21224
21249
|
var ReviewedScope = Struct({
|
|
21225
21250
|
...ScopeJudgement.fields,
|
|
21226
|
-
reported: optional2(ArraySchema(String5))
|
|
21251
|
+
reported: optional2(ArraySchema(String5)),
|
|
21252
|
+
outOfScope: optional2(ArraySchema(Struct({ part: String5, item: String5 }))),
|
|
21253
|
+
criteria: optional2(ArraySchema(CriterionDisposition))
|
|
21227
21254
|
});
|
|
21228
21255
|
|
|
21229
21256
|
// src/text-limits.ts
|
|
@@ -21251,6 +21278,7 @@ var scopeSeat = "code-review";
|
|
|
21251
21278
|
var choices = ["Post to the ChangeRequest", "Fix here", "Build from it", "Done"];
|
|
21252
21279
|
var Input = Struct({
|
|
21253
21280
|
changeRequestId: optional2(String5),
|
|
21281
|
+
deliveredBy: optional2(String5),
|
|
21254
21282
|
base: optional2(String5),
|
|
21255
21283
|
head: optional2(String5),
|
|
21256
21284
|
files: optional2(ArraySchema(String5)),
|
|
@@ -21264,38 +21292,144 @@ var Input = Struct({
|
|
|
21264
21292
|
scope: optional2(ReviewedScope),
|
|
21265
21293
|
failing: optional2(ArraySchema(String5)),
|
|
21266
21294
|
notRun: optional2(ArraySchema(String5)),
|
|
21295
|
+
outOfScopeFindings: optional2(ArraySchema(OutOfScopeFinding)),
|
|
21296
|
+
unmetCriteria: optional2(ArraySchema(String5)),
|
|
21297
|
+
metCriteria: optional2(ArraySchema(String5)),
|
|
21298
|
+
afterMergeCriteria: optional2(ArraySchema(String5)),
|
|
21299
|
+
taskOutOfScope: optional2(ArraySchema(String5)),
|
|
21267
21300
|
next: optional2(Literals(choices)),
|
|
21268
21301
|
...DeliveryFields
|
|
21269
21302
|
});
|
|
21270
21303
|
var FollowUpStatus = Literals(["fixed", "changed", "still_there"]);
|
|
21271
21304
|
var FollowUp = Struct({ id: String5, status: FollowUpStatus });
|
|
21305
|
+
var SeatFollowUp = Struct({
|
|
21306
|
+
...FollowUp.fields,
|
|
21307
|
+
severity: optional2(Finding.fields.severity),
|
|
21308
|
+
...outOfScopeCase
|
|
21309
|
+
});
|
|
21272
21310
|
var SeatFinding = Struct({
|
|
21273
21311
|
...Finding.fields,
|
|
21274
21312
|
detail: FindingDetail,
|
|
21275
21313
|
approvedCode: optional2(Boolean3),
|
|
21276
21314
|
rule: optional2(OneSentence),
|
|
21277
21315
|
checked: optional2(ArraySchema(ShortStatement)),
|
|
21278
|
-
outsideFix: optional2(Boolean3)
|
|
21316
|
+
outsideFix: optional2(Boolean3),
|
|
21317
|
+
...outOfScopeCase
|
|
21318
|
+
});
|
|
21319
|
+
var isText = is2(String5);
|
|
21320
|
+
var SeatUnmet = Union2([
|
|
21321
|
+
String5,
|
|
21322
|
+
Struct({
|
|
21323
|
+
part: String5,
|
|
21324
|
+
criterion: optional2(Int),
|
|
21325
|
+
...outOfScopeCase
|
|
21326
|
+
})
|
|
21327
|
+
]);
|
|
21328
|
+
var SeatScope = Struct({
|
|
21329
|
+
...ScopeJudgement.fields,
|
|
21330
|
+
unmet: ArraySchema(SeatUnmet),
|
|
21331
|
+
reported: optional2(ArraySchema(String5)),
|
|
21332
|
+
criteria: optional2(ArraySchema(Struct({
|
|
21333
|
+
criterion: Int,
|
|
21334
|
+
met: optional2(Boolean3),
|
|
21335
|
+
reported: optional2(Boolean3),
|
|
21336
|
+
...outOfScopeCase
|
|
21337
|
+
})))
|
|
21279
21338
|
});
|
|
21280
|
-
var
|
|
21281
|
-
|
|
21282
|
-
|
|
21283
|
-
|
|
21284
|
-
|
|
21285
|
-
|
|
21286
|
-
|
|
21339
|
+
var dispositionsOf = (judged, cases, unmetCriteria, reportedByAnswer) => {
|
|
21340
|
+
const byCriterion = new Map;
|
|
21341
|
+
for (const entry of judged) {
|
|
21342
|
+
const criterion = unmetCriteria[entry.criterion - 1];
|
|
21343
|
+
if (criterion === undefined)
|
|
21344
|
+
continue;
|
|
21345
|
+
const item = caseOf(cases, entry);
|
|
21346
|
+
const disposition = entry.met === true ? { criterion, status: "met" } : entry.reported === true || item === undefined && reportedByAnswer.includes(criterion) ? { criterion, status: "reported" } : item === undefined ? { criterion, status: "open" } : { criterion, status: "out_of_scope", item };
|
|
21347
|
+
const known = byCriterion.get(criterion);
|
|
21348
|
+
byCriterion.set(criterion, known === undefined || JSON.stringify(known) === JSON.stringify(disposition) ? disposition : { criterion, status: "open" });
|
|
21349
|
+
}
|
|
21350
|
+
return [...byCriterion.values()];
|
|
21351
|
+
};
|
|
21352
|
+
var agreedScope = ({ unmet, criteria = [], reported: seatReported = [], ...scope }, cases, numberedCriteria, earlier) => {
|
|
21353
|
+
const given = unmet.map((entry) => isText(entry) ? { part: entry, item: undefined } : {
|
|
21354
|
+
part: (entry.criterion === undefined ? undefined : numberedCriteria[entry.criterion - 1]) ?? entry.part,
|
|
21355
|
+
item: caseOf(cases, entry)
|
|
21356
|
+
});
|
|
21357
|
+
const numbered = new Set(numberedCriteria);
|
|
21358
|
+
const parts = given.filter(({ part }) => !numbered.has(part));
|
|
21359
|
+
const judgedByNumber = dispositionsOf(criteria, cases, numberedCriteria, seatReported);
|
|
21360
|
+
const named = given.filter(({ part }) => numbered.has(part));
|
|
21361
|
+
const dispositions = [
|
|
21362
|
+
...judgedByNumber.map((entry) => entry.status === "met" && named.some(({ part }) => part === entry.criterion) ? { criterion: entry.criterion, status: "open" } : entry),
|
|
21363
|
+
...named.flatMap(({ part, item }, index) => judgedByNumber.some((entry) => entry.criterion === part) || named.findIndex((other) => other.part === part) !== index ? [] : named.filter((other) => other.part === part).every((other) => other.item === item) && item !== undefined ? [{ criterion: part, status: "out_of_scope", item }] : [{ criterion: part, status: "open" }])
|
|
21364
|
+
];
|
|
21365
|
+
const criteriaApart = dispositions.flatMap(({ criterion, item }) => item === undefined ? [] : [{ part: criterion, item }]);
|
|
21366
|
+
const marked = [...parts.flatMap(({ part, item }) => item === undefined ? [] : [{ part, item }]), ...criteriaApart];
|
|
21367
|
+
const waivedParts = new Set(marked.map((entry) => entry.part));
|
|
21368
|
+
const left = [
|
|
21369
|
+
...new Set([
|
|
21370
|
+
...parts.flatMap(({ part }) => waivedParts.has(part) ? [] : [part]),
|
|
21371
|
+
...dispositions.flatMap((entry) => entry.status === "open" ? [entry.criterion] : [])
|
|
21372
|
+
])
|
|
21373
|
+
];
|
|
21374
|
+
const judgedAgain = new Set([...waivedParts, ...left, ...dispositions.map((entry) => entry.criterion)]);
|
|
21375
|
+
const kept = earlier.filter(({ part }) => !judgedAgain.has(part));
|
|
21376
|
+
const outOfScope = [...kept, ...marked];
|
|
21377
|
+
const byAnswer = dispositions.flatMap((entry) => entry.status === "reported" ? [entry.criterion] : []);
|
|
21378
|
+
const judgedOtherwise = new Set(dispositions.flatMap((entry) => entry.status === "reported" ? [] : [entry.criterion]));
|
|
21379
|
+
const reported = [...new Set([...seatReported, ...byAnswer])].filter((part) => !left.includes(part) && !judgedOtherwise.has(part));
|
|
21380
|
+
const waived = reported.length + marked.length;
|
|
21381
|
+
const strict = cases.length > 0 || unmet.some((entry) => !isText(entry));
|
|
21382
|
+
return {
|
|
21383
|
+
...scope,
|
|
21384
|
+
...reported.length === 0 ? undefined : { reported },
|
|
21385
|
+
unmet: left,
|
|
21386
|
+
met: left.length === 0 ? scope.met || waived > 0 : scope.met && !strict,
|
|
21387
|
+
...outOfScope.length === 0 ? undefined : { outOfScope },
|
|
21388
|
+
...dispositions.length === 0 ? undefined : { criteria: dispositions }
|
|
21389
|
+
};
|
|
21390
|
+
};
|
|
21391
|
+
var withUnjudged = (scope, unmetCriteria) => {
|
|
21392
|
+
const settled = new Set([
|
|
21393
|
+
...(scope?.criteria ?? []).map((entry) => entry.criterion),
|
|
21394
|
+
...(scope?.outOfScope ?? []).map((entry) => entry.part),
|
|
21395
|
+
...scope?.reported ?? [],
|
|
21396
|
+
...scope?.unmet ?? []
|
|
21397
|
+
]);
|
|
21398
|
+
const unjudged = unmetCriteria.filter((criterion) => !settled.has(criterion));
|
|
21399
|
+
return unjudged.length === 0 ? scope : { ...scope, met: false, unmet: [...scope?.unmet ?? [], ...unjudged] };
|
|
21400
|
+
};
|
|
21401
|
+
var carriedScope = (judged, earlier, cases, numberedCriteria) => {
|
|
21402
|
+
if (judged === undefined) {
|
|
21403
|
+
if (earlier === undefined)
|
|
21404
|
+
return;
|
|
21405
|
+
const { criteria: _, ...carried } = earlier;
|
|
21406
|
+
return carried;
|
|
21407
|
+
}
|
|
21408
|
+
const scope = agreedScope(judged, cases, numberedCriteria, earlier?.outOfScope ?? []);
|
|
21409
|
+
const judgedOtherwise = new Set((scope.criteria ?? []).flatMap((entry) => entry.status === "reported" ? [] : [entry.criterion]));
|
|
21410
|
+
const reported = [...new Set([...earlier?.reported ?? [], ...scope.reported ?? []])].filter((item) => !scope.unmet.includes(item) && !judgedOtherwise.has(item));
|
|
21411
|
+
if (earlier === undefined)
|
|
21412
|
+
return scope;
|
|
21413
|
+
const { reported: _, ...rest } = scope;
|
|
21414
|
+
return reported.length === 0 ? rest : { ...rest, reported };
|
|
21287
21415
|
};
|
|
21288
21416
|
var SeatOutput = Struct({
|
|
21289
21417
|
summary: OneSentence,
|
|
21290
21418
|
findings: ArraySchema(SeatFinding),
|
|
21291
21419
|
verdicts: optional2(ArraySchema(RebuttalVerdict)),
|
|
21292
|
-
scope: optional2(
|
|
21293
|
-
followUps: optional2(ArraySchema(
|
|
21420
|
+
scope: optional2(SeatScope),
|
|
21421
|
+
followUps: optional2(ArraySchema(SeatFollowUp))
|
|
21422
|
+
});
|
|
21423
|
+
var ApprovedFinding = Struct({
|
|
21424
|
+
...MergedFinding.fields,
|
|
21425
|
+
item: optionalKey2(String5),
|
|
21426
|
+
problem: OutOfScopeFinding.fields.problem
|
|
21294
21427
|
});
|
|
21295
21428
|
var Output = Struct({
|
|
21296
21429
|
summary: String5,
|
|
21297
21430
|
findings: ArraySchema(MergedFinding),
|
|
21298
|
-
approvedFindings: optional2(ArraySchema(
|
|
21431
|
+
approvedFindings: optional2(ArraySchema(ApprovedFinding)),
|
|
21432
|
+
outOfScopeFindings: optional2(ArraySchema(OutOfScopeFinding)),
|
|
21299
21433
|
followUps: ArraySchema(FollowUp),
|
|
21300
21434
|
verdicts: ArraySchema(RebuttalVerdict),
|
|
21301
21435
|
blocking: Boolean3,
|
|
@@ -21333,7 +21467,7 @@ var targetOf = (input, { base, head, branches, epic }) => {
|
|
|
21333
21467
|
if (input.files === undefined && input.approved !== undefined)
|
|
21334
21468
|
return [
|
|
21335
21469
|
`only what the change gained or lost since it was approved at ${input.approved}: compare \`git diff ${base}...${input.approved}\`, the change as approved, with \`git diff ${base}...${head}\`, the change now, in your checkout. The rest was reviewed and approved before.`,
|
|
21336
|
-
"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."
|
|
21470
|
+
"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, unless one is a blocker in one of the Task's numbered out-of-scope cases."
|
|
21337
21471
|
].join(`
|
|
21338
21472
|
|
|
21339
21473
|
`);
|
|
@@ -21369,26 +21503,102 @@ var pinnedRange = (input) => gen2(function* () {
|
|
|
21369
21503
|
return { base, head };
|
|
21370
21504
|
});
|
|
21371
21505
|
var wholeChange = (input) => input.files === undefined && input.approved === undefined;
|
|
21372
|
-
var
|
|
21373
|
-
var
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
].join(`
|
|
21381
|
-
`),
|
|
21382
|
-
"Also list in `unmet`, one line each, any criterion or part the fix undoes. What an answer under your brief's Answers so far put out of scope is reported, not unmet: list each of these in `reported` instead. Set `met` to true only if `unmet` is empty. If your brief has no Task, leave `scope` out."
|
|
21506
|
+
var casesOf = (input) => listedCases(input.taskOutOfScope);
|
|
21507
|
+
var unmetCriteriaOf = (input) => casesOf(input).length === 0 ? [] : input.unmetCriteria ?? [];
|
|
21508
|
+
var afterMergeCriteriaOf = (input) => casesOf(input).length === 0 ? [] : input.afterMergeCriteria ?? [];
|
|
21509
|
+
var criteriaOf = (input) => casesOf(input).length === 0 ? [] : [...new Set([...unmetCriteriaOf(input), ...input.metCriteria ?? [], ...afterMergeCriteriaOf(input)])];
|
|
21510
|
+
var outOfScopePrompt = (cases) => [
|
|
21511
|
+
"The Task's Out of scope list is these numbered cases, and no other list in your brief is. The change need not handle them, so a case it does not handle is not missing scope:",
|
|
21512
|
+
...numberedCases(cases),
|
|
21513
|
+
"Report a problem in one of them at its real severity, with `outOfScope` set to the case's number: a major or minor is kept apart and does not block. A blocker there, such as a security hole or lost data, still blocks."
|
|
21383
21514
|
].join(`
|
|
21515
|
+
`);
|
|
21516
|
+
var wholeScopePrompt = "If your brief has a Task, judge its scope and give it as `scope`: does the change make the Task's Promise true, if it has one, and do what the Task's description and each of its Acceptance Criteria ask? Judge it against what is still agreed: a criterion or part an answer under your brief's Answers so far put out of scope is reported, not unmet; list each in `reported`, one line each, unless it is a numbered criterion your brief asks you to judge in `criteria`, and leave it out of `unmet`. Set `met` to true only if the change does all the rest, and list in `unmet` one line for the Promise and each other criterion or part of the description that is not done, except a numbered criterion, which you judge in `criteria` alone. If your brief has no Task, leave `scope` out.";
|
|
21517
|
+
var rejudgedScopePrompt = ({ unmet, outOfScope = [] }, numbered) => {
|
|
21518
|
+
const shown = unmet.filter((item) => !numbered.includes(item));
|
|
21519
|
+
return [
|
|
21520
|
+
[
|
|
21521
|
+
"If your brief has a Task, judge its scope again and give it as `scope`. An earlier round judged what the Task's Promise, if it has one, its description and Acceptance Criteria ask, and that stands, so do not judge all of it again.",
|
|
21522
|
+
...unmet.length === 0 ? ["It found nothing unmet."] : shown.length === 0 ? ["What it found unmet is among the numbered criteria below, which you judge by number."] : [
|
|
21523
|
+
`It found these unmet. Judge each of these again, against the code at the head, and list each that is still not done in \`unmet\`, in the same words${numbered.length === 0 ? "" : ", unless it is one of the numbered criteria below: judge that one by its number alone, which wins over any line naming it"}:`,
|
|
21524
|
+
...shown.map((item) => `- ${item}`)
|
|
21525
|
+
]
|
|
21526
|
+
].join(`
|
|
21527
|
+
`),
|
|
21528
|
+
...outOfScope.length === 0 ? [] : [
|
|
21529
|
+
[
|
|
21530
|
+
"It found these not done only because of one of the Task's numbered out-of-scope cases. They stay reported apart, so leave them out of `unmet`:",
|
|
21531
|
+
...outOfScope.map(({ part, item }) => `- ${inCase(part, item)}`)
|
|
21532
|
+
].join(`
|
|
21533
|
+
`)
|
|
21534
|
+
],
|
|
21535
|
+
"Also list in `unmet`, one line each, the Promise and any criterion or part the fix undoes, except a numbered criterion, which you judge in `criteria` alone. What an answer under your brief's Answers so far put out of scope is reported, not unmet: list each of these in `reported` instead, unless it is a numbered criterion. Set `met` to true only if `unmet` is empty. If your brief has no Task, leave `scope` out."
|
|
21536
|
+
].join(`
|
|
21384
21537
|
|
|
21385
21538
|
`);
|
|
21539
|
+
};
|
|
21386
21540
|
var fixRound = (input) => (input.earlier?.length ?? 0) > 0 || input.reviewed !== undefined;
|
|
21387
|
-
var
|
|
21541
|
+
var earlierScope = (input) => {
|
|
21542
|
+
if (!fixRound(input) || input.scope === undefined)
|
|
21543
|
+
return;
|
|
21544
|
+
const { outOfScope = [], ...scope } = input.scope;
|
|
21545
|
+
const listed = outOfScope.filter(({ item }) => casesOf(input).includes(item));
|
|
21546
|
+
const unlisted = outOfScope.flatMap((entry) => listed.includes(entry) ? [] : [entry.part]);
|
|
21547
|
+
return {
|
|
21548
|
+
...scope,
|
|
21549
|
+
...unlisted.length === 0 ? undefined : { met: false, unmet: [...new Set([...scope.unmet, ...unlisted])] },
|
|
21550
|
+
...listed.length === 0 ? undefined : { outOfScope: listed }
|
|
21551
|
+
};
|
|
21552
|
+
};
|
|
21553
|
+
var scopeToRejudge = (input) => {
|
|
21554
|
+
const scope = earlierScope(input);
|
|
21555
|
+
return scope?.met === true || (scope?.unmet.length ?? 0) > 0 ? scope : undefined;
|
|
21556
|
+
};
|
|
21557
|
+
var earlierOpenCriteriaOf = (input) => {
|
|
21558
|
+
const scope = earlierScope(input);
|
|
21559
|
+
const open = new Set([
|
|
21560
|
+
...scope?.unmet ?? [],
|
|
21561
|
+
...(scope?.criteria ?? []).flatMap((entry) => entry.status === "open" ? [entry.criterion] : [])
|
|
21562
|
+
]);
|
|
21563
|
+
return criteriaOf(input).filter((criterion) => open.has(criterion));
|
|
21564
|
+
};
|
|
21565
|
+
var requiredCriteriaOf = (input) => [
|
|
21566
|
+
...new Set([...unmetCriteriaOf(input), ...earlierOpenCriteriaOf(input)])
|
|
21567
|
+
];
|
|
21568
|
+
var numbersOf = (input, criteria) => criteriaOf(input).flatMap((criterion, index) => criteria.includes(criterion) ? [index + 1] : []);
|
|
21569
|
+
var answeredPrompt = (input) => {
|
|
21570
|
+
const notMet = numbersOf(input, unmetCriteriaOf(input));
|
|
21571
|
+
const afterMerge = numbersOf(input, afterMergeCriteriaOf(input));
|
|
21572
|
+
const reopened = numbersOf(input, earlierOpenCriteriaOf(input)).filter((number) => !notMet.includes(number));
|
|
21573
|
+
const required = [...notMet, ...reopened].toSorted((left, right) => left - right);
|
|
21574
|
+
return [
|
|
21575
|
+
notMet.length === 0 && afterMerge.length === 0 ? "The implementer answered each of them met." : `The implementer answered ${[
|
|
21576
|
+
...notMet.length === 0 ? [] : [`${notMet.join(", ")} not met`],
|
|
21577
|
+
...afterMerge.length === 0 ? [] : [
|
|
21578
|
+
`${afterMerge.join(", ")} after merge, as their result shows only once the change is merged; judge those by the code, never as not done only because that result cannot be seen yet`
|
|
21579
|
+
]
|
|
21580
|
+
].join(", and ")}, and the rest met.`,
|
|
21581
|
+
...reopened.length === 0 ? [] : [`An earlier round found ${reopened.join(", ")} not done.`],
|
|
21582
|
+
required.length === 0 ? "Give one only if the change does not do it." : `Judge ${required.join(", ")} every time, and any other only if the change does not do it.`
|
|
21583
|
+
].join(" ");
|
|
21584
|
+
};
|
|
21388
21585
|
var scopePrompt = (input) => {
|
|
21389
21586
|
const earlier = scopeToRejudge(input);
|
|
21390
21587
|
return [
|
|
21391
|
-
earlier === undefined ? wholeScopePrompt : rejudgedScopePrompt(earlier
|
|
21588
|
+
earlier === undefined ? wholeScopePrompt : rejudgedScopePrompt(earlier, criteriaOf(input)),
|
|
21589
|
+
...casesOf(input).length === 0 ? [] : [
|
|
21590
|
+
`A part that is not done only because it falls in one of the Task's numbered out-of-scope cases is never unmet, even where the Promise, the description or a criterion covers it. Give it in \`unmet\` as \`{ part, outOfScope }\`, with the case's number; Kitman reports it apart. Give each part once${criteriaOf(input).length === 0 ? "" : ", and a numbered criterion only by its number"}.`
|
|
21591
|
+
],
|
|
21592
|
+
...criteriaOf(input).length === 0 ? [] : [
|
|
21593
|
+
[
|
|
21594
|
+
[
|
|
21595
|
+
"The Task's acceptance criteria are numbered below, in the implementer's words. Judge a numbered criterion in `criteria` alone, by its number, as `{ criterion, met }`: `met` true only if the change does it. For one not done only because of a numbered out-of-scope case, also set `outOfScope` to the case's number; for one an answer under your brief's Answers so far put out of scope, set `reported` to true instead. Leave them out of `unmet` and `reported`, even one an answer put out of scope or one you would word as the Task does: Kitman lists them there itself, and a criterion's number wins over any line there that names it. If you still give a line in `unmet` about one, give it as `{ part, criterion }` with the criterion's number.",
|
|
21596
|
+
answeredPrompt(input)
|
|
21597
|
+
].join(" "),
|
|
21598
|
+
...numberedCases(criteriaOf(input))
|
|
21599
|
+
].join(`
|
|
21600
|
+
`)
|
|
21601
|
+
],
|
|
21392
21602
|
...input.outcome === undefined ? [] : [`The Outcome to prove is ${input.outcome}.`],
|
|
21393
21603
|
...input.claims === undefined || input.claims.length === 0 ? [] : [
|
|
21394
21604
|
earlier === undefined ? "The implementer claims it built these. Check them against the code rather than taking them on trust:" : "The implementer claims these. Check those about the fix or an unmet item against the code rather than taking them on trust:",
|
|
@@ -21402,12 +21612,24 @@ var exhaustivePrompt = (subject) => [
|
|
|
21402
21612
|
`Review exhaustively, in this one pass. For each rule or check ${subject} adds or alters, such as who may read or change what, a validation, a limit or a state transition, trace it through every caller and every input it can get before you report: each kind of actor, each visibility, Team and Project scope, and ids the caller gives.`,
|
|
21403
21613
|
"Report every finding of every severity in this one pass, grouped by the rule it breaks: do not stop at the first serious one in an area, and hold none back for a later round. Give each its `rule`, worded alike for every finding that breaks the same rule, and its `checked`: the sibling cases of that rule you checked and found fine, so the next round need not explore them again."
|
|
21404
21614
|
].join(" ");
|
|
21405
|
-
var earlierPrompt = (earlier) => [
|
|
21406
|
-
|
|
21615
|
+
var earlierPrompt = (earlier, cases) => [
|
|
21616
|
+
[
|
|
21617
|
+
"Earlier rounds, by both reviewers, left these findings open. Give each as a `followUps` entry with its id: fixed, changed (the code moved but the problem stands) or still_there. Do not report them again as findings.",
|
|
21618
|
+
...cases.length === 0 ? [] : [
|
|
21619
|
+
"If one that is not fixed is in one of the Task's numbered out-of-scope cases, set `outOfScope` on its entry to the case's number.",
|
|
21620
|
+
"If one that is not fixed now has another severity, worse or less bad, set `severity` on its entry to its severity now: a blocker always blocks.",
|
|
21621
|
+
"Report a different problem on the same line as a finding."
|
|
21622
|
+
]
|
|
21623
|
+
].join(" "),
|
|
21407
21624
|
...earlier.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`)
|
|
21408
21625
|
].join(`
|
|
21409
21626
|
`);
|
|
21410
|
-
var outsideFixPrompt =
|
|
21627
|
+
var outsideFixPrompt = (cases) => [
|
|
21628
|
+
"Raise a new problem outside the fix and the code it touches only if it is a blocker; report one that is not as a minor with `outsideFix` set to true, which does not block landing.",
|
|
21629
|
+
...cases.length === 0 ? [] : [
|
|
21630
|
+
"A problem in one of the Task's numbered out-of-scope cases is the exception: report it at its real severity, with `outOfScope` set."
|
|
21631
|
+
]
|
|
21632
|
+
].join(" ");
|
|
21411
21633
|
var fixTargetOf = (input, { head, branches, epic }) => {
|
|
21412
21634
|
const from = input.reviewed ?? (input.files === undefined ? undefined : input.since);
|
|
21413
21635
|
const branch = branches === undefined ? epic?.branch : branches.source ?? head;
|
|
@@ -21415,7 +21637,7 @@ var fixTargetOf = (input, { head, branches, epic }) => {
|
|
|
21415
21637
|
`${from === undefined ? `the fix made since the earlier review, up to revision ${head}, which you find from the open findings and \`git log\`,` : `the fix, \`git diff ${from}..${head}\`,`} and the code it touches. An empty fix means nothing was changed, so judge only what is asked below. An earlier round reviewed the rest of the change, so do not review that again. You may read any other code you need.`,
|
|
21416
21638
|
"The commits merging the target branch brought in are not the fix; what such a merge changed in this change, such as a settled conflict, is.",
|
|
21417
21639
|
...input.files === undefined ? input.approved === undefined ? [] : [
|
|
21418
|
-
`The change was approved at ${input.approved}. Report a problem in code it already had there only if it matters, with \`approvedCode\` set to true: such findings are kept apart and do not block.`
|
|
21640
|
+
`The change was approved at ${input.approved}. Report a problem in code it already had there only if it matters, with \`approvedCode\` set to true: such findings are kept apart and do not block, unless one is a blocker in one of the Task's numbered out-of-scope cases.`
|
|
21419
21641
|
] : [
|
|
21420
21642
|
[
|
|
21421
21643
|
"Whatever changed in these files since then, even by merging the target branch, counts as the fix:",
|
|
@@ -21430,17 +21652,18 @@ var fixTargetOf = (input, { head, branches, epic }) => {
|
|
|
21430
21652
|
|
|
21431
21653
|
`);
|
|
21432
21654
|
};
|
|
21433
|
-
var promptFor = (seat, target, input, failing, notRun) => [
|
|
21655
|
+
var promptFor = (seat, target, input, earlier, failing, notRun) => [
|
|
21434
21656
|
`You are ${fixRound(input) ? "the only reviewer of this round" : "one of two reviewers"}. Follow your \`${seats[seat].skill}\` skill; if you do not have it: ${seats[seat].focus}`,
|
|
21435
21657
|
`Review ${target}`,
|
|
21436
21658
|
"Give `summary`: one sentence on whether it can merge and what matters most.",
|
|
21437
21659
|
"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.",
|
|
21438
21660
|
exhaustivePrompt(fixRound(input) ? "the fix" : "the change"),
|
|
21439
21661
|
"What an answer under your brief's Answers so far put out of scope is reported, not missing: do not report it as a finding.",
|
|
21662
|
+
...casesOf(input).length === 0 ? [] : [outOfScopePrompt(casesOf(input))],
|
|
21440
21663
|
"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.",
|
|
21441
21664
|
...seat === scopeSeat && wholeChange(input) ? [scopePrompt(input)] : [],
|
|
21442
|
-
...
|
|
21443
|
-
...fixRound(input) ? [outsideFixPrompt] : [],
|
|
21665
|
+
...earlier.length === 0 ? [] : [earlierPrompt(earlier, casesOf(input))],
|
|
21666
|
+
...fixRound(input) ? [outsideFixPrompt(casesOf(input))] : [],
|
|
21444
21667
|
...failing.length === 0 ? [] : [
|
|
21445
21668
|
`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.`
|
|
21446
21669
|
],
|
|
@@ -21460,26 +21683,67 @@ var promptFor = (seat, target, input, failing, notRun) => [
|
|
|
21460
21683
|
`);
|
|
21461
21684
|
var rank2 = { still_there: 0, changed: 1, fixed: 2 };
|
|
21462
21685
|
var outsideFixAsMinor = (finding) => finding.outsideFix === true && finding.severity === "major" ? { ...finding, severity: "minor" } : finding;
|
|
21686
|
+
var earlierOf = (input) => {
|
|
21687
|
+
const followed = new Map((input.earlier ?? []).map((finding) => [finding.id, finding]));
|
|
21688
|
+
for (const { item, problem: _, ...finding } of input.outOfScopeFindings ?? []) {
|
|
21689
|
+
if (casesOf(input).includes(item))
|
|
21690
|
+
continue;
|
|
21691
|
+
const taken = new Set(followed.keys());
|
|
21692
|
+
const id = taken.has(finding.id) ? ownId(inCase(finding.id, item), taken) : finding.id;
|
|
21693
|
+
followed.set(id, { ...finding, id });
|
|
21694
|
+
}
|
|
21695
|
+
return [...followed.values()];
|
|
21696
|
+
};
|
|
21697
|
+
var keptApart = (finding, item) => finding.severity === "blocker" ? [] : [{ ...finding, severity: finding.severity, item }];
|
|
21463
21698
|
var detailOf = (detail, rule, checked) => [
|
|
21464
21699
|
...rule === undefined ? [] : [`[${rule}]`],
|
|
21465
21700
|
detail,
|
|
21466
21701
|
...checked.length === 0 ? [] : [`Checked and fine: ${checked.join("; ")}.`]
|
|
21467
21702
|
].join(" ");
|
|
21468
21703
|
var severityRank = { blocker: 0, major: 1, minor: 2 };
|
|
21704
|
+
var ownId = (id, taken) => {
|
|
21705
|
+
if (!taken.has(id))
|
|
21706
|
+
return id;
|
|
21707
|
+
let number = 2;
|
|
21708
|
+
while (taken.has(`${id} (${number})`))
|
|
21709
|
+
number++;
|
|
21710
|
+
return `${id} (${number})`;
|
|
21711
|
+
};
|
|
21712
|
+
var wordingsOf = ({ detail, problem }) => problem === undefined ? [detail] : [detail, problem];
|
|
21713
|
+
var distinctApart = (findings, taken = new Set) => {
|
|
21714
|
+
const kept = [];
|
|
21715
|
+
for (const finding of findings) {
|
|
21716
|
+
const index = kept.findIndex((known) => known.file === finding.file && known.line === finding.line && known.item === finding.item && wordingsOf(known).some((wording) => wordingsOf(finding).includes(wording)));
|
|
21717
|
+
const same = kept[index];
|
|
21718
|
+
if (same === undefined) {
|
|
21719
|
+
kept.push({ ...finding, id: ownId(finding.id, new Set([...taken, ...kept.map((known) => known.id)])) });
|
|
21720
|
+
continue;
|
|
21721
|
+
}
|
|
21722
|
+
kept[index] = {
|
|
21723
|
+
...same,
|
|
21724
|
+
...same.problem !== undefined || finding.problem === undefined ? undefined : { problem: finding.problem },
|
|
21725
|
+
severity: severityRank[finding.severity] < severityRank[same.severity] ? finding.severity : same.severity,
|
|
21726
|
+
seats: [...new Set([...same.seats, ...finding.seats])]
|
|
21727
|
+
};
|
|
21728
|
+
}
|
|
21729
|
+
return kept;
|
|
21730
|
+
};
|
|
21469
21731
|
var blockingSeatsOf = (finding) => isBlocking(finding) ? finding.blockingSeats ?? finding.seats : [];
|
|
21732
|
+
var stillOpen = " Still open on this line: ";
|
|
21733
|
+
var problemsOf = (detail) => detail.split(stillOpen).map((problem) => problem.trim());
|
|
21470
21734
|
var withEarlier = (worse, earlier) => {
|
|
21471
21735
|
const { blockingSeats: _, ...finding } = worse;
|
|
21472
21736
|
const seats = [...new Set([...earlier.seats, ...worse.seats])];
|
|
21473
21737
|
const blockingSeats = [...new Set([...blockingSeatsOf(earlier), ...blockingSeatsOf(worse)])];
|
|
21474
21738
|
return {
|
|
21475
21739
|
...finding,
|
|
21476
|
-
detail: `${finding.detail}
|
|
21740
|
+
detail: `${finding.detail}${stillOpen}${earlier.detail}`,
|
|
21477
21741
|
seats,
|
|
21478
21742
|
...blockingSeats.length === seats.length ? undefined : { blockingSeats }
|
|
21479
21743
|
};
|
|
21480
21744
|
};
|
|
21481
21745
|
var idOf = (finding) => `${finding.file}:${finding.line}`;
|
|
21482
|
-
var groupedByRule = (bySeat) => {
|
|
21746
|
+
var groupedByRule = (bySeat, cases, taken) => {
|
|
21483
21747
|
const rules = new Map;
|
|
21484
21748
|
const checked = new Map;
|
|
21485
21749
|
for (const finding of Object.values(bySeat).flat()) {
|
|
@@ -21488,18 +21752,55 @@ var groupedByRule = (bySeat) => {
|
|
|
21488
21752
|
rules.set(id, finding.rule);
|
|
21489
21753
|
checked.set(id, new Set([...checked.get(id) ?? [], ...finding.checked ?? []]));
|
|
21490
21754
|
}
|
|
21491
|
-
const
|
|
21755
|
+
const detailed = (finding) => detailOf(finding.detail, rules.get(idOf(finding)), [...checked.get(idOf(finding)) ?? []]);
|
|
21756
|
+
const distinct = [];
|
|
21757
|
+
const blockers = Object.entries(bySeat).flatMap(([seat, seatFindings]) => seatFindings.flatMap((finding) => finding.severity === "blocker" ? [{ seat, finding }] : []));
|
|
21758
|
+
const firstOn = new Map;
|
|
21759
|
+
for (const { finding } of blockers)
|
|
21760
|
+
if (!firstOn.has(idOf(finding)))
|
|
21761
|
+
firstOn.set(idOf(finding), finding);
|
|
21762
|
+
const merges = new Set(Object.keys(bySeat).flatMap((seat) => [...firstOn].flatMap(([id, first]) => {
|
|
21763
|
+
const own = blockers.filter((entry) => entry.seat === seat && idOf(entry.finding) === id).map((entry) => entry.finding);
|
|
21764
|
+
return own.find((finding) => finding.detail === first.detail) ?? own[0] ?? [];
|
|
21765
|
+
})));
|
|
21766
|
+
const merging = Object.entries(bySeat).map(([seat, seatFindings]) => [
|
|
21767
|
+
seat,
|
|
21768
|
+
seatFindings.flatMap((finding) => {
|
|
21769
|
+
const id = idOf(finding);
|
|
21770
|
+
const first = firstOn.get(id);
|
|
21771
|
+
const marked = caseOf(cases, finding);
|
|
21772
|
+
const another = finding.severity === "blocker" && cases.length > 0 && finding.detail !== first?.detail && (!merges.has(finding) || marked !== undefined && marked !== (first && caseOf(cases, first)));
|
|
21773
|
+
if (!another)
|
|
21774
|
+
return [finding];
|
|
21775
|
+
const index = distinct.findIndex((known) => known.id === id && known.problem === finding.detail);
|
|
21776
|
+
const known = distinct[index];
|
|
21777
|
+
if (known === undefined)
|
|
21778
|
+
distinct.push({ ...finding, id, detail: detailed(finding), seats: [seat], problem: finding.detail });
|
|
21779
|
+
else
|
|
21780
|
+
distinct[index] = { ...known, seats: [...new Set([...known.seats, seat])] };
|
|
21781
|
+
return [];
|
|
21782
|
+
})
|
|
21783
|
+
]);
|
|
21784
|
+
const findings = mergeFindings(Object.fromEntries(merging.map(([seat, seatFindings]) => [
|
|
21492
21785
|
seat,
|
|
21493
21786
|
seatFindings.map((finding) => ({
|
|
21494
21787
|
severity: finding.severity,
|
|
21495
21788
|
file: finding.file,
|
|
21496
21789
|
line: finding.line,
|
|
21497
|
-
detail:
|
|
21790
|
+
detail: detailed(finding)
|
|
21498
21791
|
}))
|
|
21499
21792
|
])));
|
|
21500
|
-
const
|
|
21501
|
-
|
|
21502
|
-
|
|
21793
|
+
for (const finding of findings)
|
|
21794
|
+
taken.add(finding.id);
|
|
21795
|
+
const apart = distinct.map(({ file, line, severity, detail, seats, id }) => {
|
|
21796
|
+
const own = ownId(id, taken);
|
|
21797
|
+
taken.add(own);
|
|
21798
|
+
return { id: own, severity, file, line, detail, seats };
|
|
21799
|
+
});
|
|
21800
|
+
const groupOf = (finding) => rules.get(`${finding.file}:${finding.line}`) ?? finding.id;
|
|
21801
|
+
const all = [...findings, ...apart];
|
|
21802
|
+
const order = [...new Set(all.map(groupOf))];
|
|
21803
|
+
return all.toSorted((left, right) => order.indexOf(groupOf(left)) - order.indexOf(groupOf(right)));
|
|
21503
21804
|
};
|
|
21504
21805
|
var followUpsOf = (earlier, answers) => earlier.map((finding) => {
|
|
21505
21806
|
const statuses = answers.flatMap((answer) => answer.id === finding.id ? [answer.status] : []);
|
|
@@ -21508,27 +21809,65 @@ var followUpsOf = (earlier, answers) => earlier.map((finding) => {
|
|
|
21508
21809
|
status: statuses.length === 0 ? "still_there" : statuses.reduce((worst, status) => rank2[status] < rank2[worst] ? status : worst)
|
|
21509
21810
|
};
|
|
21510
21811
|
});
|
|
21812
|
+
var currentOf = (finding, answers) => {
|
|
21813
|
+
const judging = answers.flatMap(({ id, status, severity, seat }) => id === finding.id && status !== "fixed" && severity !== undefined ? [{ seat, severity }] : []);
|
|
21814
|
+
const now = judging.reduce((worst, { severity }) => worst === undefined || severityRank[severity] < severityRank[worst] ? severity : worst, undefined);
|
|
21815
|
+
if (now === undefined || now === finding.severity)
|
|
21816
|
+
return finding;
|
|
21817
|
+
const { blockingSeats: _, ...current } = finding;
|
|
21818
|
+
const seats = [...new Set([...finding.seats, ...judging.map(({ seat }) => seat)])];
|
|
21819
|
+
const blockingSeats = isBlocking({ severity: now }) ? [
|
|
21820
|
+
...new Set([
|
|
21821
|
+
...blockingSeatsOf(finding),
|
|
21822
|
+
...judging.flatMap(({ seat, severity }) => isBlocking({ severity }) ? [seat] : [])
|
|
21823
|
+
])
|
|
21824
|
+
] : [];
|
|
21825
|
+
return {
|
|
21826
|
+
...current,
|
|
21827
|
+
severity: now,
|
|
21828
|
+
seats,
|
|
21829
|
+
...blockingSeats.length === 0 || blockingSeats.length === seats.length ? undefined : { blockingSeats }
|
|
21830
|
+
};
|
|
21831
|
+
};
|
|
21832
|
+
var earlierCaseOf = (finding, answers, cases) => {
|
|
21833
|
+
const items = answers.flatMap((answer) => answer.id === finding.id && answer.status !== "fixed" ? [caseOf(cases, answer)] : []);
|
|
21834
|
+
return finding.severity === "blocker" || items.includes(undefined) ? undefined : items[0];
|
|
21835
|
+
};
|
|
21511
21836
|
var findingLines = (findings) => findings.map((finding) => `- **${finding.severity}** \`${finding.id}\` ${finding.detail} _(${finding.seats.join(", ")})_`).join(`
|
|
21512
21837
|
`);
|
|
21513
|
-
var reviewText = (summary, findings, followUps, approvedFindings, notRun,
|
|
21514
|
-
|
|
21515
|
-
|
|
21838
|
+
var reviewText = (summary, findings, followUps, approvedFindings, outOfScopeFindings, notRun, scope) => {
|
|
21839
|
+
const reported = scope?.reported ?? [];
|
|
21840
|
+
const outOfScope = scope?.outOfScope ?? [];
|
|
21841
|
+
return [
|
|
21842
|
+
`**Kitman review.** ${summary}`,
|
|
21843
|
+
...reported.length === 0 ? [] : [`Out of scope by an answer, so reported, not blocking:
|
|
21516
21844
|
${reported.map((item) => `- ${item}`).join(`
|
|
21517
21845
|
`)}`],
|
|
21518
|
-
|
|
21846
|
+
...notRun.length === 0 ? [] : [`Verify never ran these tests, so they are unverified:
|
|
21519
21847
|
${notRun.map((item) => `- ${item}`).join(`
|
|
21520
21848
|
`)}`],
|
|
21521
|
-
|
|
21522
|
-
|
|
21523
|
-
|
|
21524
|
-
|
|
21525
|
-
|
|
21849
|
+
...findings.length === 0 ? [] : [findingLines(findings)],
|
|
21850
|
+
...approvedFindings.length === 0 ? [] : [
|
|
21851
|
+
`In code approved before, not blocking:
|
|
21852
|
+
${findingLines(approvedFindings.map(({ item, ...finding }) => item === undefined ? finding : { ...finding, detail: inCase(finding.detail, item) }))}`
|
|
21853
|
+
],
|
|
21854
|
+
...outOfScope.length + outOfScopeFindings.length === 0 ? [] : [
|
|
21855
|
+
[
|
|
21856
|
+
"In a case the Task lists as Out of scope, so reported, not blocking:",
|
|
21857
|
+
...outOfScope.map(({ part, item }) => `- ${inCase(part, item)}`),
|
|
21858
|
+
...outOfScopeFindings.length === 0 ? [] : [findingLines(outOfScopeFindings)]
|
|
21859
|
+
].join(`
|
|
21860
|
+
`)
|
|
21861
|
+
],
|
|
21862
|
+
...followUps.length === 0 ? [] : [
|
|
21863
|
+
`Earlier findings:
|
|
21526
21864
|
${followUps.map((entry) => `- \`${entry.id}\` ${entry.status.replace("_", " ")}`).join(`
|
|
21527
21865
|
`)}`
|
|
21528
|
-
|
|
21529
|
-
].join(`
|
|
21866
|
+
]
|
|
21867
|
+
].join(`
|
|
21530
21868
|
|
|
21531
21869
|
`);
|
|
21870
|
+
};
|
|
21532
21871
|
var fixBrief = (changeRequestId, findings, unmet) => [
|
|
21533
21872
|
`Fix what a review of ChangeRequest ${changeRequestId} found, on its branch:`,
|
|
21534
21873
|
...findings.map((finding) => `- ${finding.id} (${finding.severity}): ${finding.detail}`),
|
|
@@ -21537,7 +21876,7 @@ var fixBrief = (changeRequestId, findings, unmet) => [
|
|
|
21537
21876
|
`);
|
|
21538
21877
|
var review_default = defineLoop({
|
|
21539
21878
|
id: "review",
|
|
21540
|
-
version: "3.
|
|
21879
|
+
version: "3.11.0",
|
|
21541
21880
|
title: "Review",
|
|
21542
21881
|
input: Input,
|
|
21543
21882
|
output: Output,
|
|
@@ -21571,47 +21910,119 @@ var review_default = defineLoop({
|
|
|
21571
21910
|
const verified = head === undefined ? { failing: [], notRun: [] } : yield* verifyHead("verify", head);
|
|
21572
21911
|
const failing = [...new Set([...input.failing ?? [], ...verified.failing])];
|
|
21573
21912
|
const notRun = [...new Set([...input.notRun ?? [], ...verified.notRun])];
|
|
21913
|
+
const earlier = earlierOf(input);
|
|
21574
21914
|
const outputs = yield* forEach2(fixRound(input) ? [scopeSeat] : seatNames, (seat) => agentWork(`review:${seat}`, {
|
|
21575
21915
|
agent: seat,
|
|
21576
|
-
prompt: promptFor(seat, target, input, failing, notRun),
|
|
21916
|
+
prompt: promptFor(seat, target, input, earlier, failing, notRun),
|
|
21577
21917
|
output: SeatOutput
|
|
21578
21918
|
}).pipe(map8((output) => [seat, output])), { concurrency: "unbounded" });
|
|
21579
|
-
const
|
|
21919
|
+
const cases = casesOf(input);
|
|
21580
21920
|
const earlierById = new Map(earlier.map((finding) => [finding.id, finding]));
|
|
21581
|
-
const
|
|
21921
|
+
const answers = outputs.flatMap(([seat, output]) => (output.followUps ?? []).map((answer) => ({ ...answer, seat })));
|
|
21922
|
+
const answered = followUpsOf(earlier, answers);
|
|
21582
21923
|
const standing = new Set(answered.flatMap((entry) => entry.status === "fixed" ? [] : [entry.id]));
|
|
21583
21924
|
const given = outputs.flatMap(([, output]) => output.verdicts ?? []);
|
|
21584
21925
|
const settled = settleRound({ findings: earlier, rebuttals: input.rebuttals ?? [], verdicts: given });
|
|
21585
21926
|
const withdrawn = new Set(settled.withdrawn.map((entry) => entry.finding.id));
|
|
21586
|
-
const open = new Map([...earlierById].
|
|
21927
|
+
const open = new Map([...earlierById].flatMap(([id, finding]) => standing.has(id) && !withdrawn.has(id) ? [[id, currentOf(finding, answers)]] : []));
|
|
21928
|
+
const movedApart = new Map;
|
|
21929
|
+
for (const [id, finding] of open) {
|
|
21930
|
+
const item = earlierCaseOf(finding, answers, cases);
|
|
21931
|
+
if (item === undefined)
|
|
21932
|
+
continue;
|
|
21933
|
+
open.delete(id);
|
|
21934
|
+
for (const apart of keptApart(finding, item))
|
|
21935
|
+
movedApart.set(id, apart);
|
|
21936
|
+
}
|
|
21587
21937
|
const followUps = answered.filter((entry) => !withdrawn.has(entry.id));
|
|
21588
21938
|
const sinceApproval = input.approved !== undefined && input.files === undefined;
|
|
21589
|
-
const
|
|
21939
|
+
const groupOf = (finding) => {
|
|
21940
|
+
const approved = sinceApproval && finding.approvedCode === true;
|
|
21941
|
+
if (caseOf(cases, finding) !== undefined)
|
|
21942
|
+
return finding.severity === "blocker" ? "fresh" : approved ? "approvedApart" : "outOfScope";
|
|
21943
|
+
return approved ? "approvedCode" : "fresh";
|
|
21944
|
+
};
|
|
21945
|
+
const keepsSeverity = (finding) => {
|
|
21946
|
+
const group = groupOf(finding);
|
|
21947
|
+
return group === "outOfScope" || group === "approvedApart";
|
|
21948
|
+
};
|
|
21949
|
+
const listedApart = [
|
|
21950
|
+
...(input.outOfScopeFindings ?? []).filter((finding) => cases.includes(finding.item)),
|
|
21951
|
+
...movedApart.values()
|
|
21952
|
+
];
|
|
21953
|
+
const unfixedOn = (finding) => {
|
|
21590
21954
|
const before = earlierById.get(idOf(finding));
|
|
21591
|
-
return before
|
|
21955
|
+
return before !== undefined && (standing.has(before.id) || withdrawn.has(before.id)) ? before : undefined;
|
|
21592
21956
|
};
|
|
21593
|
-
const
|
|
21957
|
+
const saysAgain = (before, finding) => [finding.detail, detailOf(finding.detail, finding.rule, finding.checked ?? [])].some((text) => problemsOf(before.detail).includes(text.trim()));
|
|
21958
|
+
const isNew = (finding) => {
|
|
21959
|
+
const before = unfixedOn(finding);
|
|
21960
|
+
return before === undefined || movedApart.has(before.id) || severityRank[finding.severity] < severityRank[before.severity] || finding.severity === "blocker" && (withdrawn.has(before.id) || caseOf(cases, finding) !== undefined) && !saysAgain(before, finding);
|
|
21961
|
+
};
|
|
21962
|
+
const isNewApart = (finding) => {
|
|
21963
|
+
const before = unfixedOn(finding);
|
|
21964
|
+
return before === undefined || movedApart.has(before.id) || severityRank[finding.severity] < severityRank[before.severity] || !saysAgain(before, finding);
|
|
21965
|
+
};
|
|
21966
|
+
const seatFindings = (holds) => Object.fromEntries(outputs.map(([seat, output]) => [
|
|
21594
21967
|
seat,
|
|
21595
|
-
output.findings.map((finding) => fixRound(input) ? outsideFixAsMinor(finding) : finding).filter(
|
|
21596
|
-
]))
|
|
21597
|
-
const
|
|
21968
|
+
output.findings.map((finding) => fixRound(input) && !keepsSeverity(finding) ? outsideFixAsMinor(finding) : finding).filter(holds)
|
|
21969
|
+
]));
|
|
21970
|
+
const takenIds = new Set(earlierById.keys());
|
|
21971
|
+
const merged = (holds) => groupedByRule(seatFindings((finding) => isNew(finding) && holds(finding)), cases, takenIds);
|
|
21972
|
+
const ownFinding = (finding) => {
|
|
21973
|
+
const id = ownId(finding.id, takenIds);
|
|
21974
|
+
takenIds.add(id);
|
|
21975
|
+
return { ...finding, id };
|
|
21976
|
+
};
|
|
21977
|
+
const fresh = merged((finding) => groupOf(finding) === "fresh").map((finding) => {
|
|
21598
21978
|
const before = open.get(finding.id);
|
|
21599
|
-
|
|
21979
|
+
const rebutted = earlierById.get(finding.id);
|
|
21980
|
+
const worse = (than) => severityRank[finding.severity] < severityRank[than.severity];
|
|
21981
|
+
if (before !== undefined)
|
|
21982
|
+
return worse(before) ? withEarlier(finding, before) : ownFinding(finding);
|
|
21983
|
+
return rebutted !== undefined && withdrawn.has(rebutted.id) && !worse(rebutted) ? ownFinding(finding) : finding;
|
|
21600
21984
|
});
|
|
21601
21985
|
const freshIds = new Set(fresh.map((finding) => finding.id));
|
|
21602
|
-
const
|
|
21986
|
+
const apartOf = (group) => Object.entries(seatFindings((finding) => groupOf(finding) === group && isNewApart(finding))).flatMap(([seat, found]) => found.flatMap((finding) => keptApart({
|
|
21987
|
+
id: idOf(finding),
|
|
21988
|
+
severity: finding.severity,
|
|
21989
|
+
file: finding.file,
|
|
21990
|
+
line: finding.line,
|
|
21991
|
+
detail: detailOf(finding.detail, finding.rule, finding.checked ?? []),
|
|
21992
|
+
seats: [seat],
|
|
21993
|
+
problem: finding.detail
|
|
21994
|
+
}, caseOf(cases, finding) ?? "")));
|
|
21995
|
+
const approvedInScope = merged((finding) => groupOf(finding) === "approvedCode");
|
|
21996
|
+
const approvedFindings = [
|
|
21997
|
+
...approvedInScope,
|
|
21998
|
+
...distinctApart(apartOf("approvedApart"), new Set(approvedInScope.map((finding) => finding.id)))
|
|
21999
|
+
];
|
|
22000
|
+
const outOfScopeFindings = distinctApart([...listedApart, ...apartOf("outOfScope")]);
|
|
21603
22001
|
const findings = [...[...open.values()].filter((finding) => !freshIds.has(finding.id)), ...fresh];
|
|
21604
22002
|
const verdicts = given.map((verdict) => freshIds.has(verdict.findingId) ? { ...verdict, accepted: false } : verdict);
|
|
21605
22003
|
const blockers = findings.filter(isBlocking);
|
|
21606
22004
|
const judged = outputs.find(([seat]) => seat === scopeSeat)?.[1].scope;
|
|
21607
|
-
const scope = wholeChange(input) ? carriedScope(judged,
|
|
21608
|
-
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(" ");
|
|
21609
|
-
const
|
|
22005
|
+
const scope = wholeChange(input) ? withUnjudged(carriedScope(judged, earlierScope(input), cases, criteriaOf(input)), requiredCriteriaOf(input)) : undefined;
|
|
22006
|
+
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.` : outOfScopeFindings.length > 0 ? "No findings in scope: 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(" ");
|
|
22007
|
+
const shownOutOfScope = outOfScopeFindings.map((finding) => ({
|
|
22008
|
+
...finding,
|
|
22009
|
+
detail: inCase(finding.detail, finding.item)
|
|
22010
|
+
}));
|
|
22011
|
+
const text = reviewText(summary, findings, followUps, approvedFindings, shownOutOfScope, notRun, scope);
|
|
22012
|
+
const apart = {
|
|
22013
|
+
...approvedFindings.length === 0 ? undefined : { approvedFindings },
|
|
22014
|
+
...outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings }
|
|
22015
|
+
};
|
|
21610
22016
|
const stored = yield* artifact("findings", {
|
|
21611
22017
|
kind: "review-findings",
|
|
21612
22018
|
title: "Review findings",
|
|
21613
22019
|
text,
|
|
21614
|
-
data: {
|
|
22020
|
+
data: {
|
|
22021
|
+
findings,
|
|
22022
|
+
followUps,
|
|
22023
|
+
...apart,
|
|
22024
|
+
...scope === undefined ? undefined : { scope: { outOfScope: scope.outOfScope ?? [] } }
|
|
22025
|
+
}
|
|
21615
22026
|
});
|
|
21616
22027
|
const reviewed = {
|
|
21617
22028
|
summary,
|
|
@@ -21620,7 +22031,7 @@ var review_default = defineLoop({
|
|
|
21620
22031
|
verdicts,
|
|
21621
22032
|
blocking: findings.some(isBlocking),
|
|
21622
22033
|
artifactId: stored.artifactId,
|
|
21623
|
-
...
|
|
22034
|
+
...apart,
|
|
21624
22035
|
...scope === undefined ? undefined : { scope },
|
|
21625
22036
|
...failing.length === 0 ? undefined : { failing },
|
|
21626
22037
|
...input.deliversTo === undefined ? undefined : { deliversTo: input.deliversTo }
|
|
@@ -21660,6 +22071,7 @@ What next?`,
|
|
|
21660
22071
|
maxRounds: 2,
|
|
21661
22072
|
reviewed: range.head,
|
|
21662
22073
|
...findings.length === 0 ? undefined : { earlier: findings },
|
|
22074
|
+
...outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings },
|
|
21663
22075
|
...scope === undefined ? undefined : { scope },
|
|
21664
22076
|
...ownDeliveryTarget(input)
|
|
21665
22077
|
});
|
|
@@ -22224,6 +22636,7 @@ var ShepherdOutput = Struct({
|
|
|
22224
22636
|
branch: optional2(String5),
|
|
22225
22637
|
reviewed: optional2(String5),
|
|
22226
22638
|
earlier: optional2(ArraySchema(MergedFinding)),
|
|
22639
|
+
outOfScopeFindings: optional2(ArraySchema(OutOfScopeFinding)),
|
|
22227
22640
|
scope: optional2(ReviewedScope)
|
|
22228
22641
|
}))
|
|
22229
22642
|
});
|
|
@@ -22414,7 +22827,7 @@ var repliesPrompt = (threads) => [
|
|
|
22414
22827
|
var threadKey = (thread) => `${thread.id}:${thread.comments.length}`;
|
|
22415
22828
|
var shepherd_default = defineLoop({
|
|
22416
22829
|
id: "shepherd",
|
|
22417
|
-
version: "1.
|
|
22830
|
+
version: "1.11.0",
|
|
22418
22831
|
title: "Shepherd",
|
|
22419
22832
|
input: Input3,
|
|
22420
22833
|
output: Output3,
|
|
@@ -22451,6 +22864,7 @@ var shepherd_default = defineLoop({
|
|
|
22451
22864
|
const leftToPerson = new Set;
|
|
22452
22865
|
let headFindings = [];
|
|
22453
22866
|
let headFindingsAt;
|
|
22867
|
+
let outOfScopeFindings = [];
|
|
22454
22868
|
let headScope;
|
|
22455
22869
|
const unranAt = new Map;
|
|
22456
22870
|
const rounds = { "ci-fix": 0, "head-fix": 0 };
|
|
@@ -22526,7 +22940,8 @@ var shepherd_default = defineLoop({
|
|
|
22526
22940
|
${open}`,
|
|
22527
22941
|
...input.taskId === undefined ? undefined : { taskId: input.taskId },
|
|
22528
22942
|
...target === "HEAD" ? undefined : { branch: target },
|
|
22529
|
-
...review
|
|
22943
|
+
...review,
|
|
22944
|
+
...outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings }
|
|
22530
22945
|
}
|
|
22531
22946
|
});
|
|
22532
22947
|
const takeTurn = () => gen2(function* () {
|
|
@@ -22760,11 +23175,14 @@ ${open}`,
|
|
|
22760
23175
|
const reviewed = yield* call(`review:${cycle}`, reviewLoop(), {
|
|
22761
23176
|
base: `origin/${target}`,
|
|
22762
23177
|
head,
|
|
23178
|
+
deliveredBy: changeRequestId,
|
|
22763
23179
|
files: files.files,
|
|
22764
23180
|
...head === files.synced ? undefined : { since: files.synced },
|
|
22765
23181
|
...files.earlier.length === 0 ? undefined : { earlier: files.earlier },
|
|
22766
|
-
...files.reviewed === undefined ? undefined : { reviewed: files.reviewed }
|
|
23182
|
+
...files.reviewed === undefined ? undefined : { reviewed: files.reviewed },
|
|
23183
|
+
...outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings }
|
|
22767
23184
|
});
|
|
23185
|
+
outOfScopeFindings = reviewed.outOfScopeFindings ?? [];
|
|
22768
23186
|
if (reviewed.blocking) {
|
|
22769
23187
|
const blocking = reviewed.findings.filter(isBlocking);
|
|
22770
23188
|
if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
|
|
@@ -22825,12 +23243,15 @@ ${open}`,
|
|
|
22825
23243
|
const reviewed = yield* call(`head-review:${cycle}`, reviewLoop(), {
|
|
22826
23244
|
base: `origin/${target}`,
|
|
22827
23245
|
head,
|
|
23246
|
+
deliveredBy: changeRequestId,
|
|
22828
23247
|
...notRun.length === 0 ? undefined : { notRun },
|
|
22829
23248
|
...since === undefined ? undefined : { approved: since },
|
|
22830
23249
|
...headFindings.length === 0 ? undefined : { earlier: headFindings },
|
|
22831
23250
|
...headFindingsAt === undefined ? undefined : { reviewed: headFindingsAt },
|
|
23251
|
+
...outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings },
|
|
22832
23252
|
...headScope === undefined ? undefined : { scope: headScope }
|
|
22833
23253
|
});
|
|
23254
|
+
outOfScopeFindings = reviewed.outOfScopeFindings ?? [];
|
|
22834
23255
|
if (reviewed.blocking) {
|
|
22835
23256
|
const blocking = reviewed.findings.filter(isBlocking);
|
|
22836
23257
|
if (!(yield* mayFix("head-fix", cycle, blocking.map((finding) => finding.id).join(", "))))
|
|
@@ -23313,6 +23734,8 @@ var BuildInput = Struct({
|
|
|
23313
23734
|
maxRebuilds: optional2(Int.check(isGreaterThanOrEqualTo2(0))),
|
|
23314
23735
|
reviewed: optional2(String5),
|
|
23315
23736
|
earlier: optional2(ArraySchema(MergedFinding)),
|
|
23737
|
+
outOfScopeFindings: optional2(ArraySchema(OutOfScopeFinding)),
|
|
23738
|
+
taskOutOfScope: optional2(ArraySchema(String5)),
|
|
23316
23739
|
scope: optional2(ReviewedScope),
|
|
23317
23740
|
planReviewed: optional2(Boolean3),
|
|
23318
23741
|
...DeliveryFields
|
|
@@ -23320,7 +23743,8 @@ var BuildInput = Struct({
|
|
|
23320
23743
|
var CriterionAnswer = Struct({
|
|
23321
23744
|
criterion: String5,
|
|
23322
23745
|
status: Literals(["met", "after_merge", "not_met"]),
|
|
23323
|
-
detail: ShortStatement
|
|
23746
|
+
detail: ShortStatement,
|
|
23747
|
+
...outOfScopeCase
|
|
23324
23748
|
});
|
|
23325
23749
|
var Criteria = Struct({ criteria: ArraySchema(CriterionAnswer) });
|
|
23326
23750
|
var SuggestedCheck = Struct({
|
|
@@ -23362,6 +23786,7 @@ var BuildOutput = Struct({
|
|
|
23362
23786
|
criteria: ArraySchema(CriterionAnswer),
|
|
23363
23787
|
notRun: optional2(ArraySchema(String5)),
|
|
23364
23788
|
findings: optional2(ArraySchema(MergedFinding)),
|
|
23789
|
+
outOfScopeFindings: optional2(ArraySchema(OutOfScopeFinding)),
|
|
23365
23790
|
scope: optional2(ReviewedScope),
|
|
23366
23791
|
blockingCounts: optional2(ArraySchema(Int)),
|
|
23367
23792
|
approval: optional2(ApproveChangeRequestResult),
|
|
@@ -23399,27 +23824,67 @@ class BuildOutcomeRefused extends TaggedError3()("BuildOutcomeRefused", {
|
|
|
23399
23824
|
}) {
|
|
23400
23825
|
}
|
|
23401
23826
|
var criteriaGuidance = "If your brief has a Task, answer each of its acceptance criteria in `criteria`: met, with the test or file that shows it; after_merge, with why it can only be seen once merged; or not_met, with why. Give an empty `criteria` when the Task has none.";
|
|
23827
|
+
var outOfScopeGuidance = (cases) => cases.length === 0 ? [] : [
|
|
23828
|
+
[
|
|
23829
|
+
"The Task's Out of scope list is these numbered cases. Do not build them: Review reports a problem in one without holding the change for it, unless it is a blocker, such as a security hole or lost data.",
|
|
23830
|
+
...numberedCases(cases),
|
|
23831
|
+
"A criterion that is not met only because it falls in one of these is not_met, with `outOfScope` set to the case's number; Review says whether it agrees."
|
|
23832
|
+
].join(`
|
|
23833
|
+
`)
|
|
23834
|
+
];
|
|
23402
23835
|
var checksGuidance = "If your brief lists no approved verifications for this repository, name in `checks` the commands from its package scripts or CI config that test, lint and typecheck it, each with a `name` of letters, digits, `.`, `_`, `:` and `-` only, such as `unit-tests`; Kitman runs them and labels them as suggested by you.";
|
|
23403
23836
|
var implementAdaptation = "You run the implement skill as a Kitman Step. The work is in this prompt and your brief, so fetch no ticket. Leave your changes uncommitted: the Run owns the branch. Skip its final code-review: a Review run or a person reviews the change.";
|
|
23404
|
-
var implementPrompt = (task, outcome, continuing) => [
|
|
23837
|
+
var implementPrompt = (task, outcome, continuing, cases) => [
|
|
23405
23838
|
...continuing === undefined ? [] : [continuingBrief(continuing), "Fix forward from there."],
|
|
23406
23839
|
`Build ${task}`,
|
|
23407
23840
|
implementAdaptation,
|
|
23408
23841
|
...outcome === undefined ? [] : [outcomeGuidance[outcome]],
|
|
23409
23842
|
'Commit nothing yourself: Kitman pushes what you leave in the workspace. Give the ChangeRequest a title and a summary, and list as claims what you believe but Kitman has not checked, such as "the tests pass".',
|
|
23843
|
+
...outOfScopeGuidance(cases),
|
|
23410
23844
|
criteriaGuidance,
|
|
23411
23845
|
checksGuidance
|
|
23412
23846
|
].join(`
|
|
23413
23847
|
|
|
23414
23848
|
`);
|
|
23415
|
-
var criteriaPrompt = (unanswered, unmet) => [
|
|
23849
|
+
var criteriaPrompt = (unanswered, unmet, cases) => [
|
|
23416
23850
|
unanswered ? "You did not answer the Task's acceptance criteria. Answer each one before anyone reviews the change." : "These acceptance criteria are not met yet. Meet them, or say why they cannot be met here, such as an answer under Answers so far that put them out of scope; do not ask that Question again:",
|
|
23417
23851
|
...unmet.map((answer) => `- ${answer.criterion}: ${answer.detail}`),
|
|
23852
|
+
...outOfScopeGuidance(cases),
|
|
23418
23853
|
criteriaGuidance
|
|
23419
23854
|
].join(`
|
|
23420
23855
|
|
|
23421
23856
|
`);
|
|
23422
|
-
var answerLine = (answer) =>
|
|
23857
|
+
var answerLine = (answer, cases) => {
|
|
23858
|
+
const line = `${answer.criterion}: ${answer.status.replaceAll("_", " ")}, ${answer.detail}`;
|
|
23859
|
+
const item = answer.status === "not_met" ? caseOf(cases, answer) : undefined;
|
|
23860
|
+
return item === undefined ? line : `${line} (proposed Out of scope: ${item})`;
|
|
23861
|
+
};
|
|
23862
|
+
var reviewedAs = (criterion, cases, scope) => {
|
|
23863
|
+
if (cases.length === 0 || scope === undefined)
|
|
23864
|
+
return;
|
|
23865
|
+
const judged = scope.criteria?.find((entry) => entry.criterion === criterion);
|
|
23866
|
+
if (judged?.status === "open" || scope.unmet.includes(criterion))
|
|
23867
|
+
return { status: "open" };
|
|
23868
|
+
if (judged?.status === "met")
|
|
23869
|
+
return { status: "met" };
|
|
23870
|
+
if (judged?.status === "reported" || scope.reported?.includes(criterion))
|
|
23871
|
+
return { status: "reported" };
|
|
23872
|
+
const item = judged?.item ?? scope.outOfScope?.find((entry) => entry.part === criterion)?.item;
|
|
23873
|
+
return item !== undefined && cases.includes(item) ? { status: "out_of_scope", item } : undefined;
|
|
23874
|
+
};
|
|
23875
|
+
var criterionLine = (answer, cases, scope) => {
|
|
23876
|
+
const final = reviewedAs(answer.criterion, cases, scope);
|
|
23877
|
+
const answered = `answered ${answer.status.replaceAll("_", " ")}: ${answer.detail}`;
|
|
23878
|
+
if (final === undefined || final.status === "met" && answer.status === "met")
|
|
23879
|
+
return answerLine(answer, cases);
|
|
23880
|
+
if (final.status === "open")
|
|
23881
|
+
return answer.status === "not_met" ? answerLine(answer, cases) : `${answer.criterion}: not met, as Review judged it (${answered})`;
|
|
23882
|
+
if (final.status === "met")
|
|
23883
|
+
return `${answer.criterion}: met, as Review judged it (${answered})`;
|
|
23884
|
+
if (final.status === "reported")
|
|
23885
|
+
return `${answer.criterion}: out of scope by an answer (${answered})`;
|
|
23886
|
+
return answer.status === "not_met" ? inCase(`${answer.criterion}: not met, ${answer.detail}`, final.item) : inCase(`${answer.criterion}: not done, as Review judged it (${answered})`, final.item);
|
|
23887
|
+
};
|
|
23423
23888
|
var reproducingCheckGuidance = "Give in `check` the command that runs only that test, with a `name` of letters, digits, `.`, `_`, `:` and `-` that no approved verification of the repository has, unless it is exactly that approved check. Kitman runs it before the fix, where it must fail, and on every head after, where it must pass.";
|
|
23424
23889
|
var reproducePrompt = (task) => [
|
|
23425
23890
|
`Reproduce the bug in ${task} before anyone fixes it.`,
|
|
@@ -23471,6 +23936,7 @@ var rally = (input) => gen2(function* () {
|
|
|
23471
23936
|
const blockingCounts = [];
|
|
23472
23937
|
let rebuttals = [];
|
|
23473
23938
|
let earlier = input.earlier;
|
|
23939
|
+
let outOfScope = input.outOfScope;
|
|
23474
23940
|
let previous;
|
|
23475
23941
|
let last;
|
|
23476
23942
|
const shown = new Set;
|
|
@@ -23499,6 +23965,7 @@ var rally = (input) => gen2(function* () {
|
|
|
23499
23965
|
head,
|
|
23500
23966
|
decision: { stop: true, reason: "findings_returned", unsettled: blockingIds(last.settled) },
|
|
23501
23967
|
claims,
|
|
23968
|
+
outOfScope,
|
|
23502
23969
|
conflicts,
|
|
23503
23970
|
earlier,
|
|
23504
23971
|
blockingCounts
|
|
@@ -23509,15 +23976,21 @@ var rally = (input) => gen2(function* () {
|
|
|
23509
23976
|
const reviewed = yield* call(`review:${round}`, review_default, {
|
|
23510
23977
|
base,
|
|
23511
23978
|
head: head.revision,
|
|
23979
|
+
...input.deliveredBy === undefined ? undefined : { deliveredBy: input.deliveredBy },
|
|
23512
23980
|
...rebuttals.length === 0 ? undefined : { rebuttals },
|
|
23513
23981
|
...earlier.length === 0 ? undefined : { earlier },
|
|
23514
23982
|
...last === undefined ? input.reviewed === undefined ? undefined : { reviewed: input.reviewed } : { reviewed: last.head.revision },
|
|
23983
|
+
...outOfScope.length === 0 ? undefined : { outOfScopeFindings: outOfScope },
|
|
23984
|
+
...input.unmetCriteria.length === 0 ? undefined : { unmetCriteria: input.unmetCriteria },
|
|
23985
|
+
...input.metCriteria.length === 0 ? undefined : { metCriteria: input.metCriteria },
|
|
23986
|
+
...input.afterMergeCriteria.length === 0 ? undefined : { afterMergeCriteria: input.afterMergeCriteria },
|
|
23515
23987
|
...scope === undefined ? undefined : { scope },
|
|
23516
23988
|
...input.outcome === undefined ? undefined : { outcome: input.outcome },
|
|
23517
23989
|
...failing.length === 0 ? undefined : { failing },
|
|
23518
23990
|
...notRun.length === 0 ? undefined : { notRun },
|
|
23519
23991
|
claims: [...claims]
|
|
23520
23992
|
});
|
|
23993
|
+
outOfScope = reviewed.outOfScopeFindings ?? [];
|
|
23521
23994
|
const checks = checkFindings(head);
|
|
23522
23995
|
const settled = settleRound({
|
|
23523
23996
|
findings: [...reviewed.findings, ...scopeFindings(reviewed.scope), ...checks],
|
|
@@ -23541,6 +24014,7 @@ var rally = (input) => gen2(function* () {
|
|
|
23541
24014
|
decision,
|
|
23542
24015
|
claims,
|
|
23543
24016
|
scope: reviewed.scope,
|
|
24017
|
+
outOfScope,
|
|
23544
24018
|
conflicts,
|
|
23545
24019
|
earlier,
|
|
23546
24020
|
blockingCounts
|
|
@@ -23564,7 +24038,7 @@ var rally = (input) => gen2(function* () {
|
|
|
23564
24038
|
});
|
|
23565
24039
|
var build2 = defineLoop({
|
|
23566
24040
|
id: "build",
|
|
23567
|
-
version: "2.
|
|
24041
|
+
version: "2.13.0",
|
|
23568
24042
|
title: "Build",
|
|
23569
24043
|
input: BuildInput,
|
|
23570
24044
|
output: BuildOutput,
|
|
@@ -23588,6 +24062,7 @@ var build2 = defineLoop({
|
|
|
23588
24062
|
yield* writeBack("write-back:started", { milestone: "started" });
|
|
23589
24063
|
const task = input.words === undefined ? "the Task your brief describes." : `this: ${input.words}`;
|
|
23590
24064
|
const outcome = input.outcome;
|
|
24065
|
+
const cases = listedCases(input.taskOutOfScope);
|
|
23591
24066
|
const epic = epicOf(input);
|
|
23592
24067
|
const target = input.continuing?.targetBranch ?? input.branch ?? epic?.branch;
|
|
23593
24068
|
if (epic !== undefined && input.continuing === undefined && input.branch === undefined)
|
|
@@ -23608,25 +24083,30 @@ var build2 = defineLoop({
|
|
|
23608
24083
|
const implemented = yield* agentWorkOnce("implement", {
|
|
23609
24084
|
agent: input.planReviewed === true ? "planned-implementer" : "implementer",
|
|
23610
24085
|
skill: "implement",
|
|
23611
|
-
prompt: implementPrompt(task, outcome, input.continuing),
|
|
24086
|
+
prompt: implementPrompt(task, outcome, input.continuing, cases),
|
|
23612
24087
|
output: Implemented
|
|
23613
24088
|
});
|
|
23614
24089
|
const unanswered = input.taskId !== undefined && implemented.criteria === undefined;
|
|
23615
|
-
const unmet = (implemented.criteria ?? []).filter((answer) => answer.status === "not_met");
|
|
24090
|
+
const unmet = (implemented.criteria ?? []).filter((answer) => answer.status === "not_met" && caseOf(cases, answer) === undefined);
|
|
23616
24091
|
const criteria = unanswered || unmet.length > 0 ? (yield* agentWorkOnce("criteria", {
|
|
23617
24092
|
agent: "implementer",
|
|
23618
|
-
prompt: criteriaPrompt(unanswered, unmet),
|
|
24093
|
+
prompt: criteriaPrompt(unanswered, unmet, cases),
|
|
23619
24094
|
output: Criteria
|
|
23620
24095
|
})).criteria : implemented.criteria ?? [];
|
|
23621
24096
|
const last = yield* rally({
|
|
23622
24097
|
maxRounds: input.maxRounds ?? 3,
|
|
23623
24098
|
target,
|
|
23624
24099
|
outcome,
|
|
23625
|
-
claims: [...implemented.claims, ...criteria.map((answer) => `Criterion ${answerLine(answer)}`)],
|
|
24100
|
+
claims: [...implemented.claims, ...criteria.map((answer) => `Criterion ${answerLine(answer, cases)}`)],
|
|
23626
24101
|
suggested: implemented.checks ?? [],
|
|
23627
24102
|
reproducing: reproduced?.check,
|
|
23628
24103
|
reviewed: input.reviewed,
|
|
24104
|
+
deliveredBy: input.changeRequestId,
|
|
23629
24105
|
earlier: input.earlier ?? [],
|
|
24106
|
+
outOfScope: input.outOfScopeFindings ?? [],
|
|
24107
|
+
unmetCriteria: cases.length === 0 ? [] : criteria.flatMap((answer) => answer.status === "not_met" ? [answer.criterion] : []),
|
|
24108
|
+
metCriteria: cases.length === 0 ? [] : criteria.flatMap((answer) => answer.status === "met" ? [answer.criterion] : []),
|
|
24109
|
+
afterMergeCriteria: cases.length === 0 ? [] : criteria.flatMap((answer) => answer.status === "after_merge" ? [answer.criterion] : []),
|
|
23630
24110
|
scope: input.scope
|
|
23631
24111
|
});
|
|
23632
24112
|
const verdict = evidenceGate({
|
|
@@ -23645,7 +24125,7 @@ var build2 = defineLoop({
|
|
|
23645
24125
|
...brokenChecks(last.head).map((check) => failsOn("head", check, last.head.tree)),
|
|
23646
24126
|
...unsettledItems(last.settled, last.decision),
|
|
23647
24127
|
...last.conflicts,
|
|
23648
|
-
...criteria.flatMap((answer) => answer.status === "not_met" ? [`Criterion not met: ${answer.criterion} (${answer.detail})`] : [])
|
|
24128
|
+
...criteria.flatMap((answer) => answer.status === "not_met" && (reviewedAs(answer.criterion, cases, last.scope)?.status ?? "open") === "open" ? [`Criterion not met: ${answer.criterion} (${answer.detail})`] : [])
|
|
23649
24129
|
])
|
|
23650
24130
|
];
|
|
23651
24131
|
const body = changeRequestBody({
|
|
@@ -23653,8 +24133,9 @@ var build2 = defineLoop({
|
|
|
23653
24133
|
head: last.head,
|
|
23654
24134
|
claims: last.claims,
|
|
23655
24135
|
unsettled,
|
|
23656
|
-
criteria: criteria.map(
|
|
24136
|
+
criteria: criteria.map((answer) => criterionLine(answer, cases, last.scope)),
|
|
23657
24137
|
later: last.settled.open.filter((finding) => !isBlocking(finding)).map((finding) => `${finding.id}: ${finding.detail}`),
|
|
24138
|
+
outOfScope: outOfScopeLines(last.outOfScope, last.scope),
|
|
23658
24139
|
rounds: last.round,
|
|
23659
24140
|
stopped: last.decision.reason
|
|
23660
24141
|
});
|
|
@@ -23678,6 +24159,7 @@ var build2 = defineLoop({
|
|
|
23678
24159
|
criteria,
|
|
23679
24160
|
...lastNotRun.length === 0 ? undefined : { notRun: lastNotRun },
|
|
23680
24161
|
...last.earlier.length === 0 ? undefined : { findings: last.earlier },
|
|
24162
|
+
...last.outOfScope.length === 0 ? undefined : { outOfScopeFindings: last.outOfScope },
|
|
23681
24163
|
...last.scope === undefined ? undefined : { scope: last.scope },
|
|
23682
24164
|
blockingCounts: last.blockingCounts,
|
|
23683
24165
|
...approval === undefined ? undefined : { approval }
|
|
@@ -23743,6 +24225,7 @@ var build2 = defineLoop({
|
|
|
23743
24225
|
land: false,
|
|
23744
24226
|
reviewed: settledAs.revision,
|
|
23745
24227
|
...settledAs.findings === undefined ? undefined : { earlier: settledAs.findings },
|
|
24228
|
+
...settledAs.outOfScopeFindings === undefined ? undefined : { outOfScopeFindings: settledAs.outOfScopeFindings },
|
|
23746
24229
|
...settledAs.scope === undefined ? undefined : { scope: settledAs.scope },
|
|
23747
24230
|
...ownDeliveryTarget(input)
|
|
23748
24231
|
}, { constraints: standing.map(standingConstraint) });
|
|
@@ -24158,7 +24641,7 @@ var steadier = (plan) => {
|
|
|
24158
24641
|
};
|
|
24159
24642
|
var hillclimb_default = defineLoop({
|
|
24160
24643
|
id: "hillclimb",
|
|
24161
|
-
version: "1.
|
|
24644
|
+
version: "1.6.0",
|
|
24162
24645
|
title: "Hillclimb",
|
|
24163
24646
|
outcome: "performance",
|
|
24164
24647
|
input: Input5,
|
|
@@ -24313,6 +24796,7 @@ var hillclimb_default = defineLoop({
|
|
|
24313
24796
|
claims,
|
|
24314
24797
|
earlier: reviewed.findings,
|
|
24315
24798
|
reviewed: fixedFrom,
|
|
24799
|
+
...reviewed.outOfScopeFindings === undefined ? undefined : { outOfScopeFindings: reviewed.outOfScopeFindings },
|
|
24316
24800
|
...reviewed.scope === undefined ? undefined : { scope: reviewed.scope }
|
|
24317
24801
|
});
|
|
24318
24802
|
}
|
|
@@ -24341,7 +24825,8 @@ ${harness.summary}
|
|
|
24341
24825
|
...unsettled.length + caveats.length === 0 ? [] : [`## Unsettled
|
|
24342
24826
|
|
|
24343
24827
|
${[...unsettled, ...caveats].map((entry) => `- ${entry}`).join(`
|
|
24344
|
-
`)}`]
|
|
24828
|
+
`)}`],
|
|
24829
|
+
...outOfScopeSection(outOfScopeLines(reviewed.outOfScopeFindings ?? [], reviewed.scope))
|
|
24345
24830
|
].join(`
|
|
24346
24831
|
|
|
24347
24832
|
`)
|
|
@@ -25856,7 +26341,7 @@ var tidyPrompt = (scope, words) => [
|
|
|
25856
26341
|
var areaOf = (revision, branch) => `in the area of the change at ${revision}: only the files that \`git diff $(git merge-base origin/${branch ?? "HEAD"} ${revision}) ${revision}\` touches, and the files that change with them`;
|
|
25857
26342
|
var tidy_default = defineLoop({
|
|
25858
26343
|
id: "tidy",
|
|
25859
|
-
version: "1.
|
|
26344
|
+
version: "1.1.0",
|
|
25860
26345
|
title: "Tidy",
|
|
25861
26346
|
input: Input12,
|
|
25862
26347
|
output: Output13,
|
|
@@ -25898,6 +26383,7 @@ var tidy_default = defineLoop({
|
|
|
25898
26383
|
head,
|
|
25899
26384
|
claims: improvement.claims,
|
|
25900
26385
|
unsettled,
|
|
26386
|
+
outOfScope: outOfScopeLines(reviewed.outOfScopeFindings ?? [], reviewed.scope),
|
|
25901
26387
|
rounds: 1,
|
|
25902
26388
|
stopped: decision.stop ? decision.reason : "round_cap"
|
|
25903
26389
|
})
|
|
@@ -31840,4 +32326,4 @@ var runKit = (config, identity, packages) => {
|
|
|
31840
32326
|
runMain2(program.pipe(flatMap3((code) => sync2(() => process.exit(code)))));
|
|
31841
32327
|
};
|
|
31842
32328
|
// .kitman-build-entry.ts
|
|
31843
|
-
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.
|
|
32329
|
+
runKit(kitman_config_default, { name: "@kitman-sh/software-engineering", version: "0.13.17" }, []);
|