@intentius/chant 0.124.57 → 0.124.58

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 (121) hide show
  1. package/dist/ci-product-words.d.ts +47 -2
  2. package/dist/ci-product-words.d.ts.map +1 -1
  3. package/dist/ci-product-words.js +59 -1
  4. package/dist/ci-product.d.ts +26 -2
  5. package/dist/ci-product.d.ts.map +1 -1
  6. package/dist/ci-product.js +26 -2
  7. package/dist/cli/commands/init.d.ts +2 -0
  8. package/dist/cli/commands/init.d.ts.map +1 -1
  9. package/dist/cli/commands/init.js +1 -1
  10. package/dist/cli/handlers/build.d.ts.map +1 -1
  11. package/dist/cli/handlers/build.js +5 -1
  12. package/dist/cli/handlers/init.d.ts.map +1 -1
  13. package/dist/cli/handlers/init.js +16 -0
  14. package/dist/cli/handlers/serve.d.ts.map +1 -1
  15. package/dist/cli/handlers/serve.js +9 -0
  16. package/dist/cli/main.d.ts.map +1 -1
  17. package/dist/cli/main.js +6 -2
  18. package/dist/cli/mcp/product-tools.d.ts +40 -7
  19. package/dist/cli/mcp/product-tools.d.ts.map +1 -1
  20. package/dist/cli/mcp/product-tools.js +59 -15
  21. package/dist/cli/mcp/read-only.d.ts +2 -1
  22. package/dist/cli/mcp/read-only.d.ts.map +1 -1
  23. package/dist/cli/mcp/read-only.js +2 -1
  24. package/dist/cli/mcp/server.d.ts +11 -0
  25. package/dist/cli/mcp/server.d.ts.map +1 -1
  26. package/dist/cli/mcp/server.js +15 -3
  27. package/dist/cli/mcp-config.d.ts +4 -1
  28. package/dist/cli/mcp-config.d.ts.map +1 -1
  29. package/dist/cli/mcp-config.js +6 -2
  30. package/dist/cli/parse-args.d.ts.map +1 -1
  31. package/dist/cli/parse-args.js +9 -0
  32. package/dist/cli/registry.d.ts +8 -0
  33. package/dist/cli/registry.d.ts.map +1 -1
  34. package/dist/components/pr-pipeline.d.ts +56 -0
  35. package/dist/components/pr-pipeline.d.ts.map +1 -1
  36. package/dist/components/pr-pipeline.js +55 -2
  37. package/dist/components/product-pipeline.d.ts +18 -1
  38. package/dist/components/product-pipeline.d.ts.map +1 -1
  39. package/dist/components/product-pipeline.js +8 -2
  40. package/dist/e2e-harness/driver.d.ts.map +1 -1
  41. package/dist/e2e-harness/driver.js +97 -0
  42. package/dist/e2e-harness/forgejo.d.ts +5 -1
  43. package/dist/e2e-harness/forgejo.d.ts.map +1 -1
  44. package/dist/e2e-harness/forgejo.js +35 -0
  45. package/dist/e2e-harness/index.d.ts +7 -0
  46. package/dist/e2e-harness/index.d.ts.map +1 -1
  47. package/dist/e2e-harness/index.js +11 -1
  48. package/dist/e2e-harness/ports.d.ts +31 -0
  49. package/dist/e2e-harness/ports.d.ts.map +1 -1
  50. package/dist/e2e-harness/scenario.d.ts.map +1 -1
  51. package/dist/e2e-harness/scenario.js +9 -5
  52. package/dist/e2e-harness/schemas/e2e-scenario.schema.json +43 -3
  53. package/dist/e2e-harness/schemas/index.d.ts +22 -1
  54. package/dist/e2e-harness/schemas/index.d.ts.map +1 -1
  55. package/dist/e2e-harness/schemas/index.js +1 -1
  56. package/dist/e2e-harness/steps.d.ts.map +1 -1
  57. package/dist/e2e-harness/steps.js +4 -0
  58. package/dist/mcp/types.d.ts +9 -0
  59. package/dist/mcp/types.d.ts.map +1 -1
  60. package/dist/release-floors.d.ts +1 -1
  61. package/dist/release-floors.js +1 -1
  62. package/dist/template-request/index.d.ts +9 -0
  63. package/dist/template-request/index.d.ts.map +1 -0
  64. package/dist/template-request/index.js +8 -0
  65. package/dist/template-request/request-body.d.ts +21 -0
  66. package/dist/template-request/request-body.d.ts.map +1 -0
  67. package/dist/template-request/request-body.js +86 -0
  68. package/dist/template-request/template-request.d.ts +100 -0
  69. package/dist/template-request/template-request.d.ts.map +1 -0
  70. package/dist/template-request/template-request.js +150 -0
  71. package/dist/template-request/template-request.schema.json +100 -0
  72. package/dist/template-request/template-spec.d.ts +83 -0
  73. package/dist/template-request/template-spec.d.ts.map +1 -0
  74. package/dist/template-request/template-spec.js +146 -0
  75. package/dist/template-request/template.schema.json +114 -0
  76. package/dist/template-request/validate.d.ts +4 -0
  77. package/dist/template-request/validate.d.ts.map +1 -0
  78. package/dist/template-request/validate.js +21 -0
  79. package/dist/wave-runtime.mjs +4 -4
  80. package/package.json +8 -1
  81. package/src/ci-product-words.test.ts +23 -0
  82. package/src/ci-product-words.ts +68 -3
  83. package/src/ci-product.ts +32 -1
  84. package/src/cli/commands/init.ts +3 -1
  85. package/src/cli/handlers/build.ts +5 -1
  86. package/src/cli/handlers/init.ts +18 -0
  87. package/src/cli/handlers/serve.ts +9 -0
  88. package/src/cli/main.ts +6 -2
  89. package/src/cli/mcp/product-tools.test.ts +57 -1
  90. package/src/cli/mcp/product-tools.ts +67 -15
  91. package/src/cli/mcp/read-only.ts +2 -1
  92. package/src/cli/mcp/server.ts +20 -5
  93. package/src/cli/mcp-config.test.ts +52 -2
  94. package/src/cli/mcp-config.ts +6 -3
  95. package/src/cli/parse-args.ts +7 -0
  96. package/src/cli/registry.ts +8 -0
  97. package/src/components/pr-pipeline.ts +87 -2
  98. package/src/components/product-actions.test.ts +76 -0
  99. package/src/components/product-pipeline.ts +21 -2
  100. package/src/e2e-harness/driver.test.ts +163 -0
  101. package/src/e2e-harness/driver.ts +86 -1
  102. package/src/e2e-harness/forgejo.ts +42 -1
  103. package/src/e2e-harness/index.ts +12 -1
  104. package/src/e2e-harness/ports.ts +33 -0
  105. package/src/e2e-harness/scenario.ts +8 -6
  106. package/src/e2e-harness/schemas/README.md +11 -2
  107. package/src/e2e-harness/schemas/e2e-scenario.schema.json +43 -3
  108. package/src/e2e-harness/schemas/index.ts +5 -1
  109. package/src/e2e-harness/schemas.test.ts +44 -1
  110. package/src/e2e-harness/steps.ts +4 -0
  111. package/src/mcp/types.ts +9 -0
  112. package/src/release-floors.ts +1 -1
  113. package/src/template-request/__fixtures__/request-body.md +41 -0
  114. package/src/template-request/index.ts +8 -0
  115. package/src/template-request/request-body.ts +91 -0
  116. package/src/template-request/template-request.schema.json +100 -0
  117. package/src/template-request/template-request.test.ts +316 -0
  118. package/src/template-request/template-request.ts +235 -0
  119. package/src/template-request/template-spec.ts +176 -0
  120. package/src/template-request/template.schema.json +114 -0
  121. package/src/template-request/validate.ts +28 -0
