@intentius/chant 0.124.31 → 0.124.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chant +7 -2
- package/dist/cli/commands/check-lexicon-plugin.d.ts +7 -4
- package/dist/cli/commands/check-lexicon-plugin.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-plugin.js +10 -7
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon.js +18 -12
- package/dist/cli/commands/import.d.ts +10 -0
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +37 -0
- package/dist/cli/commands/init-lexicon/templates/project.d.ts.map +1 -1
- package/dist/cli/commands/init-lexicon/templates/project.js +4 -3
- package/dist/cli/commands/onboard.d.ts.map +1 -1
- package/dist/cli/commands/onboard.js +8 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +2 -1
- package/dist/cli/dependencies.d.ts +18 -0
- package/dist/cli/dependencies.d.ts.map +1 -0
- package/dist/cli/dependencies.js +120 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +23 -4
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +12 -4
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +16 -6
- package/dist/cli/handlers/lint.d.ts.map +1 -1
- package/dist/cli/handlers/lint.js +6 -0
- package/dist/cli/handlers/operator.d.ts +2 -2
- package/dist/cli/handlers/operator.js +3 -3
- package/dist/cli/handlers/pr.d.ts +14 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +488 -32
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +3 -1
- package/dist/cli/handlers/run.d.ts +13 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +38 -15
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +44 -16
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +15 -0
- package/dist/cli/registry.d.ts +13 -4
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/registry.js +6 -2
- package/dist/codegen/generate-post-synth-barrel.js +2 -2
- package/dist/codegen/lexicon-regen.d.ts +4 -0
- package/dist/codegen/lexicon-regen.d.ts.map +1 -1
- package/dist/codegen/lexicon-regen.js +1 -1
- package/dist/codegen/pinned-upgrade.js +2 -2
- package/dist/components/capability.d.ts +44 -3
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +21 -0
- package/dist/components/changed-files.d.ts +7 -1
- package/dist/components/changed-files.d.ts.map +1 -1
- package/dist/components/changed-files.js +9 -1
- package/dist/components/driver.d.ts +38 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +47 -6
- package/dist/components/fan-out-record.d.ts +6 -1
- package/dist/components/fan-out-record.d.ts.map +1 -1
- package/dist/components/fan-out-record.js +24 -0
- package/dist/components/fan-out-run.d.ts +20 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +21 -1
- package/dist/components/pr-pipeline.d.ts +65 -2
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +107 -15
- package/dist/components/pr-run.d.ts +127 -29
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +290 -70
- package/dist/components/wave-plan.d.ts +5 -2
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +12 -1
- package/dist/discovery/fold-import.d.ts.map +1 -1
- package/dist/discovery/fold-import.js +16 -6
- package/dist/discovery/sandbox/bundle.d.ts.map +1 -1
- package/dist/discovery/sandbox/bundle.js +6 -0
- package/dist/discovery/specifier-resolve.d.ts.map +1 -1
- package/dist/discovery/specifier-resolve.js +8 -2
- package/dist/fold/fold.d.ts.map +1 -1
- package/dist/fold/fold.js +68 -1
- package/dist/fold/subset.d.ts +37 -0
- package/dist/fold/subset.d.ts.map +1 -1
- package/dist/fold/subset.js +88 -0
- package/dist/lexicon-module.d.ts +10 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +53 -8
- package/dist/lexicon-plugin-helpers.d.ts.map +1 -1
- package/dist/lexicon-plugin-helpers.js +6 -4
- package/dist/lexicon.d.ts +2 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/affected.d.ts.map +1 -1
- package/dist/lifecycle/affected.js +7 -1
- package/dist/lifecycle/release-ledger.d.ts +21 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +24 -0
- package/dist/lifecycle/work-dir.d.ts +45 -0
- package/dist/lifecycle/work-dir.d.ts.map +1 -0
- package/dist/lifecycle/work-dir.js +78 -0
- package/dist/lint/discover.d.ts +17 -9
- package/dist/lint/discover.d.ts.map +1 -1
- package/dist/lint/discover.js +62 -54
- package/dist/module-source.d.ts +57 -0
- package/dist/module-source.d.ts.map +1 -0
- package/dist/module-source.js +104 -0
- package/dist/op/activities/factory.js +1 -1
- package/dist/op/discover.d.ts.map +1 -1
- package/dist/op/discover.js +13 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +3 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +20 -5
- package/dist/op/operator.d.ts +2 -2
- package/dist/op/operator.js +2 -2
- package/dist/op/steward.d.ts +6 -4
- package/dist/op/steward.d.ts.map +1 -1
- package/dist/op/steward.js +5 -3
- package/dist/op/work-lease-run.d.ts +20 -7
- package/dist/op/work-lease-run.d.ts.map +1 -1
- package/dist/op/work-lease-run.js +56 -12
- package/dist/pr-forge.d.ts +10 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +39 -0
- package/dist/pr-loop.d.ts +141 -4
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +122 -6
- package/dist/pr-report-url.d.ts +2 -2
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +5 -5
- package/dist/ts-loader.d.ts +38 -4
- package/dist/ts-loader.d.ts.map +1 -1
- package/dist/ts-loader.js +190 -16
- package/dist/wave-runtime.mjs +208 -208
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts +34 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.d.ts.map +1 -0
- package/dist/workspace/chant-migrations/fountain-retired-kinds.js +176 -0
- package/dist/workspace/chant-migrations.d.ts.map +1 -1
- package/dist/workspace/chant-migrations.js +2 -0
- package/dist/workspace/checks/boxes.d.ts +6 -6
- package/dist/workspace/checks/boxes.js +9 -9
- package/dist/workspace/ci-green-forge.d.ts +6 -4
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +28 -12
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +49 -21
- package/dist/workspace/ci-list.schema.json +12 -6
- package/dist/workspace/ci-report-url.d.ts +18 -0
- package/dist/workspace/ci-report-url.d.ts.map +1 -0
- package/dist/workspace/ci-report-url.js +33 -0
- package/dist/workspace/ci-run-index.d.ts +12 -0
- package/dist/workspace/ci-run-index.d.ts.map +1 -1
- package/dist/workspace/ci-run-index.js +6 -4
- package/dist/workspace/ci-run-index.schema.json +5 -3
- package/dist/workspace/ci-run.d.ts +75 -2
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +195 -53
- package/dist/workspace/ci-runner-key.d.ts +16 -3
- package/dist/workspace/ci-runner-key.d.ts.map +1 -1
- package/dist/workspace/ci-runner-key.js +30 -10
- package/dist/workspace/ci-serve.d.ts +54 -4
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +175 -26
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +11 -2
- package/dist/workspace/declaration.schema.json +7 -2
- package/dist/workspace/export.d.ts +1 -1
- package/dist/workspace/export.d.ts.map +1 -1
- package/dist/workspace/export.js +7 -3
- package/dist/workspace/ls.d.ts +6 -1
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/ls.js +1 -0
- package/dist/workspace/ls.schema.json +7 -1
- package/dist/workspace/pin-integrity.d.ts.map +1 -1
- package/dist/workspace/pin-integrity.js +3 -2
- package/dist/workspace/pr-report.schema.json +74 -7
- package/dist/workspace/reason-codes.d.ts +1 -1
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +2 -2
- package/dist/workspace/run-event.schema.json +3 -1
- package/dist/workspace/status.schema.json +3 -1
- package/dist/workspace/write-scope.d.ts +9 -0
- package/dist/workspace/write-scope.d.ts.map +1 -1
- package/dist/workspace/write-scope.js +11 -1
- package/package.json +1 -1
- package/src/__fixtures__/pr-loop/pr-apply-wave-waiting.note.golden.md +48 -0
- package/src/cli/commands/__fixtures__/init-lexicon-output/package.json +3 -3
- package/src/cli/commands/audit.test.ts +2 -2
- package/src/cli/commands/check-lexicon-plugin.test.ts +9 -0
- package/src/cli/commands/check-lexicon-plugin.ts +11 -8
- package/src/cli/commands/check-lexicon.test.ts +1 -1
- package/src/cli/commands/check-lexicon.ts +16 -11
- package/src/cli/commands/import.ts +40 -0
- package/src/cli/commands/init-lexicon/templates/project.ts +4 -3
- package/src/cli/commands/init-lexicon.test.ts +8 -5
- package/src/cli/commands/onboard.test.ts +45 -0
- package/src/cli/commands/onboard.ts +8 -4
- package/src/cli/commands/update.test.ts +6 -0
- package/src/cli/commands/update.ts +4 -1
- package/src/cli/compiled-cli.e2e.test.ts +76 -11
- package/src/cli/dependencies.e2e.test.ts +101 -0
- package/src/cli/dependencies.test.ts +93 -0
- package/src/cli/dependencies.ts +122 -0
- package/src/cli/handlers/build.test.ts +69 -0
- package/src/cli/handlers/build.ts +20 -4
- package/src/cli/handlers/fan-out.test.ts +73 -0
- package/src/cli/handlers/fan-out.ts +11 -4
- package/src/cli/handlers/graph.test.ts +76 -0
- package/src/cli/handlers/graph.ts +19 -12
- package/src/cli/handlers/lint.test.ts +42 -0
- package/src/cli/handlers/lint.ts +6 -0
- package/src/cli/handlers/operator.ts +3 -3
- package/src/cli/handlers/pr-waves.test.ts +449 -0
- package/src/cli/handlers/pr.test.ts +134 -0
- package/src/cli/handlers/pr.ts +523 -31
- package/src/cli/handlers/promote.test.ts +26 -1
- package/src/cli/handlers/promote.ts +3 -2
- package/src/cli/handlers/run-components-exit.test.ts +99 -0
- package/src/cli/handlers/run-signer.test.ts +79 -0
- package/src/cli/handlers/run.ts +34 -16
- package/src/cli/main.test.ts +18 -0
- package/src/cli/main.ts +43 -16
- package/src/cli/parse-args.ts +12 -0
- package/src/cli/registry.ts +19 -6
- package/src/codegen/generate-post-synth-barrel.ts +2 -2
- package/src/codegen/lexicon-regen.ts +1 -1
- package/src/codegen/pinned-upgrade.ts +2 -2
- package/src/codegen/post-synth-barrel-guards.test.ts +6 -11
- package/src/components/capability.ts +51 -3
- package/src/components/changed-files.test.ts +16 -1
- package/src/components/changed-files.ts +9 -1
- package/src/components/driver.test.ts +36 -1
- package/src/components/driver.ts +76 -4
- package/src/components/fan-out-record.ts +29 -1
- package/src/components/fan-out-run.test.ts +35 -0
- package/src/components/fan-out-run.ts +40 -1
- package/src/components/pr-pipeline.test.ts +100 -0
- package/src/components/pr-pipeline.ts +132 -17
- package/src/components/pr-run.test.ts +323 -18
- package/src/components/pr-run.ts +354 -75
- package/src/components/wave-plan.ts +16 -4
- package/src/discovery/fold-host-method.test.ts +87 -0
- package/src/discovery/fold-import.ts +15 -5
- package/src/discovery/fold-package-composite.test.ts +27 -0
- package/src/discovery/fold-specifiers.test.ts +8 -0
- package/src/discovery/sandbox/bundle.ts +6 -0
- package/src/discovery/specifier-resolve.ts +8 -2
- package/src/fold/fold.test.ts +72 -0
- package/src/fold/fold.ts +71 -0
- package/src/fold/subset.test.ts +31 -0
- package/src/fold/subset.ts +99 -0
- package/src/lexicon-dist.e2e.test.ts +254 -0
- package/src/lexicon-module.test.ts +47 -0
- package/src/lexicon-module.ts +49 -7
- package/src/lexicon-plugin-helpers.ts +6 -4
- package/src/lexicon.ts +2 -0
- package/src/lifecycle/affected.test.ts +7 -0
- package/src/lifecycle/affected.ts +6 -1
- package/src/lifecycle/release-ledger.ts +34 -0
- package/src/lifecycle/work-dir.test.ts +77 -0
- package/src/lifecycle/work-dir.ts +82 -0
- package/src/lint/discover.test.ts +46 -2
- package/src/lint/discover.ts +55 -49
- package/src/module-source.test.ts +85 -0
- package/src/module-source.ts +112 -0
- package/src/op/activities/factory.ts +1 -1
- package/src/op/discover-root.test.ts +31 -2
- package/src/op/discover.ts +14 -4
- package/src/op/gate.test.ts +30 -0
- package/src/op/gate.ts +3 -0
- package/src/op/op-waves-run.ts +20 -5
- package/src/op/op-waves.test.ts +49 -0
- package/src/op/operator.ts +2 -2
- package/src/op/steward.ts +6 -4
- package/src/op/work-lease-run.test.ts +88 -2
- package/src/op/work-lease-run.ts +52 -12
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +42 -0
- package/src/pr-forge.ts +40 -0
- package/src/pr-loop-bundle.test.ts +2 -1
- package/src/pr-loop.test.ts +117 -1
- package/src/pr-loop.ts +252 -10
- package/src/pr-report-url.ts +5 -5
- package/src/terraform/__fixtures__/advise.test.ts +21 -2
- package/src/ts-loader.test.ts +89 -1
- package/src/ts-loader.ts +180 -13
- package/src/workspace/changes.test.ts +1 -1
- package/src/workspace/chant-migrations/fountain-retired-kinds.test.ts +33 -0
- package/src/workspace/chant-migrations/fountain-retired-kinds.ts +190 -0
- package/src/workspace/chant-migrations.e2e.test.ts +5 -0
- package/src/workspace/chant-migrations.ts +2 -0
- package/src/workspace/checks/boxes.ts +9 -9
- package/src/workspace/ci-green-forge.ts +6 -4
- package/src/workspace/ci-green-runs.test.ts +53 -11
- package/src/workspace/ci-green.test.ts +1 -1
- package/src/workspace/ci-green.ts +50 -22
- package/src/workspace/ci-list.schema.json +12 -6
- package/src/workspace/ci-report-url.test.ts +220 -0
- package/src/workspace/ci-report-url.ts +33 -0
- package/src/workspace/ci-run-index.schema.json +5 -3
- package/src/workspace/ci-run-index.test.ts +42 -3
- package/src/workspace/ci-run-index.ts +18 -4
- package/src/workspace/ci-run.test.ts +185 -7
- package/src/workspace/ci-run.ts +224 -54
- package/src/workspace/ci-runner-key.test.ts +55 -17
- package/src/workspace/ci-runner-key.ts +36 -11
- package/src/workspace/ci-serve.test.ts +150 -6
- package/src/workspace/ci-serve.ts +169 -25
- package/src/workspace/declaration.schema.json +7 -2
- package/src/workspace/declaration.test.ts +23 -0
- package/src/workspace/declaration.ts +19 -3
- package/src/workspace/export.ts +6 -3
- package/src/workspace/ls.schema.json +7 -1
- package/src/workspace/ls.ts +7 -2
- package/src/workspace/pin-integrity.test.ts +5 -0
- package/src/workspace/pin-integrity.ts +3 -2
- package/src/workspace/pr-report.schema.json +74 -7
- package/src/workspace/reason-codes.ts +2 -2
- package/src/workspace/run-event.schema.json +3 -1
- package/src/workspace/status.schema.json +3 -1
- package/src/workspace/write-scope.test.ts +29 -1
- package/src/workspace/write-scope.ts +12 -1
|
@@ -11,6 +11,27 @@
|
|
|
11
11
|
* live under `./verbs/*` as typed stubs — no cloud calls, no side effects.
|
|
12
12
|
* Cloud implementations are a later phase (see epic #551, issue #554).
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The exit code of a command whose capability step refused a plan that moved
|
|
16
|
+
* since it was approved: 3, the code `pr-apply` gives a moved digest and a
|
|
17
|
+
* run gives a gate (#3997).
|
|
18
|
+
*/
|
|
19
|
+
export const PLAN_MOVED_EXIT_CODE = 3;
|
|
20
|
+
/**
|
|
21
|
+
* Whether `err` is a `run`'s refusal to apply a plan from
|
|
22
|
+
* `DeployContext.plans` because the target moved since it was planned
|
|
23
|
+
* (#3997). The mark is a `planMoved: true` property, not a class, so a
|
|
24
|
+
* lexicon built against an older core can set it. An `exitCode` of
|
|
25
|
+
* {@link PLAN_MOVED_EXIT_CODE} on the error is the same mark. Any other
|
|
26
|
+
* `exitCode` is ignored: a failed step exits 1, so a capability can't pick
|
|
27
|
+
* the process's exit code.
|
|
28
|
+
*/
|
|
29
|
+
export function isPlanMovedError(err) {
|
|
30
|
+
if (typeof err !== "object" || err === null)
|
|
31
|
+
return false;
|
|
32
|
+
const e = err;
|
|
33
|
+
return e.planMoved === true || e.exitCode === PLAN_MOVED_EXIT_CODE;
|
|
34
|
+
}
|
|
14
35
|
/**
|
|
15
36
|
* Thrown by a stub `run`/`rollback` — the verb is specified and typed but has
|
|
16
37
|
* no cloud implementation yet. Distinguishes "not implemented" from a runtime
|
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
* changed paths instead (`LexiconPlugin.changedUnits`).
|
|
9
9
|
*/
|
|
10
10
|
import type { LexiconPlugin } from "../lexicon.js";
|
|
11
|
+
/**
|
|
12
|
+
* Git's empty tree. A root commit has no parent, so a push of one is measured
|
|
13
|
+
* from this (#4004): every file it holds counts as changed.
|
|
14
|
+
*/
|
|
15
|
+
export declare const EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
11
16
|
/**
|
|
12
17
|
* The commit a change is measured from: the merge base of `base` and `head`.
|
|
13
18
|
* A pull request's head that branched before `base` moved is measured from
|
|
14
19
|
* where it branched, so the other changes on `base` are not counted as its
|
|
15
|
-
* own; a merge commit's first parent is its own merge base.
|
|
20
|
+
* own; a merge commit's first parent is its own merge base. The empty tree
|
|
21
|
+
* has no merge base with anything and is returned as it is.
|
|
16
22
|
*/
|
|
17
23
|
export declare function resolveMergeBase(cwd: string, base: string, head?: string): Promise<string>;
|
|
18
24
|
/** The full commit `ref` names. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changed-files.d.ts","sourceRoot":"","sources":["../../src/components/changed-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAShD
|
|
1
|
+
{"version":3,"file":"changed-files.d.ts","sourceRoot":"","sources":["../../src/components/changed-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAShD;;;GAGG;AACH,eAAO,MAAM,cAAc,6CAA6C,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAWhG;AAED,mCAAmC;AACnC,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE7E;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAWrG;AAED,iEAAiE;AACjE,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,SAAS,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,EAAE,EACvD,GAAG,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,GACpF,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB"}
|
|
@@ -15,13 +15,21 @@ async function git(cwd, args) {
|
|
|
15
15
|
const { stdout } = await execFileAsync("git", args, { cwd, maxBuffer: 64 * 1024 * 1024 });
|
|
16
16
|
return stdout;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Git's empty tree. A root commit has no parent, so a push of one is measured
|
|
20
|
+
* from this (#4004): every file it holds counts as changed.
|
|
21
|
+
*/
|
|
22
|
+
export const EMPTY_TREE_SHA = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
18
23
|
/**
|
|
19
24
|
* The commit a change is measured from: the merge base of `base` and `head`.
|
|
20
25
|
* A pull request's head that branched before `base` moved is measured from
|
|
21
26
|
* where it branched, so the other changes on `base` are not counted as its
|
|
22
|
-
* own; a merge commit's first parent is its own merge base.
|
|
27
|
+
* own; a merge commit's first parent is its own merge base. The empty tree
|
|
28
|
+
* has no merge base with anything and is returned as it is.
|
|
23
29
|
*/
|
|
24
30
|
export async function resolveMergeBase(cwd, base, head = "HEAD") {
|
|
31
|
+
if (base === EMPTY_TREE_SHA)
|
|
32
|
+
return base;
|
|
25
33
|
try {
|
|
26
34
|
return (await git(cwd, ["merge-base", base, head])).trim();
|
|
27
35
|
}
|
|
@@ -116,6 +116,8 @@ export interface DriverStepRecord {
|
|
|
116
116
|
durationMs: number;
|
|
117
117
|
output?: unknown;
|
|
118
118
|
error?: string;
|
|
119
|
+
/** Set on a failed step whose capability refused a plan that moved since it was approved (`isPlanMovedError`, #3997). */
|
|
120
|
+
planMoved?: true;
|
|
119
121
|
/** Set on a `gate` step that passed (#2119): who resolved it, when, and at what address. */
|
|
120
122
|
approval?: {
|
|
121
123
|
gate: string;
|
|
@@ -228,6 +230,34 @@ export declare function resolveStepInput(input: Record<string, unknown>, phaseOu
|
|
|
228
230
|
* `undefined`; a plan uses this to say whose outputs it is waiting on.
|
|
229
231
|
*/
|
|
230
232
|
export declare function unresolvedWiringSources(input: Record<string, unknown>, componentOutputs: Record<string, Record<string, unknown>>): string[];
|
|
233
|
+
/** One cross-component reference a step input makes: whose output, and which. */
|
|
234
|
+
export interface WiringReference {
|
|
235
|
+
/** The component or stack whose output it reads. */
|
|
236
|
+
source: string;
|
|
237
|
+
/** `<stack>.<name>` for `stackOutput()`, `<component>.publish.<field>` for an artifact. */
|
|
238
|
+
ref: string;
|
|
239
|
+
/**
|
|
240
|
+
* Whether it reads a published artifact's identity (#3999): an
|
|
241
|
+
* `@<component>.publish.*` reference, or a `stackOutput()` whose name is
|
|
242
|
+
* under `publish`. The driver namespaces every publish-family output there
|
|
243
|
+
* (`collectComponentOutputs`), whatever capability wrote it.
|
|
244
|
+
*/
|
|
245
|
+
publish: boolean;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Every cross-component reference in `input` that has no value in
|
|
249
|
+
* `componentOutputs`, sorted by `ref` and each once (#3999). A pull
|
|
250
|
+
* request's plan names these when the output is known only after its
|
|
251
|
+
* upstream applies.
|
|
252
|
+
*/
|
|
253
|
+
export declare function unresolvedWiringReferences(input: Record<string, unknown>, componentOutputs: Record<string, Record<string, unknown>>): WiringReference[];
|
|
254
|
+
/**
|
|
255
|
+
* The cross-component references in `input` that resolve to another value
|
|
256
|
+
* against `now` than against `read`, sorted (#3999). A pull request's apply
|
|
257
|
+
* holds back a member whose plan read `read` when its upstream applied and
|
|
258
|
+
* left `now`.
|
|
259
|
+
*/
|
|
260
|
+
export declare function movedWiringReferences(input: Record<string, unknown>, read: Record<string, Record<string, unknown>>, now: Record<string, Record<string, unknown>>): WiringReference[];
|
|
231
261
|
/** How a component's run reaches the gate ledger — see `../op/gate.ts`. */
|
|
232
262
|
export interface GateContext {
|
|
233
263
|
port: GateLedgerPort;
|
|
@@ -317,6 +347,14 @@ export declare function collectComponentOutputs(phaseOutputs: Record<string, Rec
|
|
|
317
347
|
* when the component exposed nothing.
|
|
318
348
|
*/
|
|
319
349
|
export declare function accumulateComponentOutputs(componentOutputs: Record<string, Record<string, unknown>>, componentName: string, phaseOutputs: Record<string, Record<string, unknown>>): Record<string, Record<string, unknown>>;
|
|
350
|
+
/** Whether a step in `results` refused a plan that moved since it was approved (#3997). */
|
|
351
|
+
export declare function planMovedIn(results: readonly DriverComponentResult[]): boolean;
|
|
352
|
+
/**
|
|
353
|
+
* The exit code of a run that failed: {@link PLAN_MOVED_EXIT_CODE} when a
|
|
354
|
+
* step refused a plan that moved since it was approved, 1 otherwise. Every
|
|
355
|
+
* command that runs capability steps ends a failed run with it.
|
|
356
|
+
*/
|
|
357
|
+
export declare function failedRunExitCode(results: readonly DriverComponentResult[]): number;
|
|
320
358
|
export interface InterpretRunOptions {
|
|
321
359
|
/** Target environment name, threaded into every capability's `DeployContext`. */
|
|
322
360
|
env: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/components/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,EAAmC,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAI3G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/components/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAIH,OAAO,EAAmC,KAAK,kBAAkB,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAI3G,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAmD,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEzG,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD,oGAAoG;AACpG,MAAM,MAAM,WAAW,GACn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AS,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAA;CAAE,EAC9H,SAAS,EAAE,MAAM,GAChB,aAAa,CAGf;AAED,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAoE1B"}
|
|
@@ -51,6 +51,7 @@ import { evaluateGate, gitGateLedgerPort } from "../op/gate.js";
|
|
|
51
51
|
import { gateName } from "../op/gate-name.js";
|
|
52
52
|
import { GateNotRecordableError } from "../lifecycle/no-record.js";
|
|
53
53
|
import { componentPlanDigest } from "./gate-plan.js";
|
|
54
|
+
import { isPlanMovedError, PLAN_MOVED_EXIT_CODE } from "./capability.js";
|
|
54
55
|
import { isPromotedArtifact } from "./auto-release.js";
|
|
55
56
|
import { gateEventsOf, joinRunEventSinks, progressSinkOf } from "../run-event-stream.js";
|
|
56
57
|
function isGateStep(step) {
|
|
@@ -194,14 +195,32 @@ export function resolveStepInput(input, phaseOutputs, componentOutputs) {
|
|
|
194
195
|
* `undefined`; a plan uses this to say whose outputs it is waiting on.
|
|
195
196
|
*/
|
|
196
197
|
export function unresolvedWiringSources(input, componentOutputs) {
|
|
197
|
-
|
|
198
|
+
return [...new Set(unresolvedWiringReferences(input, componentOutputs).map((r) => r.source))].sort();
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Every cross-component reference in `input` that has no value in
|
|
202
|
+
* `componentOutputs`, sorted by `ref` and each once (#3999). A pull
|
|
203
|
+
* request's plan names these when the output is known only after its
|
|
204
|
+
* upstream applies.
|
|
205
|
+
*/
|
|
206
|
+
export function unresolvedWiringReferences(input, componentOutputs) {
|
|
207
|
+
return wiringReferences(input).filter((r) => r.value(componentOutputs) === undefined).map(({ source, ref, publish }) => ({ source, ref, publish }));
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Every cross-component reference in `input`, each once, sorted by `ref`,
|
|
211
|
+
* with the value it resolves to against a given outputs map.
|
|
212
|
+
*/
|
|
213
|
+
function wiringReferences(input) {
|
|
214
|
+
const found = new Map();
|
|
198
215
|
const walk = (value) => {
|
|
199
216
|
if (typeof value === "string") {
|
|
200
217
|
if (PRIOR_STEP_REF.test(value))
|
|
201
218
|
return;
|
|
202
219
|
const ref = value.match(COMPONENT_ARTIFACT_REF);
|
|
203
|
-
if (ref
|
|
204
|
-
|
|
220
|
+
if (ref) {
|
|
221
|
+
const [, source, field] = ref;
|
|
222
|
+
found.set(`${source}.publish.${field}`, { source, ref: `${source}.publish.${field}`, publish: true, value: (o) => resolvePath(o[source]?.publish, field) });
|
|
223
|
+
}
|
|
205
224
|
return;
|
|
206
225
|
}
|
|
207
226
|
if (Array.isArray(value)) {
|
|
@@ -211,15 +230,24 @@ export function unresolvedWiringSources(input, componentOutputs) {
|
|
|
211
230
|
if (value && typeof value === "object") {
|
|
212
231
|
if ("stackOutput" in value) {
|
|
213
232
|
const { stack, name } = value.stackOutput;
|
|
214
|
-
|
|
215
|
-
found.add(stack);
|
|
233
|
+
found.set(`${stack}.${name}`, { source: stack, ref: `${stack}.${name}`, publish: name === "publish" || name.startsWith("publish."), value: (o) => resolvePath(o[stack], name) });
|
|
216
234
|
return;
|
|
217
235
|
}
|
|
218
236
|
Object.values(value).forEach(walk);
|
|
219
237
|
}
|
|
220
238
|
};
|
|
221
239
|
walk(input);
|
|
222
|
-
return [...found].sort();
|
|
240
|
+
return [...found.values()].sort((a, b) => a.ref.localeCompare(b.ref));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The cross-component references in `input` that resolve to another value
|
|
244
|
+
* against `now` than against `read`, sorted (#3999). A pull request's apply
|
|
245
|
+
* holds back a member whose plan read `read` when its upstream applied and
|
|
246
|
+
* left `now`.
|
|
247
|
+
*/
|
|
248
|
+
export function movedWiringReferences(input, read, now) {
|
|
249
|
+
const same = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
250
|
+
return wiringReferences(input).filter((r) => !same(r.value(read), r.value(now))).map(({ source, ref, publish }) => ({ source, ref, publish }));
|
|
223
251
|
}
|
|
224
252
|
class StepFailure extends Error {
|
|
225
253
|
constructor(records, executed) {
|
|
@@ -280,6 +308,7 @@ async function runCapabilityStep(step, phaseName, ctx, registry, phaseOutputs, c
|
|
|
280
308
|
status: "fail",
|
|
281
309
|
durationMs: Date.now() - start,
|
|
282
310
|
error: errMessage(err),
|
|
311
|
+
...(isPlanMovedError(err) ? { planMoved: true } : {}),
|
|
283
312
|
},
|
|
284
313
|
resolvedInput,
|
|
285
314
|
};
|
|
@@ -718,6 +747,18 @@ function findStackOutputs(phaseOutputs) {
|
|
|
718
747
|
}
|
|
719
748
|
return found;
|
|
720
749
|
}
|
|
750
|
+
/** Whether a step in `results` refused a plan that moved since it was approved (#3997). */
|
|
751
|
+
export function planMovedIn(results) {
|
|
752
|
+
return results.some((r) => r.records.some((s) => s.planMoved === true));
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* The exit code of a run that failed: {@link PLAN_MOVED_EXIT_CODE} when a
|
|
756
|
+
* step refused a plan that moved since it was approved, 1 otherwise. Every
|
|
757
|
+
* command that runs capability steps ends a failed run with it.
|
|
758
|
+
*/
|
|
759
|
+
export function failedRunExitCode(results) {
|
|
760
|
+
return planMovedIn(results) ? PLAN_MOVED_EXIT_CODE : 1;
|
|
761
|
+
}
|
|
721
762
|
function errMessage(err) {
|
|
722
763
|
return err instanceof Error ? err.message : String(err);
|
|
723
764
|
}
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { type WaveRecord } from "../wave-engine.js";
|
|
38
38
|
import type { ChangeSetDocument } from "../change-set.js";
|
|
39
|
-
import type { PrMember } from "../pr-loop.js";
|
|
39
|
+
import type { PrMember, PrWave } from "../pr-loop.js";
|
|
40
40
|
/** What a pull request's apply approved, kept so a re-run can finish it (#3464). */
|
|
41
41
|
export interface PrApplyRecord {
|
|
42
42
|
/** The gate's op and name: `pr-<n>` and `pr-apply` unless the pipeline names another. */
|
|
@@ -56,6 +56,11 @@ export interface PrApplyRecord {
|
|
|
56
56
|
* against them again, so an unchanged member plans to the same digest.
|
|
57
57
|
*/
|
|
58
58
|
planOutputs: Record<string, Record<string, unknown>>;
|
|
59
|
+
/**
|
|
60
|
+
* With `--wave-gate` (#4003): each wave reached so far and the approval it
|
|
61
|
+
* applied or waits under, so the next wave's job reports every wave.
|
|
62
|
+
*/
|
|
63
|
+
waves?: PrWave[];
|
|
59
64
|
}
|
|
60
65
|
export interface FanOutAttempt {
|
|
61
66
|
digest: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-out-record.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"fan-out-record.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEnD,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,oDAAoD;IACpD,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,qGAAqG;IACrG,SAAS,EAAE,iBAAiB,CAAC;IAC7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,wCAAwC;IACxC,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAsDD,wGAAwG;AACxG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAwBzE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAE7E"}
|
|
@@ -55,6 +55,7 @@ function readPrApplyRecord(value) {
|
|
|
55
55
|
if (isRecord(v))
|
|
56
56
|
outputs[name] = v;
|
|
57
57
|
}
|
|
58
|
+
const waves = Array.isArray(value.waves) ? value.waves.map(readPrWave).filter((w) => w !== undefined) : [];
|
|
58
59
|
return {
|
|
59
60
|
op,
|
|
60
61
|
gate,
|
|
@@ -64,6 +65,29 @@ function readPrApplyRecord(value) {
|
|
|
64
65
|
members: members,
|
|
65
66
|
changeSet: changeSet,
|
|
66
67
|
planOutputs: outputs,
|
|
68
|
+
...(waves.length > 0 ? { waves } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const WAVE_STATUSES = new Set(["applied", "failed", "plan-failed", "waiting"]);
|
|
72
|
+
/** One `prApply.waves` entry, or `undefined` when it is malformed. */
|
|
73
|
+
function readPrWave(value) {
|
|
74
|
+
if (!isRecord(value))
|
|
75
|
+
return undefined;
|
|
76
|
+
const { wave, components, status, approval, gate, digest } = value;
|
|
77
|
+
if (typeof wave !== "number" || !isStringArray(components) || typeof status !== "string" || !WAVE_STATUSES.has(status))
|
|
78
|
+
return undefined;
|
|
79
|
+
if ((approval !== "pull-request" && approval !== "wave") || typeof gate !== "string" || typeof digest !== "string")
|
|
80
|
+
return undefined;
|
|
81
|
+
return {
|
|
82
|
+
wave,
|
|
83
|
+
components,
|
|
84
|
+
status: status,
|
|
85
|
+
approval,
|
|
86
|
+
gate,
|
|
87
|
+
digest,
|
|
88
|
+
...(isStringArray(value.approvedBy) ? { approvedBy: value.approvedBy } : {}),
|
|
89
|
+
...(typeof value.approved === "string" ? { approved: value.approved } : {}),
|
|
90
|
+
...(isStringArray(value.moved) ? { moved: value.moved } : {}),
|
|
67
91
|
};
|
|
68
92
|
}
|
|
69
93
|
/** Read an attempt record, or `undefined` when there is none yet. Throws on a file that is not JSON. */
|
|
@@ -138,6 +138,24 @@ export interface FanOutRunOptions {
|
|
|
138
138
|
* the returned result cannot do.
|
|
139
139
|
*/
|
|
140
140
|
onComponentSettled?: (result: DriverComponentResult, outputs: Record<string, unknown> | undefined) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Asked as each component's wave starts, with the outputs standing then
|
|
143
|
+
* (#3999). A reason holds the component back: it does not run, and nothing
|
|
144
|
+
* downstream of it runs either; each is listed in `held` and settles
|
|
145
|
+
* `waiting`. A pull request's apply holds a member whose plan read an
|
|
146
|
+
* upstream output that applied as another value, or that was known only
|
|
147
|
+
* after apply. Not with `waveGate`, which plans each wave after the one
|
|
148
|
+
* before it applied.
|
|
149
|
+
*/
|
|
150
|
+
hold?: (component: string, componentOutputs: Record<string, Record<string, unknown>>) => string | undefined;
|
|
151
|
+
}
|
|
152
|
+
/** A component {@link FanOutRunOptions.hold} held back, or one downstream of it. */
|
|
153
|
+
export interface FanOutHeld {
|
|
154
|
+
component: string;
|
|
155
|
+
/** Why the hook held it, or, downstream, why it held the component named in `heldBy`. */
|
|
156
|
+
reason: string;
|
|
157
|
+
/** Downstream of a held component: that component. */
|
|
158
|
+
heldBy?: string;
|
|
141
159
|
}
|
|
142
160
|
export interface FanOutRunResult {
|
|
143
161
|
/** The plan actually dispatched — `plan` narrowed by `options.progress`. */
|
|
@@ -155,6 +173,8 @@ export interface FanOutRunResult {
|
|
|
155
173
|
gate?: PendingGateRecord;
|
|
156
174
|
/** With `waveGate`: each wave this attempt planned, in order, the one it stopped at included. */
|
|
157
175
|
waves?: WaveRecord[];
|
|
176
|
+
/** What {@link FanOutRunOptions.hold} held back, in plan order. Absent when nothing was. */
|
|
177
|
+
held?: FanOutHeld[];
|
|
158
178
|
}
|
|
159
179
|
/**
|
|
160
180
|
* Dispatch a fan-out plan.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-out-run.d.ts","sourceRoot":"","sources":["../../src/components/fan-out-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAE3B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAqC,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACrH,OAAO,EAAmD,KA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IACjB,mFAAmF;IACnF,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,sEAAsE;IACtE,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,iGAAiG;IACjG,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,4FAA4F;IAC5F,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,UAAU,EAChB,UAAU,EAAE,eAAe,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC,CAuK1B"}
|
|
@@ -159,8 +159,21 @@ export async function runFanOut(plan, components, registry, options) {
|
|
|
159
159
|
const completed = [];
|
|
160
160
|
const failed = [];
|
|
161
161
|
const blockedBy = new Map();
|
|
162
|
+
const held = new Map();
|
|
162
163
|
let gatedFact;
|
|
163
164
|
const inPlan = new Set(active.order);
|
|
165
|
+
const waveOf = waveNumbers(active.waves);
|
|
166
|
+
/** Hold `root` and everything downstream of it that has not settled otherwise. */
|
|
167
|
+
const markHeld = (root, reason) => {
|
|
168
|
+
held.set(root, { component: root, reason });
|
|
169
|
+
emit?.({ type: "component-settle", wave: waveOf.get(root), component: root, status: "waiting" });
|
|
170
|
+
for (const [component] of downstreamWithin(components, inPlan, [root])) {
|
|
171
|
+
if (held.has(component) || blockedBy.has(component) || failed.includes(component))
|
|
172
|
+
continue;
|
|
173
|
+
held.set(component, { component, reason, heldBy: root });
|
|
174
|
+
emit?.({ type: "component-settle", wave: waveOf.get(component), component, status: "waiting" });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
164
177
|
/** Skip everything downstream of `root`, blaming `root` rather than the nearest edge. */
|
|
165
178
|
const markBlocked = (root) => {
|
|
166
179
|
for (const [component, by] of downstreamWithin(components, inPlan, [root])) {
|
|
@@ -172,7 +185,13 @@ export async function runFanOut(plan, components, registry, options) {
|
|
|
172
185
|
for (const [waveIndex, wave] of active.waves.entries()) {
|
|
173
186
|
const waveNum = waveIndex + 1;
|
|
174
187
|
// A component whose upstream failed in an earlier wave is not dispatched.
|
|
175
|
-
const
|
|
188
|
+
const candidates = wave.filter((name) => inPlan.has(name) && !blockedBy.has(name) && !held.has(name));
|
|
189
|
+
for (const name of candidates) {
|
|
190
|
+
const reason = options.hold?.(name, componentOutputs);
|
|
191
|
+
if (reason !== undefined)
|
|
192
|
+
markHeld(name, reason);
|
|
193
|
+
}
|
|
194
|
+
const runnable = candidates.filter((name) => !held.has(name));
|
|
176
195
|
if (runnable.length === 0)
|
|
177
196
|
continue;
|
|
178
197
|
emit?.({ type: "wave-start", wave: waveNum, components: runnable });
|
|
@@ -231,6 +250,7 @@ export async function runFanOut(plan, components, registry, options) {
|
|
|
231
250
|
blocked,
|
|
232
251
|
componentOutputs,
|
|
233
252
|
...(gatedFact ? { gate: gatedFact } : {}),
|
|
253
|
+
...(held.size > 0 ? { held: active.order.filter((name) => held.has(name)).map((name) => held.get(name)) } : {}),
|
|
234
254
|
};
|
|
235
255
|
}
|
|
236
256
|
/** The run's `deployContext`, with the carried state and the carry callback (#3459) when the caller gave them. */
|
|
@@ -42,6 +42,25 @@
|
|
|
42
42
|
* build is `chant build --env <env>`, or `buildCommand` when the templates
|
|
43
43
|
* come from several builds (`npm run build`).
|
|
44
44
|
*
|
|
45
|
+
* With `waveGate` (#4003) the apply runs a wave at a time: `pr-apply
|
|
46
|
+
* --wave-gate <gate>`, each wave planned after the one before it applied. A
|
|
47
|
+
* generator writes one apply job per wave of the component graph
|
|
48
|
+
* (`prLoopWaveJobs`), job `apply-wave-<k>` passing `--wave <k>` and needing
|
|
49
|
+
* the job before it, and the attempt record carries the approved set from
|
|
50
|
+
* one job to the next. A wave whose plan the approved change set covers
|
|
51
|
+
* applies under the pull request's approval; one whose plan moved stops at
|
|
52
|
+
* `<gate>-wave-<k>` (exit 3), and re-running its job after the approval
|
|
53
|
+
* carries on. `chant ci serve` runs the one apply job, which runs the waves
|
|
54
|
+
* in order until one stops.
|
|
55
|
+
*
|
|
56
|
+
* Each generated job runs its command through `chant ci run plan|apply
|
|
57
|
+
* --in-place` (#4156, `PrLoopJob.run`), so a forge job writes the same run
|
|
58
|
+
* record the chant runner does: Op `pr-plan` or `pr-apply`, signed with
|
|
59
|
+
* the runner key a forge secret puts in `CHANT_RUNNER_KEY`, and naming the
|
|
60
|
+
* forge's run as its `runOrigin`. `ci run` runs `command` in the job's own
|
|
61
|
+
* checkout with the job's environment, less the key. The plan passes
|
|
62
|
+
* `--no-push`, so it still writes nothing to the remote `chant/lifecycle`.
|
|
63
|
+
*
|
|
45
64
|
* In a workspace member (#3465) both commands run in the member's directory
|
|
46
65
|
* and pass `--member <name>`, so the member's gate (`pr-<number>-<member>`),
|
|
47
66
|
* note and statuses stay apart from every other member's on the same pull
|
|
@@ -49,6 +68,8 @@
|
|
|
49
68
|
* that one of its units reaches selects that unit.
|
|
50
69
|
*/
|
|
51
70
|
import type { ForgeKind } from "../pr-forge.js";
|
|
71
|
+
import type { DriverComponent } from "./driver.js";
|
|
72
|
+
import type { GatedWavePipelineOptions } from "./gated-wave-pipeline.js";
|
|
52
73
|
/** Where both jobs write their reports, kept as a CI artifact. */
|
|
53
74
|
export declare const PR_LOOP_REPORT_DIR = ".chant/pr";
|
|
54
75
|
/**
|
|
@@ -111,6 +132,12 @@ export interface PrLoopPipelineOptions {
|
|
|
111
132
|
* `npm run build`. Setting it turns `build` on.
|
|
112
133
|
*/
|
|
113
134
|
buildCommand?: string;
|
|
135
|
+
/**
|
|
136
|
+
* A gate per wave on merge (#4003): the apply runs `pr-apply --wave-gate
|
|
137
|
+
* <waveGate>`, a wave at a time, and a generator writes one apply job per
|
|
138
|
+
* wave. Set from `--wave-gate` beside `--pr-loop` ({@link prLoopWithWaves}).
|
|
139
|
+
*/
|
|
140
|
+
waveGate?: string;
|
|
114
141
|
/**
|
|
115
142
|
* Which GitHub-shaped forge the workflow is for. Set by the forgejo
|
|
116
143
|
* generator, which reuses the github one; a caller never needs to.
|
|
@@ -133,6 +160,20 @@ export interface PrLoopJob {
|
|
|
133
160
|
setup?: string[];
|
|
134
161
|
/** With `build` (#4088): the build line and the lint line, run in this order before the command. */
|
|
135
162
|
build?: string[];
|
|
163
|
+
/** With `waveGate` (#4003): the wave a generated apply job runs, 1-based. */
|
|
164
|
+
wave?: number;
|
|
165
|
+
/**
|
|
166
|
+
* What the generated job runs in place of `command` (#4156): `chant ci run
|
|
167
|
+
* <job> --in-place` with the same environment, gate, forge, events and
|
|
168
|
+
* report URL, which runs `command` and records the run. `env` is the
|
|
169
|
+
* job's `env` and, on GitHub and Forgejo, `CHANT_RUNNER_KEY` from the
|
|
170
|
+
* repository secret of that name. GitLab hands its CI/CD variables to a
|
|
171
|
+
* job itself.
|
|
172
|
+
*/
|
|
173
|
+
run: {
|
|
174
|
+
command: string;
|
|
175
|
+
env: Record<string, string>;
|
|
176
|
+
};
|
|
136
177
|
}
|
|
137
178
|
/** The lines `build` (#4088) runs before a job's command: the build, then the lint. Empty without the option. */
|
|
138
179
|
export declare function prLoopBuildLines(env: string, options?: PrLoopPipelineOptions): string[];
|
|
@@ -142,6 +183,22 @@ export declare function prLoopBuildLines(env: string, options?: PrLoopPipelineOp
|
|
|
142
183
|
* relative to it.
|
|
143
184
|
*/
|
|
144
185
|
export declare function prLoopJobs(forge: ForgeKind, env: string, options?: PrLoopPipelineOptions, member?: string): PrLoopJob[];
|
|
186
|
+
/**
|
|
187
|
+
* The pull-request options with `--wave-gate` beside `--pr-loop` (#4003):
|
|
188
|
+
* the apply gets a gate per wave. A canary or a fixed base is refused, since
|
|
189
|
+
* the pull request's waves are its derivation's and each push is measured
|
|
190
|
+
* from the commit before it.
|
|
191
|
+
*/
|
|
192
|
+
export declare function prLoopWithWaves(prLoop: PrLoopPipelineOptions, gatedWaves?: GatedWavePipelineOptions): PrLoopPipelineOptions;
|
|
193
|
+
/** The name of the apply job for wave `wave` (#4003). */
|
|
194
|
+
export declare function prApplyWaveJobName(wave: number): string;
|
|
195
|
+
/**
|
|
196
|
+
* One apply job per wave of the component graph (#4003), each `apply`'s
|
|
197
|
+
* command with `--wave <k>`. A change selects a subset, which never layers
|
|
198
|
+
* deeper than the graph, so a job past the change's last wave finds nothing
|
|
199
|
+
* left and exits 0.
|
|
200
|
+
*/
|
|
201
|
+
export declare function prLoopWaveJobs(components: DriverComponent[], apply: PrLoopJob): PrLoopJob[];
|
|
145
202
|
/**
|
|
146
203
|
* The concurrency group (GitHub, Forgejo) or resource group (GitLab) that
|
|
147
204
|
* keeps one apply at a time per environment, and per member in a workspace.
|
|
@@ -166,8 +223,14 @@ export declare function prApplyRecordKey(env: string, commit: string, member?: s
|
|
|
166
223
|
/**
|
|
167
224
|
* GitLab sets `CI_COMMIT_BEFORE_SHA` to forty zeros on a branch's first push.
|
|
168
225
|
* The line replaces it with the merge request's diff base when the pipeline
|
|
169
|
-
* has one, and otherwise
|
|
170
|
-
* pushed commit, or the pushed commit's parent when that is the commit itself.
|
|
226
|
+
* has one, and otherwise as {@link pushBaseFallback} does.
|
|
171
227
|
*/
|
|
172
228
|
export declare function gitlabBaseFallback(branch?: string): string;
|
|
229
|
+
/**
|
|
230
|
+
* GitHub and Forgejo set `github.event.before` to forty zeros on a branch's
|
|
231
|
+
* first push (#4004). The line replaces it as {@link pushBaseFallback} does,
|
|
232
|
+
* with the target branch `main` unless the pipeline names another, the
|
|
233
|
+
* generators' default.
|
|
234
|
+
*/
|
|
235
|
+
export declare function githubBaseFallback(branch?: string): string;
|
|
173
236
|
//# sourceMappingURL=pr-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-pipeline.d.ts","sourceRoot":"","sources":["../../src/components/pr-pipeline.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pr-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