@kitman-sh/software-engineering 0.50.0 → 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/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.50.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.50.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": "6139e1a2da3f82c161d4dc09b9eee20c813edba1939cb05be0ce49602bf26ac9",
27
+ "digest": "e1e9ba23a0821811bc1183d620d931f46722c4c840221f80dc8d2388eeb1f0ff",
28
28
  "protocolVersion": 5,
29
29
  "declarations": "dist/declarations.json",
30
30
  "setup": {
@@ -82,7 +82,8 @@ export const CriterionAnswer = Schema.Struct({
82
82
 
83
83
  export type CriterionAnswer = typeof CriterionAnswer.Type
84
84
 
85
- export const BuildOutput = Schema.Struct({
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(BuildOutput.fields, ['changeRequest', 'landed', 'next']))
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
- import { implemented, type Implemented } from './implemented'
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 }),
@@ -138,8 +138,8 @@ const gated = ({
138
138
  ...(before._tag === 'NotNeeded' ? undefined : { base: before.base }),
139
139
  ...(last.scope === undefined ? undefined : { review: last.scope }),
140
140
  ...(before._tag === 'Reproduced' ? { reproducing: before.check.name } : undefined),
141
- ...(change.documented === undefined ? undefined : { documented: change.documented }),
142
- ...(change.rollback === undefined ? undefined : { rollback: change.rollback })
141
+ ...(change.documented === undefined ? undefined : { documented: change.documented.map(check => check.name) }),
142
+ ...(change.rollback === undefined ? undefined : { rollback: change.rollback.name })
143
143
  })
144
144
 
145
145
  const stopped = stoppedAs[last._tag]
@@ -204,9 +204,9 @@ const gated = ({
204
204
 
205
205
  const outputOf = (
206
206
  input: Input,
207
- changeRequest: (typeof BuildOutput.Type)['changeRequest'],
207
+ changeRequest: (typeof ChangeBuilt.Type)['changeRequest'],
208
208
  built: Built
209
- ): typeof BuildOutput.Type => ({
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: '3.1.0',
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,
@@ -260,9 +260,12 @@ const build = defineLoop({
260
260
  outcome,
261
261
  continuing,
262
262
  ...(cases.length === 0 ? undefined : { cases }),
263
+ ...(before._tag === 'Reproduced' ? { reproducing: before.check } : undefined),
263
264
  ...(input.planReviewed === true ? { planReviewed: true } : undefined)
264
265
  })
265
266
 
267
+ const proven = [...(before._tag === 'Reproduced' ? [before.check] : []), ...proofsOf(outcome, change)]
268
+
266
269
  const last = yield* rallied({
267
270
  fixer: 'implementer',
268
271
  maxRounds: input.maxRounds ?? 3,
@@ -270,7 +273,7 @@ const build = defineLoop({
270
273
  outcome,
271
274
  claims: [...change.claims, ...change.criteria.map(answer => `Criterion ${answerLine(answer, cases)}`)],
272
275
  suggested: change.checks ?? [],
273
- extra: before._tag === 'Reproduced' ? [before.check] : undefined,
276
+ extra: proven.length === 0 ? undefined : proven,
274
277
  reviewed: input.reviewed,
275
278
  earlier: input.earlier,
276
279
  deliveredBy: input.changeRequestId,
@@ -281,6 +284,24 @@ const build = defineLoop({
281
284
  scope: input.scope
282
285
  })
283
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
+
284
305
  const gate = gated({ outcome, before, change, last, cases })
285
306
 
286
307
  const { changeRequest, approval } = yield* opened({
@@ -311,6 +332,8 @@ const build = defineLoop({
311
332
 
312
333
  if (decided._tag === 'TakenOver') return { status: 'taken_over', output: outputOf(input, changeRequest, built) }
313
334
 
335
+ if (decided._tag === 'RebuildUnchanged') return { status: 'nothing_to_do', output: decided.built }
336
+
314
337
  built = decided.built
315
338
  }
316
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, when it opened one.'
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: 'Whether a fix was started: none was offered, a person declined it, it started, or starting it failed.'
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: "The fix's ChangeRequest, when a fix opened one."
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 => new FixStarted({ changeRequestUrl: fixed.changeRequest.url })),
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.0.0',
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 => built.stopped)
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}`)),
@@ -1,10 +1,18 @@
1
- import { Continuing, continuingBrief, LoopOutcome, step } from '@kitman-sh/sdk/loop'
1
+ import { Continuing, continuingBrief, LoopOutcome, step, verify, type VerifyResult } from '@kitman-sh/sdk/loop'
2
2
  import * as Effect from 'effect/Effect'
3
3
  import * as Schema from 'effect/Schema'
4
4
  import { implementer, plannedImplementer } from './agents'
5
5
  import { CriterionAnswer, taskOf } from './build-schemas'
6
6
  import { caseOf, numberedCases } from './out-of-scope'
7
- import { SuggestedCheck } from './suggested-check'
7
+ import {
8
+ clashingChecks,
9
+ refusedCheck,
10
+ Renamed,
11
+ renamedChecks,
12
+ renamePrompt,
13
+ SuggestedCheck,
14
+ unstartedRefusal
15
+ } from './suggested-check'
8
16
  import { ChangeRequestSummary, ShortStatement } from './text-limits'
9
17
 
10
18
  const Change = Schema.Struct({
@@ -12,25 +20,30 @@ const Change = Schema.Struct({
12
20
  title: Schema.String,
13
21
  summary: ChangeRequestSummary,
14
22
  claims: Schema.Array(ShortStatement),
15
- /** The approved checks that run the documented commands, for a docs Outcome. */
16
- documented: Schema.optional(Schema.Array(Schema.String)),
17
- /** The approved check that rolls a migration back. */
18
- rollback: Schema.optional(Schema.String),
23
+ /** The checks that run the documented commands, for a docs Outcome; Kitman runs them on every head. */
24
+ documented: Schema.optional(Schema.Array(SuggestedCheck)),
25
+ /** The check that rolls a migration back; Kitman runs it on every head. */
26
+ rollback: Schema.optional(SuggestedCheck),
19
27
  /** Each acceptance criterion of the Task, answered; empty when it has none, left out when building from words. */
20
28
  criteria: Schema.optional(Schema.Array(CriterionAnswer)),
21
29
  /** Checks to run when the repository has none approved, from its package scripts or CI config. */
22
30
  checks: Schema.optional(Schema.Array(SuggestedCheck))
23
31
  })
24
32
 
33
+ type SuggestedCheckType = typeof SuggestedCheck.Type
34
+
25
35
  const Criteria = Schema.Struct({ criteria: Schema.Array(CriterionAnswer) })
26
36
 
37
+ const proofGuidance =
38
+ "Give each the command itself, with a `name` of letters, digits, `.`, `_`, `:` and `-` that no check of the repository has, unless it is exactly an approved check's name, command and directory. Kitman runs them on every head; a narrower command than an approved check is its own check."
39
+
27
40
  const outcomeGuidance = {
28
41
  feature: 'Deliver the whole scope; review checks it was met.',
29
42
  bug: 'Your failing test is already in place: make it pass.',
30
43
  refactor: 'Keep behaviour exactly as it is; the approved verifications must pass before and after.',
31
44
  investigation: 'Investigate and report what you found, with its sources.',
32
- docs: 'Name, in `documented`, the approved checks that run the commands you documented.',
33
- migration: 'Name, in `rollback`, the approved check that rolls the migration back.',
45
+ docs: `Name, in \`documented\`, a check for each command you documented that runs exactly it. ${proofGuidance}`,
46
+ migration: `Name, in \`rollback\`, the check that rolls the migration back. ${proofGuidance}`,
34
47
  performance: 'Make it faster without changing behaviour.'
35
48
  } as const satisfies { readonly [outcome in LoopOutcome]: string }
36
49
 
@@ -82,6 +95,88 @@ const criteriaPrompt = (unanswered: boolean, unmet: readonly CriterionAnswer[],
82
95
  criteriaGuidance
83
96
  ].join('\n\n')
84
97
 
98
+ type ProofLaunch = {
99
+ readonly checks: readonly string[]
100
+ readonly suggested?: readonly SuggestedCheckType[]
101
+ readonly extra: readonly SuggestedCheckType[]
102
+ }
103
+
104
+ type Proofs = Pick<typeof Change.Type, 'documented' | 'rollback'>
105
+
106
+ /** The checks a docs or migration change names to prove it, which Kitman runs on every head. */
107
+ export const proofsOf = (outcome: LoopOutcome | undefined, change: Proofs) => {
108
+ if (outcome === 'docs') return change.documented ?? []
109
+
110
+ return outcome === 'migration' && change.rollback !== undefined ? [change.rollback] : []
111
+ }
112
+
113
+ /**
114
+ * Kitman refuses a check it will not run as soon as the implementer names one, so it can correct it before the review:
115
+ * it runs the proofs at once, and refuses every name it will not take and every command that does not start together.
116
+ */
117
+ const runnableProofs = (
118
+ outcome: LoopOutcome | undefined,
119
+ change: Proofs & Pick<typeof Change.Type, 'checks'>,
120
+ reproducing: SuggestedCheckType | undefined
121
+ ) =>
122
+ Effect.gen(function* () {
123
+ const kept = reproducing === undefined ? [] : [reproducing]
124
+
125
+ const checked = <E, R>(
126
+ {
127
+ checks,
128
+ proofs
129
+ }: { readonly checks: readonly SuggestedCheckType[]; readonly proofs: readonly SuggestedCheckType[] },
130
+ verified: (launch: ProofLaunch) => Effect.Effect<VerifyResult, E, R>
131
+ ) =>
132
+ proofs.length === 0
133
+ ? Effect.suspend(() => {
134
+ const clash = clashingChecks('implemented', [...kept, ...checks])
135
+
136
+ return clash === undefined ? Effect.void : Effect.fail(clash)
137
+ })
138
+ : verified({ checks: [], ...(checks.length === 0 ? undefined : { suggested: checks }), extra: proofs }).pipe(
139
+ Effect.flatMap(result => {
140
+ const refusal = unstartedRefusal('implemented', result, proofs)
141
+
142
+ return refusal === undefined ? Effect.void : Effect.fail(refusal)
143
+ })
144
+ )
145
+
146
+ const named = { checks: change.checks ?? [], proofs: proofsOf(outcome, change) }
147
+
148
+ const { checks, proofs } = yield* checked(named, launch => verify('proofs', launch)).pipe(
149
+ Effect.as(named),
150
+ Effect.catchTag('StepFailed', error =>
151
+ refusedCheck(error)
152
+ ? Effect.gen(function* () {
153
+ const all = [...named.checks, ...named.proofs]
154
+
155
+ const renamed = renamedChecks(
156
+ all,
157
+ yield* implementer('rename', { prompt: renamePrompt(error.reason, all, kept), output: Renamed })
158
+ )
159
+
160
+ const again = {
161
+ checks: renamed.slice(0, named.checks.length),
162
+ proofs: renamed.slice(named.checks.length)
163
+ }
164
+
165
+ yield* checked(again, launch => verify('proofs-renamed', launch))
166
+
167
+ return again
168
+ })
169
+ : Effect.fail(error)
170
+ )
171
+ )
172
+
173
+ return {
174
+ ...(change.checks === undefined ? undefined : { checks }),
175
+ ...(outcome === 'docs' && change.documented !== undefined ? { documented: proofs } : undefined),
176
+ ...(outcome === 'migration' && change.rollback !== undefined ? { rollback: proofs[0] } : undefined)
177
+ }
178
+ })
179
+
85
180
  /** The change is in the workspace, with the Task's acceptance criteria answered; none when it has none. */
86
181
  export class Implemented extends Schema.TaggedClass<Implemented>()('Implemented', {
87
182
  ...Change.fields,
@@ -105,13 +200,16 @@ export const implemented = step('implemented', {
105
200
  cases: Schema.optional(Schema.Array(Schema.String)).annotate({
106
201
  description: "The Task's Out of scope list, which the implementer does not build."
107
202
  }),
203
+ reproducing: Schema.optional(SuggestedCheck).annotate({
204
+ description: "The bug's reproducing check, whose name the implementer's checks may not take for another command."
205
+ }),
108
206
  planReviewed: Schema.optional(Schema.Boolean).annotate({
109
207
  description:
110
208
  'Plan review passed the Task and this is its first implementation: the `planned-implementer` makes it.'
111
209
  })
112
210
  },
113
211
  success: Implemented,
114
- run: ({ words, taskId, outcome, continuing, cases = [], planReviewed }) =>
212
+ run: ({ words, taskId, outcome, continuing, cases = [], reproducing, planReviewed }) =>
115
213
  Effect.gen(function* () {
116
214
  const work = {
117
215
  skill: 'implement',
@@ -131,13 +229,11 @@ export const implemented = step('implemented', {
131
229
  answer => answer.status === 'not_met' && caseOf(cases, answer) === undefined
132
230
  )
133
231
 
134
- if (!unanswered && unmet.length === 0) return new Implemented({ ...change, criteria: change.criteria ?? [] })
135
-
136
- const { criteria } = yield* implementer('criteria', {
137
- prompt: criteriaPrompt(unanswered, unmet, cases),
138
- output: Criteria
139
- })
232
+ const { criteria } =
233
+ !unanswered && unmet.length === 0
234
+ ? { criteria: change.criteria ?? [] }
235
+ : yield* implementer('criteria', { prompt: criteriaPrompt(unanswered, unmet, cases), output: Criteria })
140
236
 
141
- return new Implemented({ ...change, criteria })
237
+ return new Implemented({ ...change, ...(yield* runnableProofs(outcome, change, reproducing)), criteria })
142
238
  })
143
239
  })
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?`,