@hearsay-tools/squawk 0.18.0-pr4129.7939 → 0.18.0-pr4130.7946
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/automations/service.js +3 -2
- package/dist/automations/service.js.map +1 -1
- package/dist/automations/store.d.ts +2 -0
- package/dist/automations/store.js +35 -3
- package/dist/automations/store.js.map +1 -1
- package/dist/ci-wait/controller.d.ts +42 -42
- package/dist/ci-wait/tools.d.ts +4 -4
- package/dist/delegation/transport.d.ts +65 -65
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/provider-sign-in-routes.d.ts +2 -2
- package/dist/server/repo-branch-forge.js +10 -38
- package/dist/server/repo-branch-forge.js.map +1 -1
- package/dist/server/repo-branches.js +17 -28
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runners-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1436 -1436
- package/dist/server/server.js +23 -26
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/dist/server/bounded-read-cache.d.ts +0 -10
- package/dist/server/bounded-read-cache.js +0 -54
- package/dist/server/bounded-read-cache.js.map +0 -1
- package/dist/server/repo-read-cache.d.ts +0 -22
- package/dist/server/repo-read-cache.js +0 -51
- package/dist/server/repo-read-cache.js.map +0 -1
- package/dist/server/worktree-size-cache.d.ts +0 -3
- package/dist/server/worktree-size-cache.js +0 -8
- package/dist/server/worktree-size-cache.js.map +0 -1
|
@@ -2,18 +2,6 @@ import type { DelegationRoutes } from './routes.ts';
|
|
|
2
2
|
export declare function createDelegationApp(routes: DelegationRoutes): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
|
|
3
3
|
"/list": {
|
|
4
4
|
$get: {
|
|
5
|
-
output: {
|
|
6
|
-
error: string;
|
|
7
|
-
code?: "invalid_input" | undefined;
|
|
8
|
-
};
|
|
9
|
-
outputFormat: "json";
|
|
10
|
-
status: 400;
|
|
11
|
-
input: {
|
|
12
|
-
query: {
|
|
13
|
-
offset?: string | undefined;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
} | {
|
|
17
5
|
output: {
|
|
18
6
|
workers: {
|
|
19
7
|
workerId: string;
|
|
@@ -60,6 +48,18 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
60
48
|
offset?: string | undefined;
|
|
61
49
|
};
|
|
62
50
|
};
|
|
51
|
+
} | {
|
|
52
|
+
output: {
|
|
53
|
+
error: string;
|
|
54
|
+
code?: "invalid_input" | undefined;
|
|
55
|
+
};
|
|
56
|
+
outputFormat: "json";
|
|
57
|
+
status: 400;
|
|
58
|
+
input: {
|
|
59
|
+
query: {
|
|
60
|
+
offset?: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
} & {
|
|
@@ -604,18 +604,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
604
604
|
} & {
|
|
605
605
|
"/:workerId": {
|
|
606
606
|
$get: {
|
|
607
|
-
output: {
|
|
608
|
-
error: string;
|
|
609
|
-
code?: "invalid_input" | undefined;
|
|
610
|
-
};
|
|
611
|
-
outputFormat: "json";
|
|
612
|
-
status: 400;
|
|
613
|
-
input: {
|
|
614
|
-
param: {
|
|
615
|
-
workerId: string;
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
} | {
|
|
619
607
|
output: {
|
|
620
608
|
workerId: string;
|
|
621
609
|
settled: boolean;
|
|
@@ -733,11 +721,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
733
721
|
workerId: string;
|
|
734
722
|
};
|
|
735
723
|
};
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
} & {
|
|
739
|
-
"/:workerId/collect": {
|
|
740
|
-
$post: {
|
|
724
|
+
} | {
|
|
741
725
|
output: {
|
|
742
726
|
error: string;
|
|
743
727
|
code?: "invalid_input" | undefined;
|
|
@@ -748,10 +732,12 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
748
732
|
param: {
|
|
749
733
|
workerId: string;
|
|
750
734
|
};
|
|
751
|
-
} & {
|
|
752
|
-
json: Record<string, never>;
|
|
753
735
|
};
|
|
754
|
-
}
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
} & {
|
|
739
|
+
"/:workerId/collect": {
|
|
740
|
+
$post: {
|
|
755
741
|
output: {
|
|
756
742
|
workerId: string;
|
|
757
743
|
parentRunId: string;
|
|
@@ -874,11 +860,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
874
860
|
} & {
|
|
875
861
|
json: Record<string, never>;
|
|
876
862
|
};
|
|
877
|
-
}
|
|
878
|
-
};
|
|
879
|
-
} & {
|
|
880
|
-
"/:workerId/steer": {
|
|
881
|
-
$post: {
|
|
863
|
+
} | {
|
|
882
864
|
output: {
|
|
883
865
|
error: string;
|
|
884
866
|
code?: "invalid_input" | undefined;
|
|
@@ -890,11 +872,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
890
872
|
workerId: string;
|
|
891
873
|
};
|
|
892
874
|
} & {
|
|
893
|
-
json:
|
|
894
|
-
text: string;
|
|
895
|
-
};
|
|
875
|
+
json: Record<string, never>;
|
|
896
876
|
};
|
|
897
|
-
}
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
} & {
|
|
880
|
+
"/:workerId/steer": {
|
|
881
|
+
$post: {
|
|
898
882
|
output: {
|
|
899
883
|
workerId: string;
|
|
900
884
|
state: "delivered" | "queued";
|
|
@@ -910,11 +894,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
910
894
|
text: string;
|
|
911
895
|
};
|
|
912
896
|
};
|
|
913
|
-
}
|
|
914
|
-
};
|
|
915
|
-
} & {
|
|
916
|
-
"/:workerId/stop": {
|
|
917
|
-
$post: {
|
|
897
|
+
} | {
|
|
918
898
|
output: {
|
|
919
899
|
error: string;
|
|
920
900
|
code?: "invalid_input" | undefined;
|
|
@@ -926,9 +906,15 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
926
906
|
workerId: string;
|
|
927
907
|
};
|
|
928
908
|
} & {
|
|
929
|
-
json:
|
|
909
|
+
json: {
|
|
910
|
+
text: string;
|
|
911
|
+
};
|
|
930
912
|
};
|
|
931
|
-
}
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
} & {
|
|
916
|
+
"/:workerId/stop": {
|
|
917
|
+
$post: {
|
|
932
918
|
output: {
|
|
933
919
|
workerId: string;
|
|
934
920
|
state: "stopping" | "terminated";
|
|
@@ -942,11 +928,7 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
942
928
|
} & {
|
|
943
929
|
json: Record<string, never>;
|
|
944
930
|
};
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
} & {
|
|
948
|
-
"/:workerId/destroy": {
|
|
949
|
-
$post: {
|
|
931
|
+
} | {
|
|
950
932
|
output: {
|
|
951
933
|
error: string;
|
|
952
934
|
code?: "invalid_input" | undefined;
|
|
@@ -958,11 +940,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
958
940
|
workerId: string;
|
|
959
941
|
};
|
|
960
942
|
} & {
|
|
961
|
-
json:
|
|
962
|
-
discardWork?: true | undefined;
|
|
963
|
-
};
|
|
943
|
+
json: Record<string, never>;
|
|
964
944
|
};
|
|
965
|
-
}
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
} & {
|
|
948
|
+
"/:workerId/destroy": {
|
|
949
|
+
$post: {
|
|
966
950
|
output: {
|
|
967
951
|
workerId: string;
|
|
968
952
|
state: "complete" | "incomplete";
|
|
@@ -991,6 +975,22 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
991
975
|
discardWork?: true | undefined;
|
|
992
976
|
};
|
|
993
977
|
};
|
|
978
|
+
} | {
|
|
979
|
+
output: {
|
|
980
|
+
error: string;
|
|
981
|
+
code?: "invalid_input" | undefined;
|
|
982
|
+
};
|
|
983
|
+
outputFormat: "json";
|
|
984
|
+
status: 400;
|
|
985
|
+
input: {
|
|
986
|
+
param: {
|
|
987
|
+
workerId: string;
|
|
988
|
+
};
|
|
989
|
+
} & {
|
|
990
|
+
json: {
|
|
991
|
+
discardWork?: true | undefined;
|
|
992
|
+
};
|
|
993
|
+
};
|
|
994
994
|
} | {
|
|
995
995
|
output: {
|
|
996
996
|
workerId: string;
|
|
@@ -1026,11 +1026,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1026
1026
|
"/:workerId/diff": {
|
|
1027
1027
|
$get: {
|
|
1028
1028
|
output: {
|
|
1029
|
-
|
|
1030
|
-
|
|
1029
|
+
workerId: string;
|
|
1030
|
+
baselineSha: string;
|
|
1031
|
+
diff: string;
|
|
1032
|
+
truncated: boolean;
|
|
1031
1033
|
};
|
|
1032
1034
|
outputFormat: "json";
|
|
1033
|
-
status:
|
|
1035
|
+
status: 200;
|
|
1034
1036
|
input: {
|
|
1035
1037
|
param: {
|
|
1036
1038
|
workerId: string;
|
|
@@ -1038,13 +1040,11 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
1038
1040
|
};
|
|
1039
1041
|
} | {
|
|
1040
1042
|
output: {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
diff: string;
|
|
1044
|
-
truncated: boolean;
|
|
1043
|
+
error: string;
|
|
1044
|
+
code?: "invalid_input" | undefined;
|
|
1045
1045
|
};
|
|
1046
1046
|
outputFormat: "json";
|
|
1047
|
-
status:
|
|
1047
|
+
status: 400;
|
|
1048
1048
|
input: {
|
|
1049
1049
|
param: {
|
|
1050
1050
|
workerId: string;
|
|
@@ -58,6 +58,29 @@ export declare function ciProgressPlugs(): {
|
|
|
58
58
|
export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
|
|
59
59
|
"/workspace/activity": {
|
|
60
60
|
$get: {
|
|
61
|
+
output: {
|
|
62
|
+
error: string;
|
|
63
|
+
code?: "invalid_input" | undefined;
|
|
64
|
+
};
|
|
65
|
+
outputFormat: "json";
|
|
66
|
+
status: 400;
|
|
67
|
+
input: {
|
|
68
|
+
query: {
|
|
69
|
+
project?: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
} | {
|
|
73
|
+
output: {
|
|
74
|
+
error: string;
|
|
75
|
+
};
|
|
76
|
+
outputFormat: "json";
|
|
77
|
+
status: 404 | 409 | 503;
|
|
78
|
+
input: {
|
|
79
|
+
query: {
|
|
80
|
+
project?: string | undefined;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
61
84
|
output: {
|
|
62
85
|
generatedAt: string;
|
|
63
86
|
projects: {
|
|
@@ -288,29 +311,6 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
|
|
|
288
311
|
project?: string | undefined;
|
|
289
312
|
};
|
|
290
313
|
};
|
|
291
|
-
} | {
|
|
292
|
-
output: {
|
|
293
|
-
error: string;
|
|
294
|
-
code?: "invalid_input" | undefined;
|
|
295
|
-
};
|
|
296
|
-
outputFormat: "json";
|
|
297
|
-
status: 400;
|
|
298
|
-
input: {
|
|
299
|
-
query: {
|
|
300
|
-
project?: string | undefined;
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
} | {
|
|
304
|
-
output: {
|
|
305
|
-
error: string;
|
|
306
|
-
};
|
|
307
|
-
outputFormat: "json";
|
|
308
|
-
status: 404 | 409 | 503;
|
|
309
|
-
input: {
|
|
310
|
-
query: {
|
|
311
|
-
project?: string | undefined;
|
|
312
|
-
};
|
|
313
|
-
};
|
|
314
314
|
};
|
|
315
315
|
};
|
|
316
316
|
}, "/", "/workspace/activity">;
|
|
@@ -30,19 +30,10 @@ export declare function createModelsRoutes(options: {
|
|
|
30
30
|
};
|
|
31
31
|
} | {
|
|
32
32
|
output: {
|
|
33
|
-
|
|
34
|
-
models: {
|
|
35
|
-
id: string;
|
|
36
|
-
label: string;
|
|
37
|
-
description: string;
|
|
38
|
-
effortLevels?: import('../contract/index.js').EffortLevel[];
|
|
39
|
-
}[];
|
|
40
|
-
source: import("../core/runner-model-catalog.ts").ModelCatalogSource;
|
|
41
|
-
stale: boolean;
|
|
42
|
-
reason?: string;
|
|
33
|
+
error: string;
|
|
43
34
|
};
|
|
44
35
|
outputFormat: "json";
|
|
45
|
-
status:
|
|
36
|
+
status: 400;
|
|
46
37
|
input: {
|
|
47
38
|
query: {
|
|
48
39
|
runner: string | string[];
|
|
@@ -63,10 +54,19 @@ export declare function createModelsRoutes(options: {
|
|
|
63
54
|
};
|
|
64
55
|
} | {
|
|
65
56
|
output: {
|
|
66
|
-
|
|
57
|
+
runner: string;
|
|
58
|
+
models: {
|
|
59
|
+
id: string;
|
|
60
|
+
label: string;
|
|
61
|
+
description: string;
|
|
62
|
+
effortLevels?: import('../contract/index.js').EffortLevel[];
|
|
63
|
+
}[];
|
|
64
|
+
source: import("../core/runner-model-catalog.ts").ModelCatalogSource;
|
|
65
|
+
stale: boolean;
|
|
66
|
+
reason?: string;
|
|
67
67
|
};
|
|
68
68
|
outputFormat: "json";
|
|
69
|
-
status:
|
|
69
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
70
70
|
input: {
|
|
71
71
|
query: {
|
|
72
72
|
runner: string | string[];
|
|
@@ -18,7 +18,7 @@ export declare function createProviderSignInRoutes(options: {
|
|
|
18
18
|
error: string;
|
|
19
19
|
};
|
|
20
20
|
outputFormat: "json";
|
|
21
|
-
status:
|
|
21
|
+
status: 409;
|
|
22
22
|
input: {
|
|
23
23
|
json: {
|
|
24
24
|
provider: string;
|
|
@@ -30,7 +30,7 @@ export declare function createProviderSignInRoutes(options: {
|
|
|
30
30
|
error: string;
|
|
31
31
|
};
|
|
32
32
|
outputFormat: "json";
|
|
33
|
-
status:
|
|
33
|
+
status: 400;
|
|
34
34
|
input: {
|
|
35
35
|
json: {
|
|
36
36
|
provider: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readQueue } from './bounded-read-cache.js';
|
|
2
1
|
import { productEnv } from '../core/product-env.js';
|
|
3
2
|
/**
|
|
4
3
|
* What branch classification asks GitHub: the states of the PRs runs created, and every PR whose
|
|
@@ -94,8 +93,6 @@ function defaultGraphql(repoRoot) {
|
|
|
94
93
|
return stdout;
|
|
95
94
|
};
|
|
96
95
|
}
|
|
97
|
-
const headQueue = readQueue(4);
|
|
98
|
-
const headFlights = new Map();
|
|
99
96
|
const headCache = new Map();
|
|
100
97
|
/** The default forge: the ref-status cache for created PRs, and per-head GraphQL lookups with a
|
|
101
98
|
* one-minute cache per head. `CEZ_DRY_RUN=1` never shells out. */
|
|
@@ -105,8 +102,8 @@ export function createGithubBranchForge(deps = {}) {
|
|
|
105
102
|
return {
|
|
106
103
|
async prStates(repoRoot, numbers) {
|
|
107
104
|
const states = {};
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
for (let i = 0; i < numbers.length; i += GH_REF_STATUS_MAX) {
|
|
106
|
+
const data = await resolveForgeRoot(repoRoot, deps.forgeFactory).refStatus({ prs: numbers.slice(i, i + GH_REF_STATUS_MAX) });
|
|
110
107
|
if (!data.available)
|
|
111
108
|
return { available: false, states };
|
|
112
109
|
for (const [n, status] of Object.entries(data.prs))
|
|
@@ -136,43 +133,19 @@ export function createGithubBranchForge(deps = {}) {
|
|
|
136
133
|
const run = graphql(repoRoot);
|
|
137
134
|
const incomplete = new Set();
|
|
138
135
|
let failed = false;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const flight = headFlights.get(`${repoRoot}\0${head}`);
|
|
142
|
-
if (flight)
|
|
143
|
-
batches.add(flight);
|
|
144
|
-
return !flight;
|
|
145
|
-
});
|
|
146
|
-
for (let i = 0; i < fresh.length; i += HEADS_PER_QUERY) {
|
|
147
|
-
const chunk = fresh.slice(i, i + HEADS_PER_QUERY);
|
|
148
|
-
const flight = headQueue(() => fetchHeadBatch(run, handle.owner, handle.name, chunk)).then((batch) => {
|
|
149
|
-
for (const [head, found] of batch.complete) {
|
|
150
|
-
headCache.delete(`${repoRoot}\0${head}`);
|
|
151
|
-
headCache.set(`${repoRoot}\0${head}`, { at: Date.now(), prs: found });
|
|
152
|
-
}
|
|
153
|
-
while (headCache.size > HEAD_CACHE_MAX)
|
|
154
|
-
headCache.delete(headCache.keys().next().value);
|
|
155
|
-
return batch;
|
|
156
|
-
});
|
|
157
|
-
for (const head of chunk)
|
|
158
|
-
headFlights.set(`${repoRoot}\0${head}`, flight);
|
|
159
|
-
batches.add(flight);
|
|
160
|
-
void flight.finally(() => {
|
|
161
|
-
for (const head of chunk)
|
|
162
|
-
if (headFlights.get(`${repoRoot}\0${head}`) === flight)
|
|
163
|
-
headFlights.delete(`${repoRoot}\0${head}`);
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
for (const batch of await Promise.all(batches)) {
|
|
136
|
+
for (let i = 0; i < misses.length; i += HEADS_PER_QUERY) {
|
|
137
|
+
const batch = await fetchHeadBatch(run, handle.owner, handle.name, misses.slice(i, i + HEADS_PER_QUERY));
|
|
167
138
|
failed ||= batch.failed;
|
|
168
139
|
for (const head of batch.incomplete)
|
|
169
|
-
|
|
170
|
-
incomplete.add(head);
|
|
140
|
+
incomplete.add(head);
|
|
171
141
|
for (const [head, found] of batch.complete) {
|
|
172
|
-
|
|
173
|
-
|
|
142
|
+
prs.push(...found);
|
|
143
|
+
headCache.delete(`${repoRoot}\0${head}`);
|
|
144
|
+
headCache.set(`${repoRoot}\0${head}`, { at: Date.now(), prs: found });
|
|
174
145
|
}
|
|
175
146
|
}
|
|
147
|
+
while (headCache.size > HEAD_CACHE_MAX)
|
|
148
|
+
headCache.delete(headCache.keys().next().value);
|
|
176
149
|
return { available: !failed, prs, incomplete };
|
|
177
150
|
},
|
|
178
151
|
};
|
|
@@ -181,6 +154,5 @@ export const githubBranchForge = createGithubBranchForge();
|
|
|
181
154
|
/** Test-only: forget cached per-head answers. */
|
|
182
155
|
export function __clearPrListCacheForTests() {
|
|
183
156
|
headCache.clear();
|
|
184
|
-
headFlights.clear();
|
|
185
157
|
}
|
|
186
158
|
//# sourceMappingURL=repo-branch-forge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-branch-forge.js","sourceRoot":"","sources":["../../src/server/repo-branch-forge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"repo-branch-forge.js","sourceRoot":"","sources":["../../src/server/repo-branch-forge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAsB,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAA2C,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAoCjC,SAAS,SAAS,CAAC,MAAuB;IACxC,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACzC,IAAI,MAAM,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,GAAG,EAAE,CAAC,CA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AE,CAAC;AAExE,iDAAiD;AACjD,MAAM,UAAU,0BAA0B;IACxC,SAAS,CAAC,KAAK,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -125,18 +125,18 @@ function runBranch(run) {
|
|
|
125
125
|
* the run store again. Deleting a branch drops its reflog, so a reflog commit nothing else keeps
|
|
126
126
|
* leaves the branch protected.
|
|
127
127
|
*/
|
|
128
|
-
async function releasedReceiptBranches(root, protection,
|
|
128
|
+
async function releasedReceiptBranches(root, protection, runs, heads) {
|
|
129
129
|
const released = new Map();
|
|
130
|
-
|
|
130
|
+
for (const head of heads) {
|
|
131
131
|
if (head.symbolic || !protection.branches.has(head.name))
|
|
132
|
-
|
|
133
|
-
const owners =
|
|
132
|
+
continue;
|
|
133
|
+
const owners = runs.filter((run) => runBranch(run) === head.name);
|
|
134
134
|
if (!owners.every((run) => run.endedWorker))
|
|
135
|
-
|
|
135
|
+
continue;
|
|
136
136
|
const proof = await reflogWitnesses(root, head.name, head.sha);
|
|
137
137
|
if (proof)
|
|
138
138
|
released.set(head.name, { orphan: owners.length === 0, ...proof });
|
|
139
|
-
}
|
|
139
|
+
}
|
|
140
140
|
return released;
|
|
141
141
|
}
|
|
142
142
|
/** One `verify` line per ref: git refuses two updates of one ref in a transaction. Null when one ref
|
|
@@ -401,44 +401,33 @@ function selectDisplayedPrs(rows, byHead, prByBranch) {
|
|
|
401
401
|
async function mergedPrBranches(root, prBase, baseSha, rows, byHead) {
|
|
402
402
|
const merged = new Map();
|
|
403
403
|
const onBase = async (sha) => !!sha && !!baseSha && FULL_SHA.test(sha) && (await git(root, ['merge-base', '--is-ancestor', sha, baseSha])).ok;
|
|
404
|
-
const
|
|
405
|
-
await Promise.all(rows.map(async (d) => {
|
|
404
|
+
for (const d of rows) {
|
|
406
405
|
for (const pr of byHead.get(d.head.name) ?? []) {
|
|
407
406
|
if (pr.state !== 'merged' || pr.baseRefName !== prBase || pr.headRefOid !== d.head.sha)
|
|
408
407
|
continue;
|
|
409
|
-
if (
|
|
410
|
-
checks.set(pr.mergeCommitOid, onBase(pr.mergeCommitOid));
|
|
411
|
-
if (await checks.get(pr.mergeCommitOid))
|
|
408
|
+
if (await onBase(pr.mergeCommitOid))
|
|
412
409
|
merged.set(d.head.name, [...(merged.get(d.head.name) ?? []), pr]);
|
|
413
410
|
}
|
|
414
|
-
}
|
|
411
|
+
}
|
|
415
412
|
return merged;
|
|
416
413
|
}
|
|
417
414
|
/** PR state for the rows ancestry left open (`pending`) and for the non-task branches that may be
|
|
418
415
|
* a run's PR branch (`named`). Every head is asked on its own, so evidence never falls off the end
|
|
419
416
|
* of a list; `incomplete` names each head GitHub did not answer in full. */
|
|
420
|
-
async function branchPrState(input, drafts, pending, named, prBase, baseSha
|
|
421
|
-
const displayPrs = options?.diffStats !== false;
|
|
417
|
+
async function branchPrState(input, drafts, pending, named, prBase, baseSha) {
|
|
422
418
|
const empty = { prByBranch: new Map(), mergedByPr: new Map(), incomplete: new Set() };
|
|
423
419
|
if (pending.length === 0 && named.length === 0)
|
|
424
420
|
return { ...empty, prStateKnown: true };
|
|
425
421
|
if (!input.hasRemote)
|
|
426
422
|
return { ...empty, prStateKnown: false };
|
|
427
|
-
const taskRows =
|
|
428
|
-
const
|
|
429
|
-
const initialHeads = [...needHeads, ...named].map((d) => d.head.name);
|
|
430
|
-
const [recorded, initial] = await Promise.all([
|
|
431
|
-
recordedPrs(input, taskRows),
|
|
432
|
-
initialHeads.length > 0 ? input.forge.prsForHeads(input.root, initialHeads) : Promise.resolve({ available: true, prs: [], incomplete: new Set() }),
|
|
433
|
-
]);
|
|
434
|
-
const { created, needList, prByBranch, available } = recorded;
|
|
423
|
+
const taskRows = drafts.filter((d) => d.head.name.startsWith(TASK_PREFIX));
|
|
424
|
+
const { created, needList, prByBranch, available } = await recordedPrs(input, taskRows);
|
|
435
425
|
// Settled recorded PRs need the lookup for both the merge verdict and replacement display.
|
|
436
426
|
const recordedSettled = pending.filter((d) => created.size > 0 && settled(prByBranch.get(d.head.name)?.state));
|
|
437
|
-
const asked = recordedSettled.map((d) => d.head.name);
|
|
438
|
-
const
|
|
427
|
+
const asked = [...needList, ...recordedSettled, ...named].map((d) => d.head.name);
|
|
428
|
+
const list = asked.length > 0
|
|
439
429
|
? await input.forge.prsForHeads(input.root, asked)
|
|
440
430
|
: { available: true, prs: [], incomplete: new Set() };
|
|
441
|
-
const list = { available: initial.available && extra.available, prs: [...initial.prs, ...extra.prs], incomplete: new Set([...initial.incomplete, ...extra.incomplete]) };
|
|
442
431
|
const byHead = new Map();
|
|
443
432
|
for (const pr of list.prs)
|
|
444
433
|
byHead.set(pr.headRefName, [...(byHead.get(pr.headRefName) ?? []), pr]);
|
|
@@ -460,6 +449,8 @@ export async function classifyBranches(input, options) {
|
|
|
460
449
|
ownedCleanupProtection(root),
|
|
461
450
|
]);
|
|
462
451
|
const ahead = await aheadCounts(root, heads, baseSha);
|
|
452
|
+
const released = await releasedReceiptBranches(root, protection, input.runs, heads);
|
|
453
|
+
const receiptHeld = new Set([...protection.branches].filter((name) => !released.has(name)));
|
|
463
454
|
const runsByBranch = new Map();
|
|
464
455
|
for (const run of input.runs) {
|
|
465
456
|
const branch = runBranch(run);
|
|
@@ -467,8 +458,6 @@ export async function classifyBranches(input, options) {
|
|
|
467
458
|
continue;
|
|
468
459
|
runsByBranch.set(branch, [...(runsByBranch.get(branch) ?? []), run]);
|
|
469
460
|
}
|
|
470
|
-
const released = await releasedReceiptBranches(root, protection, runsByBranch, heads);
|
|
471
|
-
const receiptHeld = new Set([...protection.branches].filter((name) => !released.has(name)));
|
|
472
461
|
const liveRun = (run) => input.isActive(run.id) || !isFinished(run);
|
|
473
462
|
const representative = (runs) => runs?.find(liveRun) ?? runs?.slice().sort((a, b) => (a.createdAt < b.createdAt ? 1 : -1))[0];
|
|
474
463
|
const drafts = heads.map((head) => {
|
|
@@ -508,7 +497,7 @@ export async function classifyBranches(input, options) {
|
|
|
508
497
|
if (run.pullRequestUrl)
|
|
509
498
|
byPrUrl.set(prKey(run.pullRequestUrl), run);
|
|
510
499
|
const named = byPrUrl.size > 0 ? drafts.filter((d) => d.cls === 'other' && !d.head.symbolic) : [];
|
|
511
|
-
const { prByBranch, mergedByPr, incomplete, prStateKnown } = await branchPrState(input, drafts, pending, named, prBase, baseSha
|
|
500
|
+
const { prByBranch, mergedByPr, incomplete, prStateKnown } = await branchPrState(input, drafts, pending, named, prBase, baseSha);
|
|
512
501
|
for (const d of pending) {
|
|
513
502
|
if (mergedByPr.has(d.head.name))
|
|
514
503
|
d.cls = 'merged';
|