@boxxy/model 0.1.2 → 0.1.3
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/README.md +8 -6
- package/dist/closeouts/build-close-out-schema.d.ts +31 -0
- package/dist/closeouts/close-out-answer-schema.d.ts +3 -0
- package/dist/closeouts/close-out-schema.d.ts +3 -0
- package/dist/closeouts/design-close-out-schema.d.ts +30 -0
- package/dist/closeouts/friction-schema.d.ts +14 -0
- package/dist/closeouts/open-item-schema.d.ts +3 -0
- package/dist/closeouts/review-close-out-schema.d.ts +40 -0
- package/dist/closeouts/triage-close-out-schema.d.ts +40 -0
- package/dist/closeouts/types.d.ts +221 -0
- package/dist/dispatch/build-applied-change.d.ts +6 -0
- package/dist/dispatch/collect-seat-sync.d.ts +14 -0
- package/dist/dispatch/pick-seat-take.d.ts +10 -0
- package/dist/dispatch/types.d.ts +11 -0
- package/dist/{outbox-fact-schema.d.ts → facts/outbox-fact-schema.d.ts} +1 -1
- package/dist/facts/parse-new-fact.d.ts +2 -0
- package/dist/facts/types.d.ts +191 -0
- package/dist/facts/work-fact-schemas.d.ts +293 -0
- package/dist/index.d.ts +64 -23
- package/dist/items/build-item-views.d.ts +4 -0
- package/dist/items/collect-retries.d.ts +3 -0
- package/dist/items/collect-settled.d.ts +3 -0
- package/dist/items/derive-item-state.d.ts +17 -0
- package/dist/{live-levers.d.ts → items/live-levers.d.ts} +1 -1
- package/dist/items/types.d.ts +12 -0
- package/dist/pipeline/advance.d.ts +10 -0
- package/dist/pipeline/constants.d.ts +2 -0
- package/dist/pipeline/count-trailing.d.ts +1 -0
- package/dist/pipeline/find-position.d.ts +9 -0
- package/dist/pipeline/find-step.d.ts +3 -0
- package/dist/pipeline/merge-by-time.d.ts +9 -0
- package/dist/pipeline/position-schema.d.ts +3 -0
- package/dist/pipeline/types.d.ts +28 -0
- package/dist/planning/define-admission.d.ts +3 -0
- package/dist/planning/define-gate.d.ts +3 -0
- package/dist/planning/define-signal.d.ts +3 -0
- package/dist/planning/is-filter-match.d.ts +3 -0
- package/dist/planning/limit-fill-schema.d.ts +3 -0
- package/dist/{signal-key.d.ts → planning/signal-key.d.ts} +1 -1
- package/dist/planning/types.d.ts +155 -0
- package/dist/ports/types.d.ts +289 -0
- package/dist/reports/constants.d.ts +3 -0
- package/dist/reports/cost-to-land-schema.d.ts +29 -0
- package/dist/reports/outbox-status.d.ts +16 -0
- package/dist/reports/stage-time-schema.d.ts +25 -0
- package/dist/reports/types.d.ts +5 -0
- package/dist/rows/actor-ref-schema.d.ts +2 -0
- package/dist/rows/attempt-row-schema.d.ts +3 -0
- package/dist/rows/attempt-session-row-schema.d.ts +3 -0
- package/dist/{brand-schemas.d.ts → rows/brand-schemas.d.ts} +5 -2
- package/dist/rows/caller-identity-schema.d.ts +3 -0
- package/dist/rows/criterion-schema.d.ts +3 -0
- package/dist/rows/decision-row-schema.d.ts +34 -0
- package/dist/rows/evidence-row-schema.d.ts +3 -0
- package/dist/rows/item-row-schema.d.ts +28 -0
- package/dist/rows/item-view-schema.d.ts +3 -0
- package/dist/rows/lease-row-schema.d.ts +3 -0
- package/dist/rows/lever-row-schema.d.ts +12 -0
- package/dist/rows/limit-schema.d.ts +3 -0
- package/dist/rows/limit-seat-row-schema.d.ts +3 -0
- package/dist/rows/note-row-schema.d.ts +3 -0
- package/dist/rows/notice-row-schema.d.ts +3 -0
- package/dist/rows/pull-request-row-schema.d.ts +3 -0
- package/dist/rows/relation-row-schema.d.ts +3 -0
- package/dist/{row-schemas.d.ts → rows/row-schemas.d.ts} +2 -2
- package/dist/rows/runner-row-schema.d.ts +3 -0
- package/dist/rows/spawn-request-schema.d.ts +3 -0
- package/dist/rules/define-phase.d.ts +3 -0
- package/dist/rules/load-rejection-schema.d.ts +3 -0
- package/dist/rules/types.d.ts +244 -0
- package/dist/test-utils/build-mock-cost-to-land.d.ts +2 -0
- package/dist/test-utils/build-mock-evidence-row.d.ts +1 -1
- package/dist/test-utils/build-mock-fact-id.d.ts +1 -1
- package/dist/test-utils/build-mock-frame-item.d.ts +1 -1
- package/dist/test-utils/build-mock-frame.d.ts +2 -0
- package/dist/test-utils/build-mock-item-rules.d.ts +2 -0
- package/dist/test-utils/build-mock-lease-row.d.ts +1 -1
- package/dist/test-utils/build-mock-outbox-fact.d.ts +2 -0
- package/dist/test-utils/build-mock-phase-kind.d.ts +7 -0
- package/dist/test-utils/build-mock-pipeline.d.ts +7 -0
- package/dist/test-utils/build-mock-relation-row.d.ts +2 -0
- package/dist/test-utils/build-mock-settled.d.ts +9 -0
- package/dist/test-utils/build-mock-snapshot.d.ts +1 -1
- package/dist/test-utils/build-mock-v1-attempt-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-item-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-item-view.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-lever-row.d.ts +2 -0
- package/dist/test-utils/build-mock-v1-pull-request-row.d.ts +2 -0
- package/dist/test-utils/build-mock-work-fact.d.ts +12 -0
- package/dist/test-utils/create-fake-notifier.d.ts +9 -0
- package/dist/test-utils/create-fake-pepys-reader.d.ts +13 -0
- package/dist/test-utils/fact-sink-contract.d.ts +14 -0
- package/dist/test-utils/pepys-reader-contract.d.ts +17 -0
- package/dist/{types/core.d.ts → types.d.ts} +93 -43
- package/package.json +13 -3
- package/src/{build-close-out-schema.ts → closeouts/build-close-out-schema.ts} +5 -10
- package/src/closeouts/close-out-answer-schema.ts +42 -0
- package/src/closeouts/close-out-schema.ts +13 -0
- package/src/closeouts/design-close-out-schema.ts +20 -0
- package/src/closeouts/friction-schema.ts +11 -0
- package/src/closeouts/open-item-schema.ts +8 -0
- package/src/closeouts/review-close-out-schema.ts +38 -0
- package/src/closeouts/triage-close-out-schema.ts +29 -0
- package/src/closeouts/types.ts +230 -0
- package/src/dispatch/build-applied-change.ts +57 -0
- package/src/dispatch/collect-seat-sync.ts +86 -0
- package/src/dispatch/pick-seat-take.ts +39 -0
- package/src/dispatch/types.ts +14 -0
- package/src/facts/outbox-fact-schema.ts +22 -0
- package/src/facts/parse-new-fact.ts +16 -0
- package/src/facts/types.ts +235 -0
- package/src/facts/work-fact-schemas.ts +201 -0
- package/src/index.ts +147 -55
- package/src/items/build-item-views.ts +146 -0
- package/src/items/collect-retries.ts +12 -0
- package/src/items/collect-settled.ts +20 -0
- package/src/items/derive-item-state.ts +95 -0
- package/src/{live-levers.ts → items/live-levers.ts} +1 -1
- package/src/items/types.ts +26 -0
- package/src/pipeline/advance.ts +78 -0
- package/src/pipeline/constants.ts +12 -0
- package/src/pipeline/count-trailing.ts +16 -0
- package/src/pipeline/find-position.ts +74 -0
- package/src/pipeline/find-step.ts +6 -0
- package/src/pipeline/merge-by-time.ts +33 -0
- package/src/pipeline/position-schema.ts +27 -0
- package/src/pipeline/types.ts +47 -0
- package/src/{define-admission.ts → planning/define-admission.ts} +2 -2
- package/src/{define-gate.ts → planning/define-gate.ts} +2 -2
- package/src/{define-signal.ts → planning/define-signal.ts} +2 -2
- package/src/planning/is-filter-match.ts +10 -0
- package/src/planning/limit-fill-schema.ts +12 -0
- package/src/{signal-key.ts → planning/signal-key.ts} +1 -1
- package/src/planning/types.ts +216 -0
- package/src/ports/types.ts +412 -0
- package/src/reports/constants.ts +6 -0
- package/src/reports/cost-to-land-schema.ts +47 -0
- package/src/reports/outbox-status.ts +22 -0
- package/src/reports/stage-time-schema.ts +21 -0
- package/src/reports/types.ts +7 -0
- package/src/rows/actor-ref-schema.ts +17 -0
- package/src/rows/attempt-row-schema.ts +69 -0
- package/src/rows/attempt-session-row-schema.ts +12 -0
- package/src/{brand-schemas.ts → rows/brand-schemas.ts} +5 -2
- package/src/rows/caller-identity-schema.ts +7 -0
- package/src/rows/criterion-schema.ts +9 -0
- package/src/rows/decision-row-schema.ts +34 -0
- package/src/rows/evidence-row-schema.ts +13 -0
- package/src/rows/item-row-schema.ts +32 -0
- package/src/rows/item-view-schema.ts +31 -0
- package/src/rows/lease-row-schema.ts +12 -0
- package/src/rows/lever-row-schema.ts +17 -0
- package/src/rows/limit-schema.ts +12 -0
- package/src/rows/limit-seat-row-schema.ts +12 -0
- package/src/rows/note-row-schema.ts +12 -0
- package/src/rows/notice-row-schema.ts +17 -0
- package/src/rows/pull-request-row-schema.ts +15 -0
- package/src/rows/relation-row-schema.ts +13 -0
- package/src/rows/row-schemas.ts +30 -0
- package/src/rows/runner-row-schema.ts +9 -0
- package/src/rows/spawn-request-schema.ts +15 -0
- package/src/rules/define-phase.ts +12 -0
- package/src/rules/load-rejection-schema.ts +51 -0
- package/src/rules/types.ts +291 -0
- package/src/test-utils/build-mock-cost-to-land.ts +31 -0
- package/src/test-utils/build-mock-evidence-row.ts +2 -2
- package/src/test-utils/build-mock-fact-id.ts +3 -3
- package/src/test-utils/build-mock-frame-item.ts +10 -5
- package/src/test-utils/build-mock-frame.ts +13 -0
- package/src/test-utils/build-mock-item-rules.ts +17 -0
- package/src/test-utils/build-mock-lease-row.ts +2 -2
- package/src/test-utils/build-mock-outbox-fact.ts +22 -0
- package/src/test-utils/build-mock-phase-kind.ts +29 -0
- package/src/test-utils/build-mock-pipeline.ts +52 -0
- package/src/test-utils/{build-mock-link-row.ts → build-mock-relation-row.ts} +4 -4
- package/src/test-utils/build-mock-settled.ts +18 -0
- package/src/test-utils/build-mock-snapshot.ts +10 -2
- package/src/test-utils/{build-mock-attempt-row.ts → build-mock-v1-attempt-row.ts} +28 -9
- package/src/test-utils/{build-mock-item-row.ts → build-mock-v1-item-row.ts} +7 -3
- package/src/test-utils/build-mock-v1-item-view.ts +29 -0
- package/src/test-utils/{build-mock-lever-row.ts → build-mock-v1-lever-row.ts} +5 -3
- package/src/test-utils/build-mock-v1-pull-request-row.ts +26 -0
- package/src/test-utils/build-mock-work-fact.ts +179 -0
- package/src/test-utils/create-fake-notifier.ts +54 -0
- package/src/test-utils/create-fake-pepys-reader.ts +73 -0
- package/src/test-utils/fact-sink-contract.ts +103 -0
- package/src/test-utils/pepys-reader-contract.ts +117 -0
- package/src/{types/core.ts → types.ts} +183 -59
- package/dist/actor-ref-schema.d.ts +0 -2
- package/dist/build-applied-change.d.ts +0 -13
- package/dist/build-close-out-schema.d.ts +0 -3
- package/dist/build-item-views.d.ts +0 -2
- package/dist/define-admission.d.ts +0 -3
- package/dist/define-gate.d.ts +0 -3
- package/dist/define-signal.d.ts +0 -3
- package/dist/derive-item-state.d.ts +0 -2
- package/dist/fact-schemas.d.ts +0 -5
- package/dist/find-slot-take.d.ts +0 -5
- package/dist/friction-schema.d.ts +0 -3
- package/dist/test-utils/build-mock-attempt-row.d.ts +0 -2
- package/dist/test-utils/build-mock-item-row.d.ts +0 -2
- package/dist/test-utils/build-mock-item-rows.d.ts +0 -2
- package/dist/test-utils/build-mock-item-view.d.ts +0 -2
- package/dist/test-utils/build-mock-lever-row.d.ts +0 -2
- package/dist/test-utils/build-mock-link-row.d.ts +0 -2
- package/dist/test-utils/build-mock-pull-request-row.d.ts +0 -2
- package/dist/types/dispatch.d.ts +0 -82
- package/dist/types/facts.d.ts +0 -154
- package/dist/types/planning.d.ts +0 -94
- package/dist/types/ports.d.ts +0 -218
- package/dist/types/registries.d.ts +0 -150
- package/src/actor-ref-schema.ts +0 -9
- package/src/build-applied-change.ts +0 -71
- package/src/build-item-views.ts +0 -128
- package/src/derive-item-state.ts +0 -76
- package/src/fact-schemas.ts +0 -132
- package/src/find-slot-take.ts +0 -12
- package/src/friction-schema.ts +0 -10
- package/src/outbox-fact-schema.ts +0 -25
- package/src/row-schemas.ts +0 -89
- package/src/test-utils/build-mock-item-rows.ts +0 -14
- package/src/test-utils/build-mock-item-view.ts +0 -8
- package/src/test-utils/build-mock-pull-request-row.ts +0 -16
- package/src/types/dispatch.ts +0 -95
- package/src/types/facts.ts +0 -166
- package/src/types/planning.ts +0 -136
- package/src/types/ports.ts +0 -262
- package/src/types/registries.ts +0 -185
- /package/dist/test-utils/{seed-faker.d.ts → pin-faker-seed.d.ts} +0 -0
- /package/dist/{format-key-path.d.ts → utils/format-key-path.d.ts} +0 -0
- /package/dist/{to-json-value.d.ts → utils/to-json-value.d.ts} +0 -0
- /package/src/test-utils/{seed-faker.ts → pin-faker-seed.ts} +0 -0
- /package/src/{format-key-path.ts → utils/format-key-path.ts} +0 -0
- /package/src/{to-json-value.ts → utils/to-json-value.ts} +0 -0
package/src/index.ts
CHANGED
|
@@ -1,27 +1,57 @@
|
|
|
1
1
|
export type { ContentHash, JsonValue } from '@boxxy/content-hash';
|
|
2
|
-
export { brandSchemas } from './brand-schemas.ts';
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from './build-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
2
|
+
export { brandSchemas } from './rows/brand-schemas.ts';
|
|
3
|
+
export { buildAppliedChange, type ChangeAssignments } from './dispatch/build-applied-change.ts';
|
|
4
|
+
export { advance } from './pipeline/advance.ts';
|
|
5
|
+
export { attemptRowSchema } from './rows/attempt-row-schema.ts';
|
|
6
|
+
export { attemptSessionRowSchema } from './rows/attempt-session-row-schema.ts';
|
|
7
|
+
export { buildCloseOutSchema } from './closeouts/build-close-out-schema.ts';
|
|
8
|
+
export { buildItemViews } from './items/build-item-views.ts';
|
|
9
|
+
export { collectRetries } from './items/collect-retries.ts';
|
|
10
|
+
export { collectSettled } from './items/collect-settled.ts';
|
|
11
|
+
export { closeOutAnswerSchema } from './closeouts/close-out-answer-schema.ts';
|
|
12
|
+
export { callerIdentitySchema } from './rows/caller-identity-schema.ts';
|
|
13
|
+
export { closeOutSchema } from './closeouts/close-out-schema.ts';
|
|
14
|
+
export { collectSeatSync, type SeatSync } from './dispatch/collect-seat-sync.ts';
|
|
15
|
+
export { costToLandSchema } from './reports/cost-to-land-schema.ts';
|
|
16
|
+
export { criterionSchema } from './rows/criterion-schema.ts';
|
|
17
|
+
export { decisionRowSchema } from './rows/decision-row-schema.ts';
|
|
18
|
+
export { defineAdmission } from './planning/define-admission.ts';
|
|
19
|
+
export { defineGate } from './planning/define-gate.ts';
|
|
20
|
+
export { definePhase } from './rules/define-phase.ts';
|
|
21
|
+
export { defineSignal } from './planning/define-signal.ts';
|
|
22
|
+
export { buildPhase, deriveItemState } from './items/derive-item-state.ts';
|
|
23
|
+
export { designCloseOutSchema } from './closeouts/design-close-out-schema.ts';
|
|
24
|
+
export { evidenceRowSchema } from './rows/evidence-row-schema.ts';
|
|
25
|
+
export { findPosition } from './pipeline/find-position.ts';
|
|
26
|
+
export { formatKeyPath } from './utils/format-key-path.ts';
|
|
27
|
+
export { frictionSchema } from './closeouts/friction-schema.ts';
|
|
28
|
+
export { isFilterMatch } from './planning/is-filter-match.ts';
|
|
29
|
+
export { itemRowSchema } from './rows/item-row-schema.ts';
|
|
30
|
+
export { itemViewSchema } from './rows/item-view-schema.ts';
|
|
31
|
+
export { leverRowSchema } from './rows/lever-row-schema.ts';
|
|
32
|
+
export { limitFillSchema } from './planning/limit-fill-schema.ts';
|
|
33
|
+
export { limitSchema } from './rows/limit-schema.ts';
|
|
34
|
+
export { limitSeatRowSchema } from './rows/limit-seat-row-schema.ts';
|
|
35
|
+
export { loadRejectionSchema } from './rules/load-rejection-schema.ts';
|
|
36
|
+
export { liveLevers } from './items/live-levers.ts';
|
|
37
|
+
export { noteRowSchema } from './rows/note-row-schema.ts';
|
|
38
|
+
export { noticeRowSchema } from './rows/notice-row-schema.ts';
|
|
39
|
+
export { outboxFactSchema } from './facts/outbox-fact-schema.ts';
|
|
40
|
+
export { positionSchema } from './pipeline/position-schema.ts';
|
|
41
|
+
export { parseNewFact } from './facts/parse-new-fact.ts';
|
|
42
|
+
export { pickSeatTake, type SeatTakeAnswer } from './dispatch/pick-seat-take.ts';
|
|
43
|
+
export { pullRequestRowSchema } from './rows/pull-request-row-schema.ts';
|
|
44
|
+
export { relationRowSchema } from './rows/relation-row-schema.ts';
|
|
45
|
+
export { reviewCloseOutSchema } from './closeouts/review-close-out-schema.ts';
|
|
46
|
+
export { rowSchemas } from './rows/row-schemas.ts';
|
|
47
|
+
export { signalKey } from './planning/signal-key.ts';
|
|
48
|
+
export { spawnRequestSchema } from './rows/spawn-request-schema.ts';
|
|
49
|
+
export { stageTimeSchema } from './reports/stage-time-schema.ts';
|
|
50
|
+
export { toJSONValue } from './utils/to-json-value.ts';
|
|
51
|
+
export { triageCloseOutSchema } from './closeouts/triage-close-out-schema.ts';
|
|
52
|
+
export { workFactSchemas } from './facts/work-fact-schemas.ts';
|
|
53
|
+
export { costBases, phaseSteps, stageSteps } from './reports/constants.ts';
|
|
54
|
+
export { engineHoldReasons, engineOutcomes } from './pipeline/constants.ts';
|
|
25
55
|
|
|
26
56
|
export type {
|
|
27
57
|
Actor,
|
|
@@ -32,6 +62,8 @@ export type {
|
|
|
32
62
|
AttemptRow,
|
|
33
63
|
AttemptSessionRow,
|
|
34
64
|
AttemptState,
|
|
65
|
+
CallerIdentity,
|
|
66
|
+
ClosingCause,
|
|
35
67
|
CommitSha,
|
|
36
68
|
ConceptPin,
|
|
37
69
|
Criterion,
|
|
@@ -39,82 +71,109 @@ export type {
|
|
|
39
71
|
DecisionId,
|
|
40
72
|
DecisionRow,
|
|
41
73
|
DerivedState,
|
|
74
|
+
DesignMode,
|
|
42
75
|
Effort,
|
|
76
|
+
EngineOutcome,
|
|
43
77
|
EvidenceKind,
|
|
44
78
|
EvidenceRow,
|
|
45
79
|
EvidenceSource,
|
|
46
80
|
FactId,
|
|
47
81
|
FaultRecord,
|
|
82
|
+
FieldValues,
|
|
48
83
|
ForcedFailure,
|
|
49
84
|
Instant,
|
|
85
|
+
ItemFields,
|
|
50
86
|
ItemId,
|
|
51
87
|
ItemKindName,
|
|
52
88
|
ItemRow,
|
|
53
|
-
ItemRows,
|
|
54
|
-
ItemSetRows,
|
|
55
89
|
ItemState,
|
|
56
90
|
ItemView,
|
|
57
|
-
|
|
91
|
+
KeptSession,
|
|
58
92
|
KnownFailure,
|
|
59
93
|
LeaseRow,
|
|
60
94
|
LeverKind,
|
|
61
95
|
LeverRow,
|
|
62
|
-
|
|
63
|
-
|
|
96
|
+
LimitCount,
|
|
97
|
+
LimitName,
|
|
98
|
+
LimitSeatRow,
|
|
64
99
|
LiveAttemptState,
|
|
65
|
-
LoadedRecipe,
|
|
66
|
-
MaxAttemptsByKind,
|
|
67
100
|
Minutes,
|
|
101
|
+
NoteRow,
|
|
102
|
+
NoticeRow,
|
|
68
103
|
ObservationBoundary,
|
|
104
|
+
OutcomeName,
|
|
69
105
|
PhaseName,
|
|
70
106
|
PipelineName,
|
|
71
107
|
PoolName,
|
|
72
|
-
|
|
108
|
+
Product,
|
|
73
109
|
PullRequestRef,
|
|
74
110
|
PullRequestRow,
|
|
75
111
|
Recipe,
|
|
76
112
|
RecipeHash,
|
|
77
113
|
RecipeMaterial,
|
|
78
114
|
RecipeName,
|
|
115
|
+
RelationRow,
|
|
116
|
+
RelationTypeName,
|
|
79
117
|
RepoName,
|
|
80
118
|
ResolvedRecipe,
|
|
81
119
|
RulesVersion,
|
|
82
120
|
RunnerId,
|
|
83
121
|
RunnerRow,
|
|
122
|
+
SessionMode,
|
|
84
123
|
SnapshotHash,
|
|
85
124
|
SourceName,
|
|
86
125
|
StreamName,
|
|
87
126
|
WaitingReason,
|
|
88
127
|
WorkerKindName,
|
|
89
|
-
} from './types
|
|
128
|
+
} from './types.ts';
|
|
90
129
|
|
|
91
130
|
export type {
|
|
92
|
-
|
|
131
|
+
HoldReason,
|
|
132
|
+
Position,
|
|
133
|
+
RetryLever,
|
|
134
|
+
RulesHoldReason,
|
|
135
|
+
Settled,
|
|
136
|
+
} from './pipeline/types.ts';
|
|
137
|
+
|
|
138
|
+
export type {
|
|
139
|
+
AcceptanceInput,
|
|
140
|
+
BuildCloseOut,
|
|
141
|
+
BuildInput,
|
|
142
|
+
CloseOut,
|
|
143
|
+
CloseOutAnswer,
|
|
93
144
|
CloseOutContext,
|
|
94
145
|
CloseOutParse,
|
|
95
146
|
CloseOutParser,
|
|
96
147
|
CloseOutProblem,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
148
|
+
CloseOutWorld,
|
|
149
|
+
CriterionText,
|
|
150
|
+
DesignCloseOut,
|
|
151
|
+
DesignRef,
|
|
152
|
+
Effect,
|
|
153
|
+
Finding,
|
|
154
|
+
Friction,
|
|
155
|
+
FrictionTargetKind,
|
|
156
|
+
NoslopSummary,
|
|
157
|
+
OpenItem,
|
|
158
|
+
PullRequestLink,
|
|
159
|
+
RelationDraft,
|
|
160
|
+
ReviewCloseOut,
|
|
161
|
+
ReviewInput,
|
|
162
|
+
TriageCloseOut,
|
|
163
|
+
} from './closeouts/types.ts';
|
|
164
|
+
|
|
165
|
+
export type { Claim } from './dispatch/types.ts';
|
|
104
166
|
|
|
105
167
|
export type {
|
|
106
|
-
|
|
168
|
+
AnyNewFact,
|
|
107
169
|
EntityRef,
|
|
108
170
|
FactEnvelope,
|
|
109
171
|
FactType,
|
|
110
|
-
Friction,
|
|
111
|
-
FrictionTargetKind,
|
|
112
|
-
LinkPayload,
|
|
113
172
|
NewFact,
|
|
114
|
-
OpenItem,
|
|
115
173
|
OutboxFact,
|
|
116
|
-
|
|
117
|
-
|
|
174
|
+
RelationPayload,
|
|
175
|
+
WorkFacts,
|
|
176
|
+
} from './facts/types.ts';
|
|
118
177
|
|
|
119
178
|
export type {
|
|
120
179
|
Admission,
|
|
@@ -122,6 +181,7 @@ export type {
|
|
|
122
181
|
AdmissionName,
|
|
123
182
|
Decision,
|
|
124
183
|
Fault,
|
|
184
|
+
Filter,
|
|
125
185
|
Frame,
|
|
126
186
|
FrameItem,
|
|
127
187
|
FrameValues,
|
|
@@ -129,52 +189,78 @@ export type {
|
|
|
129
189
|
GateName,
|
|
130
190
|
Hold,
|
|
131
191
|
Lift,
|
|
192
|
+
Limit,
|
|
193
|
+
LimitFill,
|
|
132
194
|
Pick,
|
|
133
195
|
PlanContext,
|
|
134
196
|
Pool,
|
|
135
197
|
PropagationLine,
|
|
198
|
+
SeatRef,
|
|
199
|
+
SeatRelease,
|
|
200
|
+
SeatTake,
|
|
136
201
|
Signal,
|
|
137
202
|
SignalKey,
|
|
138
203
|
SignalName,
|
|
139
204
|
Snapshot,
|
|
205
|
+
StartPick,
|
|
140
206
|
View,
|
|
141
207
|
ViewName,
|
|
208
|
+
Wait,
|
|
209
|
+
WaitReason,
|
|
142
210
|
Waiver,
|
|
143
211
|
WaiverName,
|
|
144
|
-
|
|
212
|
+
Wake,
|
|
213
|
+
WakePick,
|
|
214
|
+
} from './planning/types.ts';
|
|
145
215
|
|
|
146
216
|
export type {
|
|
147
|
-
AnyNewFact,
|
|
148
217
|
ApplyResult,
|
|
218
|
+
Attention,
|
|
219
|
+
CallerProof,
|
|
220
|
+
CapacityBackoff,
|
|
149
221
|
ClaimStore,
|
|
150
222
|
Clock,
|
|
151
|
-
CostReader,
|
|
152
|
-
CostToLandInput,
|
|
153
|
-
CostToLandRow,
|
|
154
223
|
FactSink,
|
|
224
|
+
ForgetOutcome,
|
|
155
225
|
Forge,
|
|
226
|
+
HoldNotice,
|
|
156
227
|
ItemDetailRows,
|
|
157
228
|
ItemFilter,
|
|
158
229
|
NewId,
|
|
230
|
+
NoticeOutcome,
|
|
231
|
+
Notifier,
|
|
232
|
+
OutboxReader,
|
|
233
|
+
PepysAnswer,
|
|
234
|
+
PepysReader,
|
|
235
|
+
SinkAnswer,
|
|
159
236
|
PullRequestReading,
|
|
160
237
|
RowWrite,
|
|
161
238
|
SessionFault,
|
|
162
239
|
SessionReading,
|
|
163
240
|
SpawnRequest,
|
|
164
241
|
StartOutcome,
|
|
242
|
+
StopOutcome,
|
|
165
243
|
StoreChange,
|
|
166
244
|
StoreReader,
|
|
167
245
|
StoreTx,
|
|
246
|
+
SuspendOutcome,
|
|
168
247
|
TableName,
|
|
169
248
|
Tables,
|
|
249
|
+
WakeSource,
|
|
170
250
|
WorkerKind,
|
|
171
|
-
} from './types
|
|
251
|
+
} from './ports/types.ts';
|
|
252
|
+
|
|
253
|
+
export type { CostToLand, StageTime } from './reports/types.ts';
|
|
254
|
+
export type { OutboxStatus } from './reports/outbox-status.ts';
|
|
255
|
+
export type { ItemSetRows, ItemWithLevers } from './items/types.ts';
|
|
172
256
|
|
|
173
257
|
export type {
|
|
174
258
|
Concept,
|
|
175
259
|
ConceptEntry,
|
|
176
260
|
ConceptName,
|
|
261
|
+
Edge,
|
|
177
262
|
FilterField,
|
|
263
|
+
ItemRules,
|
|
178
264
|
KindRules,
|
|
179
265
|
LoadedRules,
|
|
180
266
|
LoadRejection,
|
|
@@ -182,6 +268,8 @@ export type {
|
|
|
182
268
|
LoadResult,
|
|
183
269
|
ParamKindName,
|
|
184
270
|
ParamKinds,
|
|
271
|
+
PhaseInputContext,
|
|
272
|
+
PhaseKind,
|
|
185
273
|
Pipeline,
|
|
186
274
|
PipelineStep,
|
|
187
275
|
PlainKinds,
|
|
@@ -189,8 +277,12 @@ export type {
|
|
|
189
277
|
PluginRef,
|
|
190
278
|
Registered,
|
|
191
279
|
Registry,
|
|
280
|
+
RelationType,
|
|
192
281
|
Resolved,
|
|
193
|
-
RulesFile,
|
|
194
282
|
Schema,
|
|
283
|
+
SettleInput,
|
|
284
|
+
Settlement,
|
|
195
285
|
SignalRef,
|
|
196
|
-
|
|
286
|
+
SkillsPin,
|
|
287
|
+
SleepRules,
|
|
288
|
+
} from './rules/types.ts';
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { findPosition } from '../pipeline/find-position.ts';
|
|
2
|
+
import type { Position } from '../pipeline/types.ts';
|
|
3
|
+
import type { ItemRules } from '../rules/types.ts';
|
|
4
|
+
import type {
|
|
5
|
+
AttemptId,
|
|
6
|
+
AttemptRow,
|
|
7
|
+
DerivedState,
|
|
8
|
+
Instant,
|
|
9
|
+
ItemId,
|
|
10
|
+
ItemRow,
|
|
11
|
+
ItemState,
|
|
12
|
+
LeaseRow,
|
|
13
|
+
LeverRow,
|
|
14
|
+
PullRequestRow,
|
|
15
|
+
RelationRow,
|
|
16
|
+
} from '../types.ts';
|
|
17
|
+
import { collectRetries } from './collect-retries.ts';
|
|
18
|
+
import { collectSettled } from './collect-settled.ts';
|
|
19
|
+
import { deriveItemState } from './derive-item-state.ts';
|
|
20
|
+
import { liveLevers } from './live-levers.ts';
|
|
21
|
+
import type { ItemSetRows, ItemWithLevers } from './types.ts';
|
|
22
|
+
|
|
23
|
+
export function buildItemViews(
|
|
24
|
+
rows: ItemSetRows,
|
|
25
|
+
now: Instant,
|
|
26
|
+
rules: ItemRules,
|
|
27
|
+
): ItemWithLevers[] {
|
|
28
|
+
const groups = collectItemGroups(rows, rules);
|
|
29
|
+
|
|
30
|
+
// A blocking source counts only when it is done or archived, and no relation makes an item either,
|
|
31
|
+
// so each source's state derived without its relations settles its targets.
|
|
32
|
+
const ownStates = new Map<ItemId, ItemState>(
|
|
33
|
+
groups.map((group) => [
|
|
34
|
+
group.item.id,
|
|
35
|
+
deriveGroupState(group, rules, { relations: [], blockerStates: new Map() }).state,
|
|
36
|
+
]),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return groups.map((group) =>
|
|
40
|
+
buildItemWithLevers(
|
|
41
|
+
group,
|
|
42
|
+
deriveGroupState(group, rules, { relations: group.relations, blockerStates: ownStates }),
|
|
43
|
+
now,
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ItemGroup {
|
|
49
|
+
readonly item: ItemRow;
|
|
50
|
+
readonly relations: RelationRow[];
|
|
51
|
+
readonly attempts: AttemptRow[];
|
|
52
|
+
readonly pullRequests: PullRequestRow[];
|
|
53
|
+
readonly levers: LeverRow[];
|
|
54
|
+
liveLease: LeaseRow | null;
|
|
55
|
+
position: Position;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// in the order of `rows.items`
|
|
59
|
+
function collectItemGroups(rows: ItemSetRows, rules: ItemRules): ItemGroup[] {
|
|
60
|
+
const groups = new Map<ItemId, ItemGroup>(
|
|
61
|
+
rows.items.map((item) => [
|
|
62
|
+
item.id,
|
|
63
|
+
{
|
|
64
|
+
item,
|
|
65
|
+
relations: [],
|
|
66
|
+
attempts: [],
|
|
67
|
+
pullRequests: [],
|
|
68
|
+
levers: [],
|
|
69
|
+
liveLease: null,
|
|
70
|
+
position: { kind: 'end', reason: 'no-pipeline' },
|
|
71
|
+
},
|
|
72
|
+
]),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const attemptItems = new Map<AttemptId, ItemId>();
|
|
76
|
+
|
|
77
|
+
for (const relation of rows.relations) {
|
|
78
|
+
groups.get(relation.target)?.relations.push(relation);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (const attempt of rows.attempts) {
|
|
82
|
+
attemptItems.set(attempt.id, attempt.item);
|
|
83
|
+
groups.get(attempt.item)?.attempts.push(attempt);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
for (const pullRequest of rows.pullRequests) {
|
|
87
|
+
const item = attemptItems.get(pullRequest.attempt);
|
|
88
|
+
|
|
89
|
+
if (item !== undefined) {
|
|
90
|
+
groups.get(item)?.pullRequests.push(pullRequest);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const lever of rows.levers) {
|
|
95
|
+
groups.get(lever.item)?.levers.push(lever);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
for (const lease of rows.liveLeases) {
|
|
99
|
+
const group = groups.get(lease.item);
|
|
100
|
+
|
|
101
|
+
if (group !== undefined) {
|
|
102
|
+
group.liveLease = lease;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
for (const group of groups.values()) {
|
|
107
|
+
group.position = findPosition({
|
|
108
|
+
pipeline: rules.kinds.get(group.item.kind)?.pipeline ?? null,
|
|
109
|
+
attempts: collectSettled(group.attempts),
|
|
110
|
+
retries: collectRetries(group.levers),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return [...groups.values()];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
interface Blocking {
|
|
118
|
+
// the live relations whose target is the item
|
|
119
|
+
readonly relations: readonly RelationRow[];
|
|
120
|
+
readonly blockerStates: ReadonlyMap<ItemId, ItemState>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function deriveGroupState(group: ItemGroup, rules: ItemRules, blocking: Blocking): DerivedState {
|
|
124
|
+
return deriveItemState({
|
|
125
|
+
...blocking,
|
|
126
|
+
item: group.item,
|
|
127
|
+
position: group.position,
|
|
128
|
+
liveLease: group.liveLease,
|
|
129
|
+
phases: rules.phases,
|
|
130
|
+
attempts: group.attempts,
|
|
131
|
+
pullRequests: group.pullRequests,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildItemWithLevers(
|
|
136
|
+
group: ItemGroup,
|
|
137
|
+
derived: DerivedState,
|
|
138
|
+
now: Instant,
|
|
139
|
+
): ItemWithLevers {
|
|
140
|
+
return {
|
|
141
|
+
...group.item,
|
|
142
|
+
derived,
|
|
143
|
+
position: group.position,
|
|
144
|
+
levers: liveLevers(group.levers, now),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RetryLever } from '../pipeline/types.ts';
|
|
2
|
+
import type { LeverRow } from '../types.ts';
|
|
3
|
+
|
|
4
|
+
const retryKind = 'item.retry';
|
|
5
|
+
|
|
6
|
+
// every `item.retry` lever the item ever had, so the position never depends on the read's time
|
|
7
|
+
export function collectRetries(levers: readonly LeverRow[]): RetryLever[] {
|
|
8
|
+
return levers
|
|
9
|
+
.filter((lever) => lever.kind === retryKind)
|
|
10
|
+
.map((lever) => ({ at: lever.at, phase: lever.phase }))
|
|
11
|
+
.toSorted((first, second) => first.at - second.at);
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Settled } from '../pipeline/types.ts';
|
|
2
|
+
import type { AttemptRow } from '../types.ts';
|
|
3
|
+
|
|
4
|
+
// the settled attempts, oldest end first
|
|
5
|
+
export function collectSettled(attempts: readonly AttemptRow[]): Settled[] {
|
|
6
|
+
const settled = attempts.flatMap((attempt) =>
|
|
7
|
+
attempt.endedAt === null || attempt.outcome === null
|
|
8
|
+
? []
|
|
9
|
+
: [
|
|
10
|
+
{
|
|
11
|
+
phase: attempt.phase,
|
|
12
|
+
outcome: attempt.outcome,
|
|
13
|
+
endedAt: attempt.endedAt,
|
|
14
|
+
failure: attempt.failure,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
return settled.toSorted((first, second) => first.endedAt - second.endedAt);
|
|
20
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Position } from '../pipeline/types.ts';
|
|
2
|
+
import type {
|
|
3
|
+
AttemptRow,
|
|
4
|
+
DerivedState,
|
|
5
|
+
ItemId,
|
|
6
|
+
ItemRow,
|
|
7
|
+
ItemState,
|
|
8
|
+
LeaseRow,
|
|
9
|
+
PhaseName,
|
|
10
|
+
PullRequestRow,
|
|
11
|
+
RelationRow,
|
|
12
|
+
} from '../types.ts';
|
|
13
|
+
|
|
14
|
+
interface DeriveItemStateInput {
|
|
15
|
+
readonly item: ItemRow;
|
|
16
|
+
readonly position: Position;
|
|
17
|
+
|
|
18
|
+
// the item's live item-phase lease, a sleeping or closing attempt's included
|
|
19
|
+
readonly liveLease: LeaseRow | null;
|
|
20
|
+
|
|
21
|
+
// the phase kinds loaded now, by name
|
|
22
|
+
readonly phases: ReadonlyMap<PhaseName, { readonly needsAcceptance: boolean }>;
|
|
23
|
+
readonly attempts: readonly AttemptRow[];
|
|
24
|
+
readonly pullRequests: readonly PullRequestRow[];
|
|
25
|
+
|
|
26
|
+
// the live relations whose target is the item
|
|
27
|
+
readonly relations: readonly RelationRow[];
|
|
28
|
+
readonly blockerStates: ReadonlyMap<ItemId, ItemState>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// The table of section G of the engine sketch; the first match wins.
|
|
32
|
+
export function deriveItemState(input: DeriveItemStateInput): DerivedState {
|
|
33
|
+
const item = input.item;
|
|
34
|
+
const position = input.position;
|
|
35
|
+
|
|
36
|
+
if (item.closedAt !== null) {
|
|
37
|
+
return { state: 'archived' };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (input.liveLease !== null) {
|
|
41
|
+
return { state: 'running' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (position.kind === 'hold') {
|
|
45
|
+
return { state: 'waiting', reason: position.reason };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (position.kind === 'end') {
|
|
49
|
+
return deriveEndedState(collectBuildPullRequests(input.attempts, input.pullRequests));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (item.acceptance.length === 0 && input.phases.get(position.phase)?.needsAcceptance === true) {
|
|
53
|
+
return { state: 'idea' };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return hasOpenBlocker(input) ? { state: 'blocked' } : { state: 'ready' };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function deriveEndedState(linked: readonly PullRequestRow[]): DerivedState {
|
|
60
|
+
if (linked.some((pullRequest) => pullRequest.state === 'merged')) {
|
|
61
|
+
return { state: 'done' };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (linked.some((pullRequest) => pullRequest.state === 'open')) {
|
|
65
|
+
return { state: 'waiting', reason: 'pull request open' };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return linked.length === 0
|
|
69
|
+
? { state: 'waiting', reason: 'no pull request linked' }
|
|
70
|
+
: { state: 'waiting', reason: 'pull request closed unmerged' };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const buildPhase = 'build';
|
|
74
|
+
|
|
75
|
+
// the pull requests linked to a succeeded build attempt
|
|
76
|
+
function collectBuildPullRequests(
|
|
77
|
+
attempts: readonly AttemptRow[],
|
|
78
|
+
pullRequests: readonly PullRequestRow[],
|
|
79
|
+
): PullRequestRow[] {
|
|
80
|
+
const succeededBuilds = new Set(
|
|
81
|
+
attempts
|
|
82
|
+
.filter((attempt) => attempt.phase === buildPhase && attempt.state === 'succeeded')
|
|
83
|
+
.map((attempt) => attempt.id),
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
return pullRequests.filter((pullRequest) => succeededBuilds.has(pullRequest.attempt));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function hasOpenBlocker(input: DeriveItemStateInput): boolean {
|
|
90
|
+
return input.relations.some((relation) => {
|
|
91
|
+
const blockerState = input.blockerStates.get(relation.source);
|
|
92
|
+
|
|
93
|
+
return relation.type === 'blocks' && blockerState !== 'done' && blockerState !== 'archived';
|
|
94
|
+
});
|
|
95
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Instant, LeverKind, LeverRow } from '
|
|
1
|
+
import type { Instant, LeverKind, LeverRow } from '../types.ts';
|
|
2
2
|
|
|
3
3
|
export function liveLevers(levers: readonly LeverRow[], now: Instant): LeverRow[] {
|
|
4
4
|
return levers.filter((lever) => !isExpired(lever, now) && !isUndone(lever, levers));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AttemptRow,
|
|
3
|
+
ItemRow,
|
|
4
|
+
ItemView,
|
|
5
|
+
LeaseRow,
|
|
6
|
+
LeverRow,
|
|
7
|
+
PullRequestRow,
|
|
8
|
+
RelationRow,
|
|
9
|
+
} from '../types.ts';
|
|
10
|
+
|
|
11
|
+
// the rows a store reads to derive a set of items, with each blocking source item
|
|
12
|
+
export interface ItemSetRows {
|
|
13
|
+
readonly items: readonly ItemRow[];
|
|
14
|
+
|
|
15
|
+
// live relations only
|
|
16
|
+
readonly relations: readonly RelationRow[];
|
|
17
|
+
readonly levers: readonly LeverRow[];
|
|
18
|
+
readonly attempts: readonly AttemptRow[];
|
|
19
|
+
readonly liveLeases: readonly LeaseRow[];
|
|
20
|
+
readonly pullRequests: readonly PullRequestRow[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ItemWithLevers extends ItemView {
|
|
24
|
+
// the live levers only
|
|
25
|
+
readonly levers: readonly LeverRow[];
|
|
26
|
+
}
|