@on-par/factory-core 0.9.27 → 0.9.28-next.10
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/dist/blockers/declared-prerequisites.d.ts +4 -1
- package/dist/blockers/declared-prerequisites.d.ts.map +1 -1
- package/dist/blockers/declared-prerequisites.js +10 -5
- package/dist/blockers/declared-prerequisites.js.map +1 -1
- package/dist/config/example.d.ts.map +1 -1
- package/dist/config/example.js +6 -0
- package/dist/config/example.js.map +1 -1
- package/dist/config/index.d.ts +18 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/runtime-config-keys.d.ts.map +1 -1
- package/dist/config/runtime-config-keys.js +1 -0
- package/dist/config/runtime-config-keys.js.map +1 -1
- package/dist/config/tracker-section.d.ts +39 -0
- package/dist/config/tracker-section.d.ts.map +1 -0
- package/dist/config/tracker-section.js +31 -0
- package/dist/config/tracker-section.js.map +1 -0
- package/dist/events/queue-traits.d.ts +1 -1
- package/dist/events/queue-traits.d.ts.map +1 -1
- package/dist/events/queue-traits.js +5 -1
- package/dist/events/queue-traits.js.map +1 -1
- package/dist/filing/redact.d.ts +1 -0
- package/dist/filing/redact.d.ts.map +1 -1
- package/dist/filing/redact.js +1 -1
- package/dist/filing/redact.js.map +1 -1
- package/dist/internal.d.ts +5 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +5 -0
- package/dist/internal.js.map +1 -1
- package/dist/phases/ship-ci-watch.d.ts +25 -0
- package/dist/phases/ship-ci-watch.d.ts.map +1 -0
- package/dist/phases/ship-ci-watch.js +53 -0
- package/dist/phases/ship-ci-watch.js.map +1 -0
- package/dist/phases/ship-pr-lookup.d.ts +8 -0
- package/dist/phases/ship-pr-lookup.d.ts.map +1 -0
- package/dist/phases/ship-pr-lookup.js +41 -0
- package/dist/phases/ship-pr-lookup.js.map +1 -0
- package/dist/phases/ship-recovery.d.ts +16 -0
- package/dist/phases/ship-recovery.d.ts.map +1 -0
- package/dist/phases/ship-recovery.js +81 -0
- package/dist/phases/ship-recovery.js.map +1 -0
- package/dist/phases/ship-types.d.ts +36 -0
- package/dist/phases/ship-types.d.ts.map +1 -0
- package/dist/phases/ship-types.js +2 -0
- package/dist/phases/ship-types.js.map +1 -0
- package/dist/phases/ship.d.ts +6 -41
- package/dist/phases/ship.d.ts.map +1 -1
- package/dist/phases/ship.js +33 -171
- package/dist/phases/ship.js.map +1 -1
- package/dist/queue/linear-queue-lifecycle.d.ts +62 -0
- package/dist/queue/linear-queue-lifecycle.d.ts.map +1 -0
- package/dist/queue/linear-queue-lifecycle.js +139 -0
- package/dist/queue/linear-queue-lifecycle.js.map +1 -0
- package/dist/queue/linear-queue.d.ts +49 -0
- package/dist/queue/linear-queue.d.ts.map +1 -0
- package/dist/queue/linear-queue.js +258 -0
- package/dist/queue/linear-queue.js.map +1 -0
- package/dist/queue/queue-backend.d.ts +25 -6
- package/dist/queue/queue-backend.d.ts.map +1 -1
- package/dist/queue/queue-backend.js +35 -6
- package/dist/queue/queue-backend.js.map +1 -1
- package/dist/run/pr-run-state.d.ts +99 -0
- package/dist/run/pr-run-state.d.ts.map +1 -0
- package/dist/run/pr-run-state.js +235 -0
- package/dist/run/pr-run-state.js.map +1 -0
- package/dist/run/state.d.ts +9 -5
- package/dist/run/state.d.ts.map +1 -1
- package/dist/run/state.js +37 -13
- package/dist/run/state.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/work/index.d.ts +2 -2
- package/dist/work/index.d.ts.map +1 -1
- package/dist/work/index.js +4 -2
- package/dist/work/index.js.map +1 -1
- package/dist/work/linear-client.d.ts +21 -0
- package/dist/work/linear-client.d.ts.map +1 -0
- package/dist/work/linear-client.js +69 -0
- package/dist/work/linear-client.js.map +1 -0
- package/dist/work/linear-issue.d.ts +11 -0
- package/dist/work/linear-issue.d.ts.map +1 -0
- package/dist/work/linear-issue.js +69 -0
- package/dist/work/linear-issue.js.map +1 -0
- package/dist/work/linear-preflight.d.ts +21 -0
- package/dist/work/linear-preflight.d.ts.map +1 -0
- package/dist/work/linear-preflight.js +67 -0
- package/dist/work/linear-preflight.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// packages/core/src/queue/linear-queue.ts — Linear-backed queue seam: list and claimNext (ADR-0173, #3892).
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { LinearApiError } from '../work/linear-client.js';
|
|
4
|
+
import { claimedByLabel, CLAIMED_BY_LABEL_PREFIX, defaultClaimantId, PARKED_LABEL } from './github-queue.js';
|
|
5
|
+
import { QUEUE_ORDER_LABEL_PREFIX } from './queue-order.js';
|
|
6
|
+
import { toWorkKey } from '../work/work-key.js';
|
|
7
|
+
export const LINEAR_DEFAULT_LANE = 'default';
|
|
8
|
+
const EXCLUDED_STATE_TYPES = new Set(['started', 'completed', 'canceled']);
|
|
9
|
+
const ORDER_PATTERN = new RegExp(`^${QUEUE_ORDER_LABEL_PREFIX}(\\d+)$`);
|
|
10
|
+
export function isLinearCandidate(issue, readyLabel) {
|
|
11
|
+
if (EXCLUDED_STATE_TYPES.has(issue.stateType))
|
|
12
|
+
return false;
|
|
13
|
+
const names = issue.labels.map((l) => l.name);
|
|
14
|
+
return (names.some((n) => n === readyLabel) &&
|
|
15
|
+
!names.some((n) => n.startsWith(CLAIMED_BY_LABEL_PREFIX)) &&
|
|
16
|
+
!names.includes(PARKED_LABEL));
|
|
17
|
+
}
|
|
18
|
+
export function linearLaneOf(issue, laneLabelGroup, defaultLane = LINEAR_DEFAULT_LANE) {
|
|
19
|
+
return issue.labels.find((l) => l.group === laneLabelGroup)?.name ?? defaultLane;
|
|
20
|
+
}
|
|
21
|
+
function priorityRank(p) {
|
|
22
|
+
return p >= 1 && p <= 4 ? p : 5;
|
|
23
|
+
}
|
|
24
|
+
function orderOf(issue) {
|
|
25
|
+
const matches = issue.labels.map((l) => ORDER_PATTERN.exec(l.name)).filter((m) => m !== null);
|
|
26
|
+
if (matches.length !== 1)
|
|
27
|
+
return Number.POSITIVE_INFINITY;
|
|
28
|
+
const n = Number(matches[0]?.[1]);
|
|
29
|
+
return Number.isSafeInteger(n) && n > 0 ? n : Number.POSITIVE_INFINITY;
|
|
30
|
+
}
|
|
31
|
+
export function compareLinearCandidates(a, b) {
|
|
32
|
+
const pa = priorityRank(a.priority);
|
|
33
|
+
const pb = priorityRank(b.priority);
|
|
34
|
+
if (pa !== pb)
|
|
35
|
+
return pa - pb;
|
|
36
|
+
const oa = orderOf(a);
|
|
37
|
+
const ob = orderOf(b);
|
|
38
|
+
if (oa < ob)
|
|
39
|
+
return -1;
|
|
40
|
+
if (oa > ob)
|
|
41
|
+
return 1;
|
|
42
|
+
const ca = Date.parse(a.createdAt);
|
|
43
|
+
const cb = Date.parse(b.createdAt);
|
|
44
|
+
if (ca !== cb)
|
|
45
|
+
return ca - cb;
|
|
46
|
+
return a.identifier.localeCompare(b.identifier);
|
|
47
|
+
}
|
|
48
|
+
export function createLinearQueue(options) {
|
|
49
|
+
const { client, linear } = options;
|
|
50
|
+
const defaultLane = options.defaultLane ?? LINEAR_DEFAULT_LANE;
|
|
51
|
+
const claimantId = options.claimantId ?? defaultClaimantId();
|
|
52
|
+
const myLabel = claimedByLabel(claimantId);
|
|
53
|
+
let myLabelId;
|
|
54
|
+
async function sortedFor(lane) {
|
|
55
|
+
const issues = await client.listCandidates();
|
|
56
|
+
const laneOf = (i) => linearLaneOf(i, linear.laneLabelGroup, defaultLane);
|
|
57
|
+
const eligible = issues.filter((i) => isLinearCandidate(i, linear.readyLabel) && (lane === undefined || laneOf(i) === lane));
|
|
58
|
+
if (lane !== undefined)
|
|
59
|
+
return eligible.sort(compareLinearCandidates);
|
|
60
|
+
return eligible.sort((a, b) => laneOf(a).localeCompare(laneOf(b)) || compareLinearCandidates(a, b));
|
|
61
|
+
}
|
|
62
|
+
async function list(lane) {
|
|
63
|
+
return (await sortedFor(lane)).map((i) => toWorkKey(i.identifier));
|
|
64
|
+
}
|
|
65
|
+
async function claimNext(lane) {
|
|
66
|
+
const candidates = await sortedFor(lane);
|
|
67
|
+
if (candidates.length === 0)
|
|
68
|
+
return null;
|
|
69
|
+
myLabelId ??= await client.ensureLabel(myLabel);
|
|
70
|
+
for (const c of candidates) {
|
|
71
|
+
await client.addLabel(c.id, myLabelId);
|
|
72
|
+
await client.moveToState(c.id, linear.states.inProgress);
|
|
73
|
+
const after = await client.issueLabels(c.id);
|
|
74
|
+
const winner = after.filter((n) => n.startsWith(CLAIMED_BY_LABEL_PREFIX)).sort()[0];
|
|
75
|
+
if (winner === myLabel)
|
|
76
|
+
return { key: toWorkKey(c.identifier), decision: { kind: 'build' } };
|
|
77
|
+
// The winner owns In Progress, so the state is left alone.
|
|
78
|
+
if (after.includes(myLabel))
|
|
79
|
+
await client.removeLabel(c.id, myLabelId);
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
return { list, claimNext };
|
|
84
|
+
}
|
|
85
|
+
const MAX_PAGES = 10;
|
|
86
|
+
const ENVELOPE = z.object({
|
|
87
|
+
data: z.unknown().nullish(),
|
|
88
|
+
errors: z.array(z.object({ message: z.string() })).optional(),
|
|
89
|
+
});
|
|
90
|
+
const CANDIDATES_QUERY = `query($after: String, $team: String!, $project: String!, $ready: String!, $label: String!) {
|
|
91
|
+
issues(first: 100, after: $after, filter: { team: { key: { eq: $team } }, project: { or: [{ name: { eq: $project } }, { id: { eq: $project } }] }, state: { name: { eq: $ready } }, labels: { some: { name: { eq: $label } } } }) {
|
|
92
|
+
nodes { id identifier priority createdAt state { type } labels { nodes { id name parent { name } } } }
|
|
93
|
+
pageInfo { hasNextPage endCursor }
|
|
94
|
+
}
|
|
95
|
+
}`;
|
|
96
|
+
const TEAM_QUERY = `query($team: String!) { teams(filter: { key: { eq: $team } }) { nodes { id states { nodes { id name } } } } }`;
|
|
97
|
+
const FIND_LABEL_QUERY = `query($name: String!, $teamId: ID!) { issueLabels(filter: { name: { eq: $name }, team: { id: { eq: $teamId } } }) { nodes { id } } }`;
|
|
98
|
+
const CREATE_LABEL_MUTATION = `mutation($name: String!, $teamId: String!) { issueLabelCreate(input: { name: $name, teamId: $teamId }) { success issueLabel { id } } }`;
|
|
99
|
+
const ADD_LABEL_MUTATION = `mutation($id: String!, $labelId: String!) { issueAddLabel(id: $id, labelId: $labelId) { success } }`;
|
|
100
|
+
const REMOVE_LABEL_MUTATION = `mutation($id: String!, $labelId: String!) { issueRemoveLabel(id: $id, labelId: $labelId) { success } }`;
|
|
101
|
+
const UPDATE_STATE_MUTATION = `mutation($id: String!, $stateId: String!) { issueUpdate(id: $id, input: { stateId: $stateId }) { success } }`;
|
|
102
|
+
const ISSUE_LABELS_QUERY = `query($id: String!) { issue(id: $id) { labels { nodes { name } } } }`;
|
|
103
|
+
const CandidatesSchema = z.object({
|
|
104
|
+
issues: z.object({
|
|
105
|
+
nodes: z.array(z.object({
|
|
106
|
+
id: z.string(),
|
|
107
|
+
identifier: z.string(),
|
|
108
|
+
priority: z.number(),
|
|
109
|
+
createdAt: z.string(),
|
|
110
|
+
state: z.object({ type: z.string() }),
|
|
111
|
+
labels: z.object({
|
|
112
|
+
nodes: z.array(z.object({ id: z.string(), name: z.string(), parent: z.object({ name: z.string() }).nullish() })),
|
|
113
|
+
}),
|
|
114
|
+
})),
|
|
115
|
+
pageInfo: z.object({ hasNextPage: z.boolean(), endCursor: z.string().nullish() }),
|
|
116
|
+
}),
|
|
117
|
+
});
|
|
118
|
+
const TeamSchema = z.object({
|
|
119
|
+
teams: z.object({
|
|
120
|
+
nodes: z.array(z.object({
|
|
121
|
+
id: z.string(),
|
|
122
|
+
states: z.object({ nodes: z.array(z.object({ id: z.string(), name: z.string() })) }),
|
|
123
|
+
})),
|
|
124
|
+
}),
|
|
125
|
+
});
|
|
126
|
+
const FindLabelSchema = z.object({ issueLabels: z.object({ nodes: z.array(z.object({ id: z.string() })) }) });
|
|
127
|
+
const CreateLabelSchema = z.object({
|
|
128
|
+
issueLabelCreate: z.object({ success: z.boolean(), issueLabel: z.object({ id: z.string() }).nullish() }),
|
|
129
|
+
});
|
|
130
|
+
const AddLabelSchema = z.object({ issueAddLabel: z.object({ success: z.boolean() }) });
|
|
131
|
+
const RemoveLabelSchema = z.object({ issueRemoveLabel: z.object({ success: z.boolean() }) });
|
|
132
|
+
const UpdateSchema = z.object({ issueUpdate: z.object({ success: z.boolean() }) });
|
|
133
|
+
const IssueLabelsSchema = z.object({
|
|
134
|
+
issue: z.object({ labels: z.object({ nodes: z.array(z.object({ name: z.string() })) }) }).nullable(),
|
|
135
|
+
});
|
|
136
|
+
export function createLinearQueueGraphqlClient(opts) {
|
|
137
|
+
const { apiKey, linear, project } = opts;
|
|
138
|
+
const fetchImpl = opts.fetch ?? globalThis.fetch;
|
|
139
|
+
const endpoint = opts.endpoint ?? 'https://api.linear.app/graphql';
|
|
140
|
+
const redact = (text) => text.split(apiKey).join('***');
|
|
141
|
+
async function request(query, variables, schema) {
|
|
142
|
+
let res;
|
|
143
|
+
let json;
|
|
144
|
+
try {
|
|
145
|
+
res = await fetchImpl(endpoint, {
|
|
146
|
+
method: 'POST',
|
|
147
|
+
headers: { 'Content-Type': 'application/json', Authorization: apiKey },
|
|
148
|
+
body: JSON.stringify({ query, variables }),
|
|
149
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 30_000),
|
|
150
|
+
});
|
|
151
|
+
if (!res.ok)
|
|
152
|
+
throw new LinearApiError(`Linear API returned HTTP ${res.status}`);
|
|
153
|
+
json = await res.json();
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
if (err instanceof LinearApiError)
|
|
157
|
+
throw err;
|
|
158
|
+
throw new LinearApiError(redact(err instanceof Error ? err.message : String(err)));
|
|
159
|
+
}
|
|
160
|
+
const envelope = ENVELOPE.safeParse(json);
|
|
161
|
+
if (!envelope.success)
|
|
162
|
+
throw malformed(envelope.error);
|
|
163
|
+
const { data, errors } = envelope.data;
|
|
164
|
+
if (errors && errors.length > 0) {
|
|
165
|
+
throw new LinearApiError(redact(`Linear API error: ${errors.map((e) => e.message).join('; ')}`));
|
|
166
|
+
}
|
|
167
|
+
if (data == null)
|
|
168
|
+
throw new LinearApiError('Linear API returned no data');
|
|
169
|
+
const parsed = schema.safeParse(data);
|
|
170
|
+
if (!parsed.success)
|
|
171
|
+
throw malformed(parsed.error);
|
|
172
|
+
return parsed.data;
|
|
173
|
+
}
|
|
174
|
+
function malformed(error) {
|
|
175
|
+
const first = error.issues[0];
|
|
176
|
+
const where = first ? `${first.path.join('.')}: ${first.message}` : 'unknown';
|
|
177
|
+
return new LinearApiError(redact(`malformed Linear response: ${where}`));
|
|
178
|
+
}
|
|
179
|
+
let team;
|
|
180
|
+
function teamInfo() {
|
|
181
|
+
team ??= request(TEAM_QUERY, { team: linear.teamKey }, TeamSchema).then((d) => {
|
|
182
|
+
const found = d.teams.nodes[0];
|
|
183
|
+
if (!found)
|
|
184
|
+
throw new LinearApiError(`Linear team ${linear.teamKey} not found`);
|
|
185
|
+
return found;
|
|
186
|
+
});
|
|
187
|
+
team.catch(() => {
|
|
188
|
+
team = undefined;
|
|
189
|
+
});
|
|
190
|
+
return team;
|
|
191
|
+
}
|
|
192
|
+
function ensureSuccess(ok, what) {
|
|
193
|
+
if (!ok)
|
|
194
|
+
throw new LinearApiError(`Linear ${what} reported success=false`);
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
async listCandidates() {
|
|
198
|
+
const out = [];
|
|
199
|
+
let after = null;
|
|
200
|
+
for (let page = 0; page < MAX_PAGES; page++) {
|
|
201
|
+
const { issues } = await request(CANDIDATES_QUERY, { after, team: linear.teamKey, project, ready: linear.states.ready, label: linear.readyLabel }, CandidatesSchema);
|
|
202
|
+
for (const n of issues.nodes) {
|
|
203
|
+
out.push({
|
|
204
|
+
id: n.id,
|
|
205
|
+
identifier: n.identifier,
|
|
206
|
+
priority: n.priority,
|
|
207
|
+
createdAt: n.createdAt,
|
|
208
|
+
stateType: n.state.type,
|
|
209
|
+
labels: n.labels.nodes.map((l) => ({
|
|
210
|
+
id: l.id,
|
|
211
|
+
name: l.name,
|
|
212
|
+
...(l.parent ? { group: l.parent.name } : {}),
|
|
213
|
+
})),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (!issues.pageInfo.hasNextPage)
|
|
217
|
+
return out;
|
|
218
|
+
after = issues.pageInfo.endCursor ?? null;
|
|
219
|
+
}
|
|
220
|
+
throw new LinearApiError('Linear ready queue exceeds 1000 issues');
|
|
221
|
+
},
|
|
222
|
+
async issueLabels(issueId) {
|
|
223
|
+
const d = await request(ISSUE_LABELS_QUERY, { id: issueId }, IssueLabelsSchema);
|
|
224
|
+
if (d.issue === null)
|
|
225
|
+
throw new LinearApiError(`Linear issue ${issueId} not found`);
|
|
226
|
+
return d.issue.labels.nodes.map((l) => l.name);
|
|
227
|
+
},
|
|
228
|
+
async ensureLabel(name) {
|
|
229
|
+
const { id: teamId } = await teamInfo();
|
|
230
|
+
const found = await request(FIND_LABEL_QUERY, { name, teamId }, FindLabelSchema);
|
|
231
|
+
const existing = found.issueLabels.nodes[0];
|
|
232
|
+
if (existing)
|
|
233
|
+
return existing.id;
|
|
234
|
+
const created = (await request(CREATE_LABEL_MUTATION, { name, teamId }, CreateLabelSchema)).issueLabelCreate;
|
|
235
|
+
ensureSuccess(created.success, 'label create');
|
|
236
|
+
if (!created.issueLabel)
|
|
237
|
+
throw new LinearApiError('Linear label create returned no label');
|
|
238
|
+
return created.issueLabel.id;
|
|
239
|
+
},
|
|
240
|
+
async addLabel(issueId, labelId) {
|
|
241
|
+
const d = await request(ADD_LABEL_MUTATION, { id: issueId, labelId }, AddLabelSchema);
|
|
242
|
+
ensureSuccess(d.issueAddLabel.success, 'label add');
|
|
243
|
+
},
|
|
244
|
+
async removeLabel(issueId, labelId) {
|
|
245
|
+
const d = await request(REMOVE_LABEL_MUTATION, { id: issueId, labelId }, RemoveLabelSchema);
|
|
246
|
+
ensureSuccess(d.issueRemoveLabel.success, 'label remove');
|
|
247
|
+
},
|
|
248
|
+
async moveToState(issueId, stateName) {
|
|
249
|
+
const info = await teamInfo();
|
|
250
|
+
const state = info.states.nodes.find((s) => s.name === stateName);
|
|
251
|
+
if (!state)
|
|
252
|
+
throw new LinearApiError(`Linear state "${stateName}" not found in team ${linear.teamKey}`);
|
|
253
|
+
const d = await request(UPDATE_STATE_MUTATION, { id: issueId, stateId: state.id }, UpdateSchema);
|
|
254
|
+
ensureSuccess(d.issueUpdate.success, 'state update');
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=linear-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear-queue.js","sourceRoot":"","sources":["../../src/queue/linear-queue.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAE5G,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7G,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAC;AAoC9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAC3E,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC,IAAI,wBAAwB,SAAS,CAAC,CAAC;AAExE,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAE,UAAkB;IAC3E,IAAI,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK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O,CAAC,kBAAkB,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;YACtF,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO;YAChC,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,qBAAqB,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAC5F,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QAC5D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,SAAS;YAClC,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;YAClE,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,cAAc,CAAC,iBAAiB,SAAS,uBAAuB,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;YACxG,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,qBAAqB,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC;YACjG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import { type BlockedParkPollResult, type BlockedParkStore } from '../blockers/poller.js';
|
|
2
2
|
import { type GithubQueueOptions, type QueueClaim, type QueueReleaseOutcome } from './github-queue.js';
|
|
3
|
+
import { type WorkKey } from '../work/work-key.js';
|
|
3
4
|
import { type StaleClaimRelease } from './stale-claims.js';
|
|
5
|
+
export interface QueueBackendClaim {
|
|
6
|
+
key: WorkKey;
|
|
7
|
+
decision: QueueClaim['decision'];
|
|
8
|
+
}
|
|
4
9
|
export interface QueueBackend {
|
|
5
|
-
/** Claims and returns the next eligible
|
|
6
|
-
claimNext(lane: string): Promise<
|
|
7
|
-
/** Releases a previously claimed
|
|
8
|
-
release(
|
|
9
|
-
/**
|
|
10
|
-
|
|
10
|
+
/** Claims and returns the next eligible work item in `lane`, or null when none is eligible. */
|
|
11
|
+
claimNext(lane: string): Promise<QueueBackendClaim | null>;
|
|
12
|
+
/** Releases a previously claimed work item back to the queue with the given outcome (default 'queued'). */
|
|
13
|
+
release(key: WorkKey, outcome?: QueueReleaseOutcome): Promise<void>;
|
|
14
|
+
/** Refreshes this claimant's lease; false when the claim is gone (GithubQueue.heartbeat semantics). */
|
|
15
|
+
heartbeat(key: WorkKey): Promise<boolean>;
|
|
16
|
+
/** Queued work keys for one lane, in claim order; every lane, lane-sorted, when `lane` is omitted. */
|
|
17
|
+
list(lane?: string): Promise<WorkKey[]>;
|
|
18
|
+
/** Lane names that currently have queued work. */
|
|
19
|
+
lanes(): Promise<string[]>;
|
|
11
20
|
/** Detects and releases claims whose TTL lease has expired across the whole queue. */
|
|
12
21
|
reap(): Promise<StaleClaimRelease[]>;
|
|
13
22
|
/** Unparks `blocked` parents whose blockers resolved (#2318); [] when no blockedParks store was configured. */
|
|
@@ -17,4 +26,14 @@ export type GithubQueueBackendOptions = GithubQueueOptions & {
|
|
|
17
26
|
blockedParks?: BlockedParkStore;
|
|
18
27
|
};
|
|
19
28
|
export declare function createGithubQueueBackend(options: GithubQueueBackendOptions): QueueBackend;
|
|
29
|
+
export type QueueBackendKind = 'github';
|
|
30
|
+
export interface QueueBackendOptions {
|
|
31
|
+
kind: QueueBackendKind;
|
|
32
|
+
github: GithubQueueBackendOptions;
|
|
33
|
+
}
|
|
34
|
+
export declare class UnsupportedQueueBackendError extends Error {
|
|
35
|
+
readonly kind: string;
|
|
36
|
+
constructor(kind: string);
|
|
37
|
+
}
|
|
38
|
+
export declare function createQueueBackend(options: QueueBackendOptions): QueueBackend;
|
|
20
39
|
//# sourceMappingURL=queue-backend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-backend.d.ts","sourceRoot":"","sources":["../../src/queue/queue-backend.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,YAAY;IAC3B
|
|
1
|
+
{"version":3,"file":"queue-backend.d.ts","sourceRoot":"","sources":["../../src/queue/queue-backend.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAmC,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE/E,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAC;IACb,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,YAAY;IAC3B,+FAA+F;IAC/F,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC3D,2GAA2G;IAC3G,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,uGAAuG;IACvG,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,sGAAsG;IACtG,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxC,kDAAkD;IAClD,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3B,sFAAsF;IACtF,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACrC,+GAA+G;IAC/G,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CACtD;AAED,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,GAAG;IAAE,YAAY,CAAC,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEjG,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,YAAY,CAoCzF;AAED,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE,yBAAyB,CAAC;CACnC;AAED,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAIvB;CACF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAO7E"}
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
// packages/core/src/queue/queue-backend.ts — Backend-agnostic queue seam; GitHub-labels is today's only implementation (#1499).
|
|
1
|
+
// packages/core/src/queue/queue-backend.ts — Backend-agnostic queue seam speaking WorkKey; GitHub-labels is today's only implementation (#1499, #3890).
|
|
2
2
|
import { pollBlockedParks } from '../blockers/poller.js';
|
|
3
3
|
import { createGithubQueue, } from './github-queue.js';
|
|
4
|
+
import { issueNumberOf, workKeyFromIssue } from '../work/work-key.js';
|
|
4
5
|
import { releaseStaleClaims } from './stale-claims.js';
|
|
5
6
|
export function createGithubQueueBackend(options) {
|
|
6
7
|
const { client, owner, repo, now } = options;
|
|
7
8
|
const queue = createGithubQueue(options);
|
|
9
|
+
async function claimNext(lane) {
|
|
10
|
+
const claim = await queue.claimNext(lane);
|
|
11
|
+
return claim === null ? null : { key: workKeyFromIssue(claim.issue), decision: claim.decision };
|
|
12
|
+
}
|
|
8
13
|
async function list(lane) {
|
|
9
14
|
if (lane !== undefined)
|
|
10
|
-
return queue.list(lane);
|
|
11
|
-
const
|
|
15
|
+
return (await queue.list(lane)).map(workKeyFromIssue);
|
|
16
|
+
const keys = [];
|
|
12
17
|
for (const l of await queue.lanes()) {
|
|
13
|
-
|
|
18
|
+
keys.push(...(await queue.list(l)).map(workKeyFromIssue));
|
|
14
19
|
}
|
|
15
|
-
return
|
|
20
|
+
return keys;
|
|
16
21
|
}
|
|
17
22
|
async function reap() {
|
|
18
23
|
return releaseStaleClaims({ client, owner, repo, now });
|
|
@@ -22,6 +27,30 @@ export function createGithubQueueBackend(options) {
|
|
|
22
27
|
return [];
|
|
23
28
|
return pollBlockedParks({ client, owner, repo, store: options.blockedParks });
|
|
24
29
|
}
|
|
25
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
claimNext,
|
|
32
|
+
release: async (key, outcome) => queue.release(issueNumberOf(key), outcome),
|
|
33
|
+
heartbeat: async (key) => queue.heartbeat(issueNumberOf(key)),
|
|
34
|
+
list,
|
|
35
|
+
lanes: () => queue.lanes(),
|
|
36
|
+
reap,
|
|
37
|
+
pollBlockedParks: pollParks,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export class UnsupportedQueueBackendError extends Error {
|
|
41
|
+
kind;
|
|
42
|
+
constructor(kind) {
|
|
43
|
+
super(`unsupported queue backend "${kind}" — supported: github`);
|
|
44
|
+
this.name = 'UnsupportedQueueBackendError';
|
|
45
|
+
this.kind = kind;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function createQueueBackend(options) {
|
|
49
|
+
switch (options.kind) {
|
|
50
|
+
case 'github':
|
|
51
|
+
return createGithubQueueBackend(options.github);
|
|
52
|
+
default:
|
|
53
|
+
throw new UnsupportedQueueBackendError(String(options.kind));
|
|
54
|
+
}
|
|
26
55
|
}
|
|
27
56
|
//# sourceMappingURL=queue-backend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue-backend.js","sourceRoot":"","sources":["../../src/queue/queue-backend.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"queue-backend.js","sourceRoot":"","sources":["../../src/queue/queue-backend.ts"],"names":[],"mappings":"AAAA,wJAAwJ;AAExJ,OAAO,EAAqD,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EACL,iBAAiB,GAIlB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAgB,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAA0B,MAAM,mBAAmB,CAAC;AA0B/E,MAAM,UAAU,wBAAwB,CAAC,OAAkC;IACzE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAC7C,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEzC,KAAK,UAAU,SAAS,CAAC,IAAY;QACnC,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAClG,CAAC;IAED,KAAK,UAAU,IAAI,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,IAAI,CAAS;IAEtB,YAAY,IAAY;QACtB,KAAK,CAAC,8BAA8B,IAAI,uBAAuB,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD;YACE,MAAM,IAAI,4BAA4B,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Octokit } from '@octokit/rest';
|
|
2
|
+
import type { RunStatus } from '../types/index.js';
|
|
3
|
+
import { type WorkKey } from '../work/work-key.js';
|
|
4
|
+
export declare const PR_RUN_STATE_VERSION = "v1";
|
|
5
|
+
export declare const PR_RUN_STATUSES: readonly ['building', 'awaiting-ci', 'awaiting-review', 'parked'];
|
|
6
|
+
export type PrRunStatus = (typeof PR_RUN_STATUSES)[number];
|
|
7
|
+
export declare const SPEC_SUMMARY_MAX = 1000;
|
|
8
|
+
export declare const MAX_HANDLED_IDS = 200;
|
|
9
|
+
export declare const MAX_ROUNDS = 50;
|
|
10
|
+
export declare const MAX_ENCODED_CHARS = 60000;
|
|
11
|
+
export declare function prRunStateMarker(key: WorkKey): string;
|
|
12
|
+
export interface PrRunRound {
|
|
13
|
+
kind: 'check' | 'review' | 'ci';
|
|
14
|
+
id?: number;
|
|
15
|
+
headSha: string;
|
|
16
|
+
at: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PrRunState {
|
|
19
|
+
version: 1;
|
|
20
|
+
key: WorkKey;
|
|
21
|
+
prNumber: number;
|
|
22
|
+
status: PrRunStatus;
|
|
23
|
+
spec: {
|
|
24
|
+
sha256: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
};
|
|
27
|
+
checkRework: {
|
|
28
|
+
used: number;
|
|
29
|
+
cap: number;
|
|
30
|
+
};
|
|
31
|
+
reviewRework: {
|
|
32
|
+
used: number;
|
|
33
|
+
cap: number;
|
|
34
|
+
};
|
|
35
|
+
handledReviewIds: number[];
|
|
36
|
+
handledCommentIds: number[];
|
|
37
|
+
rounds: PrRunRound[];
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
}
|
|
40
|
+
export type PrRunStateRejectReason = 'untrusted-author' | 'digest-mismatch' | 'key-mismatch' | 'malformed' | 'identity-unavailable';
|
|
41
|
+
export interface PrStateComment {
|
|
42
|
+
id: number;
|
|
43
|
+
authorId: number | undefined;
|
|
44
|
+
body: string;
|
|
45
|
+
}
|
|
46
|
+
type Ignored = {
|
|
47
|
+
commentId: number;
|
|
48
|
+
reason: PrRunStateRejectReason;
|
|
49
|
+
}[];
|
|
50
|
+
export type PrRunStateLoad = {
|
|
51
|
+
status: 'found';
|
|
52
|
+
commentId: number;
|
|
53
|
+
state: PrRunState;
|
|
54
|
+
ignored: Ignored;
|
|
55
|
+
} | {
|
|
56
|
+
status: 'none';
|
|
57
|
+
ignored: Ignored;
|
|
58
|
+
};
|
|
59
|
+
/** Allow-list step: rebuilds the state from known fields only, redacts the summary and bounds every list. */
|
|
60
|
+
export declare function sanitizePrRunState(state: PrRunState, maxIds?: number, maxRounds?: number): PrRunState;
|
|
61
|
+
/** The hidden marker block for a state; halves rounds and handled ids until it fits one comment. */
|
|
62
|
+
export declare function encodePrRunState(state: PrRunState): string;
|
|
63
|
+
export declare function decodePrRunState(body: string, key: WorkKey): {
|
|
64
|
+
ok: true;
|
|
65
|
+
state: PrRunState;
|
|
66
|
+
} | {
|
|
67
|
+
ok: false;
|
|
68
|
+
reason: PrRunStateRejectReason;
|
|
69
|
+
} | null;
|
|
70
|
+
/**
|
|
71
|
+
* Picks the state to trust: only a comment by `selfId` (the authenticated identity) is decoded. Lowest comment id
|
|
72
|
+
* wins, as in `readParkState`. An unknown identity fails closed: every marker comment is ignored.
|
|
73
|
+
*/
|
|
74
|
+
export declare function selectTrustedPrRunState(comments: readonly PrStateComment[], selfId: number | undefined, key: WorkKey): PrRunStateLoad;
|
|
75
|
+
/**
|
|
76
|
+
* Monotonic merge of local and remote state. `used` counters take the max (a restore can only raise them, never
|
|
77
|
+
* reset a cap), `cap` comes from local because local config is current, handled ids and rounds are unioned (rounds
|
|
78
|
+
* deduped by kind+id+headSha, sorted by `at`), and `status`, `spec` and `prNumber` come from the side with the
|
|
79
|
+
* later `updatedAt`. One missing side returns the other.
|
|
80
|
+
*/
|
|
81
|
+
export declare function reconcilePrRunState(local: PrRunState | null, remote: PrRunState | null): PrRunState | null;
|
|
82
|
+
export declare function prRunStatusFor(status: RunStatus, ciPending?: boolean): PrRunStatus;
|
|
83
|
+
export declare function loadPrRunState(deps: {
|
|
84
|
+
octokit: Pick<Octokit, 'rest'>;
|
|
85
|
+
repo: string;
|
|
86
|
+
prNumber: number;
|
|
87
|
+
key: WorkKey;
|
|
88
|
+
}): Promise<PrRunStateLoad>;
|
|
89
|
+
export declare function savePrRunState(deps: {
|
|
90
|
+
octokit: Octokit;
|
|
91
|
+
repo: string;
|
|
92
|
+
prNumber: number;
|
|
93
|
+
state: PrRunState;
|
|
94
|
+
}): Promise<{
|
|
95
|
+
commentId: number;
|
|
96
|
+
created: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=pr-run-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-run-state.d.ts","sourceRoot":"","sources":["../../src/run/pr-run-state.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,qBAAqB,CA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