@intentius/chant 0.61.0 → 0.62.0

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 (35) hide show
  1. package/dist/cli/handlers/operator.d.ts +0 -18
  2. package/dist/cli/handlers/operator.d.ts.map +1 -1
  3. package/dist/lexicon.d.ts +51 -0
  4. package/dist/lexicon.d.ts.map +1 -1
  5. package/dist/lifecycle/git.d.ts +117 -0
  6. package/dist/lifecycle/git.d.ts.map +1 -1
  7. package/dist/op/activities/lexicon-upgrade.d.ts +19 -1
  8. package/dist/op/activities/lexicon-upgrade.d.ts.map +1 -1
  9. package/dist/op/activities/reconcile.d.ts +225 -14
  10. package/dist/op/activities/reconcile.d.ts.map +1 -1
  11. package/dist/op/gate.d.ts.map +1 -1
  12. package/dist/op/local-executor.d.ts +17 -2
  13. package/dist/op/local-executor.d.ts.map +1 -1
  14. package/dist/op/operator.d.ts.map +1 -1
  15. package/dist/op/runtimes/local.d.ts.map +1 -1
  16. package/dist/runtime-adapter.d.ts +8 -0
  17. package/dist/runtime-adapter.d.ts.map +1 -1
  18. package/package.json +1 -1
  19. package/src/cli/handlers/operator.test.ts +102 -1
  20. package/src/cli/handlers/operator.ts +75 -5
  21. package/src/lexicon.ts +51 -0
  22. package/src/lifecycle/git.test.ts +49 -5
  23. package/src/lifecycle/git.ts +312 -11
  24. package/src/op/activities/lexicon-upgrade.test.ts +122 -39
  25. package/src/op/activities/lexicon-upgrade.ts +55 -9
  26. package/src/op/activities/reconcile.test.ts +527 -1
  27. package/src/op/activities/reconcile.ts +446 -23
  28. package/src/op/gate.test.ts +504 -0
  29. package/src/op/gate.ts +9 -1
  30. package/src/op/local-executor.test.ts +115 -0
  31. package/src/op/local-executor.ts +130 -21
  32. package/src/op/operator.test.ts +20 -0
  33. package/src/op/operator.ts +39 -1
  34. package/src/op/runtimes/local.ts +11 -0
  35. package/src/runtime-adapter.ts +17 -3
@@ -13,6 +13,34 @@
13
13
  * `merge_request_event` pipeline sets `CI_MERGE_REQUEST_IID`, a GitHub
14
14
  * `pull_request` event sets `GITHUB_REPOSITORY`, and no run sets both. See
15
15
  * {@link mergeRequestContextFrom}.
