@intentius/chant 0.124.28 → 0.124.29
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/dist/build-params.d.ts +34 -1
- package/dist/build-params.d.ts.map +1 -1
- package/dist/build-params.js +31 -1
- package/dist/change-set-graph.d.ts +8 -1
- package/dist/change-set-graph.d.ts.map +1 -1
- package/dist/change-set-graph.js +4 -2
- package/dist/change-set.d.ts +10 -0
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +4 -3
- package/dist/cli/build-params-cli.d.ts +7 -1
- package/dist/cli/build-params-cli.d.ts.map +1 -1
- package/dist/cli/build-params-cli.js +17 -8
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +6 -3
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +45 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +15 -4
- package/dist/cli/handlers/fan-out.d.ts +9 -0
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +40 -3
- package/dist/cli/handlers/lifecycle-gc.d.ts +19 -0
- package/dist/cli/handlers/lifecycle-gc.d.ts.map +1 -0
- package/dist/cli/handlers/lifecycle-gc.js +143 -0
- package/dist/cli/handlers/pr.d.ts +11 -3
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +134 -26
- package/dist/cli/handlers/promote.d.ts +7 -0
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +210 -33
- package/dist/cli/handlers/release.d.ts +62 -5
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +414 -28
- package/dist/cli/handlers/run.d.ts +11 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +67 -6
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +61 -10
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +24 -2
- package/dist/cli/registry.d.ts +15 -3
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/run-events.d.ts +3 -2
- package/dist/cli/run-events.d.ts.map +1 -1
- package/dist/cli/run-events.js +5 -3
- package/dist/components/auto-release.d.ts +2 -0
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +1 -0
- package/dist/components/capability.d.ts +9 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/driver.d.ts +8 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +35 -0
- package/dist/components/fan-out-inputs.d.ts +69 -0
- package/dist/components/fan-out-inputs.d.ts.map +1 -0
- package/dist/components/fan-out-inputs.js +169 -0
- package/dist/components/fan-out-record.d.ts +13 -0
- package/dist/components/fan-out-record.d.ts.map +1 -1
- package/dist/components/fan-out-record.js +16 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +50 -0
- package/dist/components/fan-out.d.ts +4 -0
- package/dist/components/fan-out.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +25 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +22 -4
- package/dist/components/promote.d.ts +23 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +60 -2
- package/dist/components/release-compile.d.ts +9 -0
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +9 -3
- package/dist/components/release-gate.d.ts +11 -1
- package/dist/components/release-gate.d.ts.map +1 -1
- package/dist/components/release-gate.js +10 -4
- package/dist/components/wave-plan.d.ts +5 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +10 -2
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/flag-params.d.ts +54 -0
- package/dist/flag-params.d.ts.map +1 -0
- package/dist/flag-params.js +130 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +120 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +304 -0
- package/dist/lifecycle/change-set-store.d.ts +2 -1
- package/dist/lifecycle/change-set-store.d.ts.map +1 -1
- package/dist/lifecycle/change-set-store.js +2 -1
- package/dist/lifecycle/delivery-metrics.d.ts +139 -0
- package/dist/lifecycle/delivery-metrics.d.ts.map +1 -0
- package/dist/lifecycle/delivery-metrics.js +145 -0
- package/dist/lifecycle/deploy-outcome.d.ts +81 -0
- package/dist/lifecycle/deploy-outcome.d.ts.map +1 -0
- package/dist/lifecycle/deploy-outcome.js +101 -0
- package/dist/lifecycle/gate-change-set.d.ts +10 -1
- package/dist/lifecycle/gate-change-set.d.ts.map +1 -1
- package/dist/lifecycle/gate-change-set.js +35 -3
- package/dist/lifecycle/gate-ledger.d.ts +2 -3
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +30 -1
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +31 -5
- package/dist/lifecycle/index.d.ts +4 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/index.js +4 -0
- package/dist/lifecycle/mixed-environment.d.ts +95 -0
- package/dist/lifecycle/mixed-environment.d.ts.map +1 -0
- package/dist/lifecycle/mixed-environment.js +154 -0
- package/dist/lifecycle/publish-attachments.d.ts +79 -0
- package/dist/lifecycle/publish-attachments.d.ts.map +1 -0
- package/dist/lifecycle/publish-attachments.js +179 -0
- package/dist/lifecycle/publish-credentials.d.ts +37 -0
- package/dist/lifecycle/publish-credentials.d.ts.map +1 -0
- package/dist/lifecycle/publish-credentials.js +69 -0
- package/dist/lifecycle/publish-declaration.d.ts +97 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -0
- package/dist/lifecycle/publish-declaration.js +83 -0
- package/dist/lifecycle/publish-forge.d.ts +53 -0
- package/dist/lifecycle/publish-forge.d.ts.map +1 -0
- package/dist/lifecycle/publish-forge.js +298 -0
- package/dist/lifecycle/publish-npm.d.ts +61 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -0
- package/dist/lifecycle/publish-npm.js +242 -0
- package/dist/lifecycle/publish-oci.d.ts +64 -0
- package/dist/lifecycle/publish-oci.d.ts.map +1 -0
- package/dist/lifecycle/publish-oci.js +383 -0
- package/dist/lifecycle/publish-record.d.ts +66 -0
- package/dist/lifecycle/publish-record.d.ts.map +1 -0
- package/dist/lifecycle/publish-record.js +84 -0
- package/dist/lifecycle/publish-targets.d.ts +45 -0
- package/dist/lifecycle/publish-targets.d.ts.map +1 -0
- package/dist/lifecycle/publish-targets.js +85 -0
- package/dist/lifecycle/release-cut.d.ts +48 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +116 -23
- package/dist/lifecycle/release-join.d.ts +95 -0
- package/dist/lifecycle/release-join.d.ts.map +1 -0
- package/dist/lifecycle/release-join.js +139 -0
- package/dist/lifecycle/release-publish.d.ts +312 -0
- package/dist/lifecycle/release-publish.d.ts.map +1 -0
- package/dist/lifecycle/release-publish.js +335 -0
- package/dist/lifecycle/release-revocation.d.ts +80 -0
- package/dist/lifecycle/release-revocation.d.ts.map +1 -0
- package/dist/lifecycle/release-revocation.js +123 -0
- package/dist/lifecycle/release-store.d.ts +12 -2
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +4 -2
- package/dist/lifecycle/release-verify.d.ts +61 -0
- package/dist/lifecycle/release-verify.d.ts.map +1 -0
- package/dist/lifecycle/release-verify.js +92 -0
- package/dist/lifecycle/release-workstation.d.ts +91 -0
- package/dist/lifecycle/release-workstation.d.ts.map +1 -0
- package/dist/lifecycle/release-workstation.js +180 -0
- package/dist/lifecycle/retention-policy.d.ts +45 -0
- package/dist/lifecycle/retention-policy.d.ts.map +1 -0
- package/dist/lifecycle/retention-policy.js +43 -0
- package/dist/lifecycle/retention.d.ts +185 -0
- package/dist/lifecycle/retention.d.ts.map +1 -0
- package/dist/lifecycle/retention.js +400 -0
- package/dist/plan-summary.d.ts.map +1 -1
- package/dist/plan-summary.js +8 -2
- package/dist/pr-loop.d.ts +7 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +23 -4
- package/dist/pr-report-url.d.ts +82 -0
- package/dist/pr-report-url.d.ts.map +1 -0
- package/dist/pr-report-url.js +174 -0
- package/dist/provenance.d.ts +2 -2
- package/dist/provenance.d.ts.map +1 -1
- package/dist/run-event-store.d.ts +29 -2
- package/dist/run-event-store.d.ts.map +1 -1
- package/dist/run-event-store.js +50 -3
- package/dist/run-event-stream.d.ts +2 -1
- package/dist/run-event-stream.d.ts.map +1 -1
- package/dist/run-event-stream.js +5 -1
- package/dist/run-event.d.ts +19 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +2 -0
- package/dist/wave-runtime.mjs +260 -229
- package/dist/workspace/__fixtures__/flag-workspace.d.ts +31 -0
- package/dist/workspace/__fixtures__/flag-workspace.d.ts.map +1 -0
- package/dist/workspace/__fixtures__/flag-workspace.js +114 -0
- package/dist/workspace/change-set.schema.json +5 -1
- package/dist/workspace/check.schema.json +4 -2
- package/dist/workspace/checks/records.d.ts +9 -1
- package/dist/workspace/checks/records.d.ts.map +1 -1
- package/dist/workspace/checks/records.js +35 -1
- package/dist/workspace/checks.d.ts +1 -0
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/checks.js +2 -1
- package/dist/workspace/ci-green.d.ts +8 -0
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +10 -3
- package/dist/workspace/declaration.d.ts +16 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +26 -0
- package/dist/workspace/declaration.schema.json +64 -0
- package/dist/workspace/declared-kinds.d.ts +16 -0
- package/dist/workspace/declared-kinds.d.ts.map +1 -1
- package/dist/workspace/declared-kinds.js +25 -0
- package/dist/workspace/delivery-metrics.d.ts +91 -0
- package/dist/workspace/delivery-metrics.d.ts.map +1 -0
- package/dist/workspace/delivery-metrics.js +217 -0
- package/dist/workspace/delivery-metrics.schema.json +519 -0
- package/dist/workspace/flags-read.d.ts +37 -0
- package/dist/workspace/flags-read.d.ts.map +1 -0
- package/dist/workspace/flags-read.js +103 -0
- package/dist/workspace/flags.d.ts +100 -0
- package/dist/workspace/flags.d.ts.map +1 -0
- package/dist/workspace/flags.js +98 -0
- package/dist/workspace/graph-cli.js +1 -1
- package/dist/workspace/intent-cli.d.ts +11 -2
- package/dist/workspace/intent-cli.d.ts.map +1 -1
- package/dist/workspace/intent-cli.js +54 -5
- package/dist/workspace/intent-trace.d.ts +219 -0
- package/dist/workspace/intent-trace.d.ts.map +1 -0
- package/dist/workspace/intent-trace.js +314 -0
- package/dist/workspace/intent.d.ts +30 -6
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +141 -21
- package/dist/workspace/intent.schema.json +702 -6
- package/dist/workspace/overlap.d.ts +146 -0
- package/dist/workspace/overlap.d.ts.map +1 -0
- package/dist/workspace/overlap.js +276 -0
- package/dist/workspace/reason-codes.d.ts +2 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +3 -0
- package/dist/workspace/records.d.ts +15 -2
- package/dist/workspace/records.d.ts.map +1 -1
- package/dist/workspace/records.js +32 -0
- package/dist/workspace/records.schema.json +21 -2
- package/dist/workspace/reference-kinds/flag/flag.kind.mjs +32 -0
- package/dist/workspace/reference-kinds/flag/flag.schema.json +53 -0
- package/dist/workspace/releases.d.ts +9 -0
- package/dist/workspace/releases.d.ts.map +1 -1
- package/dist/workspace/releases.js +9 -0
- package/dist/workspace/releases.schema.json +123 -1
- package/dist/workspace/run-event.schema.json +10 -3
- package/dist/workspace/status-gates.d.ts +8 -0
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/dist/workspace/status.d.ts +78 -0
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/status.js +170 -3
- package/dist/workspace/status.schema.json +198 -1
- package/dist/workspace/wip.d.ts.map +1 -1
- package/dist/workspace/wip.js +11 -3
- package/package.json +1 -1
- package/src/build-params.test.ts +46 -0
- package/src/build-params.ts +55 -1
- package/src/change-set-graph.ts +10 -2
- package/src/change-set.ts +14 -3
- package/src/cli/build-params-cli.ts +22 -9
- package/src/cli/commands/build.ts +6 -3
- package/src/cli/handlers/approve-release.test.ts +5 -1
- package/src/cli/handlers/approve-revoked.test.ts +155 -0
- package/src/cli/handlers/approve.ts +47 -0
- package/src/cli/handlers/build.test.ts +15 -0
- package/src/cli/handlers/build.ts +17 -4
- package/src/cli/handlers/fan-out.test.ts +180 -1
- package/src/cli/handlers/fan-out.ts +38 -3
- package/src/cli/handlers/intent-trace.e2e.test.ts +201 -0
- package/src/cli/handlers/lifecycle-gc.test.ts +126 -0
- package/src/cli/handlers/lifecycle-gc.ts +146 -0
- package/src/cli/handlers/pr.test.ts +148 -1
- package/src/cli/handlers/pr.ts +139 -28
- package/src/cli/handlers/promote.test.ts +280 -2
- package/src/cli/handlers/promote.ts +210 -34
- package/src/cli/handlers/release-implicit.e2e.test.ts +12 -4
- package/src/cli/handlers/release-join.e2e.test.ts +185 -0
- package/src/cli/handlers/release-publish-targets.e2e.test.ts +295 -0
- package/src/cli/handlers/release-verify.e2e.test.ts +117 -0
- package/src/cli/handlers/release-workstation-ci.e2e.test.ts +135 -0
- package/src/cli/handlers/release.e2e.test.ts +146 -32
- package/src/cli/handlers/release.ts +415 -28
- package/src/cli/handlers/run-auto-release.test.ts +9 -0
- package/src/cli/handlers/run-release.test.ts +55 -0
- package/src/cli/handlers/run.ts +69 -5
- package/src/cli/main.test.ts +1 -0
- package/src/cli/main.ts +61 -10
- package/src/cli/parse-args.ts +19 -2
- package/src/cli/registry.ts +15 -3
- package/src/cli/run-events.ts +5 -2
- package/src/components/auto-release.test.ts +9 -0
- package/src/components/auto-release.ts +3 -0
- package/src/components/capability.ts +9 -0
- package/src/components/driver.test.ts +24 -0
- package/src/components/driver.ts +36 -0
- package/src/components/fan-out-inputs.test.ts +85 -0
- package/src/components/fan-out-inputs.ts +192 -0
- package/src/components/fan-out-record.test.ts +10 -0
- package/src/components/fan-out-record.ts +19 -0
- package/src/components/fan-out-run.ts +48 -0
- package/src/components/fan-out.ts +4 -0
- package/src/components/pr-pipeline.ts +35 -4
- package/src/components/promote.ts +68 -2
- package/src/components/release-compile.ts +17 -3
- package/src/components/release-gate.ts +18 -4
- package/src/components/wave-plan.ts +15 -2
- package/src/config.ts +8 -0
- package/src/flag-params.test.ts +144 -0
- package/src/flag-params.ts +134 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +351 -0
- package/src/lifecycle/change-set-store.ts +2 -1
- package/src/lifecycle/delivery-metrics.ts +263 -0
- package/src/lifecycle/deploy-outcome.ts +147 -0
- package/src/lifecycle/gate-change-set.ts +37 -6
- package/src/lifecycle/gate-ledger.ts +2 -2
- package/src/lifecycle/git.ts +61 -8
- package/src/lifecycle/index.ts +4 -0
- package/src/lifecycle/mixed-environment.test.ts +97 -0
- package/src/lifecycle/mixed-environment.ts +204 -0
- package/src/lifecycle/publish-attachments.ts +196 -0
- package/src/lifecycle/publish-credentials.ts +84 -0
- package/src/lifecycle/publish-declaration.ts +95 -0
- package/src/lifecycle/publish-forge.ts +325 -0
- package/src/lifecycle/publish-npm.ts +259 -0
- package/src/lifecycle/publish-oci.ts +396 -0
- package/src/lifecycle/publish-record.ts +113 -0
- package/src/lifecycle/publish-resume.test.ts +168 -0
- package/src/lifecycle/publish-targets.test.ts +494 -0
- package/src/lifecycle/publish-targets.ts +100 -0
- package/src/lifecycle/release-cut.test.ts +74 -2
- package/src/lifecycle/release-cut.ts +158 -22
- package/src/lifecycle/release-flag.test.ts +112 -0
- package/src/lifecycle/release-join.test.ts +68 -0
- package/src/lifecycle/release-join.ts +182 -0
- package/src/lifecycle/release-publish.test.ts +225 -0
- package/src/lifecycle/release-publish.ts +568 -0
- package/src/lifecycle/release-revocation.ts +147 -0
- package/src/lifecycle/release-store.ts +15 -4
- package/src/lifecycle/release-verify.test.ts +110 -0
- package/src/lifecycle/release-verify.ts +120 -0
- package/src/lifecycle/release-workstation.test.ts +204 -0
- package/src/lifecycle/release-workstation.ts +216 -0
- package/src/lifecycle/retention-growth.e2e.test.ts +279 -0
- package/src/lifecycle/retention-policy.ts +63 -0
- package/src/lifecycle/retention.test.ts +363 -0
- package/src/lifecycle/retention.ts +508 -0
- package/src/plan-summary.test.ts +20 -0
- package/src/plan-summary.ts +8 -1
- package/src/pr-loop.ts +25 -4
- package/src/pr-report-url.test.ts +131 -0
- package/src/pr-report-url.ts +209 -0
- package/src/provenance.ts +2 -2
- package/src/run-event-store.ts +63 -3
- package/src/run-event-stream.ts +4 -1
- package/src/run-event.ts +21 -1
- package/src/workspace/__fixtures__/flag-workspace.ts +132 -0
- package/src/workspace/__fixtures__/older-records/change-set-984534ea9.json +100 -0
- package/src/workspace/__fixtures__/older-records/older-records.json +326 -0
- package/src/workspace/change-set.schema.json +5 -1
- package/src/workspace/check.schema.json +4 -2
- package/src/workspace/checks/records.ts +35 -1
- package/src/workspace/checks.ts +2 -1
- package/src/workspace/ci-green.ts +14 -3
- package/src/workspace/declaration.schema.json +64 -0
- package/src/workspace/declaration.test.ts +28 -0
- package/src/workspace/declaration.ts +38 -0
- package/src/workspace/declared-kinds.ts +40 -1
- package/src/workspace/delivery-metrics.schema.json +519 -0
- package/src/workspace/delivery-metrics.test.ts +236 -0
- package/src/workspace/delivery-metrics.ts +286 -0
- package/src/workspace/flags-read.ts +121 -0
- package/src/workspace/flags.test.ts +141 -0
- package/src/workspace/flags.ts +157 -0
- package/src/workspace/graph-cli.ts +1 -1
- package/src/workspace/intent-cli.ts +46 -5
- package/src/workspace/intent-trace.test.ts +173 -0
- package/src/workspace/intent-trace.ts +484 -0
- package/src/workspace/intent.schema.json +702 -6
- package/src/workspace/intent.ts +148 -25
- package/src/workspace/older-records.test.ts +412 -0
- package/src/workspace/overlap.test.ts +165 -0
- package/src/workspace/overlap.ts +340 -0
- package/src/workspace/read-contract.e2e.test.ts +2 -1
- package/src/workspace/reason-codes.test.ts +5 -0
- package/src/workspace/reason-codes.ts +3 -0
- package/src/workspace/record-assets.test.ts +2 -1
- package/src/workspace/records-contract.e2e.test.ts +2 -1
- package/src/workspace/records.schema.json +21 -2
- package/src/workspace/records.ts +36 -2
- package/src/workspace/reference-kinds/flag/flag.kind.mjs +32 -0
- package/src/workspace/reference-kinds/flag/flag.schema.json +53 -0
- package/src/workspace/releases.schema.json +123 -1
- package/src/workspace/releases.ts +11 -0
- package/src/workspace/run-event.schema.json +10 -3
- package/src/workspace/status-contract.test.ts +29 -0
- package/src/workspace/status-gates.ts +8 -0
- package/src/workspace/status-mixed.test.ts +152 -0
- package/src/workspace/status-revoked.test.ts +153 -0
- package/src/workspace/status.schema.json +198 -1
- package/src/workspace/status.ts +254 -3
- package/src/workspace/wip.ts +11 -2
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Garbage collection of stored change sets, releases and run events by the
|
|
3
|
+
* retention policy (#4036). `chant lifecycle gc` runs it.
|
|
4
|
+
*
|
|
5
|
+
* What it prunes on `chant/lifecycle`, in every member's ledger at once:
|
|
6
|
+
*
|
|
7
|
+
* _change-sets/<digest>.json a stored change set (#4022)
|
|
8
|
+
* _releases/<digest>.json a release (#4026)
|
|
9
|
+
* _releases/templates/<digest>.txt template bytes no kept release names
|
|
10
|
+
*
|
|
11
|
+
* A prune is one new commit on the local branch that removes those files. It
|
|
12
|
+
* never rewrites or force-pushes history: other clones and tools read the
|
|
13
|
+
* branch, and every pruned file stays reachable in the commits before the
|
|
14
|
+
* prune. So a prune bounds the tree a reader walks at the tip, and the
|
|
15
|
+
* repository's history keeps growing by what is written. `git log -- <path>`
|
|
16
|
+
* on the branch still finds a pruned file.
|
|
17
|
+
*
|
|
18
|
+
* What it never touches: the ledgers. `_releases/cuts.jsonl`,
|
|
19
|
+
* `<env>/releases.jsonl`, `_gates/<op>.jsonl`, the run ledgers and every other
|
|
20
|
+
* `.jsonl` on the branch are append-only and are not edited (#4034), and a
|
|
21
|
+
* whole ledger file is not removed either: the latest deploy record of an
|
|
22
|
+
* environment, a gate's standing fact and a release's label all live in them,
|
|
23
|
+
* and they are small next to what they index (one line per fact). Nor does it
|
|
24
|
+
* touch snapshots, `_plans/`, `_builds/` or checkpoints, which have no policy
|
|
25
|
+
* yet. A cut line whose release was pruned stays, so its label keeps naming
|
|
26
|
+
* that digest and can't be given to another release.
|
|
27
|
+
*
|
|
28
|
+
* What is never pruned, whatever its age:
|
|
29
|
+
*
|
|
30
|
+
* 1. A release an environment runs: the release the latest deploy record of
|
|
31
|
+
* each component in each environment names, by its `releaseDigest` or the
|
|
32
|
+
* release gate resolution its admission names (`releaseOfDeploy`, #4043),
|
|
33
|
+
* and that release's templates. A promotion picks up what the step before
|
|
34
|
+
* runs (#4030), so this also keeps every release a promotion can take by
|
|
35
|
+
* default.
|
|
36
|
+
* 2. What a pending gate binds: the change set (`planDigest`) and release
|
|
37
|
+
* (`releaseDigest`) of every pending fact that has not expired.
|
|
38
|
+
* 3. A release still promotable: one whose commit has no `ci/revoked` tag and
|
|
39
|
+
* that was cut within `releases.days`, or is among the newest
|
|
40
|
+
* `releases.keep` releases of its member.
|
|
41
|
+
* 4. A change set a gate fact (an approval, an `empty` resolution or a
|
|
42
|
+
* pending fact) names together with a release that is kept.
|
|
43
|
+
*
|
|
44
|
+
* Anything else is pruned once it is older than its kind's window: a change
|
|
45
|
+
* set `changeSets.days` after it was stored or last named by a gate fact,
|
|
46
|
+
* whichever is later. A file that can't be read as a release is kept.
|
|
47
|
+
*
|
|
48
|
+
* Run events are local files under `<git-common-dir>/chant/run-events/`
|
|
49
|
+
* (`../run-event-store.ts`) and are deleted outright.
|
|
50
|
+
*/
|
|
51
|
+
import { execFileSync } from "node:child_process";
|
|
52
|
+
import { RefCASConflictError, writeLedgerFiles, pushLifecycleReport } from "./git.js";
|
|
53
|
+
import { MEMBERS_DIR } from "./member-ledger.js";
|
|
54
|
+
import { CHANGE_SETS_DIR } from "./change-set-store.js";
|
|
55
|
+
import { CUTS_FILE, RELEASES_DIR, TEMPLATES_SUBDIR, parseCuts, parseRelease } from "./release-store.js";
|
|
56
|
+
import { parseGateLedger } from "./gate-ledger.js";
|
|
57
|
+
import { parseReleaseLedger, releaseLedgerLines } from "./release-read.js";
|
|
58
|
+
import { latestPerComponent } from "./release-ledger.js";
|
|
59
|
+
import { releaseOfDeploy } from "./release-join.js";
|
|
60
|
+
import { RELEASE_GATE_OP } from "../op/gate-name.js";
|
|
61
|
+
import { planRunEventPrune, pruneRunEvents } from "../run-event-store.js";
|
|
62
|
+
const STATE_BRANCH = "chant/lifecycle";
|
|
63
|
+
const DAY_MS = 86400000;
|
|
64
|
+
function git(cwd, args, input) {
|
|
65
|
+
return execFileSync("git", args, { cwd, input, maxBuffer: 1024 * 1024 * 1024, stdio: ["pipe", "pipe", "pipe"] });
|
|
66
|
+
}
|
|
67
|
+
function branchTip(cwd) {
|
|
68
|
+
try {
|
|
69
|
+
return git(cwd, ["rev-parse", "--verify", "--quiet", `refs/heads/${STATE_BRANCH}`]).toString().trim() || null;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function listTree(cwd, tip) {
|
|
76
|
+
const out = [];
|
|
77
|
+
for (const line of git(cwd, ["ls-tree", "-r", "-l", "--full-tree", tip]).toString().split("\n")) {
|
|
78
|
+
const m = line.match(/^\d+ blob ([0-9a-f]+)\s+(\d+)\t(.+)$/);
|
|
79
|
+
if (m)
|
|
80
|
+
out.push({ sha: m[1], bytes: Number(m[2]), path: m[3] });
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
/** The text of each blob, read in one `git cat-file --batch`. */
|
|
85
|
+
function readBlobs(cwd, shas) {
|
|
86
|
+
const out = new Map();
|
|
87
|
+
const unique = [...new Set(shas)];
|
|
88
|
+
if (unique.length === 0)
|
|
89
|
+
return out;
|
|
90
|
+
const buf = git(cwd, ["cat-file", "--batch"], `${unique.join("\n")}\n`);
|
|
91
|
+
let at = 0;
|
|
92
|
+
while (at < buf.length) {
|
|
93
|
+
const nl = buf.indexOf(0x0a, at);
|
|
94
|
+
if (nl < 0)
|
|
95
|
+
break;
|
|
96
|
+
const header = buf.subarray(at, nl).toString().split(" ");
|
|
97
|
+
at = nl + 1;
|
|
98
|
+
if (header[1] === "missing" || header.length < 3)
|
|
99
|
+
continue;
|
|
100
|
+
const size = Number(header[2]);
|
|
101
|
+
out.set(header[0], buf.subarray(at, at + size).toString("utf8"));
|
|
102
|
+
at += size + 1;
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/** When each change set and release file was last added on the branch, newest add first, in one `git log`. */
|
|
107
|
+
function storedTimes(cwd, tip) {
|
|
108
|
+
const out = new Map();
|
|
109
|
+
const text = git(cwd, [
|
|
110
|
+
"log", "--format=%x00%cI", "--name-only", "--diff-filter=A", tip, "--",
|
|
111
|
+
`:(top,glob)**/${CHANGE_SETS_DIR}/*.json`, `:(top,glob)**/${RELEASES_DIR}/*.json`,
|
|
112
|
+
]).toString();
|
|
113
|
+
for (const chunk of text.split("\0")) {
|
|
114
|
+
const lines = chunk.split("\n").filter(Boolean);
|
|
115
|
+
const when = lines.shift();
|
|
116
|
+
if (!when)
|
|
117
|
+
continue;
|
|
118
|
+
for (const path of lines)
|
|
119
|
+
if (!out.has(path))
|
|
120
|
+
out.set(path, when);
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
/** Split a branch path into the member prefix (`_members/<a>/_members/<b>/`) and the rest. */
|
|
125
|
+
export function splitLedgerPath(path) {
|
|
126
|
+
const segs = path.split("/");
|
|
127
|
+
const names = [];
|
|
128
|
+
let i = 0;
|
|
129
|
+
while (segs[i] === MEMBERS_DIR && i + 2 < segs.length) {
|
|
130
|
+
names.push(segs[i + 1]);
|
|
131
|
+
i += 2;
|
|
132
|
+
}
|
|
133
|
+
return { prefix: segs.slice(0, i).map((s) => `${s}/`).join(""), member: names.length > 0 ? names.join("/") : null, rest: segs.slice(i).join("/") };
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The key a digest is matched by: its hex. A plan digest written `sha256:<hex>`
|
|
137
|
+
* names the same plan as `jcs1-sha256:<hex>` (`samePlanDigest`), and a file
|
|
138
|
+
* name writes `:` as `_`, so both sides are reduced to the hex.
|
|
139
|
+
*/
|
|
140
|
+
export function digestKey(digestOrStem) {
|
|
141
|
+
const hex = digestOrStem.match(/[0-9a-f]{64}$/);
|
|
142
|
+
return hex ? hex[0] : digestOrStem.replace(/:/g, "_");
|
|
143
|
+
}
|
|
144
|
+
const stemOf = (name, ext) => name.slice(0, -ext.length);
|
|
145
|
+
const fileDigest = (name, ext) => stemOf(name, ext).replace(/_/g, ":");
|
|
146
|
+
function emptySize() {
|
|
147
|
+
const z = () => ({ files: 0, bytes: 0 });
|
|
148
|
+
return { files: 0, bytes: 0, changeSets: z(), releases: z(), templates: z(), ledgers: z(), other: z() };
|
|
149
|
+
}
|
|
150
|
+
function sizeOf(files, kinds) {
|
|
151
|
+
const s = emptySize();
|
|
152
|
+
for (const f of files) {
|
|
153
|
+
s.files++;
|
|
154
|
+
s.bytes += f.bytes;
|
|
155
|
+
const kind = kinds.get(f.path);
|
|
156
|
+
const slot = kind === "change-set" ? s.changeSets : kind === "release" ? s.releases : kind === "template" ? s.templates : f.path.endsWith(".jsonl") ? s.ledgers : s.other;
|
|
157
|
+
slot.files++;
|
|
158
|
+
slot.bytes += f.bytes;
|
|
159
|
+
}
|
|
160
|
+
return s;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Decide what a prune of `chant/lifecycle` removes and keeps, by the rules at
|
|
164
|
+
* the top of this file. Reads the branch at its local tip and writes nothing.
|
|
165
|
+
*/
|
|
166
|
+
export function planLifecycleGc(input) {
|
|
167
|
+
const { cwd, policy, now } = input;
|
|
168
|
+
const revoked = input.revokedCommits ?? new Set();
|
|
169
|
+
const tip = branchTip(cwd);
|
|
170
|
+
if (!tip)
|
|
171
|
+
return { tip: null, remove: [], keep: [], before: emptySize(), after: emptySize() };
|
|
172
|
+
const files = listTree(cwd, tip);
|
|
173
|
+
const stored = storedTimes(cwd, tip);
|
|
174
|
+
const members = new Map();
|
|
175
|
+
const kinds = new Map();
|
|
176
|
+
const ledgerOf = (prefix, member) => {
|
|
177
|
+
let m = members.get(prefix);
|
|
178
|
+
if (!m) {
|
|
179
|
+
m = { prefix, member, changeSets: new Map(), releases: new Map(), templates: new Map(), cuts: null, gates: [], deploys: [] };
|
|
180
|
+
members.set(prefix, m);
|
|
181
|
+
}
|
|
182
|
+
return m;
|
|
183
|
+
};
|
|
184
|
+
for (const f of files) {
|
|
185
|
+
const { prefix, member, rest } = splitLedgerPath(f.path);
|
|
186
|
+
const segs = rest.split("/");
|
|
187
|
+
const name = segs.at(-1);
|
|
188
|
+
const entry = (kind, digest) => {
|
|
189
|
+
kinds.set(f.path, kind);
|
|
190
|
+
return { kind, member, path: f.path, digest, bytes: f.bytes, sha: f.sha, storedAt: stored.get(f.path) ?? null };
|
|
191
|
+
};
|
|
192
|
+
if (segs.length === 2 && segs[0] === CHANGE_SETS_DIR && name.endsWith(".json")) {
|
|
193
|
+
const e = entry("change-set", fileDigest(name, ".json"));
|
|
194
|
+
ledgerOf(prefix, member).changeSets.set(digestKey(stemOf(name, ".json")), e);
|
|
195
|
+
}
|
|
196
|
+
else if (segs.length === 2 && segs[0] === RELEASES_DIR && name.endsWith(".json")) {
|
|
197
|
+
const e = entry("release", fileDigest(name, ".json"));
|
|
198
|
+
ledgerOf(prefix, member).releases.set(digestKey(stemOf(name, ".json")), e);
|
|
199
|
+
}
|
|
200
|
+
else if (segs.length === 3 && segs[0] === RELEASES_DIR && segs[1] === TEMPLATES_SUBDIR && name.endsWith(".txt")) {
|
|
201
|
+
const e = entry("template", fileDigest(name, ".txt"));
|
|
202
|
+
ledgerOf(prefix, member).templates.set(digestKey(stemOf(name, ".txt")), e);
|
|
203
|
+
}
|
|
204
|
+
else if (segs.length === 2 && segs[0] === RELEASES_DIR && name === CUTS_FILE) {
|
|
205
|
+
ledgerOf(prefix, member).cuts = f;
|
|
206
|
+
}
|
|
207
|
+
else if (segs.length === 2 && segs[0] === "_gates" && name.endsWith(".jsonl")) {
|
|
208
|
+
ledgerOf(prefix, member).gates.push(f);
|
|
209
|
+
}
|
|
210
|
+
else if (segs.length === 2 && name === "releases.jsonl" && !segs[0].startsWith("_")) {
|
|
211
|
+
ledgerOf(prefix, member).deploys.push({ env: segs[0], file: f });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const blobs = readBlobs(cwd, [...members.values()].flatMap((m) => [...m.releases.values()].map((r) => r.sha).concat(m.cuts ? [m.cuts.sha] : [], m.gates.map((g) => g.sha), m.deploys.map((d) => d.file.sha))));
|
|
215
|
+
const keep = [];
|
|
216
|
+
const remove = [];
|
|
217
|
+
const nowMs = now.getTime();
|
|
218
|
+
for (const m of members.values()) {
|
|
219
|
+
const reasons = new Map();
|
|
220
|
+
const keepFile = (f, reason) => {
|
|
221
|
+
if (!f)
|
|
222
|
+
return;
|
|
223
|
+
reasons.set(f, [...(reasons.get(f) ?? []), reason]);
|
|
224
|
+
};
|
|
225
|
+
// The gate facts of every op in the member.
|
|
226
|
+
const pending = [];
|
|
227
|
+
const resolutions = [];
|
|
228
|
+
let releaseGateResolutions = [];
|
|
229
|
+
for (const g of m.gates) {
|
|
230
|
+
const parsed = parseGateLedger(blobs.get(g.sha) ?? "");
|
|
231
|
+
pending.push(...parsed.pending);
|
|
232
|
+
resolutions.push(...parsed.resolutions);
|
|
233
|
+
if (g.path.endsWith(`/${RELEASE_GATE_OP}.jsonl`) || g.path === `_gates/${RELEASE_GATE_OP}.jsonl`)
|
|
234
|
+
releaseGateResolutions = parsed.resolutions;
|
|
235
|
+
}
|
|
236
|
+
// Releases, parsed.
|
|
237
|
+
const parsed = new Map();
|
|
238
|
+
for (const r of m.releases.values()) {
|
|
239
|
+
const release = parseRelease(blobs.get(r.sha) ?? "");
|
|
240
|
+
parsed.set(r, release && digestKey(release.releaseDigest) === digestKey(r.digest) ? release : null);
|
|
241
|
+
}
|
|
242
|
+
// Rule 1: what each environment runs.
|
|
243
|
+
for (const { env, file } of m.deploys) {
|
|
244
|
+
const { records } = parseReleaseLedger(releaseLedgerLines(blobs.get(file.sha) ?? null));
|
|
245
|
+
for (const record of latestPerComponent(records).values()) {
|
|
246
|
+
const digest = releaseOfDeploy(record, releaseGateResolutions);
|
|
247
|
+
if (digest !== undefined)
|
|
248
|
+
keepFile(m.releases.get(digestKey(digest)), { code: "deployed", detail: `${env}/${record.component}` });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// Rule 2: what a pending gate binds, until its fact expires.
|
|
252
|
+
for (const p of pending) {
|
|
253
|
+
if (new Date(p.expiresAt).getTime() <= nowMs)
|
|
254
|
+
continue;
|
|
255
|
+
const detail = `${p.op}/${p.gate}${p.environment ? ` in ${p.environment}` : ""}`;
|
|
256
|
+
if (p.planDigest)
|
|
257
|
+
keepFile(m.changeSets.get(digestKey(p.planDigest)), { code: "pending-gate", detail });
|
|
258
|
+
if (p.releaseDigest)
|
|
259
|
+
keepFile(m.releases.get(digestKey(p.releaseDigest)), { code: "pending-gate", detail });
|
|
260
|
+
}
|
|
261
|
+
// Rule 3: a release still promotable.
|
|
262
|
+
const { cuts } = parseCuts(m.cuts ? (blobs.get(m.cuts.sha) ?? null) : null);
|
|
263
|
+
const cutAt = new Map();
|
|
264
|
+
for (const c of cuts) {
|
|
265
|
+
const k = digestKey(c.releaseDigest);
|
|
266
|
+
if (!cutAt.has(k) || c.timestamp > cutAt.get(k))
|
|
267
|
+
cutAt.set(k, c.timestamp);
|
|
268
|
+
}
|
|
269
|
+
const releaseCutoff = nowMs - policy.releases.days * DAY_MS;
|
|
270
|
+
const promotable = [];
|
|
271
|
+
for (const [k, file] of m.releases) {
|
|
272
|
+
const release = parsed.get(file);
|
|
273
|
+
if (!release) {
|
|
274
|
+
keepFile(file, { code: "unreadable" });
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (revoked.has(release.commit))
|
|
278
|
+
continue;
|
|
279
|
+
const when = cutAt.get(k) ?? file.storedAt;
|
|
280
|
+
promotable.push({ file, at: when ? new Date(when).getTime() : Number.POSITIVE_INFINITY });
|
|
281
|
+
}
|
|
282
|
+
promotable.sort((a, b) => b.at - a.at || (a.file.path < b.file.path ? -1 : 1));
|
|
283
|
+
promotable.forEach(({ file, at }, i) => {
|
|
284
|
+
if (i < policy.releases.keep)
|
|
285
|
+
keepFile(file, { code: "newest" });
|
|
286
|
+
if (at >= releaseCutoff)
|
|
287
|
+
keepFile(file, { code: "within-window" });
|
|
288
|
+
});
|
|
289
|
+
const keptReleases = new Set([...m.releases.values()].filter((r) => reasons.has(r)));
|
|
290
|
+
const keptKeys = new Set([...keptReleases].map((r) => digestKey(r.digest)));
|
|
291
|
+
// Templates follow the releases that name them.
|
|
292
|
+
const unreadableKept = [...keptReleases].some((r) => parsed.get(r) === null);
|
|
293
|
+
for (const r of keptReleases) {
|
|
294
|
+
const release = parsed.get(r);
|
|
295
|
+
if (!release)
|
|
296
|
+
continue;
|
|
297
|
+
for (const t of release.targets)
|
|
298
|
+
for (const tpl of t.templates)
|
|
299
|
+
keepFile(m.templates.get(digestKey(tpl.digest)), { code: "kept-release", detail: r.digest });
|
|
300
|
+
}
|
|
301
|
+
if (unreadableKept)
|
|
302
|
+
for (const t of m.templates.values())
|
|
303
|
+
keepFile(t, { code: "unreadable", detail: "a release file of this member can't be read" });
|
|
304
|
+
// Rule 4, and the change-set window.
|
|
305
|
+
const lastNamed = new Map();
|
|
306
|
+
for (const fact of [...pending, ...resolutions]) {
|
|
307
|
+
if (!fact.planDigest)
|
|
308
|
+
continue;
|
|
309
|
+
const k = digestKey(fact.planDigest);
|
|
310
|
+
const t = new Date(fact.timestamp).getTime();
|
|
311
|
+
if (!lastNamed.has(k) || t > lastNamed.get(k))
|
|
312
|
+
lastNamed.set(k, t);
|
|
313
|
+
if (fact.releaseDigest && keptKeys.has(digestKey(fact.releaseDigest)))
|
|
314
|
+
keepFile(m.changeSets.get(k), { code: "kept-release", detail: fact.releaseDigest });
|
|
315
|
+
}
|
|
316
|
+
const changeSetCutoff = nowMs - policy.changeSets.days * DAY_MS;
|
|
317
|
+
for (const [k, file] of m.changeSets) {
|
|
318
|
+
const storedMs = file.storedAt ? new Date(file.storedAt).getTime() : Number.POSITIVE_INFINITY;
|
|
319
|
+
const last = Math.max(storedMs, lastNamed.get(k) ?? Number.NEGATIVE_INFINITY);
|
|
320
|
+
if (last >= changeSetCutoff)
|
|
321
|
+
keepFile(file, { code: "within-window" });
|
|
322
|
+
}
|
|
323
|
+
for (const f of [...m.changeSets.values(), ...m.releases.values(), ...m.templates.values()]) {
|
|
324
|
+
const why = reasons.get(f);
|
|
325
|
+
if (why)
|
|
326
|
+
keep.push({ ...f, reasons: dedupe(why) });
|
|
327
|
+
else
|
|
328
|
+
remove.push(f);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
const byPath = (a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
332
|
+
remove.sort(byPath);
|
|
333
|
+
keep.sort(byPath);
|
|
334
|
+
const removed = new Set(remove.map((f) => f.path));
|
|
335
|
+
return { tip, remove, keep, before: sizeOf(files, kinds), after: sizeOf(files.filter((f) => !removed.has(f.path)), kinds) };
|
|
336
|
+
}
|
|
337
|
+
function dedupe(reasons) {
|
|
338
|
+
const seen = new Set();
|
|
339
|
+
return reasons.filter((r) => {
|
|
340
|
+
const k = `${r.code}\0${r.detail ?? ""}`;
|
|
341
|
+
if (seen.has(k))
|
|
342
|
+
return false;
|
|
343
|
+
seen.add(k);
|
|
344
|
+
return true;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
/** The commit message of a prune. */
|
|
348
|
+
export function pruneMessage(remove) {
|
|
349
|
+
const n = (kind) => remove.filter((f) => f.kind === kind).length;
|
|
350
|
+
return `Retention: remove ${n("change-set")} change set(s), ${n("release")} release(s) and ${n("template")} template(s)`;
|
|
351
|
+
}
|
|
352
|
+
const PRUNE_ATTEMPTS = 5;
|
|
353
|
+
/**
|
|
354
|
+
* Plan and, unless `dryRun`, carry out a prune: one commit on the local
|
|
355
|
+
* `chant/lifecycle` that removes what the plan lets go, and the run event
|
|
356
|
+
* files it lets go deleted. The commit is planned against the tip it is
|
|
357
|
+
* written on: if the branch moved in between, the plan is made again. It is
|
|
358
|
+
* pushed only when `push` is set.
|
|
359
|
+
*/
|
|
360
|
+
export async function runLifecycleGc(input) {
|
|
361
|
+
let plan = planLifecycleGc(input);
|
|
362
|
+
let commit = null;
|
|
363
|
+
if (!input.dryRun && plan.tip && plan.remove.length > 0) {
|
|
364
|
+
for (let attempt = 1;; attempt++) {
|
|
365
|
+
const removals = plan.remove.map((f) => ({ path: f.path, remove: true, expectPriorSha: f.sha }));
|
|
366
|
+
try {
|
|
367
|
+
commit = await writeLedgerFiles(removals, pruneMessage(plan.remove), { cwd: input.cwd, expectTip: plan.tip });
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
catch (err) {
|
|
371
|
+
if (!(err instanceof RefCASConflictError) || attempt >= PRUNE_ATTEMPTS)
|
|
372
|
+
throw err;
|
|
373
|
+
plan = planLifecycleGc(input);
|
|
374
|
+
if (!plan.tip || plan.remove.length === 0)
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
let pushed = false;
|
|
380
|
+
let pushWarning;
|
|
381
|
+
if (commit && input.push) {
|
|
382
|
+
const r = await pushLifecycleReport({ cwd: input.cwd });
|
|
383
|
+
pushed = r.pushed;
|
|
384
|
+
pushWarning = r.pushWarning;
|
|
385
|
+
}
|
|
386
|
+
const events = await planRunEventPrune(input.cwd, input.policy.runEvents, input.now);
|
|
387
|
+
const deleted = input.dryRun ? 0 : pruneRunEvents(events);
|
|
388
|
+
return {
|
|
389
|
+
now: input.now.toISOString(),
|
|
390
|
+
policy: input.policy,
|
|
391
|
+
dryRun: input.dryRun,
|
|
392
|
+
lifecycle: { ...plan, commit, pushed, ...(pushWarning ? { pushWarning } : {}) },
|
|
393
|
+
runEvents: {
|
|
394
|
+
dir: events.dir,
|
|
395
|
+
remove: events.remove,
|
|
396
|
+
kept: { files: events.keep.length, bytes: events.keep.reduce((n, f) => n + f.bytes, 0) },
|
|
397
|
+
deleted,
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-summary.d.ts","sourceRoot":"","sources":["../src/plan-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAsB,iBAAiB,EAAmC,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEjJ,oDAAoD;AACpD,eAAO,MAAM,sBAAsB,0FAA0F,CAAC;AAE9H,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,UAAY,CAAC;AAE3C,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEpD,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,iDAAiD;IACjD,KAAK,EAAE,MAAM,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AAM,WAAW,qBAAqB;IACpC,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,CA2DrG"}
|
package/dist/plan-summary.js
CHANGED
|
@@ -542,8 +542,14 @@ function groupTitle(s, g) {
|
|
|
542
542
|
t += " (outlier)";
|
|
543
543
|
if (g.provisional)
|
|
544
544
|
t += " (provisional)";
|
|
545
|
-
if (g.noChanges)
|
|
546
|
-
|
|
545
|
+
if (g.noChanges) {
|
|
546
|
+
// A member with holes planned no entries, but its plan says nothing about
|
|
547
|
+
// what the holes cover, so the group cannot say "no changes" for it
|
|
548
|
+
// (#4084). Only the heading says so: the group and its id are unchanged.
|
|
549
|
+
const holed = s.unit === "member" ? new Set(s.holes.map((h) => h.member)) : new Set();
|
|
550
|
+
const unknown = g.units.filter((u) => holed.has(u)).length;
|
|
551
|
+
t += unknown > 0 ? `, no changes known: ${unknown} with holes, listed above` : ", no changes";
|
|
552
|
+
}
|
|
547
553
|
else if (g.extends)
|
|
548
554
|
t += `, group ${g.extends}'s change plus`;
|
|
549
555
|
else if (g.units.length > 1)
|
package/dist/pr-loop.d.ts
CHANGED
|
@@ -180,6 +180,13 @@ export interface PrReport {
|
|
|
180
180
|
}
|
|
181
181
|
/** The counts a member's entries add up to. */
|
|
182
182
|
export declare function memberCounts(doc: Pick<ChangeSetDocument, "summary">, member: string): PrMemberCounts;
|
|
183
|
+
/**
|
|
184
|
+
* Why a member's plan cannot say everything it will change: its holes'
|
|
185
|
+
* reasons, each once, in order (#4084). A `cfn-deploy` member whose inputs
|
|
186
|
+
* come from a stack the same run applies first says `inputs from <stack>;
|
|
187
|
+
* re-checked on apply`.
|
|
188
|
+
*/
|
|
189
|
+
export declare function memberHoleReasons(report: Pick<PrReport, "changeSet">, member: string): string[];
|
|
183
190
|
/** The approve command a reviewer runs for this report's digest. */
|
|
184
191
|
export declare function prApproveCommand(report: Pick<PrReport, "op" | "gate" | "digest">, approver?: string): string;
|
|
185
192
|
/**
|
package/dist/pr-loop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-loop.d.ts","sourceRoot":"","sources":["../src/pr-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGvE,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,oFAAoF,CAAC;AAErH,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,mFAAmF;AACnF,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC;;;GAGG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,8HAA8H;AAC9H,eAAO,MAAM,UAAU,QAAqC,CAAC;AAE7D,+GAA+G;AAC/G,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED,4DAA4D;AAC5D,eAAO,MAAM,kBAAkB;aAAK,IAAI,EAAE,YAAY;aAAE,KAAK,EAAE,aAAa;CAAW,CAAC;AAExF,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,+BAA+B;AAC/B,MAAM,MAA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AAgB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,QAAQ,SAAU,GAAG,MAAM,CAE7G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAMzG;AAuDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAyC1G;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CA+B5D;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAIjF"}
|
package/dist/pr-loop.js
CHANGED
|
@@ -68,6 +68,16 @@ export function memberCounts(doc, member) {
|
|
|
68
68
|
const n = (a) => by[a] ?? 0;
|
|
69
69
|
return { create: n("create"), update: n("update"), replace: n("replace"), delete: n("delete") };
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Why a member's plan cannot say everything it will change: its holes'
|
|
73
|
+
* reasons, each once, in order (#4084). A `cfn-deploy` member whose inputs
|
|
74
|
+
* come from a stack the same run applies first says `inputs from <stack>;
|
|
75
|
+
* re-checked on apply`.
|
|
76
|
+
*/
|
|
77
|
+
export function memberHoleReasons(report, member) {
|
|
78
|
+
const m = report.changeSet.members.find((x) => x.member === member);
|
|
79
|
+
return [...new Set((m?.holes ?? []).map((h) => h.reason))];
|
|
80
|
+
}
|
|
71
81
|
/** The approve command a reviewer runs for this report's digest. */
|
|
72
82
|
export function prApproveCommand(report, approver = "<you>") {
|
|
73
83
|
return `chant approve ${report.op} ${report.gate} --plan ${report.digest} --approver ${approver} --sign`;
|
|
@@ -144,8 +154,15 @@ export function renderPrNote(report, options = {}) {
|
|
|
144
154
|
if (report.members.length > 0) {
|
|
145
155
|
out.push("", "| Member | Component | Status | Create | Update | Replace | Delete |", "|---|---|---|---:|---:|---:|---:|");
|
|
146
156
|
for (const m of report.members) {
|
|
147
|
-
const
|
|
148
|
-
|
|
157
|
+
const holes = memberHoleReasons(report, m.member);
|
|
158
|
+
const status = STATUS_WORDS[m.status] +
|
|
159
|
+
(m.inputsMoved?.length ? `, inputs from ${m.inputsMoved.join(", ")} moved` : "") +
|
|
160
|
+
(holes.length > 0 ? `; ${holes.length > 2 ? `${holes[0]}; and ${holes.length - 1} more, listed under Holes` : holes.join("; ")}` : "");
|
|
161
|
+
// A member whose plan has holes and no entries says nothing about what
|
|
162
|
+
// it changes, so its counts are unknown, not zero (#4084).
|
|
163
|
+
const unknown = holes.length > 0 && !report.changeSet.entries.some((e) => e.member === m.member);
|
|
164
|
+
const n = (k) => (unknown ? "?" : String(m.counts[k]));
|
|
165
|
+
out.push(`| ${code(m.member)} | ${m.component} | ${status} | ${n("create")} | ${n("update")} | ${n("replace")} | ${n("delete")} |`);
|
|
149
166
|
}
|
|
150
167
|
if (report.members.some((m) => m.inputsMoved?.length)) {
|
|
151
168
|
out.push("", "A member whose inputs moved applied the plan it was approved with. The next run plans it against the new values.");
|
|
@@ -175,9 +192,11 @@ export function prStatusDescription(report) {
|
|
|
175
192
|
case "nothing":
|
|
176
193
|
text = "nothing to plan";
|
|
177
194
|
break;
|
|
178
|
-
case "planned":
|
|
179
|
-
|
|
195
|
+
case "planned": {
|
|
196
|
+
const unknown = report.members.filter((m) => memberHoleReasons(report, m.member).length > 0).length;
|
|
197
|
+
text = `${n} member${n === 1 ? "" : "s"}: ${sum.change} to change, ${sum.destroy} to destroy or replace${unknown > 0 ? `, ${unknown} with holes` : ""}${digest}`;
|
|
180
198
|
break;
|
|
199
|
+
}
|
|
181
200
|
case "plan-failed":
|
|
182
201
|
text = `a member failed to plan${digest}`;
|
|
183
202
|
break;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pr-plan --report-url` and `pr-apply --report-url` (#4007): copy a stage's
|
|
3
|
+
* report, its change set and its run events where a reader outside CI can
|
|
4
|
+
* fetch them, keyed by pull request and commit.
|
|
5
|
+
*
|
|
6
|
+
* ```
|
|
7
|
+
* <url>/<pr>/<commit>/pr-<stage>.json
|
|
8
|
+
* <url>/<pr>/<commit>/change-set.json
|
|
9
|
+
* <url>/<pr>/<commit>/pr-<stage>.events.jsonl (with --events-json)
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* `<pr>` is the pull or merge request number, or `unknown` when pr-apply
|
|
13
|
+
* found none, and `<commit>` is the full sha the stage ran on: the pull
|
|
14
|
+
* request's head for pr-plan, the pushed commit for pr-apply. A workspace
|
|
15
|
+
* member's loop (`--member`) adds `/<member>` after the commit. There is no
|
|
16
|
+
* index: a reader that knows the pull request and the commit knows the key.
|
|
17
|
+
* The events file is named for its stage because pr-plan and pr-apply run on
|
|
18
|
+
* the same commit when a pull request merges by fast-forward.
|
|
19
|
+
*
|
|
20
|
+
* The events file is uploaded again, whole, each time a wave, a component or
|
|
21
|
+
* the run settles, so a reader polling the URL sees each wave as it applies.
|
|
22
|
+
* One upload of it is in flight at a time: a settle while one is in flight
|
|
23
|
+
* asks for one more after it, with everything written by then. A failed
|
|
24
|
+
* upload is a warning and the run goes on. The last upload, after the run
|
|
25
|
+
* settles, carries the whole stream, and the report and the change set go
|
|
26
|
+
* with it.
|
|
27
|
+
*
|
|
28
|
+
* Two schemes. `file://<dir>` writes under a directory, each file through a
|
|
29
|
+
* temporary name and a rename, so a reader never sees half a file. `s3://
|
|
30
|
+
* <bucket>/<prefix>` runs the AWS CLI (`aws s3 cp - <s3 url>`, the body on
|
|
31
|
+
* its stdin), which reads its credentials, region and endpoint from the
|
|
32
|
+
* environment the job gives it, the way the aws lexicon's `s3-sync` does.
|
|
33
|
+
* chant passes it no credential and prints none: a failed upload prints the
|
|
34
|
+
* CLI's own error line.
|
|
35
|
+
*/
|
|
36
|
+
/** Where `--report-url` points. */
|
|
37
|
+
export type ReportTarget = {
|
|
38
|
+
scheme: "file";
|
|
39
|
+
url: string;
|
|
40
|
+
dir: string;
|
|
41
|
+
} | {
|
|
42
|
+
scheme: "s3";
|
|
43
|
+
url: string;
|
|
44
|
+
bucket: string;
|
|
45
|
+
prefix: string;
|
|
46
|
+
};
|
|
47
|
+
/** `--report-url` read, or why it can't be. */
|
|
48
|
+
export declare function parseReportUrl(raw: string): ReportTarget | {
|
|
49
|
+
error: string;
|
|
50
|
+
};
|
|
51
|
+
/** The key a stage's files are kept under, below the URL: `<pr>/<commit>[/<member>]`. */
|
|
52
|
+
export declare function reportKey(pr: number | null, commit: string, member?: string): string;
|
|
53
|
+
/** The events file of a stage. */
|
|
54
|
+
export declare const reportEventsFile: (stage: "plan" | "apply") => string;
|
|
55
|
+
/** Puts one object: `key` below the URL. Rejects with a line a person can read. */
|
|
56
|
+
export type ReportPut = (key: string, body: string, contentType: string) => Promise<void>;
|
|
57
|
+
/** Runs the AWS CLI with `args` and `stdin`, rejecting with its error line on a non-zero exit. */
|
|
58
|
+
export type AwsCli = (args: string[], stdin: string) => Promise<void>;
|
|
59
|
+
/** The AWS CLI on PATH. */
|
|
60
|
+
export declare const realAwsCli: AwsCli;
|
|
61
|
+
/** A put for `target`. `aws` replaces the AWS CLI in a test. */
|
|
62
|
+
export declare function reportPut(target: ReportTarget, aws?: AwsCli): ReportPut;
|
|
63
|
+
/** A stage's upload: its events as they are written, and its files at the end. */
|
|
64
|
+
export interface PrReportUpload {
|
|
65
|
+
/** The folder the stage's files go to: `<url>/<key>`. */
|
|
66
|
+
readonly where: string;
|
|
67
|
+
/** One line of the stage's run-event stream. A wave, component or run settle uploads the events. */
|
|
68
|
+
line(line: string): void;
|
|
69
|
+
/** A file to upload when the stage closes, replacing one of the same name. */
|
|
70
|
+
file(name: string, body: string): void;
|
|
71
|
+
/** Wait for the upload in flight, then upload the whole stream and the files. Never throws. */
|
|
72
|
+
close(): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
/** Open a stage's upload to `target` under `key`. `warn` prints a warning line. */
|
|
75
|
+
export declare function openPrReportUpload(input: {
|
|
76
|
+
target: ReportTarget;
|
|
77
|
+
key: string;
|
|
78
|
+
stage: "plan" | "apply";
|
|
79
|
+
warn: (message: string) => void;
|
|
80
|
+
put?: ReportPut;
|
|
81
|
+
}): PrReportUpload;
|
|
82
|
+
//# sourceMappingURL=pr-report-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-report-url.d.ts","sourceRoot":"","sources":["../src/pr-report-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAOH,mCAAmC;AACnC,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAkB5E;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED,kCAAkC;AAClC,eAAO,MAAM,gBAAgB,UAAW,MAAM,GAAG,OAAO,KAAG,MAAoC,CAAC;AAEhG,mFAAmF;AACnF,MAAM,MAAM,SAAS,GAAG,C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