@@ -92,7 +92,8 @@ import { OIDC_REQUEST_VARS } from "../ci-identity.js";
92
92
  import { parallelismProblem } from "../parallelism.js";
93
93
  import { EMPTY_TREE_SHA } from "./changed-files.js";
94
94
  import { layerWaves } from "../gated-waves.js";
95
- import { commentLine, resolveProductWords } from "../ci-product-words.js";
95
+ import { commandWord, commentLine, PRODUCT_ACTION_ENV, PRODUCT_ACTION_EVENT_FLAG, resolveProductWords } from "../ci-product-words.js";
96
+ import { CHANT_EXIT } from "../exit-codes.js";
96
97
  import { CI_RESPOND_ENV, respondList } from "../ci-respond.js";
97
98
  /** The variable `chant ci run` reads its runner key from (`RUNNER_KEY_ENV` in ../workspace/ci-green.ts). */
98
99
  const RUNNER_KEY_ENV = "CHANT_RUNNER_KEY";
@@ -165,7 +166,7 @@ export function prLoopJobStage(name, member) {
165
166
  const bare = member && name.startsWith(`${member}-`) ? name.slice(member.length + 1) : name;
166
167
  if (bare === "plan" || bare === PR_COMMENT_PREVIEW_JOB)
167
168
  return "plan";
168
- if (bare === "apply" || bare === "record" || /^apply-wave-\d+$/.test(bare) || bare === "env-up" || bare === "env-down" || bare === "env-sweep")
169
+ if (bare === "apply" || bare === "record" || bare === PR_ACTION_JOB || /^apply-wave-\d+$/.test(bare) || bare === "env-up" || bare === "env-down" || bare === "env-sweep")
169
170
  return "apply";
170
171
  return "default";
171
172
  }
@@ -259,6 +260,58 @@ export function prCommentLockJobs(forge, options = {}) {
259
260
  }
260
261
  return out;
261
262
  }