16
+ *
17
+ * On Forgejo the same mode posts the same GitHub-shaped comment (chant
18
+ * #2291): no forge split at all, because a Forgejo Actions job already sets
19
+ * `GITHUB_REPOSITORY`, `GITHUB_API_URL` and `github.token` the same way a
20
+ * GitHub Actions job does, and Forgejo's own `/api/v1` takes the identical
21
+ * GET/POST/PATCH triple. The one thing that needed fixing was the URL: `gh
22
+ * api` resolves a *relative* path against `/api/v3` for any host other than
23
+ * `github.com`, and Forgejo does not serve `/api/v3` — verified on a real
24
+ * Forgejo 12.0.4+gitea-1.22.0 instance during INTENTIUS/choudoufu#1027. See
25
+ * {@link postOrUpdateComment} and {@link githubApiBaseFrom}.
26
+ *
27
+ * `issue` needs no merge/pull request — its whole point is a cron trigger
28
+ * that has none — so its forge split reads off a wider signal: any GitLab CI
29
+ * job sets `CI_PROJECT_ID`, not only a merge-request one (see {@link
30
+ * gitlabProjectContextFrom}), and any GitHub Actions or Forgejo Actions job
31
+ * sets `GITHUB_REPOSITORY`. Both are sticky now (chant #2292, #2297): each
32
+ * finds and edits the OPEN issue it already owns by a hidden marker, the same
33
+ * recipe `comment` mode's note uses, and opens a new one only when it finds
34
+ * none. See {@link postOrUpdateGithubIssue} for the GitHub/GHES/Forgejo half
35
+ * — including why it does not use GitHub's Search API, and the decision that
36
+ * this mode never closes the issue itself. Only a run outside any known CI
37
+ * job — no `CI_PROJECT_ID`, no `GITHUB_REPOSITORY` — falls back to `gh issue
38
+ * create`'s own ambient repo detection, still marker-prefixed so a later CI
39
+ * run of the same Op finds and edits it instead of opening a second one. `gh
40
+ * api` was not exercised against a real Forgejo instance for this mode (only
41
+ * the `comment` mode's endpoints were, chant #2291) — the request shape
42
+ * mirrors that mode's exactly, but the search behavior itself is the one
43
+ * part a mock cannot vouch for.
16
44
  */
17
45
  export type ReconcileMode = "pull-request" | "issue" | "report" | "comment";
18
46
  /** A change-set entry that triggered reconciliation. */
@@ -44,11 +72,12 @@ export interface ReconcilePrArgs {
44
72
  /** PR / issue title. Default derived from env. */
45
73
  title?: string;
46
74
  /**
47
- * Hidden marker identifying this Op's comment on the pull request (comment
48
- * mode). The activity writes it as the comment's first line and finds the
49
- * comment again by it on the next run, so a re-run edits one comment instead
50
- * of stacking a new one. Default: {@link commentMarker} keyed on `env`, so
51
- * two Ops over two roots get two comments and each updates in place.
75
+ * Hidden marker identifying this Op's own comment or issue. The activity
76
+ * writes it as the first line and finds it again by it on the next run, so
77
+ * a re-run edits one comment/issue instead of stacking a new one. Default:
78
+ * {@link commentMarker} for `comment` mode, {@link issueMarker} for `issue`
79
+ * mode, both keyed on `env`, so two Ops over two roots get two comments (or
80
+ * two issues) and each updates in place.
52
81
  */
53
82
  marker?: string;
54
83
  /**
@@ -74,7 +103,7 @@ export interface ReconcileResult {
74
103
  branch?: string;
75
104
  /** Opened PR URL (pull-request mode). */
76
105
  prUrl?: string;
77
- /** Opened issue URL (issue mode). */
106
+ /** Opened or edited issue URL (issue mode; sticky on every forge — #2292, #2297). */
78
107
  issueUrl?: string;
79
108
  /** The posted or updated PR comment / MR note URL (comment mode). */
80
109
  commentUrl?: string;
@@ -110,6 +139,17 @@ export interface PullRequestContext {
110
139
  * environments own two comments and each updates in place.
111
140
  */
112
141
  export declare function commentMarker(env: string): string;
142
+ /**
143
+ * The hidden marker that makes an `issue`-mode GitLab finding findable across
144
+ * re-runs (#2292): written as the issue description's first line, matched by
145
+ * a server-side `search` plus a `startswith` check on the next run — the same
146
+ * recipe {@link commentMarker} names for the `comment` mode's note, kept as
147
+ * its own function (rather than reused) because the two modes write to
148
+ * different resources and a caller may run both against the same `env`.
149
+ * Slugified the same way, for the same reason: interpolated next to quotes
150
+ * and URL-encoding it should not need escaping out of.
151
+ */
152
+ export declare function issueMarker(env: string): string;
113
153
  /** What a `comment`-mode step says when the run it is in has no pull request and no merge request. */
114
154
  export declare function noPullRequestContextMessage(): string;
115
155
  /**
@@ -128,6 +168,139 @@ export declare function pullRequestContextFrom(env: Record<string, string | unde
128
168
  * for it.
129
169
  */
130
170
  export declare function resolvePullRequestContext(env?: Record<string, string | undefined>): Promise<PullRequestContext>;
171
+ /**
172
+ * The REST base a GitHub-shaped `gh api` call should target, read the same
173
+ * way the runner itself reads it (chant #2291). `GITHUB_API_URL` is a default
174
+ * environment variable every GitHub Actions *and* Forgejo Actions job carries
175
+ * — `https://api.github.com` on github.com, `<host>/api/v3` on GitHub
176
+ * Enterprise Server, and `<host>/api/v1` on Forgejo, which already advertises
177
+ * it correctly (confirmed on a real Forgejo 12.0.4+gitea-1.22.0 instance
178
+ * during INTENTIUS/choudoufu#1027: `$GITHUB_API_URL` read
179
+ * `http://forgejo:3000/api/v1` inside the job).
180
+ *
181
+ * Building the full URL from this rather than handing `gh api` a bare
182
+ * relative path (`repos/…`) is the fix itself: `gh` resolves a relative path
183
+ * by guessing a host-specific prefix of its own — `api.<host>` for
184
+ * `github.com`, `<host>/api/v3` for anything else — and that guess is `/api/v3`
185
+ * for a Forgejo host too, which Forgejo answers 404 for both GET and POST.
186
+ * Handed a full URL, `gh api` uses it verbatim and skips the guess entirely,
187
+ * which is what let the same `gh` binary reach Forgejo's `/api/v1` in the
188
+ * same session, over plain HTTP and over TLS. No Forgejo-specific branch is
189
+ * needed: every host in play (github.com, GHES, Forgejo) sets
190
+ * `GITHUB_API_URL` to the base its own `/repos/...` paths actually live
191
+ * under, so building the URL from it is correct everywhere `gh` already ran,
192
+ * not only on Forgejo.
193
+ */
194
+ export declare function githubApiBaseFrom(env: Record<string, string | undefined>): string;
195
+ /** The credential a GitHub- or Forgejo-shaped comment call is made with. */
196
+ export interface CommentToken {
197
+ value: string;
198
+ /** The variable it came from, so a refusal or a log line can name it. */
199
+ source: string;
200
+ }
201
+ /**
202
+ * Resolve the token `postOrUpdateComment` sends with, most specific first
203
+ * (chant #2291). `gh` itself already resolves `GH_TOKEN`/`GITHUB_TOKEN`
204
+ * ambiently from the process environment, and the generated workflow sets
205
+ * both to `${{ github.token }}` for every non-`report` finding mode — on
206
+ * Forgejo the same way as on GitHub, and the real-instance read confirmed
207
+ * `github.token` is populated there and good for a 200 read and a 201 write,
208
+ * authored as `forgejo-actions`. So the common case needs nothing set beyond
209
+ * what the generator already emits.
210
+ *
211
+ * `CHANT_FORGEJO_TOKEN` is checked first for the case that ambient token
212
+ * cannot cover: a run posting to a Forgejo instance other than the one the
213
+ * job executes on, where `github.token`'s scope stops at its own instance.
214
+ * Resolving explicitly (rather than leaving it entirely to `gh`) also buys a
215
+ * named failure before the shell-out, in place of `gh`'s own opaque 401.
216
+ */
217
+ export declare function commentTokenFrom(env: Record<string, string | undefined>): CommentToken | undefined;
218
+ /** What a `comment`-mode step says on a pull request it has no credential for. */
219
+ export declare function noCommentTokenMessage(repo: string, number: number): string;
220
+ /**
221
+ * Minimal `gh` invocation shape {@link postOrUpdateGithubIssue} threads its
222
+ * calls through. `reconcilePr` wraps `execAsync` (carrying its own `signal`)
223
+ * to this shape; `lexiconUpgrade` passes its injectable `GhRunner` straight
224
+ * through, since the two already share the same `(cmd) => Promise<{ stdout,
225
+ * stderr }>` signature. One function, not two copies, because the recipe
226
+ * below — search, then PATCH or POST — is identical for both callers; only
227
+ * the issue's title/body and the marker that owns it differ.
228
+ */
229
+ export type GhExec = (cmd: string) => Promise<{
230
+ stdout: string;
231
+ stderr: string;
232
+ }>;
233
+ /**
234
+ * Open `title`/`body` as one GitHub-shaped issue in `repo`, or edit the issue
235
+ * this caller already owns there (#2297) — `postOrUpdateComment`'s issue
236
+ * counterpart, and the GitHub/GHES/Forgejo sibling of GitLab's
237
+ * `postOrUpdateIssue` (#2292): find by marker, PATCH when found, POST when
238
+ * not, so a nightly finding carries one issue holding the current state
239
+ * instead of stacking a new one every run. Shared by `reconcilePr`'s own
240
+ * `issue` mode and `lexiconUpgrade`'s per-lexicon upgrade-status issue.
241
+ *
242
+ * Every call targets a full URL built from {@link githubApiBaseFrom}, the
243
+ * same as `postOrUpdateComment` (#2291) — so this reaches GitHub Enterprise
244
+ * Server the same way it reaches github.com.
245
+ *
246
+ * ## Why plain pagination instead of GitHub's Search API
247
+ *
248
+ * GitHub offers real server-side full-text search — `gh issue list --search`
249
+ * and `GET /search/issues?q=...` both use it, and chant #2297 (the issue that
250
+ * asked for this) names both as candidates. Neither is used here, for three
251
+ * reasons found while building this:
252
+ *
253
+ * 1. **Consistency.** GitHub's search index is documented as eventually
254
+ * consistent: an issue this function just wrote is not guaranteed to be
255
+ * findable by search immediately afterward. That is exactly the
256
+ * read-after-write the sticky recipe depends on — a false "not found"
257
+ * means a duplicate issue, which is the bug this activity exists to fix.
258
+ * 2. **The marker itself.** The hidden marker is deliberately punctuation-
259
+ * heavy (`<!-- chant-reconcile-issue:app -->`) so it renders invisibly.
260
+ * GitHub's search tokenizer is not documented to preserve that shape
261
+ * through `in:body` matching, and a wrong query would either miss the
262
+ * marker (a duplicate, the same failure mode as above) or over-match and
263
+ * still need the same client-side `startswith` check this function
264
+ * already does — at which point the search bought nothing but risk.
265
+ * 3. **Forgejo.** `gh issue list --search` and `/search/issues` are both
266
+ * absent from Forgejo's API — checked against a live Forgejo instance's
267
+ * own OpenAPI spec while building this: no `/search/issues`, no
268
+ * `/repos/issues/search` path anywhere in it (Forgejo's own issues-list
269
+ * endpoint does carry a real `q` search parameter, but that is a
270
+ * different endpoint shape than GitHub's, which would mean forking this
271
+ * function by forge — exactly what the `comment` path (#2291)
272
+ * deliberately does not do).
273
+ *
274
+ * So this reuses the recipe `postOrUpdateComment` already proved for PR
275
+ * comments: list, `--paginate`, filter with `--jq` by an exact `startswith`
276
+ * prefix match, which is correct no matter how many pages it takes. The cost
277
+ * is real — a repository with many thousands of issues pays for every page
278
+ * on every run — and is the accepted trade-off here; narrowing further with
279
+ * GitHub's `creator` filter was considered and left alone, because the
280
+ * identity a `GH_TOKEN` posts as cannot be assumed reliably across a
281
+ * generated workflow and a hand-run one, and a wrong `creator` is a false
282
+ * negative — a duplicate — not just a slower search.
283
+ *
284
+ * ## The close decision (#2297)
285
+ *
286
+ * This never closes the issue, in either branch, matching both GitLab paths
287
+ * (#2256, #2292) — neither of which closes anything either. The search is
288
+ * scoped to `state=open` rather than `state=all`, which makes that decision
289
+ * concrete rather than implicit: a human closing the issue by hand, once the
290
+ * drift it named is actually fixed, is what tells the *next* run to open a
291
+ * fresh issue for a fresh finding instead of silently rewriting the closed
292
+ * one back open-in-substance-but-not-in-state. The alternative — searching
293
+ * `state=all` and reopening on write — would need this activity to guess
294
+ * when a finding is "resolved" with no reliable signal for that (an empty
295
+ * change set this run says nothing about whether the *last* finding was
296
+ * fixed or just not evaluated), and would turn a deliberate human "done" into
297
+ * something the bot silently reverses on its next run.
298
+ *
299
+ * `.pull_request == null` is filtered out of the search because GitHub's
300
+ * issues-list endpoint also returns pull requests, which this function must
301
+ * never mistake for an issue it owns.
302
+ */
303
+ export declare function postOrUpdateGithubIssue(repo: string, marker: string, title: string, body: string, exec: GhExec): Promise<string>;
131
304
  /**
132
305
  * The merge request a `comment`-mode run posts its note onto (#2256), as a
133
306
  * GitLab CI job knows it. The GitLab counterpart of {@link
@@ -161,6 +334,34 @@ export interface MergeRequestContext {
161
334
  * Returns undefined rather than throwing, so the caller owns the message.
162
335
  */
163
336
  export declare function mergeRequestContextFrom(env: Record<string, string | undefined>): MergeRequestContext | undefined;
337
+ /**
338
+ * The GitLab project an `issue`-mode run opens or updates its issue on (#2292),
339
+ * as any GitLab CI job knows it — the counterpart of {@link
340
+ * mergeRequestContextFrom} for a mode that needs no merge request.
341
+ */
342
+ export interface GitlabProjectContext {
343
+ /** REST v4 base, from `CI_API_V4_URL` or derived from `CI_SERVER_URL`. */
344
+ api: string;
345
+ /** The project holding the issue — its numeric id, or a `group/project` path. */
346
+ project: string;
347
+ /** `group/project`, for a human-readable result. */
348
+ path?: string;
349
+ /** The project's web URL, used to build the issue's own URL. */
350
+ webUrl?: string;
351
+ }
352
+ /**
353
+ * Derive the GitLab project an `issue`-mode run is in, from the job's own CI
354
+ * variables. Pure — exported for testing, and the whole forge detection:
355
+ * `CI_PROJECT_ID` is set on every GitLab CI job, merge request or not, and
356
+ * nothing outside GitLab CI sets it — a GitHub Actions run never reaches this
357
+ * branch. Unlike {@link mergeRequestContextFrom}, no `CI_MERGE_REQUEST_IID`
358
+ * is required, since `issue` mode's whole point is a cron trigger that has
359
+ * none.
360
+ *
361
+ * Returns undefined rather than throwing, so the caller owns the fallback:
362
+ * a run with no GitLab signal falls through to `gh issue create`.
363
+ */
364
+ export declare function gitlabProjectContextFrom(env: Record<string, string | undefined>): GitlabProjectContext | undefined;
164
365
  /** The credential a merge-request note is written with, and the header GitLab reads it from. */
165
366
  export interface GitlabNoteToken {
166
367
  /** `PRIVATE-TOKEN` for a personal/project/group access token, `JOB-TOKEN` for `CI_JOB_TOKEN`. */
@@ -188,6 +389,8 @@ export interface GitlabNoteToken {
188
389
  export declare function gitlabNoteTokenFrom(env: Record<string, string | undefined>): GitlabNoteToken | undefined;
189
390
  /** What a `comment`-mode step says on a merge request it has no credential for. */
190
391
  export declare function noGitlabNoteTokenMessage(iid: number): string;
392
+ /** What an `issue`-mode step says on a GitLab project it has no credential for (#2292). */
393
+ export declare function noGitlabIssueTokenMessage(project: string): string;
191
394
  /**
192
395
  * Map a `chant lifecycle plan --json` ChangeSet to reconcile entries, dropping
193
396
  * `noop` entries (nothing to reconcile). Pure — exported for testing.
@@ -197,16 +400,24 @@ export declare function entriesFromPlan(planJson: string): ReconcileEntry[];
197
400
  * Reconcile activity: turn regenerated TypeScript into a reviewable artifact.
198
401
  *
199
402
  * - `report` — return the summary only; no git, no network.
200
- * - `issue` — open a GitHub issue describing the drift (no code change).
403
+ * - `issue` — open or edit one issue describing the drift (no code change).
404
+ * On a GitHub Actions or Forgejo Actions job, or GitHub Enterprise Server,
405
+ * the OPEN issue already carrying this Op's hidden marker is edited in
406
+ * place and a new one opened only when there is none (#2297). On a GitLab
407
+ * CI job (any trigger — the point of this mode is a cron run that has no
408
+ * merge request), the same recipe against one GitLab issue (#2292). Neither
409
+ * branch ever closes the issue itself — see {@link postOrUpdateGithubIssue}
410
+ * for that decision and why.
201
411
  * - `comment` — post the body as one comment on the pull request that
202
412
  * triggered the run, editing that same comment on every re-run rather than
203
- * stacking a new one (#2231), or, on a GitLab `merge_request_event`
204
- * pipeline, as one note on that merge request by the same recipe (#2256).
205
- * Needs a pull-request- or merge-request-triggered run; fails by name when
206
- * there is none. No code change, and the `pull-requests: write` the
207
- * generated workflow already grants on that trigger is the whole scope it
208
- * spends on GitHub; on GitLab the scope is whatever the token it is given
209
- * carries.
413
+ * stacking a new one (#2231) — on GitHub and on Forgejo alike (#2291), the
414
+ * same GitHub-shaped `issues/{n}/comments` calls against each host's own
415
+ * API base — or, on a GitLab `merge_request_event` pipeline, as one note on
416
+ * that merge request by the same recipe (#2256). Needs a pull-request- or
417
+ * merge-request-triggered run; fails by name when there is none. No code
418
+ * change, and the `pull-requests: write` the generated workflow already
419
+ * grants on that trigger is the whole scope it spends on GitHub and
420
+ * Forgejo; on GitLab the scope is whatever the token it is given carries.
210
421
  * - `pull-request` — create a branch, regenerate source via
211
422
  * `chant import --from <env>`, commit, push, and open a PR whose diff is the
212
423
  * regenerated TypeScript. Never commits to the main branch.
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../../src/op/activities/reconcile.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,uEA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,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAAO,GACjF,cAAc,GAAG;IAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA;CAAE,CAgBpD;AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mHAAmH;IACnH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GACjB;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,oBAAoB,CAAA;CAAE,GACrD;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAKxE;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAyBlG;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/D"}
@@ -82,10 +82,25 @@ export interface OpRunResult {
82
82
  */
83
83
  record: OpRunRecord;
84
84
  }
85
- /** Thrown on terminal Op failure; carries the partial run result for rendering. */
85
+ /**
86
+ * Thrown on terminal Op failure; carries the partial run result for rendering.
87
+ *
88
+ * `cause` is what actually went wrong (#2301). Before it, this class was the
89
+ * end of the line for any error that was not a `PhaseFailure` — the executor
90
+ * caught it, built an `OpRunFailure` from the records it had, and never
91
+ * referenced the error again. Anything thrown outside a step's own
92
+ * error-capturing path therefore reached the operator as `Op "x" failed` and
93
+ * nothing else: no error line, no failing step, exit 1. That is how a gate
94
+ * whose ledger write died on a CI checkout with no `user.email` produced no
95
+ * text naming git, the ledger, or the identity, on INTENTIUS/choudoufu#1026.
96
+ */
86
97
  export declare class OpRunFailure extends Error {
87
98
  readonly result: OpRunResult;
88
- constructor(result: OpRunResult);
99
+ /** The error the run actually died on, when it was not a step's own failure. */
100
+ readonly cause?: unknown;
101
+ constructor(result: OpRunResult, options?: {
102
+ cause?: unknown;
103
+ });
89
104
  }
90
105
  /**
91
106
  * Find the first `policyGate` step anywhere in the Op (phases + `onFailure`,
@@ -1 +1 @@
1
- {"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAwC,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAI7F,OAAO,EAAmC,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAG7C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IAC3C,4GAA4G;I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,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC1C,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gFAAgF;IAChF,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFjF;AAED,wiBAAwiB;AACxiB,wBAAgB,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAgBhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/op/runtimes/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAwCpB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,iBAAiB,CAoI3F"}
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../../src/op/runtimes/local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAwCpB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,iBAAiB,CA+I3F"}
@@ -25,9 +25,17 @@ export interface RuntimeAdapter {
25
25
  * needs to round-trip content through a shell (`sh -c "echo … | cmd"`) just
26
26
  * to feed a command that reads from stdin (e.g. `git hash-object --stdin`).
27
27
  */
28
+ /**
29
+ * `opts.env` merges over the parent environment rather than replacing it —
30
+ * a caller pinning `LC_ALL=C` to parse a command's output must not also
31
+ * have to reconstruct `PATH`, `HOME` and everything else the child needs.
32
+ * An entry whose value is `""` is passed through as empty, which is how a
33
+ * gettext override like `LANGUAGE` is neutralised.
34
+ */
28
35
  spawn(cmd: string[], opts?: {
29
36
  cwd?: string;
30
37
  stdin?: string;
38
+ env?: Record<string, string>;
31
39
  }): Promise<SpawnResult>;
32
40
  /** Commands to use when spawning package manager / executor */
33
41
  readonly commands: RuntimeCommands;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-adapter.d.ts","sourceRoot":"","sources":["../src/runtime-adapter.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD;;;;;OAKG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpF,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC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cAAc,CAG5C;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,cAAc,CAK3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -16,6 +16,7 @@ const readGateResolutionsMock = vi.fn();
16
16
  const readGateLedgerMock = vi.fn();
17
17
  const readRunLedgerMock = vi.fn();
18
18
  const pushLifecycleMock = vi.fn();
19
+ const requireLifecycleLedgerMock = vi.fn();
19
20
 
20
21
  vi.mock("../../op/operator", async () => {
21
22
  const actual = await vi.importActual<typeof import("../../op/operator")>("../../op/operator");
@@ -59,7 +60,13 @@ vi.mock("../../lifecycle/gate-ledger", async () => {
59
60
  });
60
61
  vi.mock("../../lifecycle/git", async () => {
61
62
  const actual = await vi.importActual<typeof import("../../lifecycle/git")>("../../lifecycle/git");
62
- return { ...actual, pushLifecycle: (...args: unknown[]) => pushLifecycleMock(...args) };
63
+ return {
64
+ ...actual,
65
+ pushLifecycle: (...args: unknown[]) => pushLifecycleMock(...args),
66
+ // Mocked, not merely defaulted: the real one shells to `git fetch`, and
67
+ // these tests run in the chant checkout itself (#2303).
68
+ requireLifecycleLedger: (...args: unknown[]) => requireLifecycleLedgerMock(...args),
69
+ };
63
70
  });
64
71
 
65
72
  // Imported after the mocks above are registered.
@@ -80,6 +87,7 @@ beforeEach(() => {
80
87
  loadProfilesMock.mockResolvedValue({});
81
88
  discoverOpsMock.mockResolvedValue({ ops: new Map([["fountain-apply", {}]]), errors: [] });
82
89
  pushLifecycleMock.mockResolvedValue(true);
90
+ requireLifecycleLedgerMock.mockResolvedValue(undefined);
83
91
  readGateResolutionsMock.mockResolvedValue({ records: [], malformed: 0 });
84
92
  readGateLedgerMock.mockResolvedValue({ resolutions: [], pending: [], malformed: 0 });
85
93
  });
@@ -726,3 +734,96 @@ describe("runOperatorLog", () => {
726
734
  errSpy.mockRestore();
727
735
  });
728
736
  });
737
+
738
+ /**
739
+ * #2303 finding 2, at the handler. The mechanism is proved against real git
740
+ * in `op/gate.test.ts`; what these hold is that `chant approve` actually goes
741
+ * through the guard, and stops rather than writing when it refuses — the
742
+ * append must not be reached, because reaching it is what discarded the
743
+ * pending fact in the first place.
744
+ */
745
+ describe("runApprove — the ledger branch is read before it is appended to (#2303)", () => {
746
+ test("reads the branch before recording the resolution", async () => {
747
+ appendGateResolutionMock.mockResolvedValue({
748
+ commit: "sha",
749
+ record: { version: 1, op: "fountain-apply", gate: "rollout-gate", resolvedBy: "alex", timestamp: "2026-01-01T00:00:00.000Z" },
750
+ });
751
+ const errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
752
+
753
+ expect(await runApprove(ctx({ path: "fountain-apply", extraPositional: "rollout-gate", actor: "alex" }))).toBe(0);
754
+
755
+ expect(requireLifecycleLedgerMock).toHaveBeenCalled();
756
+ expect(requireLifecycleLedgerMock.mock.invocationCallOrder[0]).toBeLessThan(
757
+ appendGateResolutionMock.mock.invocationCallOrder[0],
758
+ );
759
+ errSpy.mockRestore();
760
+ });
761
+
762
+ test("refuses by name, and writes nothing, when the branch cannot be read", async () => {
763
+ requireLifecycleLedgerMock.mockRejectedValue(
764
+ new Error(
765
+ 'the chant/lifecycle ledger branch is not in this checkout and could not be fetched from "origin"',
766
+ ),
767
+ );
768
+ const errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
769
+
770
+ const code = await runApprove(ctx({ path: "fountain-apply", extraPositional: "rollout-gate", actor: "alex" }));
771
+
772
+ expect(code).toBe(1);
773
+ expect(appendGateResolutionMock).not.toHaveBeenCalled();
774
+ expect(pushLifecycleMock).not.toHaveBeenCalled();
775
+ expect(errSpy.mock.calls.map((c) => String(c[0])).join("\n")).toContain("chant/lifecycle ledger branch");
776
+ errSpy.mockRestore();
777
+ });
778
+
779
+ test("--expire is guarded the same way", async () => {
780
+ requireLifecycleLedgerMock.mockRejectedValue(new Error("the chant/lifecycle ledger branch has diverged"));
781
+ const errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
782
+
783
+ const code = await runApprove(ctx({ path: "fountain-apply", extraPositional: "rollout-gate", expire: true }));
784
+
785
+ expect(code).toBe(1);
786
+ expect(appendPendingGateMock).not.toHaveBeenCalled();
787
+ errSpy.mockRestore();
788
+ });
789
+ });
790
+
791
+ /**
792
+ * #2309 review. `pushLifecycle().catch(() => undefined)` at both write sites
793
+ * meant a rejected push printed unconditional success and exited 0 — the
794
+ * operator walks away believing the gate is answered for everybody, while the
795
+ * resolution exists only in their own checkout.
796
+ */
797
+ describe("runApprove — a push that does not land is reported (#2309 review)", () => {
798
+ test("a rejected push warns and marks the success line local-only", async () => {
799
+ appendGateResolutionMock.mockResolvedValue({
800
+ commit: "sha",
801
+ record: { version: 1, op: "fountain-apply", gate: "rollout-gate", resolvedBy: "alex", timestamp: "2026-01-01T00:00:00.000Z" },
802
+ });
803
+ pushLifecycleMock.mockRejectedValue(new Error("Another snapshot completed for chant/lifecycle"));
804
+ const errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
805
+
806
+ const code = await runApprove(ctx({ path: "fountain-apply", extraPositional: "rollout-gate", actor: "alex" }));
807
+
808
+ const out = errSpy.mock.calls.map((c) => String(c[0])).join("\n");
809
+ expect(out).toMatch(/push to the remote was rejected/);
810
+ expect(out).toMatch(/local only . the push did not land/);
811
+ // Still exit 0: the local append is a correct local fact.
812
+ expect(code).toBe(0);
813
+ errSpy.mockRestore();
814
+ });
815
+
816
+ test("a project with no remote says nothing was pushed", async () => {
817
+ appendGateResolutionMock.mockResolvedValue({
818
+ commit: "sha",
819
+ record: { version: 1, op: "fountain-apply", gate: "rollout-gate", resolvedBy: "alex", timestamp: "2026-01-01T00:00:00.000Z" },
820
+ });
821
+ pushLifecycleMock.mockResolvedValue(false);
822
+ const errSpy = vi.spyOn(console, "error").mockImplementation(() => undefined);
823
+
824
+ await runApprove(ctx({ path: "fountain-apply", extraPositional: "rollout-gate", actor: "alex" }));
825
+
826
+ expect(errSpy.mock.calls.map((c) => String(c[0])).join("\n")).toMatch(/No remote is configured/);
827
+ errSpy.mockRestore();
828
+ });
829
+ });