@hearsay-tools/squawk 0.19.0-pr4498.8903 → 0.19.0-pr4499.8906

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.
Files changed (129) hide show
  1. package/dist/boot.js +3 -2
  2. package/dist/boot.js.map +1 -1
  3. package/dist/built-in-forges.d.ts +8 -0
  4. package/dist/built-in-forges.js +15 -0
  5. package/dist/built-in-forges.js.map +1 -0
  6. package/dist/{features/github/ci-wait → ci-wait}/github.d.ts +4 -4
  7. package/dist/{features/github/ci-wait → ci-wait}/github.js +4 -4
  8. package/dist/ci-wait/github.js.map +1 -0
  9. package/dist/{features/github/ci-wait → ci-wait}/merge-progress.d.ts +1 -1
  10. package/dist/ci-wait/merge-progress.js.map +1 -0
  11. package/dist/contract/github.d.ts +0 -3
  12. package/dist/contract/index.js +0 -2
  13. package/dist/core/forge-registry.d.ts +0 -3
  14. package/dist/core/forge-registry.js +0 -3
  15. package/dist/core/forge-registry.js.map +1 -1
  16. package/dist/{features/github/merge-observations.d.ts → merge-observations.d.ts} +1 -1
  17. package/dist/{features/github/merge-observations.js → merge-observations.js} +2 -2
  18. package/dist/merge-observations.js.map +1 -0
  19. package/dist/plugin/index.d.ts +0 -2
  20. package/dist/plugin/index.js +0 -2
  21. package/dist/plugin/index.js.map +1 -1
  22. package/dist/{features/github → server/forge}/github-checks.js +2 -3
  23. package/dist/server/forge/github-checks.js.map +1 -0
  24. package/dist/{features/github → server/forge}/github-comments.js +2 -2
  25. package/dist/server/forge/github-comments.js.map +1 -0
  26. package/dist/server/forge/github-create-pr.js.map +1 -0
  27. package/dist/server/forge/github-filters.js.map +1 -0
  28. package/dist/{features/github → server/forge}/github-forge.js +4 -4
  29. package/dist/server/forge/github-forge.js.map +1 -0
  30. package/dist/{features/github → server/forge}/github-list.js +3 -3
  31. package/dist/server/forge/github-list.js.map +1 -0
  32. package/dist/server/forge/github-merge-requirements.js.map +1 -0
  33. package/dist/server/forge/github-merge-state.js.map +1 -0
  34. package/dist/server/forge/github-merged-pr-chunk.js.map +1 -0
  35. package/dist/{features/github → server/forge}/github-mutations.js +4 -4
  36. package/dist/server/forge/github-mutations.js.map +1 -0
  37. package/dist/{features/github → server/forge}/github-pr-diff.d.ts +2 -0
  38. package/dist/{features/github → server/forge}/github-pr-diff.js +4 -3
  39. package/dist/server/forge/github-pr-diff.js.map +1 -0
  40. package/dist/{features/github → server/forge}/github-ref-status-derive.js +1 -1
  41. package/dist/server/forge/github-ref-status-derive.js.map +1 -0
  42. package/dist/server/forge/github-ref-status-query.js.map +1 -0
  43. package/dist/{features/github → server/forge}/github-ref-status.js +1 -1
  44. package/dist/server/forge/github-ref-status.js.map +1 -0
  45. package/dist/server/forge/github-reviewer-ref.js.map +1 -0
  46. package/dist/{features/github → server/forge}/github-shared.js +2 -2
  47. package/dist/server/forge/github-shared.js.map +1 -0
  48. package/dist/server/forge/github-timeline.js.map +1 -0
  49. package/dist/{features/github → server/forge}/github.d.ts +3 -3
  50. package/dist/{features/github → server/forge}/github.js +6 -6
  51. package/dist/server/forge/github.js.map +1 -0
  52. package/dist/server/forge/index.d.ts +7 -0
  53. package/dist/server/forge/index.js +7 -0
  54. package/dist/server/forge/index.js.map +1 -0
  55. package/dist/{features/github → server/forge}/types.js.map +1 -1
  56. package/dist/server/forge-pr-states.d.ts +1 -1
  57. package/dist/server/forge-pr-states.js +1 -1
  58. package/dist/server/forge-pr-states.js.map +1 -1
  59. package/dist/server/github-routes.d.ts +1 -1
  60. package/dist/server/github-routes.js +5 -5
  61. package/dist/server/github-routes.js.map +1 -1
  62. package/dist/server/models-routes.d.ts +12 -12
  63. package/dist/server/projects-routes.d.ts +45 -45
  64. package/dist/server/repo-branch-forge.d.ts +28 -16
  65. package/dist/server/repo-branch-forge.js +167 -5
  66. package/dist/server/repo-branch-forge.js.map +1 -1
  67. package/dist/server/repo-branches.d.ts +1 -1
  68. package/dist/server/repo-branches.js +2 -2
  69. package/dist/server/repo-branches.js.map +1 -1
  70. package/dist/server/reports-api.d.ts +2 -2
  71. package/dist/server/runs-routes.d.ts +711 -711
  72. package/dist/server/server.d.ts +2 -2
  73. package/dist/server/workspace-live-routes.d.ts +6 -6
  74. package/package.json +4 -4
  75. package/scripts/benchmark-project-probes.mjs +3 -1
  76. package/dist/features/github/ci-wait/github.js.map +0 -1
  77. package/dist/features/github/ci-wait/merge-progress.js.map +0 -1
  78. package/dist/features/github/github-branch-forge.d.ts +0 -25
  79. package/dist/features/github/github-branch-forge.js +0 -164
  80. package/dist/features/github/github-branch-forge.js.map +0 -1
  81. package/dist/features/github/github-checks.js.map +0 -1
  82. package/dist/features/github/github-comments.js.map +0 -1
  83. package/dist/features/github/github-create-pr.js.map +0 -1
  84. package/dist/features/github/github-filters.js.map +0 -1
  85. package/dist/features/github/github-forge.js.map +0 -1
  86. package/dist/features/github/github-list.js.map +0 -1
  87. package/dist/features/github/github-merge-requirements.js.map +0 -1
  88. package/dist/features/github/github-merge-state.js.map +0 -1
  89. package/dist/features/github/github-merged-pr-chunk.js.map +0 -1
  90. package/dist/features/github/github-mutations.js.map +0 -1
  91. package/dist/features/github/github-pr-diff.js.map +0 -1
  92. package/dist/features/github/github-ref-status-derive.js.map +0 -1
  93. package/dist/features/github/github-ref-status-query.js.map +0 -1
  94. package/dist/features/github/github-ref-status.js.map +0 -1
  95. package/dist/features/github/github-reviewer-ref.js.map +0 -1
  96. package/dist/features/github/github-shared.js.map +0 -1
  97. package/dist/features/github/github-timeline.js.map +0 -1
  98. package/dist/features/github/github.js.map +0 -1
  99. package/dist/features/github/index.d.ts +0 -10
  100. package/dist/features/github/index.js +0 -6
  101. package/dist/features/github/index.js.map +0 -1
  102. package/dist/features/github/merge-observations.js.map +0 -1
  103. /package/dist/{features/github/ci-wait → ci-wait}/merge-progress.js +0 -0
  104. /package/dist/{features/github → server/forge}/github-checks.d.ts +0 -0
  105. /package/dist/{features/github → server/forge}/github-comments.d.ts +0 -0
  106. /package/dist/{features/github → server/forge}/github-create-pr.d.ts +0 -0
  107. /package/dist/{features/github → server/forge}/github-create-pr.js +0 -0
  108. /package/dist/{features/github → server/forge}/github-filters.d.ts +0 -0
  109. /package/dist/{features/github → server/forge}/github-filters.js +0 -0
  110. /package/dist/{features/github → server/forge}/github-forge.d.ts +0 -0
  111. /package/dist/{features/github → server/forge}/github-list.d.ts +0 -0
  112. /package/dist/{features/github → server/forge}/github-merge-requirements.d.ts +0 -0
  113. /package/dist/{features/github → server/forge}/github-merge-requirements.js +0 -0
  114. /package/dist/{features/github → server/forge}/github-merge-state.d.ts +0 -0
  115. /package/dist/{features/github → server/forge}/github-merge-state.js +0 -0
  116. /package/dist/{features/github → server/forge}/github-merged-pr-chunk.d.ts +0 -0
  117. /package/dist/{features/github → server/forge}/github-merged-pr-chunk.js +0 -0
  118. /package/dist/{features/github → server/forge}/github-mutations.d.ts +0 -0
  119. /package/dist/{features/github → server/forge}/github-ref-status-derive.d.ts +0 -0
  120. /package/dist/{features/github → server/forge}/github-ref-status-query.d.ts +0 -0
  121. /package/dist/{features/github → server/forge}/github-ref-status-query.js +0 -0
  122. /package/dist/{features/github → server/forge}/github-ref-status.d.ts +0 -0
  123. /package/dist/{features/github → server/forge}/github-reviewer-ref.d.ts +0 -0
  124. /package/dist/{features/github → server/forge}/github-reviewer-ref.js +0 -0
  125. /package/dist/{features/github → server/forge}/github-shared.d.ts +0 -0
  126. /package/dist/{features/github → server/forge}/github-timeline.d.ts +0 -0
  127. /package/dist/{features/github → server/forge}/github-timeline.js +0 -0
  128. /package/dist/{features/github → server/forge}/types.d.ts +0 -0
  129. /package/dist/{features/github → server/forge}/types.js +0 -0
