@intentius/chant 0.124.78 → 0.124.80

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 (184) hide show
  1. package/dist/action-pins.d.ts.map +1 -1
  2. package/dist/action-pins.js +1 -2
  3. package/dist/change-set.d.ts +10 -1
  4. package/dist/change-set.d.ts.map +1 -1
  5. package/dist/change-set.js +4 -1
  6. package/dist/ci-agent.d.ts +16 -2
  7. package/dist/ci-agent.d.ts.map +1 -1
  8. package/dist/ci-agent.js +6 -1
  9. package/dist/ci-commit.d.ts.map +1 -1
  10. package/dist/ci-commit.js +2 -3
  11. package/dist/ci-note-commands.d.ts +199 -0
  12. package/dist/ci-note-commands.d.ts.map +1 -0
  13. package/dist/ci-note-commands.js +372 -0
  14. package/dist/ci-product.d.ts +6 -2
  15. package/dist/ci-product.d.ts.map +1 -1
  16. package/dist/ci-product.js +5 -1
  17. package/dist/cli/handlers/build.d.ts.map +1 -1
  18. package/dist/cli/handlers/build.js +7 -1
  19. package/dist/cli/handlers/pr-notes.d.ts +13 -0
  20. package/dist/cli/handlers/pr-notes.d.ts.map +1 -0
  21. package/dist/cli/handlers/pr-notes.js +73 -0
  22. package/dist/cli/handlers/release.d.ts +8 -0
  23. package/dist/cli/handlers/release.d.ts.map +1 -1
  24. package/dist/cli/handlers/release.js +64 -2
  25. package/dist/cli/handlers/run-wave.js +1 -0
  26. package/dist/cli/main.d.ts.map +1 -1
  27. package/dist/cli/main.js +17 -1
  28. package/dist/cli/mcp/product-tools.d.ts +6 -0
  29. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  30. package/dist/cli/mcp/product-tools.js +6 -0
  31. package/dist/cli/mcp/read-only.d.ts +12 -0
  32. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  33. package/dist/cli/mcp/read-only.js +16 -0
  34. package/dist/cli/mcp/server.d.ts +11 -0
  35. package/dist/cli/mcp/server.d.ts.map +1 -1
  36. package/dist/cli/mcp/server.js +26 -5
  37. package/dist/cli/mcp/types.d.ts +5 -1
  38. package/dist/cli/mcp/types.d.ts.map +1 -1
  39. package/dist/cli/parse-args.d.ts.map +1 -1
  40. package/dist/cli/parse-args.js +10 -0
  41. package/dist/cli/registry.d.ts +4 -0
  42. package/dist/cli/registry.d.ts.map +1 -1
  43. package/dist/components/capability.d.ts +53 -0
  44. package/dist/components/capability.d.ts.map +1 -1
  45. package/dist/components/group-digest.d.ts +17 -0
  46. package/dist/components/group-digest.d.ts.map +1 -0
  47. package/dist/components/group-digest.js +18 -0
  48. package/dist/components/groups.d.ts +2 -11
  49. package/dist/components/groups.d.ts.map +1 -1
  50. package/dist/components/groups.js +2 -12
  51. package/dist/components/index.d.ts +1 -1
  52. package/dist/components/index.d.ts.map +1 -1
  53. package/dist/components/pr-pipeline.d.ts +22 -0
  54. package/dist/components/pr-pipeline.d.ts.map +1 -1
  55. package/dist/components/pr-pipeline.js +26 -0
  56. package/dist/components/product-pipeline.d.ts +12 -0
  57. package/dist/components/product-pipeline.d.ts.map +1 -1
  58. package/dist/components/product-pipeline.js +5 -1
  59. package/dist/config.d.ts +14 -0
  60. package/dist/config.d.ts.map +1 -1
  61. package/dist/config.js +5 -0
  62. package/dist/lexicon.d.ts.map +1 -1
  63. package/dist/lexicon.js +1 -2
  64. package/dist/lifecycle/release-cut.d.ts +7 -1
  65. package/dist/lifecycle/release-cut.d.ts.map +1 -1
  66. package/dist/lifecycle/release-cut.js +1 -0
  67. package/dist/lifecycle/release-images.d.ts +12 -3
  68. package/dist/lifecycle/release-images.d.ts.map +1 -1
  69. package/dist/lifecycle/release-images.js +6 -7
  70. package/dist/lifecycle/release-publish.d.ts +8 -1
  71. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  72. package/dist/lifecycle/release-publish.js +30 -3
  73. package/dist/lifecycle/release-version.d.ts +86 -0
  74. package/dist/lifecycle/release-version.d.ts.map +1 -0
  75. package/dist/lifecycle/release-version.js +208 -0
  76. package/dist/mcp/types.d.ts +26 -0
  77. package/dist/mcp/types.d.ts.map +1 -1
  78. package/dist/notify-product.d.ts.map +1 -1
  79. package/dist/notify-product.js +1 -2
  80. package/dist/op/activities/review-product.d.ts.map +1 -1
  81. package/dist/op/activities/review-product.js +1 -2
  82. package/dist/op/gate.d.ts +17 -0
  83. package/dist/op/gate.d.ts.map +1 -1
  84. package/dist/op/gate.js +36 -0
  85. package/dist/op/index.d.ts +8 -6
  86. package/dist/op/index.d.ts.map +1 -1
  87. package/dist/op/index.js +5 -4
  88. package/dist/op/op-waves-after-plan.d.ts +109 -1
  89. package/dist/op/op-waves-after-plan.d.ts.map +1 -1
  90. package/dist/op/op-waves-after-plan.js +180 -3
  91. package/dist/op/op-waves-capability-spec.js +1 -2
  92. package/dist/op/op-waves-capability.d.ts +93 -3
  93. package/dist/op/op-waves-capability.d.ts.map +1 -1
  94. package/dist/op/op-waves-capability.js +218 -10
  95. package/dist/op/op-waves-run-hooks.d.ts +104 -0
  96. package/dist/op/op-waves-run-hooks.d.ts.map +1 -0
  97. package/dist/op/op-waves-run-hooks.js +145 -0
  98. package/dist/op/op-waves-run.d.ts +21 -0
  99. package/dist/op/op-waves-run.d.ts.map +1 -1
  100. package/dist/op/op-waves-run.js +307 -21
  101. package/dist/op/op-waves.d.ts +11 -1
  102. package/dist/op/op-waves.d.ts.map +1 -1
  103. package/dist/op/op-waves.js +7 -1
  104. package/dist/op/runtime.d.ts +2 -0
  105. package/dist/op/runtime.d.ts.map +1 -1
  106. package/dist/pr-forge-reads.d.ts +151 -1
  107. package/dist/pr-forge-reads.d.ts.map +1 -1
  108. package/dist/pr-forge-reads.js +265 -1
  109. package/dist/pr-plan-note.d.ts.map +1 -1
  110. package/dist/pr-plan-note.js +1 -2
  111. package/dist/release-floors.d.ts +19 -1
  112. package/dist/release-floors.d.ts.map +1 -1
  113. package/dist/release-floors.js +23 -5
  114. package/dist/wave-runtime.mjs +312 -312
  115. package/dist/workspace/change-set.schema.json +7 -0
  116. package/dist/workspace/release-workflow.d.ts +7 -0
  117. package/dist/workspace/release-workflow.d.ts.map +1 -1
  118. package/dist/workspace/release-workflow.js +11 -1
  119. package/package.json +1 -1
  120. package/src/action-pins.test.ts +1 -2
  121. package/src/action-pins.ts +1 -3
  122. package/src/change-set.test.ts +20 -0
  123. package/src/change-set.ts +11 -1
  124. package/src/ci-agent.test.ts +9 -0
  125. package/src/ci-agent.ts +15 -2
  126. package/src/ci-commit.test.ts +2 -3
  127. package/src/ci-commit.ts +2 -3
  128. package/src/ci-note-commands.test.ts +377 -0
  129. package/src/ci-note-commands.ts +479 -0
  130. package/src/ci-product.ts +6 -2
  131. package/src/cli/handlers/build.ts +7 -1
  132. package/src/cli/handlers/pr-notes.ts +70 -0
  133. package/src/cli/handlers/release.ts +55 -2
  134. package/src/cli/handlers/run-wave.ts +1 -0
  135. package/src/cli/main.ts +17 -1
  136. package/src/cli/mcp/product-tools.test.ts +49 -0
  137. package/src/cli/mcp/product-tools.ts +7 -0
  138. package/src/cli/mcp/read-only.ts +19 -0
  139. package/src/cli/mcp/server.test.ts +30 -0
  140. package/src/cli/mcp/server.ts +28 -5
  141. package/src/cli/mcp/types.ts +6 -1
  142. package/src/cli/parse-args.ts +8 -0
  143. package/src/cli/registry.ts +4 -0
  144. package/src/components/capability.ts +52 -0
  145. package/src/components/group-digest.ts +20 -0
  146. package/src/components/groups.ts +3 -13
  147. package/src/components/index.ts +2 -0
  148. package/src/components/pr-pipeline.ts +35 -0
  149. package/src/components/product-pipeline.test.ts +14 -0
  150. package/src/components/product-pipeline.ts +13 -1
  151. package/src/config.ts +15 -0
  152. package/src/lexicon.ts +1 -2
  153. package/src/lifecycle/release-cut.ts +11 -0
  154. package/src/lifecycle/release-images-dockerfile.test.ts +10 -2
  155. package/src/lifecycle/release-images.ts +12 -8
  156. package/src/lifecycle/release-publish.ts +34 -3
  157. package/src/lifecycle/release-version.test.ts +155 -0
  158. package/src/lifecycle/release-version.ts +226 -0
  159. package/src/mcp/types.ts +27 -0
  160. package/src/notify-message-words.test.ts +1 -2
  161. package/src/notify-product.ts +1 -2
  162. package/src/op/activities/review-product.ts +1 -2
  163. package/src/op/gate.ts +46 -0
  164. package/src/op/index.ts +10 -4
  165. package/src/op/op-waves-after-plan-wave.test.ts +225 -0
  166. package/src/op/op-waves-after-plan.ts +228 -5
  167. package/src/op/op-waves-capability-spec.ts +1 -1
  168. package/src/op/op-waves-capability.test.ts +9 -1
  169. package/src/op/op-waves-capability.ts +246 -13
  170. package/src/op/op-waves-gate-port.test.ts +232 -0
  171. package/src/op/op-waves-run-hooks.test.ts +183 -0
  172. package/src/op/op-waves-run-hooks.ts +194 -0
  173. package/src/op/op-waves-run.ts +313 -25
  174. package/src/op/op-waves-step-wave.test.ts +276 -0
  175. package/src/op/op-waves.ts +15 -2
  176. package/src/op/runtime.ts +2 -0
  177. package/src/pr-forge-reads-compare.test.ts +145 -0
  178. package/src/pr-forge-reads.test.ts +203 -0
  179. package/src/pr-forge-reads.ts +398 -1
  180. package/src/pr-plan-note.ts +1 -2
  181. package/src/release-floors.ts +32 -5
  182. package/src/workspace/change-set.schema.json +7 -0
  183. package/src/workspace/release-workflow.test.ts +18 -0
  184. package/src/workspace/release-workflow.ts +21 -1
