@kitman-sh/software-engineering 0.50.1 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +103 -20
- package/dist/declarations.json +2201 -1327
- package/kitman.config.ts +6 -0
- package/package.json +3 -3
- package/src/build-schemas.ts +34 -2
- package/src/build.ts +26 -6
- package/src/errand.ts +9 -1
- package/src/firewatch.ts +25 -6
- package/src/hillclimb.ts +3 -0
- package/src/hindsight.ts +8 -1
- package/src/index.ts +11 -4
- package/src/plan.ts +10 -3
- package/src/rallied.ts +13 -2
- package/src/review.ts +19 -7
- package/src/standing.ts +9 -2
package/kitman.config.ts
CHANGED
|
@@ -95,6 +95,7 @@ export {
|
|
|
95
95
|
RoundCap,
|
|
96
96
|
SameEvidence,
|
|
97
97
|
Settled,
|
|
98
|
+
Unchanged,
|
|
98
99
|
surveyed,
|
|
99
100
|
Surveyed,
|
|
100
101
|
tidied,
|
|
@@ -111,6 +112,7 @@ export {
|
|
|
111
112
|
FixDeclined,
|
|
112
113
|
FixStarted,
|
|
113
114
|
FixFailed,
|
|
115
|
+
FixUnneeded,
|
|
114
116
|
researched,
|
|
115
117
|
researchReviewed,
|
|
116
118
|
found,
|
|
@@ -128,6 +130,7 @@ export {
|
|
|
128
130
|
TakenOver,
|
|
129
131
|
Rebuilt,
|
|
130
132
|
BuildBlocked,
|
|
133
|
+
RebuildUnchanged,
|
|
131
134
|
landed,
|
|
132
135
|
Assessed,
|
|
133
136
|
Closed,
|
|
@@ -155,6 +158,9 @@ export {
|
|
|
155
158
|
Unsafe
|
|
156
159
|
} from './src/index'
|
|
157
160
|
|
|
161
|
+
/** Build's Output: a ChangeRequest it made, or nothing to do. */
|
|
162
|
+
export { ChangeBuilt, isNothingToDo, NothingToDo } from './src/index'
|
|
163
|
+
|
|
158
164
|
/** What Release's Steps end in, for a Layer that replaces one or a Loop of your own that calls them. */
|
|
159
165
|
export {
|
|
160
166
|
Cut,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitman-sh/software-engineering",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
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": "SEE LICENSE IN LICENSE.md",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"LICENSE.md"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@kitman-sh/sdk": "0.
|
|
22
|
+
"@kitman-sh/sdk": "0.51.0",
|
|
23
23
|
"effect": "^4.1.2"
|
|
24
24
|
},
|
|
25
25
|
"kitman": {
|
|
26
26
|
"bundle": "dist/bundle.js",
|
|
27
|
-
"digest": "
|
|
27
|
+
"digest": "e1e9ba23a0821811bc1183d620d931f46722c4c840221f80dc8d2388eeb1f0ff",
|
|
28
28
|
"protocolVersion": 5,
|
|
29
29
|
"declarations": "dist/declarations.json",
|
|
30
30
|
"setup": {
|
package/src/build-schemas.ts
CHANGED
|
@@ -82,7 +82,8 @@ export const CriterionAnswer = Schema.Struct({
|
|
|
82
82
|
|
|
83
83
|
export type CriterionAnswer = typeof CriterionAnswer.Type
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
/** A Build that opened or fixed forward a ChangeRequest. */
|
|
86
|
+
export const ChangeBuilt = Schema.Struct({
|
|
86
87
|
changeRequest: ChangeRequestResult.annotate({ description: 'The ChangeRequest the Build opened or fixed forward.' }),
|
|
87
88
|
revision: Schema.String.annotate({ description: 'The head commit the Build pushed.' }),
|
|
88
89
|
tree: Schema.String.annotate({
|
|
@@ -128,8 +129,39 @@ export const BuildOutput = Schema.Struct({
|
|
|
128
129
|
})
|
|
129
130
|
})
|
|
130
131
|
|
|
132
|
+
/** The head ended at the base, or a rebuild found its ChangeRequest's change already on the target, so nothing landed. */
|
|
133
|
+
export const NothingToDo = Schema.Struct({
|
|
134
|
+
status: Schema.Literal('nothing_to_do').annotate({
|
|
135
|
+
description:
|
|
136
|
+
"Nothing needed changing: the implementer changed nothing, a fix reverted the change, or a rebuild found the ChangeRequest's change already on its target."
|
|
137
|
+
}),
|
|
138
|
+
summary: Schema.String.annotate({
|
|
139
|
+
description: "The implementer's summary, the evidence that nothing needed changing."
|
|
140
|
+
}),
|
|
141
|
+
claims: Schema.Array(Schema.String).annotate({
|
|
142
|
+
description: "The implementer's claims, which Kitman has not checked."
|
|
143
|
+
}),
|
|
144
|
+
criteria: Schema.Array(CriterionAnswer).annotate({
|
|
145
|
+
description: "The implementer's answer to each Acceptance Criterion."
|
|
146
|
+
}),
|
|
147
|
+
revision: Schema.String.annotate({ description: 'The head, which is the base.' }),
|
|
148
|
+
tree: Schema.String.annotate({ description: 'The tree of that head.' }),
|
|
149
|
+
reverted: Schema.optionalKey(Schema.Boolean).annotate({
|
|
150
|
+
description: "True when a fix after a review returned the head to the base, reverting the implementer's change."
|
|
151
|
+
}),
|
|
152
|
+
changeRequest: Schema.optionalKey(ChangeRequestResult).annotate({
|
|
153
|
+
description: 'The open ChangeRequest a rebuild found with nothing left on it, for a person to close.'
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
export const BuildOutput = Schema.Union([ChangeBuilt, NothingToDo])
|
|
158
|
+
|
|
159
|
+
export type BuildOutput = typeof BuildOutput.Type
|
|
160
|
+
|
|
161
|
+
export const isNothingToDo = (output: BuildOutput): output is typeof NothingToDo.Type => 'status' in output
|
|
162
|
+
|
|
131
163
|
/** What a Build made, less its ChangeRequest and landing: a rebuild on that ChangeRequest replaces it. */
|
|
132
|
-
export const Built = Schema.Struct(Struct.omit(
|
|
164
|
+
export const Built = Schema.Struct(Struct.omit(ChangeBuilt.fields, ['changeRequest', 'landed', 'next']))
|
|
133
165
|
|
|
134
166
|
export const taskOf = (words: string | undefined) =>
|
|
135
167
|
words === undefined ? 'the Task your brief describes.' : `this: ${words}`
|
package/src/build.ts
CHANGED
|
@@ -12,14 +12,14 @@ import {
|
|
|
12
12
|
} from '@kitman-sh/sdk/loop'
|
|
13
13
|
import * as Effect from 'effect/Effect'
|
|
14
14
|
import * as Schema from 'effect/Schema'
|
|
15
|
-
import { BuildInput, BuildOutput, type Built, type CriterionAnswer } from './build-schemas'
|
|
15
|
+
import { BuildInput, BuildOutput, type Built, type ChangeBuilt, type CriterionAnswer } from './build-schemas'
|
|
16
16
|
import { brokenChecks, changeRequestBody, codeFindings, unsettledItems } from './change-request-body'
|
|
17
17
|
import { epicOf, ownDeliveryTarget } from './delivery'
|
|
18
18
|
import { implemented, proofsOf, type Implemented } from './implemented'
|
|
19
19
|
import { landed } from './landed'
|
|
20
20
|
import { opened } from './opened'
|
|
21
21
|
import { caseOf, inCase, listedCases, outOfScopeLines } from './out-of-scope'
|
|
22
|
-
import { rallied } from './rallied'
|
|
22
|
+
import { rallied, type Unchanged } from './rallied'
|
|
23
23
|
import { reproduced } from './reproduced'
|
|
24
24
|
import review from './review'
|
|
25
25
|
import type { ReviewedScope } from './reviewed-scope'
|
|
@@ -130,7 +130,7 @@ const gated = ({
|
|
|
130
130
|
readonly outcome: LoopOutcome | undefined
|
|
131
131
|
readonly before: Effect.Success<ReturnType<typeof reproduced>>
|
|
132
132
|
readonly change: Implemented
|
|
133
|
-
readonly last: Effect.Success<ReturnType<typeof rallied
|
|
133
|
+
readonly last: Exclude<Effect.Success<ReturnType<typeof rallied>>, Unchanged>
|
|
134
134
|
}) => {
|
|
135
135
|
const verdict = evidenceGate({
|
|
136
136
|
...(outcome === undefined ? undefined : { outcome }),
|
|
@@ -204,9 +204,9 @@ const gated = ({
|
|
|
204
204
|
|
|
205
205
|
const outputOf = (
|
|
206
206
|
input: Input,
|
|
207
|
-
changeRequest: (typeof
|
|
207
|
+
changeRequest: (typeof ChangeBuilt.Type)['changeRequest'],
|
|
208
208
|
built: Built
|
|
209
|
-
): typeof
|
|
209
|
+
): typeof ChangeBuilt.Type => ({
|
|
210
210
|
changeRequest,
|
|
211
211
|
...built,
|
|
212
212
|
next: { changeRequestId: changeRequest.id },
|
|
@@ -221,7 +221,7 @@ const outputOf = (
|
|
|
221
221
|
*/
|
|
222
222
|
const build = defineLoop({
|
|
223
223
|
id: 'build',
|
|
224
|
-
version: '
|
|
224
|
+
version: '4.0.0',
|
|
225
225
|
title: 'Build',
|
|
226
226
|
description: 'Implements a Task or words, reviews and fixes the change, and opens a ChangeRequest with its evidence.',
|
|
227
227
|
input: BuildInput,
|
|
@@ -284,6 +284,24 @@ const build = defineLoop({
|
|
|
284
284
|
scope: input.scope
|
|
285
285
|
})
|
|
286
286
|
|
|
287
|
+
if (last._tag === 'Unchanged') {
|
|
288
|
+
const { summary, claims, criteria } = change
|
|
289
|
+
const { revision, tree } = last.head
|
|
290
|
+
|
|
291
|
+
return {
|
|
292
|
+
status: 'nothing_to_do',
|
|
293
|
+
output: {
|
|
294
|
+
status: 'nothing_to_do',
|
|
295
|
+
summary,
|
|
296
|
+
claims,
|
|
297
|
+
criteria,
|
|
298
|
+
revision,
|
|
299
|
+
tree,
|
|
300
|
+
...(last.reverted ? { reverted: true } : undefined)
|
|
301
|
+
} satisfies BuildOutput
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
287
305
|
const gate = gated({ outcome, before, change, last, cases })
|
|
288
306
|
|
|
289
307
|
const { changeRequest, approval } = yield* opened({
|
|
@@ -314,6 +332,8 @@ const build = defineLoop({
|
|
|
314
332
|
|
|
315
333
|
if (decided._tag === 'TakenOver') return { status: 'taken_over', output: outputOf(input, changeRequest, built) }
|
|
316
334
|
|
|
335
|
+
if (decided._tag === 'RebuildUnchanged') return { status: 'nothing_to_do', output: decided.built }
|
|
336
|
+
|
|
317
337
|
built = decided.built
|
|
318
338
|
}
|
|
319
339
|
|
package/src/errand.ts
CHANGED
|
@@ -12,6 +12,7 @@ import * as Effect from 'effect/Effect'
|
|
|
12
12
|
import * as Schema from 'effect/Schema'
|
|
13
13
|
import { implementer } from './agents'
|
|
14
14
|
import build from './build'
|
|
15
|
+
import { isNothingToDo } from './build-schemas'
|
|
15
16
|
import { evidenceTable } from './change-request-body'
|
|
16
17
|
import { implementAdaptation } from './implemented'
|
|
17
18
|
import { opened } from './opened'
|
|
@@ -55,7 +56,7 @@ const Output = Schema.Struct({
|
|
|
55
56
|
}),
|
|
56
57
|
summary: Schema.String.annotate({ description: 'What the Errand did, in a line.' }),
|
|
57
58
|
changeRequest: Schema.optional(ChangeRequestResult).annotate({
|
|
58
|
-
description: 'The ChangeRequest it opened,
|
|
59
|
+
description: 'The ChangeRequest it opened, or one a Build found nothing left on, for a person to close.'
|
|
59
60
|
})
|
|
60
61
|
})
|
|
61
62
|
|
|
@@ -190,6 +191,13 @@ export default defineLoop({
|
|
|
190
191
|
...(input.branch === undefined ? undefined : { branch: input.branch })
|
|
191
192
|
})
|
|
192
193
|
|
|
194
|
+
if (isNothingToDo(built))
|
|
195
|
+
return {
|
|
196
|
+
status: 'done' as const,
|
|
197
|
+
summary: built.summary,
|
|
198
|
+
...(built.changeRequest === undefined ? undefined : { changeRequest: built.changeRequest })
|
|
199
|
+
}
|
|
200
|
+
|
|
193
201
|
return { status: 'handed_to_build' as const, summary: errand.summary, changeRequest: built.changeRequest }
|
|
194
202
|
}
|
|
195
203
|
|
package/src/firewatch.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as Predicate from 'effect/Predicate'
|
|
|
4
4
|
import * as Schema from 'effect/Schema'
|
|
5
5
|
import { investigator } from './agents'
|
|
6
6
|
import build from './build'
|
|
7
|
+
import { isNothingToDo } from './build-schemas'
|
|
7
8
|
import { OneSentence } from './text-limits'
|
|
8
9
|
|
|
9
10
|
const Input = Schema.Struct({
|
|
@@ -60,11 +61,13 @@ const Output = Schema.Struct({
|
|
|
60
61
|
description: "The Artifact holding the investigation's conclusion."
|
|
61
62
|
}),
|
|
62
63
|
resolvedDuring: Schema.Boolean.annotate({ description: 'It resolved on its own while it was being investigated.' }),
|
|
63
|
-
fix: Schema.Literals(['none', 'declined', 'started', 'failed']).annotate({
|
|
64
|
-
description:
|
|
64
|
+
fix: Schema.Literals(['none', 'declined', 'started', 'failed', 'unneeded']).annotate({
|
|
65
|
+
description:
|
|
66
|
+
'Whether a fix was started: none was offered, a person declined it, it started, starting it failed, or its Build found nothing needed changing.'
|
|
65
67
|
}),
|
|
66
68
|
changeRequestUrl: Schema.optional(Schema.String).annotate({
|
|
67
|
-
description:
|
|
69
|
+
description:
|
|
70
|
+
"The fix's ChangeRequest, when a fix opened one; with an unneeded fix, the one left open for a person to close."
|
|
68
71
|
}),
|
|
69
72
|
fixRequest: Schema.optional(FixRequest).annotate({
|
|
70
73
|
description: "The fix a person can still start from the Run's offer."
|
|
@@ -216,6 +219,11 @@ export class FixStarted extends Schema.TaggedClass<FixStarted>()('FixStarted', {
|
|
|
216
219
|
/** The Build it started failed. */
|
|
217
220
|
export class FixFailed extends Schema.TaggedClass<FixFailed>()('FixFailed', {}) {}
|
|
218
221
|
|
|
222
|
+
/** The Build it started changed nothing, as nothing needed changing. */
|
|
223
|
+
export class FixUnneeded extends Schema.TaggedClass<FixUnneeded>()('FixUnneeded', {
|
|
224
|
+
changeRequestUrl: Schema.optionalKey(Schema.String)
|
|
225
|
+
}) {}
|
|
226
|
+
|
|
219
227
|
/** Asks whether to start a Build that fixes the cause as a bug, and starts it when the answer says so. */
|
|
220
228
|
export const fixOffered = step('fixOffered', {
|
|
221
229
|
payload: {
|
|
@@ -228,7 +236,7 @@ export const fixOffered = step('fixOffered', {
|
|
|
228
236
|
taskId: Schema.optional(Schema.String),
|
|
229
237
|
repoBindingId: Schema.optional(Schema.String)
|
|
230
238
|
},
|
|
231
|
-
success: Schema.Union([FixDeclined, FixStarted, FixFailed]),
|
|
239
|
+
success: Schema.Union([FixDeclined, FixStarted, FixFailed, FixUnneeded]),
|
|
232
240
|
run: ({ summary, fix, fixRequest, confident, resolvedDuring, autoFix, taskId, repoBindingId }) =>
|
|
233
241
|
Effect.gen(function* () {
|
|
234
242
|
const answer = yield* ask('start-fix', {
|
|
@@ -254,7 +262,11 @@ export const fixOffered = step('fixOffered', {
|
|
|
254
262
|
...(taskId === undefined ? undefined : { taskId }),
|
|
255
263
|
...(repoBindingId === undefined ? undefined : { repoBindingId })
|
|
256
264
|
}).pipe(
|
|
257
|
-
Effect.map(fixed =>
|
|
265
|
+
Effect.map(fixed =>
|
|
266
|
+
isNothingToDo(fixed)
|
|
267
|
+
? new FixUnneeded(fixed.changeRequest === undefined ? {} : { changeRequestUrl: fixed.changeRequest.url })
|
|
268
|
+
: new FixStarted({ changeRequestUrl: fixed.changeRequest.url })
|
|
269
|
+
),
|
|
258
270
|
Effect.catchTag('ChildFailed', () => Effect.succeed(new FixFailed()))
|
|
259
271
|
)
|
|
260
272
|
})
|
|
@@ -268,7 +280,7 @@ export const fixOffered = step('fixOffered', {
|
|
|
268
280
|
*/
|
|
269
281
|
export default defineLoop({
|
|
270
282
|
id: 'firewatch',
|
|
271
|
-
version: '2.
|
|
283
|
+
version: '2.1.0',
|
|
272
284
|
title: 'Firewatch',
|
|
273
285
|
description: 'Investigates an alert and writes its cited cause on a Bug Task, offering a fix.',
|
|
274
286
|
input: Input,
|
|
@@ -337,6 +349,13 @@ export default defineLoop({
|
|
|
337
349
|
|
|
338
350
|
if (offered._tag === 'FixFailed') return { ...ended, fix: 'failed', fixRequest } satisfies Output
|
|
339
351
|
|
|
352
|
+
if (offered._tag === 'FixUnneeded')
|
|
353
|
+
return {
|
|
354
|
+
...ended,
|
|
355
|
+
fix: 'unneeded',
|
|
356
|
+
...(offered.changeRequestUrl === undefined ? undefined : { changeRequestUrl: offered.changeRequestUrl })
|
|
357
|
+
} satisfies Output
|
|
358
|
+
|
|
340
359
|
return { ...ended, fix: 'declined', fixRequest } satisfies Output
|
|
341
360
|
})
|
|
342
361
|
})
|
package/src/hillclimb.ts
CHANGED
|
@@ -709,6 +709,9 @@ export default defineLoop({
|
|
|
709
709
|
|
|
710
710
|
if (rally._tag === 'Halted') return yield* halted(rally, findings)
|
|
711
711
|
|
|
712
|
+
if (rally._tag === 'Unchanged')
|
|
713
|
+
return yield* ending('no_gain', 'The reviewed head is the base, so it changes nothing', findings)
|
|
714
|
+
|
|
712
715
|
const shipped =
|
|
713
716
|
provenAt(rally.head, improvements) ?? (yield* measured({ ...gain, revision: rally.head.revision }))
|
|
714
717
|
|
package/src/hindsight.ts
CHANGED
|
@@ -13,6 +13,7 @@ import * as Effect from 'effect/Effect'
|
|
|
13
13
|
import * as Schema from 'effect/Schema'
|
|
14
14
|
import { investigator } from './agents'
|
|
15
15
|
import build from './build'
|
|
16
|
+
import { isNothingToDo } from './build-schemas'
|
|
16
17
|
import errand from './errand'
|
|
17
18
|
import { FindingDetail, OneSentence, Reason } from './text-limits'
|
|
18
19
|
|
|
@@ -344,7 +345,13 @@ export const improved = step('improved', {
|
|
|
344
345
|
const started =
|
|
345
346
|
size === 'errand'
|
|
346
347
|
? Effect.map(call('improve', errand, on), done => done.status)
|
|
347
|
-
: Effect.map(call('improve', build, on), built =>
|
|
348
|
+
: Effect.map(call('improve', build, on), built =>
|
|
349
|
+
isNothingToDo(built)
|
|
350
|
+
? built.changeRequest === undefined
|
|
351
|
+
? built.status
|
|
352
|
+
: `${built.status}: close ${built.changeRequest.url}`
|
|
353
|
+
: built.stopped
|
|
354
|
+
)
|
|
348
355
|
|
|
349
356
|
return started.pipe(
|
|
350
357
|
Effect.catchTag('ChildFailed', failed => Effect.succeed(`failed: ${failed.reason}`)),
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ import firewatch, {
|
|
|
43
43
|
concluded,
|
|
44
44
|
FixDeclined,
|
|
45
45
|
FixFailed,
|
|
46
|
+
FixUnneeded,
|
|
46
47
|
fixOffered,
|
|
47
48
|
FixStarted,
|
|
48
49
|
Folded,
|
|
@@ -97,7 +98,8 @@ import {
|
|
|
97
98
|
reviewed,
|
|
98
99
|
RoundCap,
|
|
99
100
|
SameEvidence,
|
|
100
|
-
Settled
|
|
101
|
+
Settled,
|
|
102
|
+
Unchanged
|
|
101
103
|
} from './rallied'
|
|
102
104
|
import { BaseVerified, NotNeeded, Reproduced, reproduced } from './reproduced'
|
|
103
105
|
import release, {
|
|
@@ -202,7 +204,8 @@ import shepherd, {
|
|
|
202
204
|
Wanted,
|
|
203
205
|
Watching
|
|
204
206
|
} from './shepherd'
|
|
205
|
-
import { BuildBlocked, Rebuilt, standing, TakenOver } from './standing'
|
|
207
|
+
import { BuildBlocked, RebuildUnchanged, Rebuilt, standing, TakenOver } from './standing'
|
|
208
|
+
import { ChangeBuilt, isNothingToDo, NothingToDo } from './build-schemas'
|
|
206
209
|
import sweep, {
|
|
207
210
|
Assessed,
|
|
208
211
|
assessed,
|
|
@@ -355,7 +358,9 @@ export { Implemented, implemented }
|
|
|
355
358
|
|
|
356
359
|
export { Opened, opened }
|
|
357
360
|
|
|
358
|
-
export { BuildBlocked, Rebuilt, standing, TakenOver }
|
|
361
|
+
export { BuildBlocked, RebuildUnchanged, Rebuilt, standing, TakenOver }
|
|
362
|
+
|
|
363
|
+
export { ChangeBuilt, isNothingToDo, NothingToDo }
|
|
359
364
|
|
|
360
365
|
export { landed }
|
|
361
366
|
|
|
@@ -423,7 +428,8 @@ export {
|
|
|
423
428
|
reviewed,
|
|
424
429
|
RoundCap,
|
|
425
430
|
SameEvidence,
|
|
426
|
-
Settled
|
|
431
|
+
Settled,
|
|
432
|
+
Unchanged
|
|
427
433
|
}
|
|
428
434
|
|
|
429
435
|
export { NothingWorthIt, Surveyed, surveyed, Tidied, tidied }
|
|
@@ -435,6 +441,7 @@ export {
|
|
|
435
441
|
concluded,
|
|
436
442
|
FixDeclined,
|
|
437
443
|
FixFailed,
|
|
444
|
+
FixUnneeded,
|
|
438
445
|
fixOffered,
|
|
439
446
|
FixStarted,
|
|
440
447
|
Folded,
|
package/src/plan.ts
CHANGED
|
@@ -27,6 +27,7 @@ import * as Effect from 'effect/Effect'
|
|
|
27
27
|
import * as Schema from 'effect/Schema'
|
|
28
28
|
import { reviewer } from './agents'
|
|
29
29
|
import build from './build'
|
|
30
|
+
import { isNothingToDo } from './build-schemas'
|
|
30
31
|
import {
|
|
31
32
|
DeclinedConcern,
|
|
32
33
|
disputedText,
|
|
@@ -615,9 +616,11 @@ const unmerged = {
|
|
|
615
616
|
reason: Schema.String
|
|
616
617
|
}
|
|
617
618
|
|
|
619
|
+
/** Its change merged, or its Build found the integration branch already had it, with no ChangeRequest. */
|
|
618
620
|
export class Merged extends Schema.TaggedClass<Merged>()('Merged', {
|
|
619
621
|
repoBindingId: Schema.String,
|
|
620
|
-
changeRequest: ChangeRequestResult
|
|
622
|
+
changeRequest: Schema.optionalKey(ChangeRequestResult),
|
|
623
|
+
reason: Schema.optionalKey(Schema.String)
|
|
621
624
|
}) {}
|
|
622
625
|
|
|
623
626
|
/** Its Build failed, or a person gave up on its merge. */
|
|
@@ -652,7 +655,8 @@ const resultOf = ({ key, title }: PlanTicket, outcome: Merged | Failed | Skipped
|
|
|
652
655
|
title,
|
|
653
656
|
status: 'merged',
|
|
654
657
|
repoBindingId: outcome.repoBindingId,
|
|
655
|
-
changeRequest: outcome.changeRequest
|
|
658
|
+
...(outcome.changeRequest === undefined ? undefined : { changeRequest: outcome.changeRequest }),
|
|
659
|
+
...(outcome.reason === undefined ? undefined : { reason: outcome.reason })
|
|
656
660
|
}
|
|
657
661
|
|
|
658
662
|
return {
|
|
@@ -679,7 +683,7 @@ const buildOf = {
|
|
|
679
683
|
|
|
680
684
|
export const buildTried = step('buildTried', {
|
|
681
685
|
payload: buildOf,
|
|
682
|
-
success: Schema.Union([Built, Failed, Skipped]),
|
|
686
|
+
success: Schema.Union([Built, Merged, Failed, Skipped]),
|
|
683
687
|
run: ({ ticket, head, taskId, steer }) =>
|
|
684
688
|
Effect.gen(function* () {
|
|
685
689
|
const words =
|
|
@@ -710,6 +714,9 @@ export const buildTried = step('buildTried', {
|
|
|
710
714
|
|
|
711
715
|
if (built instanceof ChildFailed) return new Failed({ repoBindingId: head.repoBindingId, reason: built.reason })
|
|
712
716
|
|
|
717
|
+
if (isNothingToDo(built))
|
|
718
|
+
return new Merged({ repoBindingId: head.repoBindingId, reason: `Nothing needed changing: ${built.summary}` })
|
|
719
|
+
|
|
713
720
|
if (built.notRun !== undefined && built.notRun.length > 0) {
|
|
714
721
|
const unverified = yield* ask('unverified', {
|
|
715
722
|
prompt: `Verify never ran some tests of the ChangeRequest for ${ticket.key} (${built.changeRequest.url}):\n${built.notRun.map(item => `- ${item}`).join('\n')}\n\nMerge it once they pass by hand, or skip it and the tickets it blocks?`,
|
package/src/rallied.ts
CHANGED
|
@@ -221,6 +221,12 @@ export class Reviewed extends Schema.TaggedClass<Reviewed>()('Reviewed', {
|
|
|
221
221
|
review: Schema.String
|
|
222
222
|
}) {}
|
|
223
223
|
|
|
224
|
+
/** The head is the base, so there is no change to review; `reverted` when a fix in a later round returned it there. */
|
|
225
|
+
export class Unchanged extends Schema.TaggedClass<Unchanged>()('Unchanged', {
|
|
226
|
+
head: VerifyResult,
|
|
227
|
+
reverted: Schema.Boolean
|
|
228
|
+
}) {}
|
|
229
|
+
|
|
224
230
|
/** The head's tree and evidence are those of the head `known`, so a review would judge the same change. */
|
|
225
231
|
export class SameEvidence extends Schema.TaggedClass<SameEvidence>()('SameEvidence', headRead) {}
|
|
226
232
|
|
|
@@ -256,7 +262,7 @@ export const reviewed = step('reviewed', {
|
|
|
256
262
|
'A head already reviewed, and what the fixer was told of its failing checks; a head with its tree and evidence, and no failure the fixer was not told of, is not reviewed again.'
|
|
257
263
|
})
|
|
258
264
|
},
|
|
259
|
-
success: Schema.Union([Reviewed, SameEvidence]),
|
|
265
|
+
success: Schema.Union([Reviewed, SameEvidence, Unchanged]),
|
|
260
266
|
error: BaseUnpinned,
|
|
261
267
|
run: payload =>
|
|
262
268
|
Effect.gen(function* () {
|
|
@@ -299,6 +305,8 @@ export const reviewed = step('reviewed', {
|
|
|
299
305
|
const head =
|
|
300
306
|
verified ?? (yield* verify('verify', { suggested, ...(extra === undefined ? undefined : { extra }) }))
|
|
301
307
|
|
|
308
|
+
if (head.revision === reviewBase) return new Unchanged({ head, reverted: payload.round > 1 })
|
|
309
|
+
|
|
302
310
|
const found = {
|
|
303
311
|
head,
|
|
304
312
|
...(synced?.status === 'conflict' ? { conflict: { files: synced.files, reason: synced.reason } } : undefined)
|
|
@@ -396,7 +404,7 @@ export const rallied = step('rallied', {
|
|
|
396
404
|
'An Effect to run after each fix, before the round that reviews it. A head it gives, having verified it, is reviewed as `verified` is. Failing with `Halted` ends the rally. The journal holds null for it.'
|
|
397
405
|
})
|
|
398
406
|
},
|
|
399
|
-
success: Schema.Union([Settled, DisputeStands, FindingsReturned, RoundCap]),
|
|
407
|
+
success: Schema.Union([Settled, DisputeStands, FindingsReturned, RoundCap, Unchanged]),
|
|
400
408
|
error: Schema.Union([BaseUnpinned, Halted]),
|
|
401
409
|
run: ({ maxRounds, guidance, fixes = 'open', afterFix, ...payload }) =>
|
|
402
410
|
Effect.gen(function* () {
|
|
@@ -429,6 +437,9 @@ export const rallied = step('rallied', {
|
|
|
429
437
|
: undefined
|
|
430
438
|
})
|
|
431
439
|
|
|
440
|
+
if (found._tag === 'Unchanged')
|
|
441
|
+
return new Unchanged({ head: withoutOutput(found.head), reverted: found.reverted })
|
|
442
|
+
|
|
432
443
|
const { head, conflict } = found
|
|
433
444
|
|
|
434
445
|
// A round that merges or finds the branch up to date settles every round before it that could not merge.
|
package/src/review.ts
CHANGED
|
@@ -30,6 +30,7 @@ import * as Effect from 'effect/Effect'
|
|
|
30
30
|
import * as Schema from 'effect/Schema'
|
|
31
31
|
import * as Struct from 'effect/Struct'
|
|
32
32
|
import build, { BuildInput, BuildOutput } from './build'
|
|
33
|
+
import { isNothingToDo, type NothingToDo } from './build-schemas'
|
|
33
34
|
import { verifyHead } from './change-request-body'
|
|
34
35
|
import { DeliveryFields, ownDeliveryTarget } from './delivery'
|
|
35
36
|
import { caseOf, inCase, listedCases, numberedCases, OutOfScopeFinding, outOfScopeCase } from './out-of-scope'
|
|
@@ -1160,6 +1161,12 @@ const reviewText = (
|
|
|
1160
1161
|
].join('\n\n')
|
|
1161
1162
|
}
|
|
1162
1163
|
|
|
1164
|
+
/** What a person is told of a Build that found nothing to do, naming a ChangeRequest it left open for them to close. */
|
|
1165
|
+
const nothingNeeded = (built: typeof NothingToDo.Type) =>
|
|
1166
|
+
built.changeRequest === undefined
|
|
1167
|
+
? `Nothing needed changing: ${built.summary}`
|
|
1168
|
+
: `Nothing needed changing, so close ${built.changeRequest.url}: ${built.summary}`
|
|
1169
|
+
|
|
1163
1170
|
const fixBrief = (changeRequestId: string, findings: readonly MergedFinding[], unmet: readonly string[]) =>
|
|
1164
1171
|
[
|
|
1165
1172
|
`Fix what a review of ChangeRequest ${changeRequestId} found, on its branch:`,
|
|
@@ -1563,12 +1570,13 @@ export const followedUp = step('followedUp', {
|
|
|
1563
1570
|
...(scope === undefined ? undefined : { scope }),
|
|
1564
1571
|
...ownDeliveryTarget(input)
|
|
1565
1572
|
}).pipe(
|
|
1566
|
-
Effect.map(
|
|
1567
|
-
fixed
|
|
1568
|
-
new
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1573
|
+
Effect.map(fixed =>
|
|
1574
|
+
isNothingToDo(fixed)
|
|
1575
|
+
? new Done({ choice, detail: nothingNeeded(fixed) })
|
|
1576
|
+
: new Fixed({
|
|
1577
|
+
choice,
|
|
1578
|
+
detail: fixed.settled ? 'Fixed and pushed' : `Pushed; left: ${fixed.unsettled.join('; ')}`
|
|
1579
|
+
})
|
|
1572
1580
|
),
|
|
1573
1581
|
Effect.catchTag('ChildFailed', failed => Effect.succeed(new Done({ choice, detail: failed.reason })))
|
|
1574
1582
|
)
|
|
@@ -1578,7 +1586,11 @@ export const followedUp = step('followedUp', {
|
|
|
1578
1586
|
words: fixBrief(changeRequestId, findings, scope?.unmet ?? []),
|
|
1579
1587
|
...ownDeliveryTarget(input)
|
|
1580
1588
|
}).pipe(
|
|
1581
|
-
Effect.map(built =>
|
|
1589
|
+
Effect.map(built =>
|
|
1590
|
+
isNothingToDo(built)
|
|
1591
|
+
? new Done({ choice, detail: nothingNeeded(built) })
|
|
1592
|
+
: new Built({ choice, detail: built.changeRequest.url })
|
|
1593
|
+
),
|
|
1582
1594
|
Effect.catchTag('ChildFailed', failed => Effect.succeed(new Done({ choice, detail: failed.reason })))
|
|
1583
1595
|
)
|
|
1584
1596
|
|
package/src/standing.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as Effect from 'effect/Effect'
|
|
|
3
3
|
import * as Schema from 'effect/Schema'
|
|
4
4
|
import * as SchemaTransformation from 'effect/SchemaTransformation'
|
|
5
5
|
import * as Struct from 'effect/Struct'
|
|
6
|
-
import { BuildInput, BuildOutput, Built } from './build-schemas'
|
|
6
|
+
import { BuildInput, BuildOutput, Built, isNothingToDo, NothingToDo } from './build-schemas'
|
|
7
7
|
import { rebuildRefusal } from './convergence'
|
|
8
8
|
import { ownDeliveryTarget } from './delivery'
|
|
9
9
|
import { OutOfScopeFinding } from './out-of-scope'
|
|
@@ -42,6 +42,11 @@ export class TakenOver extends Schema.TaggedClass<TakenOver>()('TakenOver', {})
|
|
|
42
42
|
/** Another Build ran on the ChangeRequest; `built` is what it made. */
|
|
43
43
|
export class Rebuilt extends Schema.TaggedClass<Rebuilt>()('Rebuilt', { built: Built }) {}
|
|
44
44
|
|
|
45
|
+
/** A rebuild left the branch at its target, so the ChangeRequest has no change left to land; `built` is what it found. */
|
|
46
|
+
export class RebuildUnchanged extends Schema.TaggedClass<RebuildUnchanged>()('RebuildUnchanged', {
|
|
47
|
+
built: NothingToDo
|
|
48
|
+
}) {}
|
|
49
|
+
|
|
45
50
|
/** Build was marked blocked on findings that still stand, so the Task waits on its owner. */
|
|
46
51
|
export class BuildBlocked extends Schema.TaggedError<BuildBlocked>()('BuildBlocked', {
|
|
47
52
|
message: Schema.String
|
|
@@ -78,7 +83,7 @@ export const standing = step('standing', {
|
|
|
78
83
|
Struct.pick(BuildInput.fields, ['words', 'taskId', 'repoBindingId', 'outcome', 'maxRounds', 'deliversTo'])
|
|
79
84
|
).annotate({ description: "The Build's own Input, which a rebuild is given too." })
|
|
80
85
|
},
|
|
81
|
-
success: Schema.Union([TakenOver, Rebuilt]),
|
|
86
|
+
success: Schema.Union([TakenOver, Rebuilt, RebuildUnchanged]),
|
|
82
87
|
error: BuildBlocked,
|
|
83
88
|
run: ({
|
|
84
89
|
changeRequest,
|
|
@@ -160,6 +165,8 @@ export const standing = step('standing', {
|
|
|
160
165
|
{ constraints: unsettled.map(standingConstraint) }
|
|
161
166
|
)
|
|
162
167
|
|
|
168
|
+
if (isNothingToDo(rebuilt)) return new RebuildUnchanged({ built: { ...rebuilt, changeRequest } })
|
|
169
|
+
|
|
163
170
|
return new Rebuilt({ built: Struct.omit(rebuilt, ['changeRequest', 'landed', 'next']) })
|
|
164
171
|
})
|
|
165
172
|
})
|