@kitman-sh/software-engineering 0.13.16 → 0.13.18

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.
@@ -1,8 +1,24 @@
1
1
  import { ScopeJudgement } from '@kitman-sh/sdk/loop'
2
2
  import * as Schema from 'effect/Schema'
3
3
 
4
- /** A scope judgement with what an answer put out of scope, which is reported and never unmet. */
4
+ /** What one review judged of a criterion the implementer answered not met, on the head it read. */
5
+ export const CriterionDisposition = Schema.Struct({
6
+ /** The criterion in the implementer's exact words. */
7
+ criterion: Schema.String,
8
+ status: Schema.Literals(['met', 'open', 'out_of_scope', 'reported']),
9
+ /** The Task's out-of-scope case, when it is out of scope. */
10
+ item: Schema.optionalKey(Schema.String)
11
+ })
12
+
13
+ export type CriterionDisposition = typeof CriterionDisposition.Type
14
+
15
+ /** A scope judgement with what an answer or the Task's Out of scope list leaves out, which is reported and never unmet. */
5
16
  export const ReviewedScope = Schema.Struct({
6
17
  ...ScopeJudgement.fields,
7
- reported: Schema.optional(Schema.Array(Schema.String))
18
+ reported: Schema.optional(Schema.Array(Schema.String)),
19
+ outOfScope: Schema.optional(Schema.Array(Schema.Struct({ part: Schema.String, item: Schema.String }))),
20
+ /** Only the review that gave them judged these, so a scope carried to a later head has none. */
21
+ criteria: Schema.optional(Schema.Array(CriterionDisposition))
8
22
  })
23
+
24
+ export type ReviewedScope = typeof ReviewedScope.Type
@@ -1,5 +1,6 @@
1
1
  import { MergedFinding, ResolvedDeliveryTarget, ResolvedReleaseTrigger } from '@kitman-sh/sdk/loop'
2
2
  import * as Schema from 'effect/Schema'
3
+ import { OutOfScopeFinding } from './out-of-scope'
3
4
  import { ReviewedScope } from './reviewed-scope'
4
5
 
5
6
  /** Shepherd's Output, outside shepherd.ts so Build can import it without the review → build → shepherd cycle. */
@@ -35,6 +36,7 @@ export const ShepherdOutput = Schema.Struct({
35
36
  /** The head the review that handed it back read, and its findings, so Build's first review reviews the fix. */
36
37
  reviewed: Schema.optional(Schema.String),
37
38
  earlier: Schema.optional(Schema.Array(MergedFinding)),
39
+ outOfScopeFindings: Schema.optional(Schema.Array(OutOfScopeFinding)),
38
40
  /** That review's scope judgement, whose unmet items Build's first review judges again. */
39
41
  scope: Schema.optional(ReviewedScope)
40
42
  })
package/src/shepherd.ts CHANGED
@@ -37,6 +37,7 @@ import release, { approvalRef } from './release'
37
37
  import landEpic, { LandEpicInput, LandEpicOutput } from './land-epic'
38
38
  import { DeliveryFields, epicOf, ownDeliveryTarget } from './delivery'
39
39
  import { verifyHead } from './change-request-body'
40
+ import type { OutOfScopeFinding } from './out-of-scope'
40
41
  import type { ReviewedScope } from './reviewed-scope'
41
42
  import review, { ReviewInput, ReviewOutput } from './review'
42
43
  import { ShepherdOutput } from './shepherd-output'
