lastlight-core 0.32.1 → 0.33.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/config/default.yaml +81 -0
- package/dist/admin/board-cache.d.ts +81 -0
- package/dist/admin/board-cache.js +301 -0
- package/dist/admin/board-cache.js.map +1 -0
- package/dist/admin/board-stream.d.ts +47 -0
- package/dist/admin/board-stream.js +45 -0
- package/dist/admin/board-stream.js.map +1 -0
- package/dist/admin/board.d.ts +264 -0
- package/dist/admin/board.js +376 -0
- package/dist/admin/board.js.map +1 -0
- package/dist/admin/routes.js +943 -13
- package/dist/admin/routes.js.map +1 -1
- package/dist/config/config.d.ts +88 -0
- package/dist/config/config.js +163 -0
- package/dist/config/config.js.map +1 -1
- package/dist/connectors/github-webhook.d.ts +16 -0
- package/dist/connectors/github-webhook.js +104 -8
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/types.d.ts +9 -2
- package/dist/cron/issue-discovery.d.ts +120 -0
- package/dist/cron/issue-discovery.js +127 -0
- package/dist/cron/issue-discovery.js.map +1 -0
- package/dist/cron/runner.d.ts +25 -1
- package/dist/cron/runner.js +53 -10
- package/dist/cron/runner.js.map +1 -1
- package/dist/engine/build-decisions.d.ts +91 -0
- package/dist/engine/build-decisions.js +295 -0
- package/dist/engine/build-decisions.js.map +1 -0
- package/dist/engine/build-gate.d.ts +78 -0
- package/dist/engine/build-gate.js +355 -0
- package/dist/engine/build-gate.js.map +1 -0
- package/dist/engine/executors/shared.d.ts +1 -0
- package/dist/engine/executors/shared.js +13 -2
- package/dist/engine/executors/shared.js.map +1 -1
- package/dist/engine/github/github-app-client.js +25 -1
- package/dist/engine/github/github-app-client.js.map +1 -1
- package/dist/engine/github/github.d.ts +195 -6
- package/dist/engine/github/github.js +331 -6
- package/dist/engine/github/github.js.map +1 -1
- package/dist/engine/pr-decisions.d.ts +23 -0
- package/dist/engine/pr-decisions.js.map +1 -1
- package/dist/engine/router.js +108 -1
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/stage-advance.d.ts +92 -0
- package/dist/engine/stage-advance.js +129 -0
- package/dist/engine/stage-advance.js.map +1 -0
- package/dist/engine/stage-labels.d.ts +57 -0
- package/dist/engine/stage-labels.js +58 -0
- package/dist/engine/stage-labels.js.map +1 -0
- package/dist/engine/stage-observer.d.ts +79 -0
- package/dist/engine/stage-observer.js +221 -0
- package/dist/engine/stage-observer.js.map +1 -0
- package/dist/index.js +110 -2
- package/dist/index.js.map +1 -1
- package/dist/logging/phase-log.d.ts +6 -0
- package/dist/logging/phase-log.js +16 -0
- package/dist/logging/phase-log.js.map +1 -1
- package/dist/state/activity-store.d.ts +45 -1
- package/dist/state/activity-store.js +44 -0
- package/dist/state/activity-store.js.map +1 -1
- package/dist/state/execution-store.d.ts +48 -0
- package/dist/state/execution-store.js +112 -0
- package/dist/state/execution-store.js.map +1 -1
- package/dist/state/schema/pg.d.ts +2 -2
- package/dist/state/schema/sqlite.d.ts +2 -2
- package/dist/state/workflow-run-store.d.ts +51 -0
- package/dist/state/workflow-run-store.js +98 -0
- package/dist/state/workflow-run-store.js.map +1 -1
- package/dist/workflows/simple.d.ts +40 -1
- package/dist/workflows/simple.js +113 -2
- package/dist/workflows/simple.js.map +1 -1
- package/package.json +4 -4
- package/workflows/cron-autonomy.yaml +24 -0
- package/workflows/prompts/pr.md +18 -1
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pipeline board — the PURE projection of labels, runs and approvals onto
|
|
3
|
+
* columns.
|
|
4
|
+
*
|
|
5
|
+
* Everything in this module is a function of its arguments. No Hono, no
|
|
6
|
+
* GitHub, no database: the caller (`admin/routes.ts`) resolves the three
|
|
7
|
+
* inputs — cached live items, one `latestForTriggers` map, one
|
|
8
|
+
* `listPending()` — and hands them over. That is what makes the board's rules
|
|
9
|
+
* table-testable, and it is the same split `pr-decisions.ts` makes against
|
|
10
|
+
* `pr-state.ts`.
|
|
11
|
+
*
|
|
12
|
+
* ## Columns come from CONFIG, never from constants
|
|
13
|
+
*
|
|
14
|
+
* The stage vocabulary is operator-owned (`autonomy.stages`,
|
|
15
|
+
* `engine/stage-labels.ts`), so the columns are read from it in the order the
|
|
16
|
+
* operator declared them. A deployment that has configured no stages gets
|
|
17
|
+
* `configured: false` and NO columns — the UI then says so, rather than the
|
|
18
|
+
* server inventing "Intake / Triage / In Progress / Review". Those names come
|
|
19
|
+
* from a mockup; they are examples, not a schema, and a board that shows
|
|
20
|
+
* columns nothing writes to is a board that lies.
|
|
21
|
+
*
|
|
22
|
+
* Each stage contributes its four labels in pipeline order — `enter`,
|
|
23
|
+
* `running`, `on_success`, `on_failure` — which is what turns one configured
|
|
24
|
+
* stage into a legible four-column board rather than a single column. Labels
|
|
25
|
+
* repeated across stages collapse onto their first column: a card carrying the
|
|
26
|
+
* label belongs in one place, and the earlier position is the one the pipeline
|
|
27
|
+
* reaches first.
|
|
28
|
+
*
|
|
29
|
+
* ## The RUN decides a tie; column order is the fallback
|
|
30
|
+
*
|
|
31
|
+
* A card carrying two stage labels is not an error state to refuse; it is the
|
|
32
|
+
* ordinary result of `stage-advance.ts`'s ADD-then-REMOVE ordering failing
|
|
33
|
+
* halfway (its module header explains why that direction is the safe one), or
|
|
34
|
+
* of a re-run leaving an older verdict behind. Either way the card is flagged
|
|
35
|
+
* `ambiguousStage: true` so the UI shows the pair rather than silently picking.
|
|
36
|
+
*
|
|
37
|
+
* WHICH column it lands in is decided by the latest run, when there is one:
|
|
38
|
+
* a `succeeded` run means the `on_success` column and a `failed` one means
|
|
39
|
+
* `on_failure`, because the run is the FACT and the labels are its projection.
|
|
40
|
+
* Column order alone gets this wrong in the case that actually happens — an
|
|
41
|
+
* issue that failed, was re-run, and succeeded carries both terminal labels,
|
|
42
|
+
* and `on_failure` sits right-most, so the board would file a finished build
|
|
43
|
+
* under "blocked" and show a green SUCCEEDED band inside a red column.
|
|
44
|
+
*
|
|
45
|
+
* With no run, or a run still in flight, the right-most matching column wins:
|
|
46
|
+
* the card has PROGRESSED, and later stages are further right.
|
|
47
|
+
*
|
|
48
|
+
* ## Why the SERVER computes `actions`
|
|
49
|
+
*
|
|
50
|
+
* Because the server is the side that knows the hold label, the run lock and
|
|
51
|
+
* the route map. Deriving them in the SPA would mean a second implementation of
|
|
52
|
+
* policy in a place that cannot see any of the three — the #256 class of defect
|
|
53
|
+
* exactly. In this slice the actions are advisory (the client renders them
|
|
54
|
+
* inert), but they are computed honestly so that wiring them up later is a
|
|
55
|
+
* client change, not a second policy.
|
|
56
|
+
*/
|
|
57
|
+
/** A label chip, as GitHub reports it. `color` is a bare hex string, no `#`. */
|
|
58
|
+
export interface BoardLabel {
|
|
59
|
+
name: string;
|
|
60
|
+
color: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
}
|
|
63
|
+
/** The live item the board is projecting — one open issue or pull request. */
|
|
64
|
+
export interface BoardBuilderItem {
|
|
65
|
+
/** Qualified `owner/repo`. */
|
|
66
|
+
repo: string;
|
|
67
|
+
number: number;
|
|
68
|
+
isPr: boolean;
|
|
69
|
+
title: string;
|
|
70
|
+
url: string;
|
|
71
|
+
author: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
draft: boolean;
|
|
74
|
+
labels: BoardLabel[];
|
|
75
|
+
/** Flattened, server-truncated body text. Empty when GitHub gave us none. */
|
|
76
|
+
body?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The run facts a card renders. Structurally satisfied by `WorkflowRun`, and
|
|
80
|
+
* declared here rather than imported so the builder's tests need no store.
|
|
81
|
+
*/
|
|
82
|
+
export interface BoardBuilderRun {
|
|
83
|
+
id: string;
|
|
84
|
+
workflowName: string;
|
|
85
|
+
status: string;
|
|
86
|
+
currentPhase?: string;
|
|
87
|
+
startedAt: string;
|
|
88
|
+
/**
|
|
89
|
+
* Why this run failed, short enough for a card. Present only on a FAILED run
|
|
90
|
+
* whose ledger carried a reason — see `failureReasonsForRuns`. A FAILED band
|
|
91
|
+
* with no reason cannot distinguish "blocked by guardrails" from "crashed",
|
|
92
|
+
* which on the bootstrap path is the whole question.
|
|
93
|
+
*/
|
|
94
|
+
failure?: {
|
|
95
|
+
phase: string;
|
|
96
|
+
reason: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The phase to SHOW for this run, when it differs from `currentPhase`.
|
|
100
|
+
*
|
|
101
|
+
* `currentPhase` is written on phase COMPLETION, so it lags by one for every
|
|
102
|
+
* phase after the first — a run working on `executor` reads `architect`. This
|
|
103
|
+
* is the honest answer: the ledger's in-flight phase for a live run, the
|
|
104
|
+
* phase that failed for a failed one. Absent when the two agree or when
|
|
105
|
+
* nothing better is known, and the card falls back to `currentPhase`.
|
|
106
|
+
*/
|
|
107
|
+
phase?: string;
|
|
108
|
+
}
|
|
109
|
+
/** The approval facts a card renders. Structurally satisfied by `WorkflowApproval`. */
|
|
110
|
+
export interface BoardBuilderApproval {
|
|
111
|
+
id: string;
|
|
112
|
+
workflowRunId: string;
|
|
113
|
+
gate: string;
|
|
114
|
+
summary?: string;
|
|
115
|
+
artifact?: string;
|
|
116
|
+
createdAt: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* One configured stage, flattened. Structurally satisfied by
|
|
120
|
+
* `AutonomyStageConfig` plus the record key it was declared under.
|
|
121
|
+
*/
|
|
122
|
+
export interface BoardStage {
|
|
123
|
+
/** The key in `autonomy.stages` — `build` for the one shipped stage. */
|
|
124
|
+
id: string;
|
|
125
|
+
enter: string;
|
|
126
|
+
running: string;
|
|
127
|
+
on_success: string;
|
|
128
|
+
on_failure: string;
|
|
129
|
+
}
|
|
130
|
+
/** An action the board offers on a card. */
|
|
131
|
+
export interface BoardAction {
|
|
132
|
+
id: string;
|
|
133
|
+
label: string;
|
|
134
|
+
kind: string;
|
|
135
|
+
enabled: boolean;
|
|
136
|
+
disabledReason?: string | null;
|
|
137
|
+
/**
|
|
138
|
+
* The stage label this action moves the card TO — set only on the
|
|
139
|
+
* move-shaped actions (`unblock`).
|
|
140
|
+
*
|
|
141
|
+
* The SERVER names it for the same reason it computes `enabled`: stage labels
|
|
142
|
+
* are operator-configured, so a client deriving "the entry column" from
|
|
143
|
+
* column order would be re-deriving policy it cannot see. It also means the
|
|
144
|
+
* button and the drag gesture post the identical request.
|
|
145
|
+
*/
|
|
146
|
+
to?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface BoardCard {
|
|
149
|
+
/** `owner/repo#123` — also the `workflow_runs.triggerId` for this subject. */
|
|
150
|
+
key: string;
|
|
151
|
+
repo: string;
|
|
152
|
+
number: number;
|
|
153
|
+
isPr: boolean;
|
|
154
|
+
title: string;
|
|
155
|
+
author: string;
|
|
156
|
+
createdAt: string;
|
|
157
|
+
url: string;
|
|
158
|
+
draft: boolean;
|
|
159
|
+
labels: BoardLabel[];
|
|
160
|
+
/**
|
|
161
|
+
* A short excerpt of the item's body, already flattened and clipped by the
|
|
162
|
+
* GitHub client. Absent or empty means GitHub gave us none — an item with no
|
|
163
|
+
* description, or the throttled REST path, which does not fetch one.
|
|
164
|
+
*/
|
|
165
|
+
body?: string;
|
|
166
|
+
/** The stage label this card was filed under; empty for an unstaged card. */
|
|
167
|
+
stageLabel: string;
|
|
168
|
+
/** The card carries more than one configured stage label. */
|
|
169
|
+
ambiguousStage: boolean;
|
|
170
|
+
/** The hold label is on this card — Last Light is off this subject entirely. */
|
|
171
|
+
held: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* WHY it is held, in prose naming the operator's configured hold label.
|
|
174
|
+
*
|
|
175
|
+
* Present only when {@link held}. The server supplies it because the server
|
|
176
|
+
* is the side that knows the label's name — it is operator-configurable, so
|
|
177
|
+
* the client cannot render "remove `lastlight-ignore`" from a bare boolean
|
|
178
|
+
* without hardcoding a string that may be wrong.
|
|
179
|
+
*/
|
|
180
|
+
heldReason?: string;
|
|
181
|
+
run?: BoardBuilderRun | null;
|
|
182
|
+
approval?: BoardBuilderApproval | null;
|
|
183
|
+
actions: BoardAction[];
|
|
184
|
+
}
|
|
185
|
+
export interface BoardColumn {
|
|
186
|
+
/** Stable `<stage>.<slot>` id — survives an operator renaming the label. */
|
|
187
|
+
id: string;
|
|
188
|
+
title: string;
|
|
189
|
+
/** The GitHub label this column collects. */
|
|
190
|
+
label: string;
|
|
191
|
+
count: number;
|
|
192
|
+
/** Cards in this column with a pending approval — the HITL badge. */
|
|
193
|
+
awaitingHumanCount: number;
|
|
194
|
+
cards: BoardCard[];
|
|
195
|
+
}
|
|
196
|
+
export interface BoardScope {
|
|
197
|
+
repos: string[];
|
|
198
|
+
truncated: boolean;
|
|
199
|
+
reason: string;
|
|
200
|
+
/**
|
|
201
|
+
* Every repo this board COULD show — the autonomy allow-list intersected with
|
|
202
|
+
* the managed set — whether or not it is in the current `repos` scope.
|
|
203
|
+
*
|
|
204
|
+
* The scope picker is built from this rather than from `GET /repos`. That
|
|
205
|
+
* endpoint answers "what does this deployment manage", which is a strictly
|
|
206
|
+
* larger set, so a picker fed from it offers repos the board can never
|
|
207
|
+
* display: pick one and you get an empty board with no explanation, because
|
|
208
|
+
* the server correctly filtered it out. The eligible list is the server's own
|
|
209
|
+
* answer to the only question the picker is asking.
|
|
210
|
+
*/
|
|
211
|
+
eligible: string[];
|
|
212
|
+
}
|
|
213
|
+
export interface BoardDegradation {
|
|
214
|
+
repo: string;
|
|
215
|
+
error: string;
|
|
216
|
+
staleSince?: string;
|
|
217
|
+
}
|
|
218
|
+
export interface BoardResponse {
|
|
219
|
+
generatedAt: string;
|
|
220
|
+
ttlSeconds: number;
|
|
221
|
+
/** False when the operator has configured no `autonomy.stages`. */
|
|
222
|
+
configured: boolean;
|
|
223
|
+
scope: BoardScope;
|
|
224
|
+
degraded: BoardDegradation[];
|
|
225
|
+
columns: BoardColumn[];
|
|
226
|
+
unstaged?: {
|
|
227
|
+
count: number;
|
|
228
|
+
cards: BoardCard[];
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
export interface BuildBoardInput {
|
|
232
|
+
/**
|
|
233
|
+
* The phase each ACTIVE run is running right now, keyed by RUN id — one
|
|
234
|
+
* `inFlightPhasesForRuns` answer. See {@link BoardBuilderRun.phase}.
|
|
235
|
+
*/
|
|
236
|
+
inFlight?: Map<string, string>;
|
|
237
|
+
/**
|
|
238
|
+
* Why each FAILED run failed, keyed by RUN id — not by trigger id, unlike
|
|
239
|
+
* {@link BuildBoardInput.runs}. One `failureReasonsForRuns` answer, passed in
|
|
240
|
+
* rather than merged by the caller so the clipping rule lives here with the
|
|
241
|
+
* rest of the projection and is table-tested with it.
|
|
242
|
+
*/
|
|
243
|
+
failures?: Map<string, {
|
|
244
|
+
phase: string;
|
|
245
|
+
error: string;
|
|
246
|
+
}>;
|
|
247
|
+
items: BoardBuilderItem[];
|
|
248
|
+
/** Keyed by trigger id (`owner/repo#N`) — one `latestForTriggers` answer. */
|
|
249
|
+
runs: Map<string, BoardBuilderRun>;
|
|
250
|
+
/** Pending approvals, in any order; indexed by `workflowRunId` here. */
|
|
251
|
+
approvals: BoardBuilderApproval[];
|
|
252
|
+
/** The ordered `autonomy.stages` list. Empty means "not configured". */
|
|
253
|
+
stages: BoardStage[];
|
|
254
|
+
holdLabel: string;
|
|
255
|
+
scope: BoardScope;
|
|
256
|
+
degraded: BoardDegradation[];
|
|
257
|
+
generatedAt?: string;
|
|
258
|
+
ttlSeconds: number;
|
|
259
|
+
}
|
|
260
|
+
export interface BuildBoardOptions {
|
|
261
|
+
/** Populate the `unstaged` bucket. Off by default — it is the long tail. */
|
|
262
|
+
unstaged?: boolean;
|
|
263
|
+
}
|
|
264
|
+
export declare function buildBoard(input: BuildBoardInput, opts?: BuildBoardOptions): BoardResponse;
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pipeline board — the PURE projection of labels, runs and approvals onto
|
|
3
|
+
* columns.
|
|
4
|
+
*
|
|
5
|
+
* Everything in this module is a function of its arguments. No Hono, no
|
|
6
|
+
* GitHub, no database: the caller (`admin/routes.ts`) resolves the three
|
|
7
|
+
* inputs — cached live items, one `latestForTriggers` map, one
|
|
8
|
+
* `listPending()` — and hands them over. That is what makes the board's rules
|
|
9
|
+
* table-testable, and it is the same split `pr-decisions.ts` makes against
|
|
10
|
+
* `pr-state.ts`.
|
|
11
|
+
*
|
|
12
|
+
* ## Columns come from CONFIG, never from constants
|
|
13
|
+
*
|
|
14
|
+
* The stage vocabulary is operator-owned (`autonomy.stages`,
|
|
15
|
+
* `engine/stage-labels.ts`), so the columns are read from it in the order the
|
|
16
|
+
* operator declared them. A deployment that has configured no stages gets
|
|
17
|
+
* `configured: false` and NO columns — the UI then says so, rather than the
|
|
18
|
+
* server inventing "Intake / Triage / In Progress / Review". Those names come
|
|
19
|
+
* from a mockup; they are examples, not a schema, and a board that shows
|
|
20
|
+
* columns nothing writes to is a board that lies.
|
|
21
|
+
*
|
|
22
|
+
* Each stage contributes its four labels in pipeline order — `enter`,
|
|
23
|
+
* `running`, `on_success`, `on_failure` — which is what turns one configured
|
|
24
|
+
* stage into a legible four-column board rather than a single column. Labels
|
|
25
|
+
* repeated across stages collapse onto their first column: a card carrying the
|
|
26
|
+
* label belongs in one place, and the earlier position is the one the pipeline
|
|
27
|
+
* reaches first.
|
|
28
|
+
*
|
|
29
|
+
* ## The RUN decides a tie; column order is the fallback
|
|
30
|
+
*
|
|
31
|
+
* A card carrying two stage labels is not an error state to refuse; it is the
|
|
32
|
+
* ordinary result of `stage-advance.ts`'s ADD-then-REMOVE ordering failing
|
|
33
|
+
* halfway (its module header explains why that direction is the safe one), or
|
|
34
|
+
* of a re-run leaving an older verdict behind. Either way the card is flagged
|
|
35
|
+
* `ambiguousStage: true` so the UI shows the pair rather than silently picking.
|
|
36
|
+
*
|
|
37
|
+
* WHICH column it lands in is decided by the latest run, when there is one:
|
|
38
|
+
* a `succeeded` run means the `on_success` column and a `failed` one means
|
|
39
|
+
* `on_failure`, because the run is the FACT and the labels are its projection.
|
|
40
|
+
* Column order alone gets this wrong in the case that actually happens — an
|
|
41
|
+
* issue that failed, was re-run, and succeeded carries both terminal labels,
|
|
42
|
+
* and `on_failure` sits right-most, so the board would file a finished build
|
|
43
|
+
* under "blocked" and show a green SUCCEEDED band inside a red column.
|
|
44
|
+
*
|
|
45
|
+
* With no run, or a run still in flight, the right-most matching column wins:
|
|
46
|
+
* the card has PROGRESSED, and later stages are further right.
|
|
47
|
+
*
|
|
48
|
+
* ## Why the SERVER computes `actions`
|
|
49
|
+
*
|
|
50
|
+
* Because the server is the side that knows the hold label, the run lock and
|
|
51
|
+
* the route map. Deriving them in the SPA would mean a second implementation of
|
|
52
|
+
* policy in a place that cannot see any of the three — the #256 class of defect
|
|
53
|
+
* exactly. In this slice the actions are advisory (the client renders them
|
|
54
|
+
* inert), but they are computed honestly so that wiring them up later is a
|
|
55
|
+
* client change, not a second policy.
|
|
56
|
+
*/
|
|
57
|
+
/** The universal subject key. Matches `build-decisions.ts`'s `issueTriggerId`. */
|
|
58
|
+
function cardKey(repo, number) {
|
|
59
|
+
return `${repo}#${number}`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A column heading from a label name: `ready-for-agent` → `Ready for agent`.
|
|
63
|
+
*
|
|
64
|
+
* Derived rather than mapped, because the label is operator-owned — a lookup
|
|
65
|
+
* table would render a renamed stage as a blank or a stale heading, and the
|
|
66
|
+
* label is the only name the operator ever wrote down.
|
|
67
|
+
*/
|
|
68
|
+
function titleForLabel(label) {
|
|
69
|
+
const words = label.replace(/[-_]+/g, " ").trim();
|
|
70
|
+
return words ? words.charAt(0).toUpperCase() + words.slice(1) : label;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The ordered column definitions for a set of stages.
|
|
74
|
+
*
|
|
75
|
+
* Four slots per stage in pipeline order, skipping unconfigured labels and
|
|
76
|
+
* collapsing a label two stages share onto its first column.
|
|
77
|
+
*/
|
|
78
|
+
function columnsForStages(stages) {
|
|
79
|
+
const slots = ["enter", "running", "on_success", "on_failure"];
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const stage of stages) {
|
|
83
|
+
for (const slot of slots) {
|
|
84
|
+
const label = stage[slot];
|
|
85
|
+
if (!label || seen.has(label))
|
|
86
|
+
continue;
|
|
87
|
+
seen.add(label);
|
|
88
|
+
out.push({ id: `${stage.id}.${slot}`, title: titleForLabel(label), label });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Why a held card is inert, in the wording `holdReply` uses on every other
|
|
95
|
+
* surface — it NAMES the label, because the label is the remedy.
|
|
96
|
+
*
|
|
97
|
+
* Declared once and read by both the card's `heldReason` and every disabled
|
|
98
|
+
* action's `disabledReason`, so the tooltip and the menu item can never
|
|
99
|
+
* disagree about why the same card is inert. The client used to derive this by
|
|
100
|
+
* taking the first action that happened to carry a reason, which is a guess: on
|
|
101
|
+
* a card whose actions are disabled for an unrelated cause (a run already owns
|
|
102
|
+
* it) that guess reads back the wrong sentence entirely.
|
|
103
|
+
*
|
|
104
|
+
* Not imported from `pr-decisions.ts`'s `holdReply`: this module is pure by
|
|
105
|
+
* construction and has no imports at all, and the two sentences address
|
|
106
|
+
* different readers — that one answers a maintainer who asked the bot to act,
|
|
107
|
+
* this one labels a card in a UI.
|
|
108
|
+
*/
|
|
109
|
+
function heldReasonFor(holdLabel) {
|
|
110
|
+
return `Held by \`${holdLabel}\` — remove the label to let Last Light act.`;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* What the board offers to DO with a card, and why it can't.
|
|
114
|
+
*
|
|
115
|
+
* The order of the branches is the policy. A hold outranks everything, for the
|
|
116
|
+
* same reason it does at the dispatch gate (`build-decisions.ts` branch 1): it
|
|
117
|
+
* is the one instruction that means "you, the bot, are off this subject
|
|
118
|
+
* entirely", and an action that stayed enabled through it would not mean that.
|
|
119
|
+
* Opening the item on GitHub survives a hold because reading is not acting.
|
|
120
|
+
*/
|
|
121
|
+
function actionsFor(args) {
|
|
122
|
+
const { held, holdLabel, isPr, run, approval, staged, stageLabel, entryLabel, failureLabel } = args;
|
|
123
|
+
const actions = [
|
|
124
|
+
{ id: "open", label: "Open on GitHub", kind: "link", enabled: true, disabledReason: null },
|
|
125
|
+
];
|
|
126
|
+
const holdReason = heldReasonFor(holdLabel);
|
|
127
|
+
const gate = (action) => held ? { ...action, enabled: false, disabledReason: holdReason } : action;
|
|
128
|
+
if (approval) {
|
|
129
|
+
actions.push(gate({ id: "approve", label: "Approve", kind: "approval", enabled: true, disabledReason: null }), gate({ id: "reject", label: "Reject", kind: "approval", enabled: true, disabledReason: null }));
|
|
130
|
+
}
|
|
131
|
+
const live = run ? ["queued", "running", "paused"].includes(run.status) : false;
|
|
132
|
+
if (live) {
|
|
133
|
+
actions.push(gate({ id: "cancel", label: "Cancel run", kind: "run", enabled: true, disabledReason: null }));
|
|
134
|
+
}
|
|
135
|
+
else if (run && run.status === "failed") {
|
|
136
|
+
actions.push(gate({ id: "retry", label: "Retry run", kind: "run", enabled: true, disabledReason: null }));
|
|
137
|
+
}
|
|
138
|
+
// ── UNBLOCK ───────────────────────────────────────────────────────────
|
|
139
|
+
//
|
|
140
|
+
// The affordance for a card that has STOPPED: it carries the stage's
|
|
141
|
+
// `on_failure` label, or its last run failed, and nothing will move it again
|
|
142
|
+
// on its own — the backstop sweep queries the `enter` label, so a parked card
|
|
143
|
+
// is deliberately invisible to it (`issue-discovery.ts`).
|
|
144
|
+
//
|
|
145
|
+
// Distinct from `retry` above, and the distinction is the whole point.
|
|
146
|
+
// `retry` RESUMES the same run: same row, same branch, same workspace, from
|
|
147
|
+
// the phase that failed. This starts AGAIN — it moves the card back to the
|
|
148
|
+
// entry column, which crosses the dispatch gate as the human who pressed it
|
|
149
|
+
// and begins a fresh build. A guardrails block wants this one; a run that
|
|
150
|
+
// died on a flaky step wants the other.
|
|
151
|
+
//
|
|
152
|
+
// It posts the SAME request the drag gesture does, which is why it carries
|
|
153
|
+
// `to` rather than a dedicated endpoint: one path, one gate, one set of
|
|
154
|
+
// refusals. The stale FAILED band clears by itself, because the new run
|
|
155
|
+
// becomes the latest for this trigger.
|
|
156
|
+
const parked = !isPr &&
|
|
157
|
+
staged &&
|
|
158
|
+
!!entryLabel &&
|
|
159
|
+
stageLabel !== entryLabel &&
|
|
160
|
+
(run?.status === "failed" || (!!failureLabel && stageLabel === failureLabel));
|
|
161
|
+
if (parked) {
|
|
162
|
+
const disabledReason = held ? holdReason : live ? "A run already owns this issue." : null;
|
|
163
|
+
actions.push({
|
|
164
|
+
id: "unblock",
|
|
165
|
+
label: "Unblock & rebuild",
|
|
166
|
+
kind: "stage",
|
|
167
|
+
enabled: !disabledReason,
|
|
168
|
+
disabledReason,
|
|
169
|
+
to: entryLabel,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
// Dispatch is issue-only: the pipeline builds ISSUES. A PR's equivalent is
|
|
173
|
+
// the existing PR retry surface, which the board does not duplicate.
|
|
174
|
+
//
|
|
175
|
+
// A PREVIOUS run does NOT disable it, and that is load-bearing. The gate
|
|
176
|
+
// treats a human ask as an explicit retry — `resolveBuildTrigger`'s
|
|
177
|
+
// `already-built` branch hard-skips only a BOT re-label, and this surface
|
|
178
|
+
// crosses with `senderIsBot: false` — so disabling on `run` made the board
|
|
179
|
+
// STRICTER than the server it speaks for, refusing something the endpoint
|
|
180
|
+
// would have honoured.
|
|
181
|
+
//
|
|
182
|
+
// That was a trap with no way out. An issue whose build failed on the ENTRY
|
|
183
|
+
// column has no `unblock` (there is nowhere back to move it) and no
|
|
184
|
+
// `dispatch` (a run exists), leaving only `retry`, which resumes the same
|
|
185
|
+
// failed run in its stale workspace. If the blocker was fixed upstream, that
|
|
186
|
+
// is precisely the one thing that cannot help.
|
|
187
|
+
if (!isPr) {
|
|
188
|
+
const disabledReason = held
|
|
189
|
+
? holdReason
|
|
190
|
+
: live
|
|
191
|
+
? "A run already owns this issue."
|
|
192
|
+
: !staged
|
|
193
|
+
? "No stage label — apply one to put this issue in the pipeline."
|
|
194
|
+
: null;
|
|
195
|
+
actions.push({
|
|
196
|
+
id: "dispatch",
|
|
197
|
+
// Named for what it does to THIS card: a first build, or another one.
|
|
198
|
+
label: run ? "Rebuild" : "Start build",
|
|
199
|
+
kind: "dispatch",
|
|
200
|
+
enabled: !disabledReason,
|
|
201
|
+
disabledReason,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return actions;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Project the live items onto the configured columns.
|
|
208
|
+
*
|
|
209
|
+
* Three inputs, no I/O, no exceptions. An item that matches no column is
|
|
210
|
+
* unstaged — which is the NORMAL state of an open pull request, not an error:
|
|
211
|
+
* the pipeline labels issues, and nothing labels PRs.
|
|
212
|
+
*/
|
|
213
|
+
/**
|
|
214
|
+
* Two rendered lines' worth of reason. The same argument `boardExcerpt` makes
|
|
215
|
+
* about bodies: a thrown failure's `error` can be a whole stack trace, and the
|
|
216
|
+
* payload is the budget — so it is clipped HERE, on the server, rather than by
|
|
217
|
+
* a CSS clamp that ships the whole trace to every open tab.
|
|
218
|
+
*/
|
|
219
|
+
const FAILURE_REASON_CHARS = 160;
|
|
220
|
+
/** A ledger error, flattened and clipped for a card. */
|
|
221
|
+
function failureReason(error) {
|
|
222
|
+
const flat = error.replace(/\s+/g, " ").trim();
|
|
223
|
+
return flat.length > FAILURE_REASON_CHARS ? `${flat.slice(0, FAILURE_REASON_CHARS - 1)}…` : flat;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* `<workflowName>:<phaseName>` → `phaseName`. Ledger rows are namespaced by
|
|
227
|
+
* their workflow; the card already says which workflow it is.
|
|
228
|
+
*/
|
|
229
|
+
function phaseOfSkill(workflowName, skill) {
|
|
230
|
+
const prefix = `${workflowName}:`;
|
|
231
|
+
return skill.startsWith(prefix) ? skill.slice(prefix.length) : skill;
|
|
232
|
+
}
|
|
233
|
+
export function buildBoard(input, opts = {}) {
|
|
234
|
+
const generatedAt = input.generatedAt ?? new Date().toISOString();
|
|
235
|
+
const base = {
|
|
236
|
+
generatedAt,
|
|
237
|
+
ttlSeconds: input.ttlSeconds,
|
|
238
|
+
scope: input.scope,
|
|
239
|
+
degraded: input.degraded,
|
|
240
|
+
};
|
|
241
|
+
const defs = columnsForStages(input.stages);
|
|
242
|
+
if (defs.length === 0) {
|
|
243
|
+
// Not configured. No columns at all — see the module header.
|
|
244
|
+
return { ...base, configured: false, columns: [] };
|
|
245
|
+
}
|
|
246
|
+
const approvalsByRun = new Map();
|
|
247
|
+
for (const approval of input.approvals) {
|
|
248
|
+
// Newest wins only if the caller ordered them so; a run has at most one
|
|
249
|
+
// pending gate in practice, so the first entry stands.
|
|
250
|
+
if (!approvalsByRun.has(approval.workflowRunId))
|
|
251
|
+
approvalsByRun.set(approval.workflowRunId, approval);
|
|
252
|
+
}
|
|
253
|
+
const columnIndexByLabel = new Map();
|
|
254
|
+
defs.forEach((def, idx) => columnIndexByLabel.set(def.label, idx));
|
|
255
|
+
const columns = defs.map((def) => ({
|
|
256
|
+
...def,
|
|
257
|
+
count: 0,
|
|
258
|
+
awaitingHumanCount: 0,
|
|
259
|
+
cards: [],
|
|
260
|
+
}));
|
|
261
|
+
const unstaged = [];
|
|
262
|
+
for (const item of input.items) {
|
|
263
|
+
const names = item.labels.map((l) => l.name);
|
|
264
|
+
const held = names.includes(input.holdLabel);
|
|
265
|
+
const key = cardKey(item.repo, item.number);
|
|
266
|
+
const baseRun = input.runs.get(key) ?? null;
|
|
267
|
+
// The FALLBACK placement: right-most configured stage, on the reading that
|
|
268
|
+
// the card has progressed. A finished run overrides it just below.
|
|
269
|
+
let index = -1;
|
|
270
|
+
let matches = 0;
|
|
271
|
+
const matched = [];
|
|
272
|
+
for (const name of names) {
|
|
273
|
+
const at = columnIndexByLabel.get(name);
|
|
274
|
+
if (at === undefined)
|
|
275
|
+
continue;
|
|
276
|
+
matches++;
|
|
277
|
+
matched.push(at);
|
|
278
|
+
if (at > index)
|
|
279
|
+
index = at;
|
|
280
|
+
}
|
|
281
|
+
// ── THE TIE-BREAK ───────────────────────────────────────────────────────
|
|
282
|
+
//
|
|
283
|
+
// Two stage labels and a finished run: the RUN is the fact, so it picks the
|
|
284
|
+
// column. See the module header — column order alone files a re-run that
|
|
285
|
+
// succeeded under "blocked", because `on_failure` sits right-most.
|
|
286
|
+
if (matches > 1 && baseRun) {
|
|
287
|
+
const wanted = baseRun.status === "succeeded"
|
|
288
|
+
? ".on_success"
|
|
289
|
+
: baseRun.status === "failed" || baseRun.status === "cancelled"
|
|
290
|
+
? ".on_failure"
|
|
291
|
+
: null;
|
|
292
|
+
if (wanted) {
|
|
293
|
+
const byRun = matched.find((at) => defs[at].id.endsWith(wanted));
|
|
294
|
+
if (byRun !== undefined)
|
|
295
|
+
index = byRun;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Which STAGE this card is filed under, so "back to the start" means that
|
|
299
|
+
// stage's entry column rather than the board's first one.
|
|
300
|
+
const stageId = index >= 0 ? (defs[index].id.split(".")[0] ?? "") : "";
|
|
301
|
+
const stage = stageId ? input.stages.find((candidate) => candidate.id === stageId) ?? null : null;
|
|
302
|
+
// Only a FAILED run owes an explanation, and only the ledger has one.
|
|
303
|
+
const failed = baseRun?.status === "failed" ? input.failures?.get(baseRun.id) : undefined;
|
|
304
|
+
// The phase to SHOW. `currentPhase` is written on completion, so it lags —
|
|
305
|
+
// prefer the ledger's answer: what a live run is running, or what a failed
|
|
306
|
+
// one died in.
|
|
307
|
+
const liveNow = baseRun ? input.inFlight?.get(baseRun.id) : undefined;
|
|
308
|
+
const displayPhase = failed
|
|
309
|
+
? phaseOfSkill(baseRun.workflowName, failed.phase)
|
|
310
|
+
: liveNow
|
|
311
|
+
? phaseOfSkill(baseRun.workflowName, liveNow)
|
|
312
|
+
: undefined;
|
|
313
|
+
const run = baseRun
|
|
314
|
+
? {
|
|
315
|
+
...baseRun,
|
|
316
|
+
...(failed
|
|
317
|
+
? {
|
|
318
|
+
failure: {
|
|
319
|
+
phase: phaseOfSkill(baseRun.workflowName, failed.phase),
|
|
320
|
+
reason: failureReason(failed.error),
|
|
321
|
+
},
|
|
322
|
+
}
|
|
323
|
+
: {}),
|
|
324
|
+
...(displayPhase && displayPhase !== baseRun.currentPhase ? { phase: displayPhase } : {}),
|
|
325
|
+
}
|
|
326
|
+
: null;
|
|
327
|
+
const approval = run ? approvalsByRun.get(run.id) ?? null : null;
|
|
328
|
+
const staged = index >= 0;
|
|
329
|
+
const card = {
|
|
330
|
+
key,
|
|
331
|
+
repo: item.repo,
|
|
332
|
+
number: item.number,
|
|
333
|
+
isPr: item.isPr,
|
|
334
|
+
title: item.title,
|
|
335
|
+
author: item.author,
|
|
336
|
+
createdAt: item.createdAt,
|
|
337
|
+
url: item.url,
|
|
338
|
+
draft: item.draft,
|
|
339
|
+
labels: item.labels,
|
|
340
|
+
...(item.body ? { body: item.body } : {}),
|
|
341
|
+
stageLabel: staged ? columns[index].label : "",
|
|
342
|
+
ambiguousStage: matches > 1,
|
|
343
|
+
held,
|
|
344
|
+
...(held ? { heldReason: heldReasonFor(input.holdLabel) } : {}),
|
|
345
|
+
run,
|
|
346
|
+
approval,
|
|
347
|
+
actions: actionsFor({
|
|
348
|
+
held,
|
|
349
|
+
holdLabel: input.holdLabel,
|
|
350
|
+
isPr: item.isPr,
|
|
351
|
+
run,
|
|
352
|
+
approval,
|
|
353
|
+
staged,
|
|
354
|
+
stageLabel: staged ? columns[index].label : "",
|
|
355
|
+
entryLabel: stage?.enter ?? null,
|
|
356
|
+
failureLabel: stage?.on_failure ?? null,
|
|
357
|
+
}),
|
|
358
|
+
};
|
|
359
|
+
if (!staged) {
|
|
360
|
+
unstaged.push(card);
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const column = columns[index];
|
|
364
|
+
column.cards.push(card);
|
|
365
|
+
column.count++;
|
|
366
|
+
if (approval)
|
|
367
|
+
column.awaitingHumanCount++;
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
...base,
|
|
371
|
+
configured: true,
|
|
372
|
+
columns,
|
|
373
|
+
...(opts.unstaged ? { unstaged: { count: unstaged.length, cards: unstaged } } : {}),
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.js","sourceRoot":"","sources":["../../src/admin/board.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAqNH,kFAAkF;AAClF,SAAS,OAAO,CAAC,IAAY,EAAE,MAAc;IAC3C,OAAO,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACxE,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,MAAoB;IAC5C,MAAM,KAAK,GAAwC,CAAC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACpG,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAwD,EAAE,CAAC;IACpE,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;YAC1B,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,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