@@ -63,17 +63,6 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
63
63
  } & {
64
64
  "/projects": {
65
65
  $post: {
66
- output: {
67
- error: string;
68
- };
69
- outputFormat: "json";
70
- status: 400 | 500;
71
- input: {
72
- json: {
73
- root: string;
74
- };
75
- };
76
- } | {
77
66
  output: {
78
67
  project: {
79
68
  id: string;
@@ -104,10 +93,10 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
104
93
  agent: boolean;
105
94
  }[] | undefined;
106
95
  };
107
- error: string;
96
+ error?: string | undefined;
108
97
  };
109
98
  outputFormat: "json";
110
- status: 409;
99
+ status: 200;
111
100
  input: {
112
101
  json: {
113
102
  root: string;
@@ -144,10 +133,21 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
144
133
  agent: boolean;
145
134
  }[] | undefined;
146
135
  };
147
- error?: string | undefined;
136
+ error: string;
148
137
  };
149
138
  outputFormat: "json";
150
- status: 200;
139
+ status: 409;
140
+ input: {
141
+ json: {
142
+ root: string;
143
+ };
144
+ };
145
+ } | {
146
+ output: {
147
+ error: string;
148
+ };
149
+ outputFormat: "json";
150
+ status: 400 | 500;
151
151
  input: {
152
152
  json: {
153
153
  root: string;
@@ -306,7 +306,7 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
306
306
  error: string;
307
307
  };
308
308
  outputFormat: "json";
309
- status: 404;
309
+ status: 400;
310
310
  input: {
311
311
  param: {
312
312
  projectId: string;
@@ -317,7 +317,7 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
317
317
  error: string;
318
318
  };
319
319
  outputFormat: "json";
320
- status: 400;
320
+ status: 404;
321
321
  input: {
322
322
  param: {
323
323
  projectId: string;
@@ -342,27 +342,6 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
342
342
  } & {
343
343
  "/projects/:projectId/webhooks": {
344
344
  $post: {
345
- output: {
346
- error: string;
347
- };
348
- outputFormat: "json";
349
- status: 400 | 404 | 409 | 500;
350
- input: {
351
- json: {
352
- name: string;
353
- description?: string | undefined;
354
- url: string;
355
- token?: string | undefined;
356
- tasks?: boolean | undefined;
357
- triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
358
- agent?: boolean | undefined;
359
- };
360
- } & {
361
- param: {
362
- projectId: string;
363
- };
364
- };
365
- } | {
366
345
  output: {
367
346
  project: {
368
347
  id: string;
@@ -421,6 +400,27 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
421
400
  projectId: string;
422
401
  };
423
402
  };
403
+ } | {
404
+ output: {
405
+ error: string;
406
+ };
407
+ outputFormat: "json";
408
+ status: 400 | 404 | 409 | 500;
409
+ input: {
410
+ json: {
411
+ name: string;
412
+ description?: string | undefined;
413
+ url: string;
414
+ token?: string | undefined;
415
+ tasks?: boolean | undefined;
416
+ triggers?: ("cancelled" | "done" | "failed" | "needs-you" | "running" | "waiting-ci" | "waiting-other" | "waiting-timer" | "waiting-workers")[] | undefined;
417
+ agent?: boolean | undefined;
418
+ };
419
+ } & {
420
+ param: {
421
+ projectId: string;
422
+ };
423
+ };
424
424
  };
425
425
  };
426
426
  } & {
@@ -618,13 +618,10 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
618
618
  };
619
619
  } | {
620
620
  output: {
621
- ok: boolean;
622
- status?: number | undefined;
623
- error?: string | undefined;
624
- dryRun?: boolean | undefined;
621
+ error: string;
625
622
  };
626
623
  outputFormat: "json";
627
- status: import("hono/utils/http-status").ContentfulStatusCode;
624
+ status: 404;
628
625
  input: {
629
626
  param: {
630
627
  projectId: string;
@@ -633,10 +630,13 @@ export declare function createProjectsRoutes(deps: ProjectsRouteDeps): import("h
633
630
  };
634
631
  } | {
635
632
  output: {
636
- error: string;
633
+ ok: boolean;
634
+ status?: number | undefined;
635
+ error?: string | undefined;
636
+ dryRun?: boolean | undefined;
637
637
  };
638
638
  outputFormat: "json";
639
- status: 404;
639
+ status: import("hono/utils/http-status").ContentfulStatusCode;
640
640
  input: {
641
641
  param: {
642
642
  projectId: string;
@@ -1,18 +1,14 @@
1
- /**
2
- * What branch classification asks the project's forge: the states of the PRs runs created, and
3
- * every PR whose head is one of the branches still in question. A head the forge did not answer
4
- * in full is reported, never read as "no PR".
5
- */
6
1
  import type { BranchPrState } from '../contract/index.js';
7
- import type { ForgeBranchPullRequest, ForgeHeadPullRequests, ForgeProjectClient } from '../core/forge-registry.ts';
2
+ import { type GraphqlRunner } from './forge/github.ts';
3
+ import type { ForgeBranchPullRequest, ForgeHeadPullRequests } from '../core/forge-registry.ts';
8
4
  import { type ProjectForgeResolver } from './project-forge.ts';
9
5
  export type ForgePr = ForgeBranchPullRequest;
10
- /** The PRs of some heads. `incomplete` names each head whose PRs the forge did not return in
11
- * full. `available` is false once the forge did not answer, which a classification must report
12
- * as unknown PR state. */
6
+ /** The PRs of some heads. `incomplete` names each head whose PRs GitHub did not return in full:
7
+ * its batch failed, or it has more PRs than one page holds. `available` is false once any batch
8
+ * failed: GitHub did not answer, which a classification must report as unknown PR state. */
13
9
  export type HeadPrs = ForgeHeadPullRequests;
14
10
  /**
15
- * What the classifier asks the forge. Both calls degrade to `available: false` instead of throwing;
11
+ * What the classifier asks GitHub. Both calls degrade to `available: false` instead of throwing;
16
12
  * the classifier then falls back to ancestry and reports `prStateKnown: false`.
17
13
  */
18
14
  export interface BranchForge {
@@ -25,16 +21,32 @@ export interface BranchForge {
25
21
  * against. */
26
22
  prsForHeads(repoRoot: string, heads: readonly string[]): Promise<HeadPrs>;
27
23
  }
28
- /** At most four forge reads of branch classification run at once. */
29
- export declare const branchReadQueue: <T>(read: () => Promise<T>) => Promise<T>;
30
- /** States of created PRs through a client's ref-status cache, in bounded batches. */
31
- export declare function clientPrStates(client: Pick<ForgeProjectClient, 'refStatus'>, numbers: number[]): Promise<{
32
- available: boolean;
33
- states: Record<number, BranchPrState>;
24
+ /** Heads per GraphQL query, and PRs per head: GitHub caps a connection page at 100. */
25
+ export declare const HEADS_PER_QUERY = 50;
26
+ /** One query for up to `HEADS_PER_QUERY` heads. A head comes back complete with its PRs, or is
27
+ * named incomplete; a failed or unreadable reply makes every head of the batch incomplete and
28
+ * the batch `failed`. */
29
+ export declare function fetchHeadBatch(run: GraphqlRunner, owner: string, name: string, heads: readonly string[]): Promise<{
30
+ complete: Map<string, ForgePr[]>;
31
+ incomplete: string[];
32
+ failed: boolean;
34
33
  }>;
34
+ export interface GithubBranchForgeDeps {
35
+ graphql?: (repoRoot: string) => GraphqlRunner;
36
+ handle?: (repoRoot: string) => Promise<{
37
+ owner: string;
38
+ name: string;
39
+ } | null>;
40
+ }
41
+ /** The default forge: the ref-status cache for created PRs, and per-head GraphQL lookups with a
42
+ * one-minute cache per head. `CEZ_DRY_RUN=1` never shells out. */
43
+ export declare function createGithubBranchForge(deps?: GithubBranchForgeDeps): BranchForge;
44
+ export declare const githubBranchForge: BranchForge;
35
45
  /**
36
46
  * The branch forge of a project's matched forge: created-PR states from its `refStatus`, head PRs
37
47
  * from its `branchPullRequests`. A project without a forge, or a forge without the method,
38
48
  * answers unavailable, and the classifier falls back to ancestry.
39
49
  */
40
50
  export declare function projectBranchForge(resolve?: ProjectForgeResolver): BranchForge;
51
+ /** Test-only: forget cached per-head answers. */
52
+ export declare function __clearPrListCacheForTests(): void;
@@ -1,6 +1,19 @@
1
- import { REFERENCE_STATUS_MAX } from '../contract/index.js';
2
1
  import { readQueue } from './bounded-read-cache.js';
2
+ import { productEnv } from '../core/product-env.js';
3
+ /**
4
+ * What branch classification asks GitHub: the states of the PRs runs created, and every PR whose
5
+ * head is one of the branches still in question. The second is asked per head, never as one
6
+ * newest-first list, so a branch merged long ago keeps its evidence however many PRs came after it
7
+ * (hearsay-tools/cezarion#2268). A head GitHub did not answer in full is reported, never read as
8
+ * "no PR".
9
+ */
10
+ import { z } from 'zod';
11
+ import { ghGraphqlArgs, resolveRepoHandle } from './forge/github.js';
12
+ import { createGithubDriver, GH_REF_STATUS_MAX } from './forge/index.js';
3
13
  import { resolveProjectForge } from './project-forge.js';
14
+ import { execFile } from 'node:child_process';
15
+ import { promisify } from 'node:util';
16
+ const exec = promisify(execFile);
4
17
  function prStateOf(status) {
5
18
  if (status === 'merged')
6
19
  return 'merged';
@@ -10,16 +23,160 @@ function prStateOf(status) {
10
23
  return 'draft';
11
24
  return 'open';
12
25
  }
13
- /** At most four forge reads of branch classification run at once. */
14
- export const branchReadQueue = readQueue(4);
26
+ const prNodeSchema = z.object({
27
+ number: z.number(),
28
+ url: z.string(),
29
+ headRefName: z.string(),
30
+ baseRefName: z.string(),
31
+ headRefOid: z.string(),
32
+ mergeCommit: z.object({ oid: z.string() }).nullable().optional(),
33
+ state: z.string(),
34
+ isDraft: z.boolean().optional(),
35
+ });
36
+ const headConnectionSchema = z.object({
37
+ pageInfo: z.object({ hasNextPage: z.boolean() }),
38
+ nodes: z.array(prNodeSchema),
39
+ });
40
+ const headReplySchema = z.object({
41
+ data: z.object({ repository: z.record(z.string(), headConnectionSchema.nullable()).nullable() }),
42
+ });
43
+ /** Heads per GraphQL query, and PRs per head: GitHub caps a connection page at 100. */
44
+ export const HEADS_PER_QUERY = 50;
45
+ const PRS_PER_HEAD = 100;
46
+ const HEAD_TTL_MS = 60_000;
47
+ const HEAD_CACHE_MAX = 20_000;
48
+ function headQuery(count) {
49
+ const vars = Array.from({ length: count }, (_, i) => `$h${i}: String!`).join(', ');
50
+ const fields = Array.from({ length: count }, (_, i) => `h${i}: pullRequests(headRefName: $h${i}, first: ${PRS_PER_HEAD}, states: [OPEN, CLOSED, MERGED]) { pageInfo { hasNextPage } nodes { number url headRefName baseRefName headRefOid mergeCommit { oid } state isDraft } }`).join('\n ');
51
+ return `query ($owner: String!, $name: String!, ${vars}) {\n repository(owner: $owner, name: $name) {\n ${fields}\n }\n}`;
52
+ }
53
+ function toForgePr(row) {
54
+ return {
55
+ number: row.number,
56
+ url: row.url,
57
+ headRefName: row.headRefName,
58
+ baseRefName: row.baseRefName,
59
+ headRefOid: row.headRefOid,
60
+ mergeCommitOid: row.mergeCommit?.oid ?? null,
61
+ state: row.state === 'MERGED' ? 'merged' : row.state === 'CLOSED' ? 'closed' : row.isDraft ? 'draft' : 'open',
62
+ };
63
+ }
64
+ /** One query for up to `HEADS_PER_QUERY` heads. A head comes back complete with its PRs, or is
65
+ * named incomplete; a failed or unreadable reply makes every head of the batch incomplete and
66
+ * the batch `failed`. */
67
+ export async function fetchHeadBatch(run, owner, name, heads) {
68
+ const variables = { owner, name };
69
+ heads.forEach((head, i) => { variables[`h${i}`] = head; });
70
+ const complete = new Map();
71
+ let repository = null;
72
+ try {
73
+ repository = headReplySchema.parse(JSON.parse(await run(headQuery(heads.length), variables))).data.repository;
74
+ }
75
+ catch {
76
+ // An unreadable reply answers nothing, like no reply.
77
+ }
78
+ // `repository: null` says the handle did not resolve: GitHub answered none of these heads.
79
+ if (!repository)
80
+ return { complete, incomplete: [...heads], failed: true };
81
+ const found = repository;
82
+ const incomplete = [];
83
+ heads.forEach((head, i) => {
84
+ const connection = found[`h${i}`];
85
+ if (!connection || connection.pageInfo.hasNextPage)
86
+ incomplete.push(head);
87
+ else
88
+ complete.set(head, connection.nodes.map(toForgePr).filter((pr) => pr.headRefName === head));
89
+ });
90
+ return { complete, incomplete, failed: false };
91
+ }
92
+ function defaultGraphql(repoRoot) {
93
+ return async (query, variables) => {
94
+ const { stdout } = await exec('gh', ghGraphqlArgs(query, variables), { cwd: repoRoot, timeout: 30_000, maxBuffer: 16 * 1024 * 1024 });
95
+ return stdout;
96
+ };
97
+ }
98
+ const headQueue = readQueue(4);
99
+ const headFlights = new Map();
100
+ const headCache = new Map();
101
+ /** The default forge: the ref-status cache for created PRs, and per-head GraphQL lookups with a
102
+ * one-minute cache per head. `CEZ_DRY_RUN=1` never shells out. */
103
+ export function createGithubBranchForge(deps = {}) {
104
+ const graphql = deps.graphql ?? defaultGraphql;
105
+ const handleOf = deps.handle ?? ((root) => resolveRepoHandle(root));
106
+ return {
107
+ prStates: (repoRoot, numbers) => clientPrStates(createGithubDriver(repoRoot, null), numbers),
108
+ async prsForHeads(repoRoot, heads) {
109
+ const wanted = [...new Set(heads)];
110
+ if (productEnv('DRY_RUN') === '1' || wanted.length === 0)
111
+ return { available: true, prs: [], incomplete: new Set() };
112
+ const prs = [];
113
+ const misses = [];
114
+ const now = Date.now();
115
+ for (const head of wanted) {
116
+ const hit = headCache.get(`${repoRoot}\0${head}`);
117
+ if (hit && now - hit.at < HEAD_TTL_MS)
118
+ prs.push(...hit.prs);
119
+ else
120
+ misses.push(head);
121
+ }
122
+ if (misses.length === 0)
123
+ return { available: true, prs, incomplete: new Set() };
124
+ const handle = await handleOf(repoRoot).catch(() => null);
125
+ if (!handle)
126
+ return { available: false, prs: [], incomplete: new Set(wanted) };
127
+ const run = graphql(repoRoot);
128
+ const incomplete = new Set();
129
+ let failed = false;
130
+ const batches = new Set();
131
+ const fresh = misses.filter((head) => {
132
+ const flight = headFlights.get(`${repoRoot}\0${head}`);
133
+ if (flight)
134
+ batches.add(flight);
135
+ return !flight;
136
+ });
137
+ for (let i = 0; i < fresh.length; i += HEADS_PER_QUERY) {
138
+ const chunk = fresh.slice(i, i + HEADS_PER_QUERY);
139
+ const flight = headQueue(() => fetchHeadBatch(run, handle.owner, handle.name, chunk)).then((batch) => {
140
+ for (const [head, found] of batch.complete) {
141
+ headCache.delete(`${repoRoot}\0${head}`);
142
+ headCache.set(`${repoRoot}\0${head}`, { at: Date.now(), prs: found });
143
+ }
144
+ while (headCache.size > HEAD_CACHE_MAX)
145
+ headCache.delete(headCache.keys().next().value);
146
+ return batch;
147
+ });
148
+ for (const head of chunk)
149
+ headFlights.set(`${repoRoot}\0${head}`, flight);
150
+ batches.add(flight);
151
+ void flight.finally(() => {
152
+ for (const head of chunk)
153
+ if (headFlights.get(`${repoRoot}\0${head}`) === flight)
154
+ headFlights.delete(`${repoRoot}\0${head}`);
155
+ });
156
+ }
157
+ for (const batch of await Promise.all(batches)) {
158
+ failed ||= batch.failed;
159
+ for (const head of batch.incomplete)
160
+ if (wanted.includes(head))
161
+ incomplete.add(head);
162
+ for (const [head, found] of batch.complete) {
163
+ if (wanted.includes(head))
164
+ prs.push(...found);
165
+ }
166
+ }
167
+ return { available: !failed, prs, incomplete };
168
+ },
169
+ };
170
+ }
171
+ export const githubBranchForge = createGithubBranchForge();
15
172
  /** States of created PRs through a client's ref-status cache, in bounded batches. */
16
- export async function clientPrStates(client, numbers) {
173
+ async function clientPrStates(client, numbers) {
17
174
  const states = {};
18
175
  if (!client.refStatus)
19
176
  return { available: false, states };
20
177
  // Called on the client, so a client that keeps its state on `this` works.
21
178
  const reader = client;
22
- const batches = await Promise.all(Array.from({ length: Math.ceil(numbers.length / REFERENCE_STATUS_MAX) }, (_, i) => branchReadQueue(() => reader.refStatus({ prs: numbers.slice(i * REFERENCE_STATUS_MAX, (i + 1) * REFERENCE_STATUS_MAX) }))));
179
+ const batches = await Promise.all(Array.from({ length: Math.ceil(numbers.length / GH_REF_STATUS_MAX) }, (_, i) => headQueue(() => reader.refStatus({ prs: numbers.slice(i * GH_REF_STATUS_MAX, (i + 1) * GH_REF_STATUS_MAX) }))));
23
180
  for (const data of batches) {
24
181
  if (!data.available)
25
182
  return { available: false, states };
@@ -49,4 +206,9 @@ export function projectBranchForge(resolve = resolveProjectForge) {
49
206
  },
50
207
  };
51
208
  }
209
+ /** Test-only: forget cached per-head answers. */
210
+ export function __clearPrListCacheForTests() {
211
+ headCache.clear();
212
+ headFlights.clear();
213
+ }
52
214
  //# 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":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAA6B,MAAM,oBAAoB,CAAC;AAqBpF,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,C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5,7 @@ import type { RunQueries } from '../runs/ports.ts';
5
5
  import type { RunManager } from '../workflows/run.ts';
6
6
  import { type LogEntryWithParents } from '../core/git.ts';
7
7
  import type { BranchForge } from './repo-branch-forge.ts';
8
- export { projectBranchForge, type BranchForge, type ForgePr } from './repo-branch-forge.ts';
8
+ export { __clearPrListCacheForTests, githubBranchForge, projectBranchForge, type BranchForge, type ForgePr } from './repo-branch-forge.ts';
9
9
  export interface ClassifyInput {
10
10
  /** Repository top level (`RepoInfo.root`). */
11
11
  root: string;
@@ -12,9 +12,9 @@ import { isSafeGitRef } from '../git-refs.js';
12
12
  import { withWorktreeMutation } from '../git-worktree-lock.js';
13
13
  import { branchesInUse, ownedCleanupProtection, parseShortstat, retainingRef } from '../git-worktree.js';
14
14
  import { loadConfig } from '../config.js';
15
- import { refNumberFromUrl } from '../contract/index.js';
15
+ import { refNumberFromUrl } from './forge/index.js';
16
16
  import { getBranches, getRepoInfo } from '../core/git.js';
17
- export { projectBranchForge } from './repo-branch-forge.js';
17
+ export { __clearPrListCacheForTests, githubBranchForge, projectBranchForge } from './repo-branch-forge.js';
18
18
  /** How many `git` processes this module runs at once, across every repository and request. A
19
19
  * repository with thousands of branches otherwise gets one process per branch at the same
20
20
  * moment (hearsay-tools/cezarion#2029). */