@boxxy/model 0.1.2 → 0.1.4
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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import type { TableName, Tables } from '
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { TableName, Tables } from '../ports/types.ts';
|
|
3
3
|
export declare const rowSchemas: {
|
|
4
4
|
readonly [T in TableName]: z.ZodType<Tables[T]>;
|
|
5
5
|
};
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import type { JsonValue } from '@boxxy/content-hash';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
import type { CloseOutParser, Effect } from '../closeouts/types.ts';
|
|
4
|
+
import type { RulesHoldReason } from '../pipeline/types.ts';
|
|
5
|
+
import type { Admission, FrameItem, Gate, Limit, Pool, PropagationLine, Signal, SignalKey, SignalName, View, Waiver } from '../planning/types.ts';
|
|
6
|
+
import type { AttemptRow, CommitSha, ConceptPin, EngineOutcome, Instant, ItemKindName, ItemView, LeverKind, Minutes, PhaseName, PipelineName, PullRequestRow, RecipeMaterial, RecipeName, RelationTypeName, RulesVersion, SessionMode, WorkerKindName } from '../types.ts';
|
|
7
|
+
export type Schema<T> = z.ZodType<T>;
|
|
8
|
+
export interface ParamKinds<P> {
|
|
9
|
+
signal: Signal<P>;
|
|
10
|
+
gate: Gate<P>;
|
|
11
|
+
admission: Admission<P>;
|
|
12
|
+
}
|
|
13
|
+
export type ParamKindName = keyof ParamKinds<unknown>;
|
|
14
|
+
export interface Registered<K extends ParamKindName> {
|
|
15
|
+
readonly kind: K;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
open: <R>(use: <P>(plugin: ParamKinds<P>[K]) => R) => R;
|
|
18
|
+
}
|
|
19
|
+
export interface Resolved<K extends ParamKindName> {
|
|
20
|
+
readonly kind: K;
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly key: string;
|
|
23
|
+
open: <R>(use: <P>(plugin: ParamKinds<P>[K], params: P) => R) => R;
|
|
24
|
+
}
|
|
25
|
+
export type ConceptName = string;
|
|
26
|
+
export interface Concept {
|
|
27
|
+
name: ConceptName;
|
|
28
|
+
version: number;
|
|
29
|
+
signals?: Registered<'signal'>[];
|
|
30
|
+
gates?: Registered<'gate'>[];
|
|
31
|
+
waivers?: Waiver[];
|
|
32
|
+
levers?: LeverKind[];
|
|
33
|
+
filterFields?: FilterField[];
|
|
34
|
+
}
|
|
35
|
+
export interface FilterField {
|
|
36
|
+
name: string;
|
|
37
|
+
value: (item: FrameItem) => string | readonly string[] | null;
|
|
38
|
+
}
|
|
39
|
+
export interface PlainKinds {
|
|
40
|
+
waiver: Waiver;
|
|
41
|
+
'filter-field': FilterField;
|
|
42
|
+
lever: {
|
|
43
|
+
readonly kind: LeverKind;
|
|
44
|
+
};
|
|
45
|
+
view: View;
|
|
46
|
+
}
|
|
47
|
+
export type PluginKindName = ParamKindName | keyof PlainKinds;
|
|
48
|
+
export type Registry = {
|
|
49
|
+
readonly [K in ParamKindName]: ReadonlyMap<string, Registered<K>>;
|
|
50
|
+
} & {
|
|
51
|
+
readonly [K in keyof PlainKinds]: ReadonlyMap<string, PlainKinds[K]>;
|
|
52
|
+
} & {
|
|
53
|
+
readonly pins: readonly ConceptPin[];
|
|
54
|
+
};
|
|
55
|
+
export interface PhaseKind<Body = unknown, Input extends JsonValue = JsonValue, Outcomes extends readonly string[] = readonly string[]> {
|
|
56
|
+
readonly name: PhaseName;
|
|
57
|
+
readonly version: number;
|
|
58
|
+
readonly worker: WorkerKindName;
|
|
59
|
+
readonly outcomes: Outcomes;
|
|
60
|
+
readonly needsAcceptance: boolean;
|
|
61
|
+
readonly mode?: (item: ItemView) => SessionMode;
|
|
62
|
+
readonly input: (ctx: PhaseInputContext) => Input;
|
|
63
|
+
readonly closeOut: CloseOutParser<Body>;
|
|
64
|
+
readonly settle: BivariantSettle<Body, Outcomes[number]>['settle'];
|
|
65
|
+
}
|
|
66
|
+
interface BivariantSettle<Body, Outcome extends string> {
|
|
67
|
+
settle(input: SettleInput<Body>): Settlement<Outcome>;
|
|
68
|
+
}
|
|
69
|
+
export interface PhaseInputContext {
|
|
70
|
+
readonly item: ItemView;
|
|
71
|
+
readonly history: readonly AttemptRow[];
|
|
72
|
+
readonly pullRequests: readonly PullRequestRow[];
|
|
73
|
+
}
|
|
74
|
+
export interface SettleInput<Body> {
|
|
75
|
+
readonly attempt: AttemptRow;
|
|
76
|
+
readonly item: ItemView;
|
|
77
|
+
readonly closeOut: Body;
|
|
78
|
+
readonly now: Instant;
|
|
79
|
+
}
|
|
80
|
+
export interface Settlement<Outcome extends string = string> {
|
|
81
|
+
readonly state: 'succeeded' | 'failed';
|
|
82
|
+
readonly failure: string | null;
|
|
83
|
+
readonly outcome: Outcome;
|
|
84
|
+
readonly effects: readonly Effect[];
|
|
85
|
+
readonly frictionDropped: number;
|
|
86
|
+
}
|
|
87
|
+
export interface KindRules {
|
|
88
|
+
readonly pipeline: Pipeline;
|
|
89
|
+
readonly recipes: Readonly<Record<string, RecipeName>>;
|
|
90
|
+
}
|
|
91
|
+
export interface Pipeline {
|
|
92
|
+
readonly name: PipelineName;
|
|
93
|
+
readonly steps: readonly PipelineStep[];
|
|
94
|
+
}
|
|
95
|
+
export interface PipelineStep {
|
|
96
|
+
readonly phase: PhaseName;
|
|
97
|
+
readonly maxAttempts: number;
|
|
98
|
+
readonly timeoutMinutes: Minutes;
|
|
99
|
+
readonly on: Readonly<Record<string, Edge>>;
|
|
100
|
+
}
|
|
101
|
+
export type Edge = 'next' | 'again' | {
|
|
102
|
+
readonly to: PhaseName;
|
|
103
|
+
readonly max?: number;
|
|
104
|
+
readonly resume?: boolean;
|
|
105
|
+
} | {
|
|
106
|
+
readonly end: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly hold: RulesHoldReason;
|
|
109
|
+
};
|
|
110
|
+
export interface SkillsPin {
|
|
111
|
+
readonly source: string;
|
|
112
|
+
readonly ref: CommitSha;
|
|
113
|
+
}
|
|
114
|
+
export interface RelationType {
|
|
115
|
+
readonly name: RelationTypeName;
|
|
116
|
+
}
|
|
117
|
+
export interface SleepRules {
|
|
118
|
+
readonly afterIdleMinutes: Minutes;
|
|
119
|
+
readonly afterQuietMinutes: Minutes;
|
|
120
|
+
readonly afterUnattendedMinutes: Minutes;
|
|
121
|
+
}
|
|
122
|
+
export type ConceptEntry = `${string}@${number}`;
|
|
123
|
+
export type PluginRef = string | Readonly<Record<string, JsonValue>>;
|
|
124
|
+
export type SignalRef = SignalName | Readonly<Record<string, JsonValue>>;
|
|
125
|
+
export interface ItemRules {
|
|
126
|
+
readonly kinds: ReadonlyMap<ItemKindName, {
|
|
127
|
+
readonly pipeline: Pipeline;
|
|
128
|
+
}>;
|
|
129
|
+
readonly phases: ReadonlyMap<PhaseName, {
|
|
130
|
+
readonly needsAcceptance: boolean;
|
|
131
|
+
}>;
|
|
132
|
+
}
|
|
133
|
+
export interface LoadedRules {
|
|
134
|
+
readonly version: RulesVersion;
|
|
135
|
+
readonly commit: string;
|
|
136
|
+
readonly registry: Registry;
|
|
137
|
+
readonly signals: ReadonlyMap<SignalKey, Resolved<'signal'>>;
|
|
138
|
+
readonly gates: readonly Resolved<'gate'>[];
|
|
139
|
+
readonly kinds: ReadonlyMap<ItemKindName, KindRules>;
|
|
140
|
+
readonly phases: ReadonlyMap<PhaseName, PhaseKind>;
|
|
141
|
+
readonly limits: readonly Limit[];
|
|
142
|
+
readonly pools: readonly Pool[];
|
|
143
|
+
readonly propagation: readonly PropagationLine[];
|
|
144
|
+
readonly recipes: ReadonlyMap<RecipeName, RecipeMaterial>;
|
|
145
|
+
readonly sleep: SleepRules;
|
|
146
|
+
readonly skills: SkillsPin | null;
|
|
147
|
+
readonly relationTypes: ReadonlyMap<RelationTypeName, RelationType>;
|
|
148
|
+
}
|
|
149
|
+
export interface LoadRejection {
|
|
150
|
+
readonly file: string;
|
|
151
|
+
readonly path: string;
|
|
152
|
+
readonly reason: LoadRejectionReason;
|
|
153
|
+
}
|
|
154
|
+
export type LoadRejectionReason = {
|
|
155
|
+
readonly kind: 'invalid';
|
|
156
|
+
readonly message: string;
|
|
157
|
+
} | {
|
|
158
|
+
readonly kind: 'unknown-concept';
|
|
159
|
+
readonly ref: string;
|
|
160
|
+
} | {
|
|
161
|
+
readonly kind: 'unknown-signal';
|
|
162
|
+
readonly signal: string;
|
|
163
|
+
} | {
|
|
164
|
+
readonly kind: 'bad-plugin-params';
|
|
165
|
+
readonly pluginKind: ParamKindName;
|
|
166
|
+
readonly name: string;
|
|
167
|
+
readonly message: string;
|
|
168
|
+
} | {
|
|
169
|
+
readonly kind: 'unknown-relation-type';
|
|
170
|
+
readonly relation: string;
|
|
171
|
+
} | {
|
|
172
|
+
readonly kind: 'signal-without-combine';
|
|
173
|
+
readonly signal: string;
|
|
174
|
+
} | {
|
|
175
|
+
readonly kind: 'missing-recipe';
|
|
176
|
+
readonly itemKind: string;
|
|
177
|
+
readonly phase: string;
|
|
178
|
+
} | {
|
|
179
|
+
readonly kind: 'missing-prompt';
|
|
180
|
+
readonly path: string;
|
|
181
|
+
} | {
|
|
182
|
+
readonly kind: 'uncommitted-changes';
|
|
183
|
+
} | {
|
|
184
|
+
readonly kind: 'unknown-filter-field';
|
|
185
|
+
readonly field: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: 'pool-without-limit';
|
|
188
|
+
readonly pool: string;
|
|
189
|
+
} | {
|
|
190
|
+
readonly kind: 'unknown-phase';
|
|
191
|
+
readonly phase: string;
|
|
192
|
+
} | {
|
|
193
|
+
readonly kind: 'unmapped-outcome';
|
|
194
|
+
readonly phase: PhaseName;
|
|
195
|
+
readonly outcome: string;
|
|
196
|
+
} | {
|
|
197
|
+
readonly kind: 'unknown-outcome';
|
|
198
|
+
readonly phase: PhaseName;
|
|
199
|
+
readonly outcome: string;
|
|
200
|
+
} | {
|
|
201
|
+
readonly kind: 'open-loop';
|
|
202
|
+
readonly phase: PhaseName;
|
|
203
|
+
readonly outcome: string;
|
|
204
|
+
} | {
|
|
205
|
+
readonly kind: 'edge-to-unknown-phase';
|
|
206
|
+
readonly phase: PhaseName;
|
|
207
|
+
readonly to: string;
|
|
208
|
+
} | {
|
|
209
|
+
readonly kind: 'step-without-recipe';
|
|
210
|
+
readonly itemKind: ItemKindName;
|
|
211
|
+
readonly phase: PhaseName;
|
|
212
|
+
} | {
|
|
213
|
+
readonly kind: 'step-without-timeout';
|
|
214
|
+
readonly phase: PhaseName;
|
|
215
|
+
} | {
|
|
216
|
+
readonly kind: 'quiet-below-idle';
|
|
217
|
+
} | {
|
|
218
|
+
readonly kind: 'unattended-below-quiet';
|
|
219
|
+
} | {
|
|
220
|
+
readonly kind: 'engine-outcome-listed';
|
|
221
|
+
readonly phase: PhaseName;
|
|
222
|
+
readonly outcome: EngineOutcome;
|
|
223
|
+
} | {
|
|
224
|
+
readonly kind: 'skills-without-pin';
|
|
225
|
+
readonly recipe: string;
|
|
226
|
+
} | {
|
|
227
|
+
readonly kind: 'resume-on-forward-edge';
|
|
228
|
+
readonly phase: PhaseName;
|
|
229
|
+
readonly outcome: string;
|
|
230
|
+
} | {
|
|
231
|
+
readonly kind: 'engine-hold-reason';
|
|
232
|
+
readonly phase: PhaseName;
|
|
233
|
+
readonly outcome: string;
|
|
234
|
+
readonly reason: string;
|
|
235
|
+
};
|
|
236
|
+
export type LoadResult = {
|
|
237
|
+
readonly kind: 'loaded';
|
|
238
|
+
readonly rules: LoadedRules;
|
|
239
|
+
readonly warnings: readonly string[];
|
|
240
|
+
} | {
|
|
241
|
+
readonly kind: 'rejected';
|
|
242
|
+
readonly rejections: readonly LoadRejection[];
|
|
243
|
+
};
|
|
244
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { EvidenceRow } from '../types
|
|
1
|
+
import type { EvidenceRow } from '../types.ts';
|
|
2
2
|
export declare function buildMockEvidenceRow(overrides?: Partial<EvidenceRow>): EvidenceRow;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FactId } from '../types
|
|
1
|
+
import type { FactId } from '../types.ts';
|
|
2
2
|
export declare function buildMockFactId(): FactId;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FrameItem } from '../types
|
|
1
|
+
import type { FrameItem } from '../planning/types.ts';
|
|
2
2
|
export declare function buildMockFrameItem(overrides?: Partial<FrameItem>): FrameItem;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { LeaseRow } from '../types
|
|
1
|
+
import type { LeaseRow } from '../types.ts';
|
|
2
2
|
export declare function buildMockLeaseRow(overrides?: Partial<LeaseRow>): LeaseRow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Pipeline, PipelineStep } from '../rules/types.ts';
|
|
2
|
+
interface MockPipelineInput {
|
|
3
|
+
readonly phases?: readonly string[];
|
|
4
|
+
readonly steps?: Readonly<Record<string, Partial<PipelineStep>>>;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildMockPipeline(input?: MockPipelineInput): Pipeline;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Settled } from '../pipeline/types.ts';
|
|
2
|
+
interface MockSettledInput {
|
|
3
|
+
readonly phase: string;
|
|
4
|
+
readonly outcome: string;
|
|
5
|
+
readonly endedAt: number;
|
|
6
|
+
readonly failure?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildMockSettled(input: MockSettledInput): Settled;
|
|
9
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Snapshot } from '../types
|
|
1
|
+
import type { Snapshot } from '../planning/types.ts';
|
|
2
2
|
export declare function buildMockSnapshot(overrides?: Partial<Snapshot>): Snapshot;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EntityRef, OutboxFact, WorkFacts } from '../facts/types.ts';
|
|
2
|
+
export type MockedFactType = 'boxxy.item.filed' | 'boxxy.item.edited' | 'boxxy.item.closed' | 'boxxy.attempt.claimed' | 'boxxy.attempt.started' | 'boxxy.attempt.reconciled' | 'boxxy.attempt.resumed' | 'boxxy.attempt.session_bound' | 'boxxy.attempt.slept' | 'boxxy.attempt.woken' | 'boxxy.attempt.closed_out' | 'boxxy.attempt.settled' | 'boxxy.pull_request.linked';
|
|
3
|
+
interface WorkFactOverrides<Type extends MockedFactType> {
|
|
4
|
+
readonly payload?: {
|
|
5
|
+
readonly [Key in keyof WorkFacts[Type]]?: unknown;
|
|
6
|
+
};
|
|
7
|
+
readonly at?: number;
|
|
8
|
+
readonly entity?: EntityRef;
|
|
9
|
+
readonly seq?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function buildMockWorkFact<Type extends MockedFactType>(type: Type, overrides?: WorkFactOverrides<Type>): OutboxFact;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HoldNotice, Notifier } from '../ports/types.ts';
|
|
2
|
+
export interface FakeNotifier extends Notifier {
|
|
3
|
+
readonly told: readonly HoldNotice[];
|
|
4
|
+
readonly calls: () => number;
|
|
5
|
+
failNext: (reason: string) => void;
|
|
6
|
+
failAlways: (reason: string) => void;
|
|
7
|
+
recover: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createFakeNotifier(): FakeNotifier;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PepysReader } from '../ports/types.ts';
|
|
2
|
+
import type { CostToLand, StageTime } from '../reports/types.ts';
|
|
3
|
+
import type { ItemId } from '../types.ts';
|
|
4
|
+
interface FakeValues {
|
|
5
|
+
readonly cost?: CostToLand;
|
|
6
|
+
readonly stageTime?: StageTime;
|
|
7
|
+
}
|
|
8
|
+
export interface FakePepysReader extends PepysReader {
|
|
9
|
+
set: (item: ItemId, values: FakeValues) => void;
|
|
10
|
+
failNext: (reason: string) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createFakePepysReader(environment?: string): FakePepysReader;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FactId, FactSink, OutboxFact } from '@boxxy/model';
|
|
2
|
+
export interface FactSinkHarness {
|
|
3
|
+
readonly sink: FactSink;
|
|
4
|
+
readStored: () => Promise<readonly FactId[]>;
|
|
5
|
+
corrupt: (fact: OutboxFact) => OutboxFact;
|
|
6
|
+
}
|
|
7
|
+
export type FactSinkCase = readonly [
|
|
8
|
+
title: string,
|
|
9
|
+
check: (harness: FactSinkHarness) => Promise<{
|
|
10
|
+
received: unknown;
|
|
11
|
+
expected: unknown;
|
|
12
|
+
}>
|
|
13
|
+
];
|
|
14
|
+
export declare const factSinkContract: readonly FactSinkCase[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PepysReader } from '../ports/types.ts';
|
|
2
|
+
import type { CostToLand } from '../reports/types.ts';
|
|
3
|
+
import type { ItemId } from '../types.ts';
|
|
4
|
+
export interface PepysReaderHarness {
|
|
5
|
+
readonly reader: PepysReader;
|
|
6
|
+
readonly environment: string;
|
|
7
|
+
writeCost: (item: ItemId, cost: CostToLand) => Promise<void>;
|
|
8
|
+
takeDown: () => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export type PepysReaderCase = readonly [
|
|
11
|
+
title: string,
|
|
12
|
+
check: (harness: PepysReaderHarness) => Promise<{
|
|
13
|
+
received: unknown;
|
|
14
|
+
expected: unknown;
|
|
15
|
+
}>
|
|
16
|
+
];
|
|
17
|
+
export declare const pepysReaderContract: readonly PepysReaderCase[];
|