@kitman-sh/software-engineering 0.14.8 → 0.15.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.
@@ -1,13 +1,14 @@
1
1
  import {
2
+ isBlocking,
2
3
  testsNotRunReasons,
3
4
  verify,
4
5
  type MergedFinding,
5
- type RallyDecision,
6
6
  type ScopeJudgement,
7
7
  type SettledRound,
8
8
  type VerifyResult
9
9
  } from '@kitman-sh/sdk/loop'
10
10
  import * as Effect from 'effect/Effect'
11
+ import * as Struct from 'effect/Struct'
11
12
  import { outOfScopeSection } from './out-of-scope'
12
13
 
13
14
  /** Each part of the Task the reviewer found not done, as a blocker the implementer fixes or rebuts like any other. */
@@ -21,6 +22,12 @@ export const scopeFindings = (scope: ScopeJudgement | undefined): readonly Merge
21
22
  seats: ['code-review']
22
23
  }))
23
24
 
25
+ /** A head less what its checks printed, which its verify Step's entry holds: a journal entry is at most 256 KiB. */
26
+ export const withoutOutput = (head: VerifyResult): VerifyResult => ({
27
+ ...head,
28
+ checks: head.checks.map(entry => Struct.omit(entry, ['outputTail']))
29
+ })
30
+
24
31
  /** What fails on the head and not on the base, so the change broke it. */
25
32
  export const brokenChecks = (head: VerifyResult) =>
26
33
  head.unchanged === true ? [] : head.checks.filter(check => check.status === 'failed' && !check.preExisting)
@@ -66,9 +73,21 @@ export const checkFindings = (head: VerifyResult): readonly MergedFinding[] =>
66
73
  seats: ['verify']
67
74
  }))
68
75
 
76
+ /** The review's findings still open or disputed, less the scope's and the checks', which each round finds again. */
77
+ export const codeFindings = (settled: SettledRound): readonly MergedFinding[] =>
78
+ [...settled.open, ...settled.standing.map(entry => entry.finding)].filter(
79
+ finding => !finding.id.startsWith('scope: ') && !isCheckFinding(finding.id)
80
+ )
81
+
82
+ /** The findings that still block, open or disputed. */
83
+ export const unsettledIds = (settled: SettledRound): readonly string[] =>
84
+ [...settled.open, ...settled.standing.map(entry => entry.finding)].flatMap(finding =>
85
+ isBlocking(finding) ? [finding.id] : []
86
+ )
87
+
69
88
  /** Why each item the rally could not settle is still open; a failing check is the evidence's to report. */
70
- export const unsettledItems = (settled: SettledRound, decision: RallyDecision & { readonly stop: true }) =>
71
- decision.unsettled
89
+ export const unsettledItems = (settled: SettledRound) =>
90
+ unsettledIds(settled)
72
91
  .filter(id => !isCheckFinding(id))
73
92
  .map(id => {
74
93
  const standing = settled.standing.find(entry => entry.finding.id === id)
package/src/delivery.ts CHANGED
@@ -1,14 +1,34 @@
1
1
  import { DeliveryTarget, EpicDelivery, ResolvedDeliveryTarget } from '@kitman-sh/sdk/loop'
2
2
  import * as Schema from 'effect/Schema'
3
3
 
4
+ /** Kitman sets it when a Run starts from its Task's own, Milestone's or Project's target branch, which its work merges into. */
5
+ export const TargetBranchField = {
6
+ targetBranch: Schema.optional(Schema.String).annotate({
7
+ description:
8
+ "The branch the Run's delivery merges into, as the Task, its Milestone or its Project sets it; Kitman sets it when the Run starts."
9
+ })
10
+ }
11
+
12
+ /** The branch a base sync merges in: the Run's own, else its target branch; the default branch when neither. */
13
+ export const baseOf = (input: { readonly branch?: string | undefined; readonly targetBranch?: string | undefined }) => {
14
+ const target = input.branch ?? input.targetBranch
15
+
16
+ return target === undefined ? undefined : { target }
17
+ }
18
+
4
19
  /** The Input fields of a Loop that delivers by the Workspace's, Team's and Project's delivery target. */
5
20
  export const DeliveryFields = {
6
- /** This Run's own delivery target, over its Project's, Team's and Workspace's; `default_branch` ships a hotfix. */
7
- deliveryTarget: Schema.optional(DeliveryTarget),
8
- /** Where the Run's delivery lands and the layer it came from; Kitman sets it when the Run starts. */
9
- deliversTo: Schema.optional(ResolvedDeliveryTarget),
10
- /** The epic the Run's Task delivers through under epic delivery; Kitman sets it when the Run starts. */
11
- epic: Schema.optional(EpicDelivery)
21
+ deliveryTarget: Schema.optional(DeliveryTarget).annotate({
22
+ description:
23
+ "This Run's own delivery target, over its Project's, Team's and Workspace's; `default_branch` ships a hotfix."
24
+ }),
25
+ deliversTo: Schema.optional(ResolvedDeliveryTarget).annotate({
26
+ description: "Where the Run's delivery lands and the layer it came from; Kitman sets it when the Run starts."
27
+ }),
28
+ epic: Schema.optional(EpicDelivery).annotate({
29
+ description: "The epic the Run's Task delivers through under epic delivery; Kitman sets it when the Run starts."
30
+ }),
31
+ ...TargetBranchField
12
32
  }
13
33
 
14
34
  type Delivering = { readonly deliversTo?: ResolvedDeliveryTarget | undefined }