263
+ /** The job answering the action comment and the action dispatch (#4654). */
264
+ export const PR_ACTION_JOB = "action";
265
+ const INPUT_NAME = /^[A-Za-z_][A-Za-z0-9_-]{0,63}$/;
266
+ /**
267
+ * The action job (#4654), with `actionJob`: one job that answers the
268
+ * product's action comment and a dispatch of the workflow with a member and
269
+ * an action. It runs at the target branch's commit (an `issue_comment` run's
270
+ * checkout) or the dispatched ref, never a pull request's head, and runs the
271
+ * product's own action verb, which asks for the gated request and runs the
272
+ * action once an approval counts. The comment and the inputs reach the verb
273
+ * as variables ({@link PRODUCT_ACTION_ENV}), never as shell text.
274
+ *
275
+ * Undefined without `actionJob`. Throws on GitLab, which starts no pipeline
276
+ * on a note; for words that name no `action` command or no `bin`, since
277
+ * chant has no action verb of its own; and for input names that are not
278
+ * plain names or are the same.
279
+ */
280
+ export function prActionJob(forge, options = {}) {
281
+ if (!options.actionJob)
282
+ return undefined;
283
+ if (forge === "gitlab")
284
+ throw new Error("the action job runs on GitHub and Forgejo, whose workflows start on a comment and on a dispatch with inputs; on GitLab, run the product's action verb from a pipeline of its own");
285
+ const words = resolveProductWords(options.words);
286
+ const typed = commandWord(words, "action");
287
+ if (typed === undefined)
288
+ throw new Error(`--action-job answers /${words.product} <action command>, and the words name no action command; name one in the words' commands, or drop --action-job`);
289
+ if (!words.bin)
290
+ throw new Error("--action-job runs the product's action verb, and the words name no bin; chant has no action verb of its own");
291
+ const given = options.actionJob === true ? {} : options.actionJob.inputs ?? {};
292
+ const inputs = { member: given.member ?? words.noun[0], action: given.action ?? "action" };
293
+ for (const [role, name] of Object.entries(inputs)) {
294
+ if (!INPUT_NAME.test(name))
295
+ throw new Error(`the action job's ${role} input is a plain name, not ${JSON.stringify(name)}`);
296
+ }
297
+ if (inputs.member === inputs.action)
298
+ throw new Error(`the action job's two inputs need two names, and both are ${inputs.action}`);
299
+ const command = withProductBin(["chant", typed, PRODUCT_ACTION_EVENT_FLAG].join(" "), words.bin);
300
+ return {
301
+ jobName: PR_ACTION_JOB,
302
+ comment: `/${words.product} ${typed}`,
303
+ inputs,
304
+ command,
305
+ script: ["set +e", command, 'code="$?"', `if [ "$code" -eq ${CHANT_EXIT.waiting} ]; then echo "The action waits for an approval."; exit 0; fi`, 'exit "$code"'].join("\n"),
306
+ env: {
307
+ [PRODUCT_ACTION_ENV.comment]: "${{ github.event.comment.body }}",
308
+ [PRODUCT_ACTION_ENV.member]: `\${{ github.event.inputs.${inputs.member} }}`,
309
+ [PRODUCT_ACTION_ENV.action]: `\${{ github.event.inputs.${inputs.action} }}`,
310
+ PR_NUMBER: "${{ github.event.issue.number }}",
311
+ GITHUB_TOKEN: GITHUB_JOB_TOKEN,
312
+ },
313
+ };
314
+ }
262
315
  /** The job answering `/<product> <plan word>` (#4620). */
263
316
  export const PR_COMMENT_PREVIEW_JOB = "comment-preview";
264
317
  /** The job that posts the comment preview's note and status (#4620). */
@@ -24,7 +24,7 @@ import type { ForgeKind } from "../pr-forge.js";
24
24
  import { type OpWaveJob, type OpWavesSpec } from "../op/op-waves.js";
25
25
  import { type ControlNoteCheckout } from "../control/dispatch.js";
26
26
  import { type CiProductCommand, type CiProductWords, type CiProductWordsInput } from "../ci-product-words.js";
27
- import { type PrCommentLockJob, type PrCommentPreviewJob, type PrLoopJob, type PrLoopPipelineOptions } from "./pr-pipeline.js";
27
+ import { type PrActionJob, type PrCommentLockJob, type PrCommentPreviewJob, type PrLoopJob, type PrLoopPipelineOptions } from "./pr-pipeline.js";
28
28
  import type { DriverComponent } from "./driver.js";
29
29
  import type { ScheduledOpSpec } from "../lexicon.js";
30
30
  import type { CiRunner } from "../ci-jobs.js";
@@ -55,6 +55,15 @@ export interface ProductPipelineOptions extends Omit<PrLoopPipelineOptions, "wor
55
55
  * scheduled Ops.
56
56
  */
57
57
  agent?: boolean | ProductAgentOptions;
58
+ /**
59
+ * The product answers its `action` command (#4654) from a workflow of its
60
+ * own, such as terragucci's action workflow: `true` counts the command as
61
+ * answered, so words that map a word onto `action` are not refused, and
62
+ * `comments.action` names the comment. The pipeline writes no job for it.
63
+ * A product with no workflow of its own sets `actionJob` instead, and the
64
+ * pipeline writes the job ({@link ProductPipelineJobs.action}).
65
+ */
66
+ actions?: boolean;
58
67
  /**
59
68
  * The apply on merge from the component graph (#4588), when `waves` is
60
69
  * absent: the spec `pr-apply --wave-gate` runs, a wave per layer of
@@ -155,6 +164,14 @@ export interface ProductPipelineJobs {
155
164
  name: string;
156
165
  spec: ScheduledOpSpec;
157
166
  };
167
+ /**
168
+ * The action job (#4654), with `actionJob`: the comment and the dispatch
169
+ * inputs it answers, and the product's action verb it runs. The GitHub and
170
+ * Forgejo lexicons render the same job.
171
+ */
172
+ action?: PrActionJob & {
173
+ runner?: CiRunner;
174
+ };
158
175
  }