@@ -283,3 +283,206 @@ test("forgeReadsFor builds the reads for a target", async () => {
283
283
  expect(await reads.tokenUser()).toEqual({ login: "bot", id: 1 });
284
284
  expect(calls[0]!.headers["JOB-TOKEN"]).toBe("cj");
285
285
  });
286
+
287
+ describe("workflow runs, jobs and artifacts (#4846)", () => {
288
+ const gh = { apiBase: "https://api.github.com", repo: "acme/infra", token: "t0k" };
289
+ const fj = { apiBase: "https://code.acme.io/api/v1", repo: "acme/infra", token: "t0k", host: "code.acme.io" };
290
+ const gl = { apiBase: "https://gitlab.com/api/v4", project: "acme/infra", token: "glpat" };
291
+ const P = "/api/v4/projects/acme%2Finfra";
292
+ const OTHER = "b".repeat(40);
293
+
294
+ test("github: a head's runs of an event, newest first, with their pull requests", async () => {
295
+ const { fetch, calls } = fakeFetch({
296
+ "GET /repos/acme/infra/actions/runs": {
297
+ total_count: 3,
298
+ workflow_runs: [
299
+ { id: 10, event: "pull_request", head_sha: SHA, head_branch: "feat", path: ".github/workflows/pipeline.yml@refs/heads/feat", status: "completed", conclusion: "success", head_repository: { full_name: "acme/infra" }, pull_requests: [{ number: 12, head: { ref: "feat", sha: SHA }, base: { ref: "main" } }] },
300
+ { id: 11, event: "pull_request", head_sha: SHA, path: ".github/workflows/pipeline.yml", status: "in_progress", pull_requests: [] },
301
+ { id: 12, event: "pull_request", head_sha: OTHER, status: "completed" },
302
+ ],
303
+ },
304
+ });
305
+ const runs = await githubReads({ ...gh, fetch }).headRuns(SHA, { event: "pull_request" });
306
+ expect(runs.map((r) => [r.id, r.done])).toEqual([
307
+ [11, false],
308
+ [10, true],
309
+ ]);
310
+ expect(runs[1]).toEqual({
311
+ id: 10,
312
+ event: "pull_request",
313
+ workflow: "pipeline.yml",
314
+ path: ".github/workflows/pipeline.yml",
315
+ headSha: SHA,
316
+ headBranch: "feat",
317
+ headRepo: "acme/infra",
318
+ status: "completed",
319
+ conclusion: "success",
320
+ done: true,
321
+ pullRequests: [{ number: 12, head: "feat", headSha: SHA, base: "main" }],
322
+ });
323
+ expect(urls(calls)).toEqual([`GET https://api.github.com/repos/acme/infra/actions/runs?head_sha=${SHA}&event=pull_request&per_page=100&page=1`]);
324
+ });
325
+
326
+ test("github: a run by id, undefined when missing; its jobs over the jobs object", async () => {
327
+ const { fetch, calls } = fakeFetch({
328
+ "GET /repos/acme/infra/actions/runs/10": { id: 10, event: "workflow_run", head_sha: SHA, path: ".github/workflows/review.yml", status: "completed" },
329
+ "GET /repos/acme/infra/actions/runs/10/jobs": { total_count: 2, jobs: [{ id: 1, name: "plan", status: "completed", conclusion: "failure" }, { id: 2, name: "plan-note", status: "queued" }] },
330
+ });
331
+ const reads = githubReads({ ...gh, fetch });
332
+ expect(await reads.run(10)).toMatchObject({ id: 10, event: "workflow_run", path: ".github/workflows/review.yml", workflow: "review.yml" });
333
+ expect(await reads.run(99)).toBeUndefined();
334
+ expect(await reads.runJobs(10)).toEqual([
335
+ { id: 1, name: "plan", status: "completed", conclusion: "failure", done: true },
336
+ { id: 2, name: "plan-note", status: "queued", done: false },
337
+ ]);
338
+ expect(urls(calls)).toContain("GET https://api.github.com/repos/acme/infra/actions/runs/10/jobs?per_page=100&page=1");
339
+ });
340
+
341
+ test("github: artifacts by name in a run and across the repository, expired ones and other names left out", async () => {
342
+ const { fetch, calls } = fakeFetch({
343
+ "GET /repos/acme/infra/actions/runs/10/artifacts": { artifacts: [{ id: 5, name: "report", size_in_bytes: 300 }] },
344
+ "GET /repos/acme/infra/actions/artifacts": {
345
+ artifacts: [
346
+ { id: 6, name: "review-x", workflow_run: { id: 20, head_sha: SHA } },
347
+ { id: 9, name: "review-x", expired: true, workflow_run: { id: 21 } },
348
+ { id: 8, name: "review-x", workflow_run: { id: 22, head_sha: SHA } },
349
+ { id: 7, name: "other", workflow_run: { id: 23 } },
350
+ ],
351
+ },
352
+ });
353
+ const reads = githubReads({ ...gh, fetch });
354
+ expect(await reads.artifacts("report", { run: 10 })).toEqual([{ id: 5, name: "report", run: 10, size: 300 }]);
355
+ expect(await reads.artifacts("review-x")).toEqual([
356
+ { id: 8, name: "review-x", run: 22, headSha: SHA },
357
+ { id: 6, name: "review-x", run: 20, headSha: SHA },
358
+ ]);
359
+ expect(urls(calls)).toEqual([
360
+ "GET https://api.github.com/repos/acme/infra/actions/runs/10/artifacts?name=report&per_page=100&page=1",
361
+ "GET https://api.github.com/repos/acme/infra/actions/artifacts?name=review-x&per_page=100&page=1",
362
+ ]);
363
+ });
364
+
365
+ test("forgejo: trigger_event is the run's event, its listed event kept, and the payload names the pull request", async () => {
366
+ const payload = JSON.stringify({ pull_request: { number: 3, base: { ref: "main" }, head: { ref: "feat", sha: SHA } } });
367
+ const { fetch, calls } = fakeFetch({
368
+ "GET /api/v1/repos/acme/infra/actions/runs": {
369
+ workflow_runs: [
370
+ { id: 40, event: "pull_request", trigger_event: "pull_request_target", workflow_id: "review.yml", commit_sha: SHA, status: "running", event_payload: payload },
371
+ { id: 41, event: "pull_request", trigger_event: "pull_request", workflow_id: "pipeline.yml", commit_sha: SHA, status: "success" },
372
+ ],
373
+ },
374
+ "GET /api/v1/repos/acme/infra/actions/runs/40/jobs": [{ id: 1, name: "plan-note", status: "success" }],
375
+ "GET /api/v1/repos/acme/infra/actions/runs/40/artifacts": [{ id: 2, name: "report", run_id: 40 }],
376
+ });
377
+ const reads = forgejoReads({ ...fj, fetch });
378
+ const runs = await reads.headRuns(SHA, { event: "pull_request" });
379
+ expect(runs.map((r) => [r.id, r.event, r.listedEvent, r.workflow, r.done])).toEqual([
380
+ [41, "pull_request", undefined, "pipeline.yml", true],
381
+ [40, "pull_request_target", "pull_request", "review.yml", false],
382
+ ]);
383
+ expect(runs[1]!.pullRequests).toEqual([{ number: 3, head: "feat", headSha: SHA, base: "main" }]);
384
+ expect(await reads.runJobs(40)).toEqual([{ id: 1, name: "plan-note", status: "success", done: true }]);
385
+ expect(await reads.artifacts("report", { run: 40 })).toEqual([{ id: 2, name: "report", run: 40 }]);
386
+ expect(urls(calls)[0]).toBe(`GET https://code.acme.io/api/v1/repos/acme/infra/actions/runs?head_sha=${SHA}&event=pull_request&limit=50&page=1`);
387
+ });
388
+
389
+ test("gitlab: a head's pipelines by source, a pipeline's merge request from its ref, its jobs", async () => {
390
+ const { fetch, calls } = fakeFetch({
391
+ [`GET ${P}/pipelines`]: [
392
+ { id: 31, sha: SHA, ref: "refs/merge-requests/5/head", source: "merge_request_event", status: "running", web_url: "https://gitlab.com/acme/infra/-/pipelines/31" },
393
+ { id: 30, sha: SHA, ref: "refs/merge-requests/5/head", source: "merge_request_event", status: "failed" },
394
+ ],
395
+ [`GET ${P}/pipelines/30`]: { id: 30, sha: SHA, ref: "main", source: "push", status: "success" },
396
+ [`GET ${P}/pipelines/30/jobs`]: [{ id: 300, name: "plan", status: "success" }, { id: 301, name: "apply", status: "manual" }],
397
+ });
398
+ const reads = gitlabReads({ ...gl, fetch });
399
+ const runs = await reads.headRuns(SHA, { event: "merge_request_event" });
400
+ expect(runs.map((r) => [r.id, r.event, r.done])).toEqual([
401
+ [31, "merge_request_event", false],
402
+ [30, "merge_request_event", true],
403
+ ]);
404
+ expect(runs[0]).toMatchObject({ headBranch: "refs/merge-requests/5/head", pullRequests: [{ number: 5, headSha: SHA }], url: "https://gitlab.com/acme/infra/-/pipelines/31" });
405
+ expect(await reads.run(30)).toMatchObject({ id: 30, event: "push", headBranch: "main", pullRequests: [] });
406
+ expect(await reads.run(99)).toBeUndefined();
407
+ expect(await reads.runJobs(30)).toEqual([
408
+ { id: 300, name: "plan", status: "success", done: true },
409
+ { id: 301, name: "apply", status: "manual", done: false },
410
+ ]);
411
+ expect(urls(calls)[0]).toBe(`GET https://gitlab.com${P}/pipelines?sha=${SHA}&source=merge_request_event&order_by=id&sort=desc&per_page=100&page=1`);
412
+ });
413
+
414
+ test("gitlab: a job's archive is its artifact, by the job's name, in a pipeline or across the project", async () => {
415
+ const { fetch, calls } = fakeFetch({
416
+ [`GET ${P}/pipelines/30/jobs`]: [
417
+ { id: 300, name: "plan", artifacts: [{ file_type: "archive", size: 12 }, { file_type: "metadata" }], pipeline: { id: 30, sha: SHA } },
418
+ { id: 301, name: "plan", artifacts: [{ file_type: "trace" }], pipeline: { id: 30, sha: SHA } },
419
+ { id: 302, name: "lint", artifacts_file: { filename: "artifacts.zip", size: 1 }, pipeline: { id: 30, sha: SHA } },
420
+ ],
421
+ [`GET ${P}/jobs`]: [
422
+ { id: 410, name: "review", artifacts_file: { filename: "artifacts.zip", size: 5 }, pipeline: { id: 41, sha: OTHER } },
423
+ { id: 400, name: "review", artifacts_file: { filename: "artifacts.zip" }, artifacts_expire_at: "2000-01-01T00:00:00Z", pipeline: { id: 40 } },
424
+ { id: 390, name: "review", artifacts: [{ file_type: "archive" }], pipeline: { id: 39, sha: SHA } },
425
+ ],
426
+ });
427
+ const reads = gitlabReads({ ...gl, fetch });
428
+ expect(await reads.artifacts("plan", { run: 30 })).toEqual([{ id: 300, name: "plan", run: 30, headSha: SHA, size: 12 }]);
429
+ expect(await reads.artifacts("review")).toEqual([
430
+ { id: 410, name: "review", run: 41, headSha: OTHER, size: 5 },
431
+ { id: 390, name: "review", run: 39, headSha: SHA },
432
+ ]);
433
+ expect(urls(calls)).toEqual([`GET https://gitlab.com${P}/pipelines/30/jobs?per_page=100&page=1`, `GET https://gitlab.com${P}/jobs?per_page=100&page=1`]);
434
+ });
435
+ });
436
+
437
+ describe("a branch's runs, and the pull requests updated since a time (#4785)", () => {
438
+ const gh = { apiBase: "https://api.github.com", repo: "acme/infra", token: "t0k" };
439
+ const gl = { apiBase: "https://gitlab.com/api/v4", project: "acme/infra", token: "glpat" };
440
+ const P = "/api/v4/projects/acme%2Finfra";
441
+
442
+ test("github: a branch's push runs, newest first", async () => {
443
+ const { fetch, calls } = fakeFetch({
444
+ "GET /repos/acme/infra/actions/runs": { workflow_runs: [{ id: 3, event: "push", head_sha: SHA, head_branch: "main", status: "completed" }, { id: 4, event: "push", head_sha: MERGED, head_branch: "main", status: "queued" }] },
445
+ });
446
+ expect((await githubReads({ ...gh, fetch }).branchRuns("main", { event: "push" })).map((r) => [r.id, r.headSha])).toEqual([
447
+ [4, MERGED],
448
+ [3, SHA],
449
+ ]);
450
+ expect(urls(calls)).toEqual(["GET https://api.github.com/repos/acme/infra/actions/runs?branch=main&event=push&per_page=100&page=1"]);
451
+ });
452
+
453
+ test("gitlab: a branch's pipelines by ref and source, another ref's left out", async () => {
454
+ const { fetch, calls } = fakeFetch({
455
+ [`GET ${P}/pipelines`]: [
456
+ { id: 12, sha: MERGED, ref: "main", source: "push", status: "success" },
457
+ { id: 11, sha: SHA, ref: "ci/green/1", source: "push", status: "success" },
458
+ ],
459
+ });
460
+ expect((await gitlabReads({ ...gl, fetch }).branchRuns("main", { event: "push" })).map((r) => r.id)).toEqual([12]);
461
+ expect(urls(calls)).toEqual([`GET https://gitlab.com${P}/pipelines?ref=main&source=push&order_by=id&sort=desc&per_page=100&page=1`]);
462
+ });
463
+
464
+ test("gitlab: the merge requests updated since a time, forks' among them", async () => {
465
+ const { fetch, calls } = fakeFetch({
466
+ [`GET ${P}/merge_requests`]: [
467
+ { iid: 3, state: "opened", source_branch: "a", source_project_id: 9, target_project_id: 1 },
468
+ { iid: 2, state: "merged", source_branch: "b", merge_commit_sha: MERGED },
469
+ ],
470
+ });
471
+ expect((await gitlabReads({ ...gl, fetch }).pullRequestsUpdated("2026-11-07T00:00:00.000Z")).map((m) => [m.number, m.state, m.sameRepo])).toEqual([
472
+ [3, "open", false],
473
+ [2, "merged", true],
474
+ ]);
475
+ expect(urls(calls)).toEqual([`GET https://gitlab.com${P}/merge_requests?state=all&updated_after=2026-11-07T00%3A00%3A00.000Z&order_by=updated_at&sort=desc&per_page=100&page=1`]);
476
+ });
477
+
478
+ test("github: newest update first, stopping at the first one older than the time", async () => {
479
+ const { fetch, calls } = fakeFetch({
480
+ "GET /repos/acme/infra/pulls": [
481
+ { number: 9, state: "open", updated_at: "2026-11-08T00:00:00Z", head: { ref: "x", repo: { full_name: "eve/infra" } } },
482
+ { number: 8, state: "closed", updated_at: "2026-11-01T00:00:00Z", head: { ref: "y" } },
483
+ ],
484
+ });
485
+ expect((await githubReads({ ...gh, fetch }).pullRequestsUpdated("2026-11-07T00:00:00Z")).map((p) => [p.number, p.sameRepo])).toEqual([[9, false]]);
486
+ expect(urls(calls)).toEqual(["GET https://api.github.com/repos/acme/infra/pulls?state=all&sort=updated&direction=desc&per_page=100&page=1"]);
487
+ });
488
+ });