@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/declarations.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{
|
|
4
4
|
"id": "build",
|
|
5
5
|
"title": "Build",
|
|
6
|
-
"version": "2.
|
|
6
|
+
"version": "2.3.0",
|
|
7
7
|
"input": {
|
|
8
8
|
"type": "object",
|
|
9
9
|
"properties": {
|
|
@@ -267,6 +267,19 @@
|
|
|
267
267
|
"additionalProperties": true
|
|
268
268
|
}
|
|
269
269
|
},
|
|
270
|
+
"notRun": {
|
|
271
|
+
"anyOf": [
|
|
272
|
+
{
|
|
273
|
+
"type": "array",
|
|
274
|
+
"items": {
|
|
275
|
+
"type": "string"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"type": "null"
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
},
|
|
270
283
|
"approval": {
|
|
271
284
|
"anyOf": [
|
|
272
285
|
{
|
|
@@ -322,7 +335,8 @@
|
|
|
322
335
|
"enum": [
|
|
323
336
|
"merged",
|
|
324
337
|
"ready",
|
|
325
|
-
"needs_you"
|
|
338
|
+
"needs_you",
|
|
339
|
+
"handed_back"
|
|
326
340
|
]
|
|
327
341
|
},
|
|
328
342
|
"reason": {
|
|
@@ -370,6 +384,49 @@
|
|
|
370
384
|
"type": "null"
|
|
371
385
|
}
|
|
372
386
|
]
|
|
387
|
+
},
|
|
388
|
+
"handBack": {
|
|
389
|
+
"anyOf": [
|
|
390
|
+
{
|
|
391
|
+
"type": "object",
|
|
392
|
+
"properties": {
|
|
393
|
+
"changeRequestId": {
|
|
394
|
+
"type": "string"
|
|
395
|
+
},
|
|
396
|
+
"words": {
|
|
397
|
+
"type": "string"
|
|
398
|
+
},
|
|
399
|
+
"taskId": {
|
|
400
|
+
"anyOf": [
|
|
401
|
+
{
|
|
402
|
+
"type": "string"
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"type": "null"
|
|
406
|
+
}
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
"branch": {
|
|
410
|
+
"anyOf": [
|
|
411
|
+
{
|
|
412
|
+
"type": "string"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"type": "null"
|
|
416
|
+
}
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"required": [
|
|
421
|
+
"changeRequestId",
|
|
422
|
+
"words"
|
|
423
|
+
],
|
|
424
|
+
"additionalProperties": true
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
"type": "null"
|
|
428
|
+
}
|
|
429
|
+
]
|
|
373
430
|
}
|
|
374
431
|
},
|
|
375
432
|
"required": [
|
|
@@ -1115,7 +1172,7 @@
|
|
|
1115
1172
|
{
|
|
1116
1173
|
"id": "plan",
|
|
1117
1174
|
"title": "Plan",
|
|
1118
|
-
"version": "2.
|
|
1175
|
+
"version": "2.1.0",
|
|
1119
1176
|
"input": {
|
|
1120
1177
|
"type": "object",
|
|
1121
1178
|
"properties": {
|
|
@@ -2014,7 +2071,7 @@
|
|
|
2014
2071
|
{
|
|
2015
2072
|
"id": "review",
|
|
2016
2073
|
"title": "Review",
|
|
2017
|
-
"version": "3.
|
|
2074
|
+
"version": "3.5.0",
|
|
2018
2075
|
"input": {
|
|
2019
2076
|
"type": "object",
|
|
2020
2077
|
"properties": {
|
|
@@ -2071,6 +2128,16 @@
|
|
|
2071
2128
|
}
|
|
2072
2129
|
]
|
|
2073
2130
|
},
|
|
2131
|
+
"approved": {
|
|
2132
|
+
"anyOf": [
|
|
2133
|
+
{
|
|
2134
|
+
"type": "string"
|
|
2135
|
+
},
|
|
2136
|
+
{
|
|
2137
|
+
"type": "null"
|
|
2138
|
+
}
|
|
2139
|
+
]
|
|
2140
|
+
},
|
|
2074
2141
|
"rebuttals": {
|
|
2075
2142
|
"anyOf": [
|
|
2076
2143
|
{
|
|
@@ -2194,6 +2261,19 @@
|
|
|
2194
2261
|
}
|
|
2195
2262
|
]
|
|
2196
2263
|
},
|
|
2264
|
+
"notRun": {
|
|
2265
|
+
"anyOf": [
|
|
2266
|
+
{
|
|
2267
|
+
"type": "array",
|
|
2268
|
+
"items": {
|
|
2269
|
+
"type": "string"
|
|
2270
|
+
}
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
"type": "null"
|
|
2274
|
+
}
|
|
2275
|
+
]
|
|
2276
|
+
},
|
|
2197
2277
|
"next": {
|
|
2198
2278
|
"anyOf": [
|
|
2199
2279
|
{
|
|
@@ -2265,6 +2345,58 @@
|
|
|
2265
2345
|
"additionalProperties": true
|
|
2266
2346
|
}
|
|
2267
2347
|
},
|
|
2348
|
+
"approvedFindings": {
|
|
2349
|
+
"anyOf": [
|
|
2350
|
+
{
|
|
2351
|
+
"type": "array",
|
|
2352
|
+
"items": {
|
|
2353
|
+
"type": "object",
|
|
2354
|
+
"properties": {
|
|
2355
|
+
"id": {
|
|
2356
|
+
"type": "string"
|
|
2357
|
+
},
|
|
2358
|
+
"severity": {
|
|
2359
|
+
"type": "string",
|
|
2360
|
+
"enum": [
|
|
2361
|
+
"blocker",
|
|
2362
|
+
"major",
|
|
2363
|
+
"minor"
|
|
2364
|
+
]
|
|
2365
|
+
},
|
|
2366
|
+
"file": {
|
|
2367
|
+
"type": "string"
|
|
2368
|
+
},
|
|
2369
|
+
"line": {
|
|
2370
|
+
"type": "integer",
|
|
2371
|
+
"minimum": -9007199254740991,
|
|
2372
|
+
"maximum": 9007199254740991
|
|
2373
|
+
},
|
|
2374
|
+
"detail": {
|
|
2375
|
+
"type": "string"
|
|
2376
|
+
},
|
|
2377
|
+
"seats": {
|
|
2378
|
+
"type": "array",
|
|
2379
|
+
"items": {
|
|
2380
|
+
"type": "string"
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
},
|
|
2384
|
+
"required": [
|
|
2385
|
+
"id",
|
|
2386
|
+
"severity",
|
|
2387
|
+
"file",
|
|
2388
|
+
"line",
|
|
2389
|
+
"detail",
|
|
2390
|
+
"seats"
|
|
2391
|
+
],
|
|
2392
|
+
"additionalProperties": true
|
|
2393
|
+
}
|
|
2394
|
+
},
|
|
2395
|
+
{
|
|
2396
|
+
"type": "null"
|
|
2397
|
+
}
|
|
2398
|
+
]
|
|
2399
|
+
},
|
|
2268
2400
|
"followUps": {
|
|
2269
2401
|
"type": "array",
|
|
2270
2402
|
"items": {
|
|
@@ -2456,7 +2588,7 @@
|
|
|
2456
2588
|
{
|
|
2457
2589
|
"id": "shepherd",
|
|
2458
2590
|
"title": "Shepherd",
|
|
2459
|
-
"version": "1.
|
|
2591
|
+
"version": "1.3.0",
|
|
2460
2592
|
"input": {
|
|
2461
2593
|
"type": "object",
|
|
2462
2594
|
"properties": {
|
|
@@ -2483,6 +2615,19 @@
|
|
|
2483
2615
|
}
|
|
2484
2616
|
]
|
|
2485
2617
|
},
|
|
2618
|
+
"notRun": {
|
|
2619
|
+
"anyOf": [
|
|
2620
|
+
{
|
|
2621
|
+
"type": "array",
|
|
2622
|
+
"items": {
|
|
2623
|
+
"type": "string"
|
|
2624
|
+
}
|
|
2625
|
+
},
|
|
2626
|
+
{
|
|
2627
|
+
"type": "null"
|
|
2628
|
+
}
|
|
2629
|
+
]
|
|
2630
|
+
},
|
|
2486
2631
|
"branch": {
|
|
2487
2632
|
"anyOf": [
|
|
2488
2633
|
{
|
|
@@ -2568,18 +2713,6 @@
|
|
|
2568
2713
|
}
|
|
2569
2714
|
]
|
|
2570
2715
|
},
|
|
2571
|
-
"maxFixRounds": {
|
|
2572
|
-
"anyOf": [
|
|
2573
|
-
{
|
|
2574
|
-
"type": "integer",
|
|
2575
|
-
"minimum": -9007199254740991,
|
|
2576
|
-
"maximum": 9007199254740991
|
|
2577
|
-
},
|
|
2578
|
-
{
|
|
2579
|
-
"type": "null"
|
|
2580
|
-
}
|
|
2581
|
-
]
|
|
2582
|
-
},
|
|
2583
2716
|
"maxCycles": {
|
|
2584
2717
|
"anyOf": [
|
|
2585
2718
|
{
|
|
@@ -2607,7 +2740,8 @@
|
|
|
2607
2740
|
"enum": [
|
|
2608
2741
|
"merged",
|
|
2609
2742
|
"ready",
|
|
2610
|
-
"needs_you"
|
|
2743
|
+
"needs_you",
|
|
2744
|
+
"handed_back"
|
|
2611
2745
|
]
|
|
2612
2746
|
},
|
|
2613
2747
|
"reason": {
|
|
@@ -2655,6 +2789,49 @@
|
|
|
2655
2789
|
"type": "null"
|
|
2656
2790
|
}
|
|
2657
2791
|
]
|
|
2792
|
+
},
|
|
2793
|
+
"handBack": {
|
|
2794
|
+
"anyOf": [
|
|
2795
|
+
{
|
|
2796
|
+
"type": "object",
|
|
2797
|
+
"properties": {
|
|
2798
|
+
"changeRequestId": {
|
|
2799
|
+
"type": "string"
|
|
2800
|
+
},
|
|
2801
|
+
"words": {
|
|
2802
|
+
"type": "string"
|
|
2803
|
+
},
|
|
2804
|
+
"taskId": {
|
|
2805
|
+
"anyOf": [
|
|
2806
|
+
{
|
|
2807
|
+
"type": "string"
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
"type": "null"
|
|
2811
|
+
}
|
|
2812
|
+
]
|
|
2813
|
+
},
|
|
2814
|
+
"branch": {
|
|
2815
|
+
"anyOf": [
|
|
2816
|
+
{
|
|
2817
|
+
"type": "string"
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
"type": "null"
|
|
2821
|
+
}
|
|
2822
|
+
]
|
|
2823
|
+
}
|
|
2824
|
+
},
|
|
2825
|
+
"required": [
|
|
2826
|
+
"changeRequestId",
|
|
2827
|
+
"words"
|
|
2828
|
+
],
|
|
2829
|
+
"additionalProperties": true
|
|
2830
|
+
},
|
|
2831
|
+
{
|
|
2832
|
+
"type": "null"
|
|
2833
|
+
}
|
|
2834
|
+
]
|
|
2658
2835
|
}
|
|
2659
2836
|
},
|
|
2660
2837
|
"required": [
|
|
@@ -2671,7 +2848,14 @@
|
|
|
2671
2848
|
},
|
|
2672
2849
|
"checkout": "write",
|
|
2673
2850
|
"when": [],
|
|
2674
|
-
"offers": [
|
|
2851
|
+
"offers": [
|
|
2852
|
+
{
|
|
2853
|
+
"id": "build",
|
|
2854
|
+
"title": "Hand back to Build",
|
|
2855
|
+
"loop": "build",
|
|
2856
|
+
"from": "handBack"
|
|
2857
|
+
}
|
|
2858
|
+
],
|
|
2675
2859
|
"capabilities": [
|
|
2676
2860
|
"agent_work",
|
|
2677
2861
|
"read_change_request",
|
|
@@ -2682,15 +2866,15 @@
|
|
|
2682
2866
|
"write_back",
|
|
2683
2867
|
"ask",
|
|
2684
2868
|
"verify",
|
|
2685
|
-
"change_request",
|
|
2686
2869
|
"claim",
|
|
2870
|
+
"change_request",
|
|
2687
2871
|
"publish_release"
|
|
2688
2872
|
]
|
|
2689
2873
|
},
|
|
2690
2874
|
{
|
|
2691
2875
|
"id": "sweep",
|
|
2692
2876
|
"title": "Sweep",
|
|
2693
|
-
"version": "1.
|
|
2877
|
+
"version": "1.1.0",
|
|
2694
2878
|
"input": {
|
|
2695
2879
|
"type": "object",
|
|
2696
2880
|
"properties": {
|
|
@@ -3187,7 +3371,7 @@
|
|
|
3187
3371
|
"carried": [
|
|
3188
3372
|
{
|
|
3189
3373
|
"name": "@kitman-sh/software-engineering",
|
|
3190
|
-
"version": "0.10.
|
|
3374
|
+
"version": "0.10.71",
|
|
3191
3375
|
"setup": "2a237548a69b0cd53ec3be7f687cfa8c2128335b3a655d34e185f2abce6a3c37",
|
|
3192
3376
|
"loops": [
|
|
3193
3377
|
"build",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/software-engineering",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.71",
|
|
4
4
|
"description": "Everything for building software: Loops, their Agents, the skills they use and the Ponytail plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"tsconfig.json"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@kitman-sh/sdk": "0.10.
|
|
20
|
+
"@kitman-sh/sdk": "0.10.71",
|
|
21
21
|
"effect": "4.1.2"
|
|
22
22
|
},
|
|
23
23
|
"kitman": {
|
|
24
24
|
"bundle": "dist/bundle.js",
|
|
25
|
-
"digest": "
|
|
25
|
+
"digest": "3e92429bb72947c9fb7b14f3f388616bf63436356ddb8bed8e83ab30d232612f",
|
|
26
26
|
"protocolVersion": 5,
|
|
27
27
|
"declarations": "dist/declarations.json",
|
|
28
28
|
"setup": {
|
package/src/build.ts
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
rallyStop,
|
|
22
22
|
Rebuttal,
|
|
23
23
|
settleRound,
|
|
24
|
+
testsNotRunReasons,
|
|
24
25
|
verify,
|
|
25
26
|
writeBack,
|
|
26
27
|
type Disputed,
|
|
@@ -128,6 +129,8 @@ export const BuildOutput = Schema.Struct({
|
|
|
128
129
|
rounds: Schema.Int,
|
|
129
130
|
stopped: Schema.Literals(['settled', 'dispute_stands', 'findings_returned', 'round_cap']),
|
|
130
131
|
criteria: Schema.Array(CriterionAnswer),
|
|
132
|
+
/** Why each head test verify never ran is unverified; absent when it ran them all. */
|
|
133
|
+
notRun: Schema.optional(Schema.Array(Schema.String)),
|
|
131
134
|
/** Whether the last Review's approval was recorded, or why not, when nothing was left unsettled. */
|
|
132
135
|
approval: Schema.optional(ApproveChangeRequestResult),
|
|
133
136
|
/** What Shepherd did with the ChangeRequest, when the Build was told to land it. */
|
|
@@ -294,6 +297,7 @@ const rally = (input: {
|
|
|
294
297
|
} satisfies Round
|
|
295
298
|
|
|
296
299
|
const failing = brokenChecks(head).map(check => check.name)
|
|
300
|
+
const notRun = testsNotRunReasons(head)
|
|
297
301
|
|
|
298
302
|
const reviewed = yield* call(`review:${round}`, review, {
|
|
299
303
|
base: input.base,
|
|
@@ -302,6 +306,7 @@ const rally = (input: {
|
|
|
302
306
|
...(earlier.length === 0 ? undefined : { earlier }),
|
|
303
307
|
...(input.outcome === undefined ? undefined : { outcome: input.outcome }),
|
|
304
308
|
...(failing.length === 0 ? undefined : { failing }),
|
|
309
|
+
...(notRun.length === 0 ? undefined : { notRun }),
|
|
305
310
|
claims: [...claims]
|
|
306
311
|
})
|
|
307
312
|
|
|
@@ -368,7 +373,7 @@ const rally = (input: {
|
|
|
368
373
|
*/
|
|
369
374
|
export default defineLoop({
|
|
370
375
|
id: 'build',
|
|
371
|
-
version: '2.
|
|
376
|
+
version: '2.3.0',
|
|
372
377
|
title: 'Build',
|
|
373
378
|
input: BuildInput,
|
|
374
379
|
output: BuildOutput,
|
|
@@ -465,6 +470,8 @@ export default defineLoop({
|
|
|
465
470
|
...(implemented.rollback === undefined ? undefined : { rollback: implemented.rollback })
|
|
466
471
|
})
|
|
467
472
|
|
|
473
|
+
const lastNotRun = testsNotRunReasons(last.head)
|
|
474
|
+
|
|
468
475
|
// An Outcome's gate may not read every check, so a failing one is reported here too, once.
|
|
469
476
|
const unsettled = [
|
|
470
477
|
...new Set([
|
|
@@ -522,6 +529,7 @@ export default defineLoop({
|
|
|
522
529
|
input.land !== false && unsettled.length === 0
|
|
523
530
|
? yield* call('land', shepherd, {
|
|
524
531
|
changeRequestId: opened.id,
|
|
532
|
+
...(lastNotRun.length === 0 ? undefined : { notRun: lastNotRun }),
|
|
525
533
|
...(input.taskId === undefined ? undefined : { taskId: input.taskId }),
|
|
526
534
|
...(input.branch === undefined ? undefined : { branch: input.branch })
|
|
527
535
|
})
|
|
@@ -546,6 +554,7 @@ export default defineLoop({
|
|
|
546
554
|
rounds: last.round,
|
|
547
555
|
stopped: last.decision.reason,
|
|
548
556
|
criteria,
|
|
557
|
+
...(lastNotRun.length === 0 ? undefined : { notRun: lastNotRun }),
|
|
549
558
|
...(approval === undefined ? undefined : { approval }),
|
|
550
559
|
...(landed === undefined ? undefined : { landed }),
|
|
551
560
|
next: { changeRequestId: opened.id }
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
testsNotRunReasons,
|
|
3
|
+
verify,
|
|
4
|
+
type MergedFinding,
|
|
5
|
+
type RallyDecision,
|
|
6
|
+
type ScopeJudgement,
|
|
7
|
+
type SettledRound,
|
|
8
|
+
type VerifyResult
|
|
9
|
+
} from '@kitman-sh/sdk/loop'
|
|
10
|
+
import * as Effect from 'effect/Effect'
|
|
2
11
|
|
|
3
12
|
/** Each part of the Task the reviewer found not done, as a blocker the implementer fixes or rebuts like any other. */
|
|
4
13
|
export const scopeFindings = (scope: ScopeJudgement | undefined): readonly MergedFinding[] =>
|
|
@@ -15,6 +24,27 @@ export const scopeFindings = (scope: ScopeJudgement | undefined): readonly Merge
|
|
|
15
24
|
export const brokenChecks = (head: VerifyResult) =>
|
|
16
25
|
head.unchanged === true ? [] : head.checks.filter(check => check.status === 'failed' && !check.preExisting)
|
|
17
26
|
|
|
27
|
+
/** Kitman's refusals of a verify that has no check of its own to run, such as one whose approved checks are all pipeline checks. */
|
|
28
|
+
const nothingToVerify = (reason: string) =>
|
|
29
|
+
reason.includes('has no approved verifications') || reason.includes('approved verifications are all pipeline checks')
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Verify at a ChangeRequest's head: the checks it broke and the tests it never ran. A repository with nothing for verify
|
|
33
|
+
* to run has no skips to compare; a head Kitman otherwise could not verify ran none.
|
|
34
|
+
*/
|
|
35
|
+
export const verifyHead = (name: string, revision: string) =>
|
|
36
|
+
verify(name, { revision }).pipe(
|
|
37
|
+
Effect.map(head => ({ failing: brokenChecks(head).map(check => check.name), notRun: testsNotRunReasons(head) })),
|
|
38
|
+
Effect.catchTag('StepFailed', failed =>
|
|
39
|
+
Effect.succeed({
|
|
40
|
+
failing: [],
|
|
41
|
+
notRun: nothingToVerify(failed.reason)
|
|
42
|
+
? []
|
|
43
|
+
: [`Kitman could not verify the head, so none of its tests count as run: ${failed.reason}`]
|
|
44
|
+
})
|
|
45
|
+
)
|
|
46
|
+
)
|
|
47
|
+
|
|
18
48
|
export const isCheckFinding = (id: string) => id.startsWith('check: ')
|
|
19
49
|
|
|
20
50
|
/** Each check the change broke, as a blocker with its output, which only the check passing closes. */
|
|
@@ -44,8 +74,41 @@ export const unsettledItems = (settled: SettledRound, decision: RallyDecision &
|
|
|
44
74
|
return `Unresolved ${settled.open.find(finding => finding.id === id)?.severity ?? 'blocker'} at ${id}: ${settled.open.find(finding => finding.id === id)?.detail ?? ''}`
|
|
45
75
|
})
|
|
46
76
|
|
|
47
|
-
|
|
48
|
-
|
|
77
|
+
/** The tests the checks skipped on the head where the baseline ran them or did not have them. */
|
|
78
|
+
export const notVerifiedSection = (head: VerifyResult) => {
|
|
79
|
+
const listed = head.checks.flatMap(entry => [
|
|
80
|
+
...(entry.newNotRun ?? []).map(test => `- ${entry.name}: \`${test}\` is new and was skipped`),
|
|
81
|
+
...(entry.skippedSinceBaseline ?? []).map(
|
|
82
|
+
test => `- ${entry.name}: \`${test}\` was skipped, and ran on the base branch`
|
|
83
|
+
)
|
|
84
|
+
])
|
|
85
|
+
|
|
86
|
+
return listed.length === 0
|
|
87
|
+
? undefined
|
|
88
|
+
: [
|
|
89
|
+
'**Not verified.** Verify never ran these tests, so their checks passing says nothing about them. Run them where they can run before trusting them:',
|
|
90
|
+
'',
|
|
91
|
+
...listed
|
|
92
|
+
].join('\n')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const unsettledLines = (unsettled: readonly string[], head: VerifyResult) => {
|
|
96
|
+
const listed = new Set(testsNotRunReasons(head))
|
|
97
|
+
const left = unsettled.filter(item => !listed.has(item))
|
|
98
|
+
|
|
99
|
+
if (left.length > 0) return left.map(item => `- ${item}`)
|
|
100
|
+
|
|
101
|
+
return [
|
|
102
|
+
left.length === unsettled.length
|
|
103
|
+
? 'Nothing is unsettled.'
|
|
104
|
+
: 'Only the tests verify never ran, listed under Evidence.'
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const evidenceTable = (head: VerifyResult) => {
|
|
109
|
+
const notVerified = notVerifiedSection(head)
|
|
110
|
+
|
|
111
|
+
return [
|
|
49
112
|
`Collected by a Runner for revision \`${head.revision}\`, tree \`${head.tree}\`; it holds for any revision with this tree.`,
|
|
50
113
|
'',
|
|
51
114
|
'| Check | Command | Result |',
|
|
@@ -54,6 +117,7 @@ export const evidenceTable = (head: VerifyResult) =>
|
|
|
54
117
|
entry =>
|
|
55
118
|
`| ${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)' : ''} |`
|
|
56
119
|
),
|
|
120
|
+
...(notVerified === undefined ? [] : ['', notVerified]),
|
|
57
121
|
...(head.checks.some(entry => entry.suggested === true)
|
|
58
122
|
? [
|
|
59
123
|
'',
|
|
@@ -61,8 +125,12 @@ export const evidenceTable = (head: VerifyResult) =>
|
|
|
61
125
|
]
|
|
62
126
|
: [])
|
|
63
127
|
].join('\n')
|
|
128
|
+
}
|
|
64
129
|
|
|
65
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* A ChangeRequest's description: the summary, the head's evidence, the claims and what was left unsettled, less the
|
|
132
|
+
* tests verify never ran, which the evidence lists.
|
|
133
|
+
*/
|
|
66
134
|
export const changeRequestBody = (build: {
|
|
67
135
|
readonly summary: string
|
|
68
136
|
readonly head: VerifyResult
|
|
@@ -86,7 +154,7 @@ export const changeRequestBody = (build: {
|
|
|
86
154
|
'What the agent says and Kitman has not checked.',
|
|
87
155
|
...(build.claims.length === 0 ? ['None.'] : build.claims.map(claim => `- ${claim}`)),
|
|
88
156
|
'## Unsettled',
|
|
89
|
-
...(build.unsettled
|
|
157
|
+
...unsettledLines(build.unsettled, build.head),
|
|
90
158
|
...(build.later === undefined || build.later.length === 0
|
|
91
159
|
? []
|
|
92
160
|
: ['## Left for later', ...build.later.map(item => `- ${item}`)]),
|
package/src/errand.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
changeRequest,
|
|
6
6
|
ChangeRequestResult,
|
|
7
7
|
defineLoop,
|
|
8
|
+
testsNotRunReasons,
|
|
8
9
|
verify,
|
|
9
10
|
writeBack
|
|
10
11
|
} from '@kitman-sh/sdk/loop'
|
|
@@ -97,17 +98,28 @@ export default defineLoop({
|
|
|
97
98
|
|
|
98
99
|
const head = yield* verify('verify', { suggested: done.checks ?? [] })
|
|
99
100
|
|
|
101
|
+
const notRun = testsNotRunReasons(head)
|
|
102
|
+
const trusted = head.passed && notRun.length === 0
|
|
103
|
+
|
|
104
|
+
const checksSay = !head.passed
|
|
105
|
+
? 'The checks fail.'
|
|
106
|
+
: notRun.length === 0
|
|
107
|
+
? 'The checks pass.'
|
|
108
|
+
: `The checks pass, but verify never ran some tests:\n${notRun.map(item => `- ${item}`).join('\n')}`
|
|
109
|
+
|
|
100
110
|
const answer = yield* ask('next', {
|
|
101
|
-
prompt: `${done.summary}\n\
|
|
111
|
+
prompt: `${done.summary}\n\n${checksSay}\n\nWhat next?`,
|
|
102
112
|
options: [
|
|
103
113
|
{ value: 'Open a ChangeRequest', description: 'Deliver it as it is, unreviewed.' },
|
|
104
114
|
{ value: 'Hand to Build for a full review', description: 'Build reviews and verifies it before delivering.' },
|
|
105
115
|
{ value: 'Discard', description: 'Drop the change.' }
|
|
106
116
|
] satisfies { readonly value: (typeof choices)[number]; readonly description: string }[],
|
|
107
|
-
recommended:
|
|
108
|
-
recommendationReason:
|
|
117
|
+
recommended: trusted ? 'Open a ChangeRequest' : 'Hand to Build for a full review',
|
|
118
|
+
recommendationReason: trusted
|
|
109
119
|
? 'The checks pass, and an errand is small enough to review on the ChangeRequest.'
|
|
110
|
-
:
|
|
120
|
+
: head.passed
|
|
121
|
+
? 'Verify skipped tests it should have run, so it needs the review a Build gives before anyone merges it.'
|
|
122
|
+
: 'The checks fail, so it needs the fixes and review a Build gives before anyone merges it.',
|
|
111
123
|
default: 'Open a ChangeRequest',
|
|
112
124
|
timeout: '1 hour'
|
|
113
125
|
})
|
package/src/hillclimb.ts
CHANGED
|
@@ -12,13 +12,15 @@ import {
|
|
|
12
12
|
measure,
|
|
13
13
|
MeasurePlan,
|
|
14
14
|
syncBase,
|
|
15
|
+
testsNotRunReasons,
|
|
15
16
|
verify,
|
|
16
17
|
writeBack,
|
|
17
|
-
type Measurement
|
|
18
|
+
type Measurement,
|
|
19
|
+
type VerifyResult
|
|
18
20
|
} from '@kitman-sh/sdk/loop'
|
|
19
21
|
import * as Effect from 'effect/Effect'
|
|
20
22
|
import * as Schema from 'effect/Schema'
|
|
21
|
-
import { scopeFindings } from './change-request-body'
|
|
23
|
+
import { notVerifiedSection, scopeFindings } from './change-request-body'
|
|
22
24
|
import review from './review'
|
|
23
25
|
|
|
24
26
|
const Input = Schema.Struct({
|
|
@@ -151,6 +153,13 @@ const report = (input: {
|
|
|
151
153
|
`## Opportunities\n\n${input.discovery.opportunities.map(entry => `- ${entry.title} (${entry.evidence}${entry.external === true ? ', external' : ''}): ${entry.detail}`).join('\n')}`
|
|
152
154
|
].join('\n\n')
|
|
153
155
|
|
|
156
|
+
/** Review's `notRun` for a head, left out when verify ran every test. */
|
|
157
|
+
const notRunOf = (head: VerifyResult) => {
|
|
158
|
+
const notRun = testsNotRunReasons(head)
|
|
159
|
+
|
|
160
|
+
return notRun.length === 0 ? undefined : { notRun }
|
|
161
|
+
}
|
|
162
|
+
|
|
154
163
|
/** Makes the plan's low-variance counter its primary metric, the old primary a guardrail. */
|
|
155
164
|
const steadier = (plan: MeasurePlan): MeasurePlan | undefined => {
|
|
156
165
|
const counter = plan.metrics.find(metric => metric.lowVariance === true && metric.role !== 'primary')
|
|
@@ -337,10 +346,13 @@ export default defineLoop({
|
|
|
337
346
|
...kept.map(entry => entry.summary)
|
|
338
347
|
]
|
|
339
348
|
|
|
349
|
+
let head = checked
|
|
350
|
+
|
|
340
351
|
let reviewed = yield* call('review', review, {
|
|
341
352
|
base: baseline,
|
|
342
353
|
head: checked.revision,
|
|
343
354
|
outcome: 'performance',
|
|
355
|
+
...notRunOf(checked),
|
|
344
356
|
claims
|
|
345
357
|
})
|
|
346
358
|
|
|
@@ -366,15 +378,21 @@ export default defineLoop({
|
|
|
366
378
|
if (final.verdict !== 'gain')
|
|
367
379
|
return yield* ending('gain_gone', `The review's fixes cost the gain: ${final.reason}`, final)
|
|
368
380
|
|
|
381
|
+
head = fixed
|
|
382
|
+
|
|
369
383
|
reviewed = yield* call(`review:${round + 1}`, review, {
|
|
370
384
|
base: baseline,
|
|
371
385
|
head: fixed.revision,
|
|
372
386
|
outcome: 'performance',
|
|
387
|
+
...notRunOf(fixed),
|
|
373
388
|
claims,
|
|
374
389
|
earlier: blocking
|
|
375
390
|
})
|
|
376
391
|
}
|
|
377
392
|
|
|
393
|
+
const notRun = testsNotRunReasons(head)
|
|
394
|
+
const notVerified = notVerifiedSection(head)
|
|
395
|
+
|
|
378
396
|
const unsettled = [
|
|
379
397
|
...[...reviewed.findings, ...scopeFindings(reviewed.scope)].flatMap(finding =>
|
|
380
398
|
isBlocking(finding) ? [`${finding.id}: ${finding.detail}`] : []
|
|
@@ -394,6 +412,7 @@ export default defineLoop({
|
|
|
394
412
|
numbers(final),
|
|
395
413
|
`## Kept\n\n${kept.map(entry => `- ${entry.summary}: ${entry.reason}`).join('\n')}`,
|
|
396
414
|
`## Benchmark\n\n${harness.summary}\n\n\`${plan.command}\``,
|
|
415
|
+
...(notVerified === undefined ? [] : [notVerified]),
|
|
397
416
|
...(unsettled.length + caveats.length === 0
|
|
398
417
|
? []
|
|
399
418
|
: [`## Unsettled\n\n${[...unsettled, ...caveats].map(entry => `- ${entry}`).join('\n')}`])
|
|
@@ -402,6 +421,10 @@ export default defineLoop({
|
|
|
402
421
|
|
|
403
422
|
yield* writeBack('write-back', { milestone: 'change_request_opened', changeRequestUrl: opened.url })
|
|
404
423
|
|
|
405
|
-
return {
|
|
424
|
+
return {
|
|
425
|
+
...(yield* ending('improved', final.reason, final)),
|
|
426
|
+
changeRequest: opened,
|
|
427
|
+
unsettled: [...unsettled, ...notRun]
|
|
428
|
+
}
|
|
406
429
|
})
|
|
407
430
|
})
|