@@ -249,7 +250,7 @@ type UnranReview = { readonly notRun: readonly string[] } & ({ readonly review:
249
250
  */
250
251
  export default defineLoop({
251
252
  id: 'shepherd',
252
- version: '1.10.0',
253
+ version: '1.11.0',
253
254
  title: 'Shepherd',
254
255
  input: Input,
255
256
  output: Output,
@@ -290,8 +291,10 @@ export default defineLoop({
290
291
  let headFindings: readonly MergedFinding[] = []
291
292
  /** The head that review read. */
292
293
  let headFindingsAt: string | undefined
294
+ /** The last review's findings kept apart as out of scope, for the next review and a Build handed the ChangeRequest. */
295
+ let outOfScopeFindings: readonly OutOfScopeFinding[] = []
293
296
  /** That review's scope judgement. */
294
- let headScope: typeof ReviewedScope.Type | undefined
297
+ let headScope: ReviewedScope | undefined
295
298
  /** Each head a review passed but left unapproved, as verify never ran these of its tests. */
296
299
  const unranAt = new Map<string, UnranReview>()
297
300
  const rounds: Record<RoundKind, number> = { 'ci-fix': 0, 'head-fix': 0 }
@@ -431,7 +434,7 @@ export default defineLoop({
431
434
  review?: {
432
435
  readonly reviewed: string
433
436
  readonly earlier: readonly MergedFinding[]
434
- readonly scope?: typeof ReviewedScope.Type
437
+ readonly scope?: ReviewedScope
435
438
  }
436
439
  ): Output => ({
437
440
  ...done('handed_back', reason),
@@ -441,7 +444,8 @@ export default defineLoop({
441
444
  ...(input.taskId === undefined ? undefined : { taskId: input.taskId }),
442
445
  // Build's target, over the offer's default of this Run's branch, which is the ChangeRequest's own.
443
446
  ...(target === 'HEAD' ? undefined : { branch: target }),
444
- ...review
447
+ ...review,
448
+ ...(outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings })
445
449
  }
446
450
  })
447
451
 
@@ -830,12 +834,16 @@ export default defineLoop({
830
834
  const reviewed = yield* call(`review:${cycle}`, reviewLoop(), {
831
835
  base: `origin/${target}`,
832
836
  head,
837
+ deliveredBy: changeRequestId,
833
838
  files: files.files,
834
839
  ...(head === files.synced ? undefined : { since: files.synced }),
835
840
  ...(files.earlier.length === 0 ? undefined : { earlier: files.earlier }),
836
- ...(files.reviewed === undefined ? undefined : { reviewed: files.reviewed })
841
+ ...(files.reviewed === undefined ? undefined : { reviewed: files.reviewed }),
842
+ ...(outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings })
837
843
  })
838
844
 
845
+ outOfScopeFindings = reviewed.outOfScopeFindings ?? []
846
+
839
847
  if (reviewed.blocking) {
840
848
  const blocking = reviewed.findings.filter(isBlocking)
841
849
 
@@ -935,13 +943,17 @@ export default defineLoop({
935
943
  const reviewed = yield* call(`head-review:${cycle}`, reviewLoop(), {
936
944
  base: `origin/${target}`,
937
945
  head,
946
+ deliveredBy: changeRequestId,
938
947
  ...(notRun.length === 0 ? undefined : { notRun }),
939
948
  ...(since === undefined ? undefined : { approved: since }),
940
949
  ...(headFindings.length === 0 ? undefined : { earlier: headFindings }),
941
950
  ...(headFindingsAt === undefined ? undefined : { reviewed: headFindingsAt }),
951
+ ...(outOfScopeFindings.length === 0 ? undefined : { outOfScopeFindings }),
942
952
  ...(headScope === undefined ? undefined : { scope: headScope })
943
953
  })
944
954
 
955
+ outOfScopeFindings = reviewed.outOfScopeFindings ?? []
956
+
945
957
  if (reviewed.blocking) {
946
958
  const blocking = reviewed.findings.filter(isBlocking)
947
959
 
package/src/tidy.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  import * as Effect from 'effect/Effect'
18
18
  import * as Schema from 'effect/Schema'
19
19
  import { changeRequestBody, unsettledItems } from './change-request-body'
20
+ import { outOfScopeLines } from './out-of-scope'
20
21
  import plan from './plan'
21
22
  import review from './review'
22
23
  import { OneSentence, ShortStatement } from './text-limits'
@@ -125,7 +126,7 @@ const next = ['Plan it', 'Tidy the top one now', 'Done'] as const
125
126
  */
126
127
  export default defineLoop({
127
128
  id: 'tidy',
128
- version: '1.0.0',
129
+ version: '1.1.0',
129
130
  title: 'Tidy',
130
131
  input: Input,
131
132
  output: Output,
@@ -177,6 +178,7 @@ export default defineLoop({
177
178
  head,
178
179
  claims: improvement.claims,
179
180
  unsettled,
181
+ outOfScope: outOfScopeLines(reviewed.outOfScopeFindings ?? [], reviewed.scope),
180
182
  rounds: 1,
181
183
  stopped: decision.stop ? decision.reason : 'round_cap'
182
184
  })