159
176
  /** An agent's settings as a product passes them (#4616): {@link OpAgentSpec} without the trigger, which the pipeline names. */
160
177
  export interface ProductAgentOptions extends Omit<OpAgentSpec, "on" | "comment" | "branch"> {
@@ -1 +1 @@
1
- {"version":3,"file":"product-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/product-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAgE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAChI,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAA+G,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACzO,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,M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Z,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,wBAAwB,GAAG,kBAAkB,CAaxF;AAED,uFAAuF;AACvF,MAAM,WAAW,yBAAyB;IACxC,4HAA4H;IAC5H,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yHAAyH;IACzH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gHAAgH;IAChH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,SAAS,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAAC,EAAE,EAClE,OAAO,EAAE,mBAAmB,GAAG,cAAc,EAC7C,KAAK,EAAE,kBAAkB,EACzB,OAAO,GAAE,yBAA8B,GACtC,WAAW,CAuBb;AAED,sGAAsG;AACtG,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1E"}
@@ -24,7 +24,7 @@ import { layerWaves } from "../gated-waves.js";
24
24
  import { opWaveBinArgv, opWaveJobs, opWavesControlTarget } from "../op/op-waves.js";
25
25
  import { controlNoteCheckout } from "../control/dispatch.js";
26
26
  import { assertProductWords, CHANT_WORDS, commentLine, } from "../ci-product-words.js";
27
- import { prCommentLockJobs, prCommentPreviewJob, prLoopJobs, prLoopPostJob, prLoopRunner, prStaleJob, withProductBin } from "./pr-pipeline.js";
27
+ import { prActionJob, prCommentLockJobs, prCommentPreviewJob, prLoopJobs, prLoopPostJob, prLoopRunner, prStaleJob, withProductBin } from "./pr-pipeline.js";
28
28
  import { resolveAgentSpec } from "../ci-agent.js";
29
29
  /** Where the generator writes a product's waves spec, which chant reads at base (#4550). */
30
30
  export const PRODUCT_WAVES_SPEC_DIR = ".chant/op-waves";
@@ -83,12 +83,15 @@ export function productPipelineJobs(forge, env, options) {
83
83
  jobs.push("lock", "unlock");
84
84
  if (options.agent)
85
85
  jobs.push("agent");
86
+ // #4654: the action command, answered by the product's own workflow (`actions`) or by the pipeline's action job.
87
+ if (options.actions || options.actionJob)
88
+ jobs.push("action");
86
89
  // #4601: the note's merge sentence follows the jobs built here: waves on merge, an apply before merge, else a record for a release.
87
90
  // Words that ask for before-merge keep it when the pipeline has that job beside its waves.
88
91
  const built = options.waves || options.componentWaves ? "on-merge" : options.applyBeforeMerge ? "before-merge" : "release";
89
92
  const applyMode = options.words.applyMode === "before-merge" && options.applyBeforeMerge ? "before-merge" : built;
90
93
  const words = assertProductWords({ ...options.words, applyMode }, { jobs });
91
- const { waves: given, wavesSpecFile, member, agent: _agent, componentWaves, ...loop } = options;
94
+ const { waves: given, wavesSpecFile, member, agent: _agent, actions: _actions, componentWaves, ...loop } = options;
92
95
  const { respond } = options;
93
96
  // #4629: the pull request loop puts the responses on the apply and note jobs, as `chant build --pr-loop --respond` does.
94
97
  const prLoop = { ...loop, words, gate: options.gate ?? words.prGate };
@@ -115,6 +118,9 @@ export function productPipelineJobs(forge, env, options) {
115
118
  const locks = prCommentLockJobs(forge, { locks: options.locks, words });
116
119
  if (locks.length > 0)
117
120
  out.locks = locks.map((job) => ({ ...job, ...defaultRunner }));
121
+ const action = prActionJob(forge, prLoop);
122
+ if (action)
123
+ out.action = { ...action, ...(prLoopRunner(options, "apply") !== undefined ? { runner: prLoopRunner(options, "apply") } : {}) };
118
124
  const stale = prStaleJob(forge, env, prLoop, member);
119
125
  if (stale)
120
126
  out.stale = { ...stale, ...defaultRunner };
@@ -1 +1 @@
1
- {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/driver.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzG,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAiC,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG7H,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,yDAAyD;IACzD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,qEAAqE;IACrE,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,6FAA6F;IAC7F,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3D,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,aAAa;IAC5B,8EAA8E;I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CACxD;AAED,6DAA6D;AAC7D,wBAAsB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAIlG"}
@@ -5,6 +5,10 @@
5
5
  * the BREAK run, and checks each step's outcomes against chant's own reports
6
6
  * and run ledger, never the runner's status or logs.
7
7
  *
8
+ * A pull request comes from the driver's own open step or from a product:
9
+ * an await-pull step waits for the one a product opened from its branch
10
+ * (chant#4650), and later steps name it as they name an open step's.
11
+ *
8
12
  * A run ends one of three ways. Every outcome held: the plain run passes, and
9
13
  * a BREAK run that ends so was missed. An outcome did not hold: the run stops
10
14
  * there, the plain run fails, and the BREAK run was caught. A step did not
@@ -20,6 +24,12 @@ class Stall extends Error {
20
24
  class Broke extends Error {
21
25
  }
22
26
  const iso = (ms) => new Date(ms).toISOString();
27
+ /** How a gated request stands: gated until a finished line names it, then ok or failed. */
28
+ function gatedStatus(r) {
29
+ if (!r.finished)
30
+ return "gated";
31
+ return r.finished.result === "applied" ? "ok" : "failed";
32
+ }
23
33
  /** The check of one outcome, or null when it holds. */
24
34
  async function checkOutcome(o, ctx, p) {
25
35
  if ("report" in o) {
@@ -52,6 +62,44 @@ async function checkOutcome(o, ctx, p) {
52
62
  }
53
63
  return matching.length > 0 ? null : `no ${o.ledger.op} run${o.ledger.status ? ` ${o.ledger.status}` : ""} on the ledger since the run started`;
54
64
  }
65
+ if ("gated" in o) {
66
+ if (!p.ledger?.gatedRequests)
67
+ throw new Stall("a gated outcome needs the ledger's gated requests");
68
+ const asked = (await p.ledger.gatedRequests(o.gated.op)).filter((r) => r.pending.timestamp >= ctx.since);
69
+ const matching = o.gated.status ? asked.filter((r) => gatedStatus(r) === o.gated.status) : asked;
70
+ const status = o.gated.status ? ` ${o.gated.status}` : "";
71
+ if (o.gated.count !== undefined) {
72
+ return matching.length === o.gated.count ? null : `${matching.length} gated ${o.gated.op} requests${status} on the ledger, not ${o.gated.count}`;
73
+ }
74
+ return matching.length > 0 ? null : `no gated ${o.gated.op} request${status} on the ledger since the run started`;
75
+ }
76
+ if ("pull" in o) {
77
+ if (ctx.pull === undefined)
78
+ return "no pull request to read";
79
+ if (o.pull.title !== undefined) {
80
+ if (!p.forge.pullInfo)
81
+ throw new Stall("a pull outcome with a title needs the forge's pull requests");
82
+ const info = await p.forge.pullInfo(ctx.pull);
83
+ if (!info)
84
+ return `the forge does not know pull request ${ctx.pull}`;
85
+ if (!info.title.includes(o.pull.title))
86
+ return `pull request ${ctx.pull} is titled "${info.title}", which does not hold "${o.pull.title}"`;
87
+ }
88
+ if (o.pull.files !== undefined) {
89
+ if (!p.forge.changedFiles)
90
+ throw new Stall("a pull outcome with files needs the forge's changed files");
91
+ const changed = await p.forge.changedFiles(ctx.pull);
92
+ const missing = o.pull.files.filter((f) => !changed.includes(f));
93
+ if (missing.length > 0)
94
+ return `pull request ${ctx.pull} does not change ${missing.join(", ")}`;
95
+ if (o.pull.only) {
96
+ const extra = changed.filter((f) => !o.pull.files.includes(f));
97
+ if (extra.length > 0)
98
+ return `pull request ${ctx.pull} also changes ${extra.join(", ")} beyond the files named`;
99
+ }
100
+ }
101
+ return null;
102
+ }
55
103
  if ("comment" in o) {
56
104
  if (!p.forge.comments)
57
105
  throw new Stall("a comment outcome needs the forge's comments");
@@ -125,9 +173,42 @@ export async function runArm(s, arm, p, opts) {
125
173
  throw new Stall(`no pull request from ${id}`);
126
174
  return o;
127
175
  };
176
+ // The pull requests open when the run started. await-pull never binds one
177
+ // of these, so the BREAK run cannot pick up the plain run's pull request
178
+ // when the reset left it open.
179
+ let before = new Set();
180
+ const awaitPull = async (step) => {
181
+ const find = p.forge.findPull;
182
+ if (!find)
183
+ throw new Stall("an await-pull step needs the forge's findPull");
184
+ // The product picks the branch, so it is the same on both runs.
185
+ const deadline = deadlineOf("await-pull");
186
+ let seen;
187
+ for (;;) {
188
+ const found = await find.call(p.forge, step.branch);
189
+ if (found && !before.has(found.number) && (step.title === undefined || found.title.includes(step.title))) {
190
+ opened.set(step.id, { pull: found.number, head: found.head });
191
+ log(`${s.id} ${arm}: ${step.id} found pull request ${found.number} at ${found.head.slice(0, 8)}`);
192
+ return { id: step.id, do: step.do, pull: found.number, commit: found.head };
193
+ }
194
+ if (found)
195
+ seen = found;
196
+ if (p.clock.now() >= deadline)
197
+ break;
198
+ await p.clock.sleep(opts.pollMs ?? 2000);
199
+ }
200
+ const why = !seen
201
+ ? `no open pull request from ${step.branch} within ${limits["await-pull"]}s`
202
+ : before.has(seen.number)
203
+ ? `pull request ${seen.number} from ${step.branch} was open before the run started, and no new one came within ${limits["await-pull"]}s`
204
+ : `pull request ${seen.number} from ${step.branch} is titled "${seen.title}", which does not hold "${step.title}", after ${limits["await-pull"]}s`;
205
+ throw new Stall(why);
206
+ };
128
207
  try {
129
208
  await p.reset?.();
130
209
  await p.arm?.(arm, arm === "break" ? { ...s.break.env } : {});
210
+ if (s.steps.some((x) => x.do === "await-pull"))
211
+ before = new Set(await p.forge.openPulls());
131
212
  for (let i = 0; i < s.steps.length; i++) {
132
213
  const step = s.steps[i];
133
214
  let result;
@@ -154,6 +235,11 @@ export async function runArm(s, arm, p, opts) {
154
235
  }
155
236
  continue;
156
237
  }
238
+ case "await-pull": {
239
+ result = await awaitPull(step);
240
+ ctx.pull = result.pull;
241
+ break;
242
+ }
157
243
  case "plan": {
158
244
  const o = pullOf(step.pull);
159
245
  const r = await report("plan", o.pull, o.head, "plan");
@@ -180,6 +266,17 @@ export async function runArm(s, arm, p, opts) {
180
266
  result = { id: step.id, do: step.do, pull: o.pull, commit };
181
267
  break;
182
268
  }
269
+ case "comment": {
270
+ const o = pullOf(step.pull);
271
+ const post = p.forge.postComment;
272
+ if (!post)
273
+ throw new Stall("a comment step needs the forge's postComment");
274
+ await within("comment", post.call(p.forge, o.pull, step.body, step.as ?? "author"));
275
+ log(`${s.id} ${arm}: ${step.id} commented on pull request ${o.pull} as ${step.as ?? "author"}`);
276
+ ctx.pull = o.pull;
277
+ result = { id: step.id, do: step.do, pull: o.pull };
278
+ break;
279
+ }
183
280
  case "apply": {
184
281
  const m = merged.get(step.merge);
185
282
  if (!m)
@@ -1,4 +1,4 @@
1
- import type { Clock, ForgeIssue, ForgeRun, HarnessForge } from "./ports.js";
1
+ import type { Clock, ForgeIssue, ForgePerson, ForgePull, ForgeRun, HarnessForge } from "./ports.js";
2
2
  import { type RunnerConfigOptions } from "./stack.js";
3
3
  export interface Person {
4
4
  login: string;
@@ -48,6 +48,10 @@ export declare class ForgejoForge implements HarnessForge {
48
48
  deleteBranch(name: string): Promise<void>;
49
49
  comments(pull: number): Promise<string[]>;
50
50
  issues(): Promise<ForgeIssue[]>;
51
+ findPull(branch: string): Promise<ForgePull | undefined>;
52
+ pullInfo(pull: number): Promise<ForgePull | undefined>;
53
+ changedFiles(pull: number): Promise<string[]>;
54
+ postComment(pull: number, body: string, as: ForgePerson): Promise<void>;
51
55
  applyAgain(sha: string, workflow: string): Promise<ForgeRun>;
52
56
  watch(sha: string, workflow: string): Promise<ForgeRun>;
53
57
  /** Start `workflow` on main by hand and wait for the run it started at `sha`. */
@@ -1 +1 @@
1
- {"version":3,"file":"forgejo.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/forgejo.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAExE,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,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AI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAG3D;IAEK,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASlD;IAEK,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;IAED,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE3D;IAED,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEtD;IAED,iFAAiF;YACnE,QAAQ;YAiBR,IAAI;CAInB;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,CAAC;IACxF,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,sHAAsH;IACtH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,qEAAqE;IACrE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAa/F"}
@@ -35,6 +35,8 @@ export async function forgejoApi(url, token, method, path, body, opts = {}) {
35
35
  throw new Error(`Forgejo ${method} ${path} answered ${res.status}: ${text.slice(0, 200)}`);
36
36
  return (text ? JSON.parse(text) : {});
37
37
  }
38
+ const pullOf = (p) => ({ number: p.number, title: p.title, branch: p.head?.ref ?? "", head: p.head?.sha ?? "" });
39
+ const sameRepo = (a, b) => a !== undefined && a.toLowerCase() === b.toLowerCase();
38
40
  const DONE = new Set(["success", "failure", "cancelled", "skipped"]);
39
41
  export class ForgejoForge {
40
42
  constructor(o) {
@@ -153,6 +155,39 @@ export class ForgejoForge {
153
155
  }
154
156
  return out;
155
157
  }
158
+ async findPull(branch) {
159
+ const found = [];
160
+ for (let page = 1; page < 50; page++) {
161
+ const list = await this.api(this.o.admin, "GET", `${this.r}/pulls?state=open&sort=oldest&page=${page}&limit=50`);
162
+ if (!list || list.length === 0)
163
+ break;
164
+ for (const p of list)
165
+ if (p.head?.ref === branch && sameRepo(p.head.repo?.full_name, this.o.repo))
166
+ found.push(pullOf(p));
167
+ if (list.length < 50)
168
+ break;
169
+ }
170
+ return found.sort((a, b) => a.number - b.number)[0];
171
+ }
172
+ async pullInfo(pull) {
173
+ const p = await this.api(this.o.admin, "GET", `${this.r}/pulls/${pull}`, undefined, true);
174
+ return p ? pullOf(p) : undefined;
175
+ }
176
+ async changedFiles(pull) {
177
+ const out = [];
178
+ for (let page = 1; page < 50; page++) {
179
+ const list = await this.api(this.o.admin, "GET", `${this.r}/pulls/${pull}/files?page=${page}&limit=50`);
180
+ if (!list || list.length === 0)
181
+ break;
182
+ out.push(...list.map((f) => f.filename));
183
+ if (list.length < 50)
184
+ break;
185
+ }
186
+ return out;
187
+ }
188
+ async postComment(pull, body, as) {
189
+ await this.api(this.o[as], "POST", `${this.r}/issues/${pull}/comments`, { body });
190
+ }
156
191
  applyAgain(sha, workflow) {
157
192
  return this.dispatch(sha, workflow);
158
193
  }
@@ -1,5 +1,12 @@
1
1
  /** The first chant with the e2e harness. */
2
2
  export declare const E2E_HARNESS_FLOOR = "0.124.56";
3
+ /**
4
+ * The first chant whose harness follows a pull request a product opened
5
+ * (chant#4650): the await-pull and comment steps, the pull and gated
6
+ * outcomes, and the forge reads under them. A scenario that uses one needs
7
+ * this chant or newer.
8
+ */
9
+ export declare const E2E_HARNESS_PULL_STEPS_FLOOR = "0.124.58";
3
10
  /**
4
11
  * The harness's chant docker-lexicon project, to `chant build <dir>/src
5
12
  * --lexicon docker`. It ships as source in the package's src/.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/index.ts"],"names":[],"mappings":"AAoBA,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/index.ts"],"names":[],"mappings":"AAuBA,4CAA4C;AAC5C,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,aAAe,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
@@ -13,12 +13,22 @@
13
13
  * - the no-real-cloud wrapper: ./safe-run.ts
14
14
  *
15
15
  * A product on a published chant without this subpath feature-detects:
16
- * import it lazily, and use it when `E2E_HARNESS_FLOOR` is there.
16
+ * import it lazily, and use it when `E2E_HARNESS_FLOOR` is there. A scenario
17
+ * with await-pull or comment steps, or a pull or gated outcome, needs
18
+ * `E2E_HARNESS_PULL_STEPS_FLOOR` as well.
17
19
  */
18
20
  import { existsSync } from "node:fs";
19
21
  import { join } from "node:path";
22
+ import { NEXT_RELEASE } from "../release-floors.js";
20
23
  /** The first chant with the e2e harness. */
21
24
  export const E2E_HARNESS_FLOOR = "0.124.56";
25
+ /**
26
+ * The first chant whose harness follows a pull request a product opened
27
+ * (chant#4650): the await-pull and comment steps, the pull and gated
28
+ * outcomes, and the forge reads under them. A scenario that uses one needs
29
+ * this chant or newer.
30
+ */
31
+ export const E2E_HARNESS_PULL_STEPS_FLOOR = NEXT_RELEASE;
22
32
  /**
23
33
  * The harness's chant docker-lexicon project, to `chant build <dir>/src
24
34
  * --lexicon docker`. It ships as source in the package's src/.
@@ -4,6 +4,7 @@
4
4
  * chant's reports land, chant run outside the pipeline, the ledger, and time.
5
5
  * The real ones are ./forgejo.ts and ./bucket.ts; tests pass fakes.
6
6
  */
7
+ import type { GatedRequestRead } from "../lifecycle/gated-request.js";
7
8
  import type { OpRunRecord } from "../op/runtime.js";
8
9
  /** A forge repository as the author, the reviewer and the admin: the pull request loop. */
9
10
  export interface PullForge {
@@ -44,6 +45,17 @@ export interface ForgeIssue {
44
45
  body: string;
45
46
  open: boolean;
46
47
  }
48
+ /** An open pull request as the forge reads it. */
49
+ export interface ForgePull {
50
+ number: number;
51
+ title: string;
52
+ /** Its head branch. */
53
+ branch: string;
54
+ /** Its head commit's sha. */
55
+ head: string;
56
+ }
57
+ /** Who on the forge a comment comes from. */
58
+ export type ForgePerson = "author" | "reviewer" | "admin";
47
59
  /**
48
60
  * sql-yodeler's Forge verbs (scenarios/forges/forge.ts:26-61) that the pull
49
61
  * request loop lacks. `openPr` and `merge` there are `openPull` and
@@ -55,6 +67,18 @@ export interface ForgeReads {
55
67
  comments(pull: number): Promise<string[]>;
56
68
  /** The repository's issues, open and closed, without pull requests. */
57
69
  issues(): Promise<ForgeIssue[]>;
70
+ /**
71
+ * The OPEN pull request from `branch` in this repository (a fork's branch
72
+ * of the same name is not it), or undefined. The oldest when there are
73
+ * several. A product opens it, and the await-pull step finds it.
74
+ */
75
+ findPull(branch: string): Promise<ForgePull | undefined>;
76
+ /** Pull request `pull`, open or not, or undefined when the forge does not know it. */
77
+ pullInfo(pull: number): Promise<ForgePull | undefined>;
78
+ /** The repo-relative paths pull request `pull` changes, a renamed file under its new path. */
79
+ changedFiles(pull: number): Promise<string[]>;
80
+ /** Post `body` as a comment on pull request `pull`, as `as`. */
81
+ postComment(pull: number, body: string, as: ForgePerson): Promise<void>;
58
82
  }
59
83
  export interface ForgeRuns {
60
84
  /** The apply again, started by hand on main at `sha` (workflow dispatch of `workflow`). */
@@ -96,6 +120,13 @@ export interface Chant {
96
120
  /** The run ledger of the scenario's repo (`chant/lifecycle`), read. */
97
121
  export interface Ledger {
98
122
  runs(env: string, op: string): Promise<OpRunRecord[]>;
123
+ /**
124
+ * The gated requests of `op`, oldest first, for the gated outcome. A gated
125
+ * request writes no op-run record, so `runs` never sees it. The real one
126
+ * is `readGatedRequests(op, location)` from the lifecycle module, on the
127
+ * scenario repo's ledger.
128
+ */
129
+ gatedRequests?(op: string): Promise<GatedRequestRead[]>;
99
130
  }
100
131
  /** Work outside the forge and chant: a change made out of band. */
101
132
  export interface OutOfBand {
@@ -1 +1 @@
1
- {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/ports.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,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D;AACvD,MAAM,WAAW,KAAK;IACpB,GAAG,IAAI,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/scenario.ts"],"names":[],"mappings":"AAQA,OAAO,EAAoB,KAAK,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CA+D7D;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKnD"}
1
+ {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../src/e2e-harness/scenario.ts"],"names":[],"mappings":"AASA,OAAO,EAAoB,KAAK,QAAQ,EAAqB,MAAM,iBAAiB,CAAC;AAErF,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,EAAE,CAgE7D;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAKnD"}
@@ -3,7 +3,8 @@
3
3
  * a repo tree, an ordered list of pull request steps, and the outcomes each
4
4
  * step must show. The lint refuses one that cannot record a row: no claim
5
5
  * id, no BREAK arm, nothing to check, or a step that names a pull request or
6
- * a merge no earlier step made.
6
+ * a merge no earlier step made. An await-pull step makes a pull request as
7
+ * an open step does.
7
8
  */
8
9
  import { readFileSync } from "node:fs";
9
10
  import { validateScenario } from "./schemas/index.js";
@@ -37,7 +38,7 @@ export function lintScenario(data) {
37
38
  out.push({ at: `${at}/id`, message: `step id ${step.id} is used twice` });
38
39
  const opened = (id) => {
39
40
  const o = seen.get(id);
40
- return o !== undefined && (o.do === "open" || o.do === "open-concurrent");
41
+ return o !== undefined && (o.do === "open" || o.do === "open-concurrent" || o.do === "await-pull");
41
42
  };
42
43
  switch (step.do) {
43
44
  case "open-concurrent": {
@@ -50,8 +51,9 @@ export function lintScenario(data) {
50
51
  case "plan":
51
52
  case "approve":
52
53
  case "merge":
54
+ case "comment":
53
55
  if (!opened(step.pull))
54
- out.push({ at: `${at}/pull`, message: `${step.do} names ${step.pull}, which is not an earlier open step` });
56
+ out.push({ at: `${at}/pull`, message: `${step.do} names ${step.pull}, which is not an earlier open or await-pull step` });
55
57
  break;
56
58
  case "apply": {
57
59
  const m = seen.get(step.merge);
@@ -67,9 +69,11 @@ export function lintScenario(data) {
67
69
  if ("report" in e && step.do !== "plan" && step.do !== "apply") {
68
70
  out.push({ at: `${at}/expect/${j}`, message: `a report outcome belongs on a plan or apply step, not ${step.do}` });
69
71
  }
70
- if ("comment" in e && !("pull" in step) && step.do !== "open" && step.do !== "open-concurrent") {
72
+ const hasPull = "pull" in step || step.do === "open" || step.do === "open-concurrent" || step.do === "await-pull";
73
+ if ("comment" in e && !hasPull)
71
74
  out.push({ at: `${at}/expect/${j}`, message: "a comment outcome belongs on a step with a pull request" });
72
- }
75
+ if ("pull" in e && !hasPull)
76
+ out.push({ at: `${at}/expect/${j}`, message: "a pull outcome belongs on a step with a pull request" });
73
77
  if ("exit" in e && step.do !== "out-of-band")
74
78
  out.push({ at: `${at}/expect/${j}`, message: "an exit outcome belongs on an out-of-band step" });
75
79
  }