@intentius/chant 0.124.28 → 0.124.30
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 +18 -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 +67 -8
- 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 +91 -10
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +73 -2
- package/dist/cli/registry.d.ts +32 -4
- 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 +49 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +38 -4
- package/dist/components/pr-run.d.ts +20 -2
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +26 -13
- 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 +16 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +36 -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-ledger.d.ts +8 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +2 -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/lifecycle/run-ledger.d.ts +1 -1
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -0
- package/dist/op/activities/activity-contracts.d.ts +1 -0
- package/dist/op/activities/activity-contracts.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.js +1 -0
- package/dist/op/activities/shell.d.ts +6 -0
- package/dist/op/activities/shell.d.ts.map +1 -1
- package/dist/op/activities/shell.js +1 -1
- package/dist/op/local-executor.d.ts +23 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +9 -3
- package/dist/op/runtime.d.ts +27 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +20 -0
- package/dist/plan-summary.d.ts.map +1 -1
- package/dist/plan-summary.js +8 -2
- package/dist/pr-forge.d.ts +23 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +44 -0
- package/dist/pr-loop.d.ts +17 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +30 -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 +4 -3
- package/dist/run-event-stream.d.ts.map +1 -1
- package/dist/run-event-stream.js +7 -3
- package/dist/run-event.d.ts +34 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +4 -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-forge.d.ts +2 -0
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +10 -0
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +14 -5
- package/dist/workspace/ci-run.d.ts +222 -0
- package/dist/workspace/ci-run.d.ts.map +1 -0
- package/dist/workspace/ci-run.js +464 -0
- package/dist/workspace/ci-serve.d.ts +214 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -0
- package/dist/workspace/ci-serve.js +412 -0
- 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/pr-report.schema.json +5 -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 +24 -6
- package/dist/workspace/status-gates.d.ts +8 -0
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/dist/workspace/status-stewards.d.ts +2 -0
- package/dist/workspace/status-stewards.d.ts.map +1 -1
- package/dist/workspace/status-stewards.js +1 -0
- 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 +210 -2
- 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 +30 -0
- package/src/cli/handlers/build.ts +20 -4
- package/src/cli/handlers/fan-out.test.ts +262 -1
- package/src/cli/handlers/fan-out.ts +72 -8
- 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 +144 -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 +91 -10
- package/src/cli/parse-args.ts +54 -2
- package/src/cli/registry.ts +32 -4
- 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 +67 -4
- package/src/components/pr-run.test.ts +127 -0
- package/src/components/pr-run.ts +32 -12
- 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 +45 -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-ledger.ts +9 -3
- 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/lifecycle/run-ledger.ts +7 -1
- package/src/op/activities/activity-contracts.ts +1 -0
- package/src/op/activities/shell.ts +7 -1
- package/src/op/local-executor.ts +27 -4
- package/src/op/runtime.ts +42 -0
- package/src/plan-summary.test.ts +20 -0
- package/src/plan-summary.ts +8 -1
- package/src/pr-forge.test.ts +25 -0
- package/src/pr-forge.ts +62 -0
- package/src/pr-loop.test.ts +13 -1
- package/src/pr-loop.ts +41 -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 +8 -4
- package/src/run-event.ts +38 -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-forge.ts +2 -0
- package/src/workspace/ci-green.ts +20 -5
- package/src/workspace/ci-run.test.ts +416 -0
- package/src/workspace/ci-run.ts +571 -0
- package/src/workspace/ci-serve.test.ts +268 -0
- package/src/workspace/ci-serve.ts +521 -0
- 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/pr-report.schema.json +5 -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 +24 -6
- 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-stewards.ts +3 -0
- package/src/workspace/status.schema.json +210 -2
- 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,6 +1,6 @@
|
|
|
1
1
|
import type { OpConfig } from "../op/types.js";
|
|
2
2
|
import type { StepRecord } from "../op/local-executor.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type OpRunRecord, type OpRunRecordInput } from "../op/runtime.js";
|
|
4
4
|
/** The env a run records against when its Op declares no `labels.Env`. */
|
|
5
5
|
export declare const DEFAULT_RUN_ENV = "local";
|
|
6
6
|
/** The env a run records against: the Op's own `labels.Env`, else {@link DEFAULT_RUN_ENV}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/run-ledger.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"run-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/run-ledger.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAA+C,MAAM,eAAe,CAAC;AASrI,0EAA0E;AAC1E,eAAO,MAAM,eAAe,UAAU,CAAC;AAMvC,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,MAAM,CAEjE;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,EACzC,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,KAAK,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACrC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GACA,gBAAgB,CAiDlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,CAsBlD;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCxD"}
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { randomUUID } from "node:crypto";
|
|
38
38
|
import { sortedJsonReplacer } from "../utils.js";
|
|
39
|
+
import { opRunFailureOf } from "../op/runtime.js";
|
|
39
40
|
import { readBlobFromPath, readPathSha, readBlobBySha, writeBlobToPath, RefCASConflictError } from "./git.js";
|
|
40
41
|
/** Prefix folding the per-op run ledgers into one flat name under `<env>/`. See the module doc. */
|
|
41
42
|
const PREFIX = "runs__";
|
|
@@ -177,6 +178,14 @@ export async function readRunLedger(environment, op, opts) {
|
|
|
177
178
|
malformed++;
|
|
178
179
|
continue;
|
|
179
180
|
}
|
|
181
|
+
// A `failure` (#4094) that is not one is dropped and the line kept, as a gate line's wrong-typed `gitSha` is.
|
|
182
|
+
if ("failure" in parsed) {
|
|
183
|
+
const failure = opRunFailureOf(parsed.failure);
|
|
184
|
+
if (failure)
|
|
185
|
+
parsed.failure = failure;
|
|
186
|
+
else
|
|
187
|
+
delete parsed.failure;
|
|
188
|
+
}
|
|
180
189
|
records.push(parsed);
|
|
181
190
|
}
|
|
182
191
|
catch {
|
|
@@ -47,6 +47,7 @@ export declare const shellCmdContract: import("../index.js").ActivityContract<{
|
|
|
47
47
|
cmd: string;
|
|
48
48
|
env?: Record<string, string> | undefined;
|
|
49
49
|
cwd?: string | undefined;
|
|
50
|
+
inheritEnv?: boolean | undefined;
|
|
50
51
|
okExit?: number[] | undefined;
|
|
51
52
|
gatedExit?: number | undefined;
|
|
52
53
|
gate?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../../src/op/activities/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,eAAO,MAAM,yBAAyB;;SAGrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;EAIjC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../../src/op/activities/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,eAAO,MAAM,yBAAyB;;SAGrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;EAIjC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;EAgB5B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;EAgB7B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;SAGjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;EAUpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;EAuBpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgClC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;EAkBhC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIjC,CAAC;AAOF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;EAIpC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;EAI1C,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;EAIrC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;EAW/B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;EAWjC,CAAC;AAUF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6B1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;EAoBvC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;EAWzC,CAAC;AAWF,eAAO,MAAM,mBAAmB;;;;;;;;;;;EAQ/B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;YAIhC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;EAIhC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAIhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EASjC,CAAC"}
|
|
@@ -41,6 +41,7 @@ export const shellCmdContract = activityContract("shellCmd", z.strictObject({
|
|
|
41
41
|
cmd: z.string(),
|
|
42
42
|
env: z.record(z.string(), z.string()).optional(),
|
|
43
43
|
cwd: z.string().optional(),
|
|
44
|
+
inheritEnv: z.boolean().optional(),
|
|
44
45
|
okExit: z.array(z.number()).optional(),
|
|
45
46
|
gatedExit: z.number().optional(),
|
|
46
47
|
gate: z.strictObject({ op: z.string(), gate: z.string() }).optional(),
|
|
@@ -4,6 +4,12 @@ export interface ShellCmdArgs {
|
|
|
4
4
|
env?: Record<string, string>;
|
|
5
5
|
/** Working directory. Default: process.cwd(). */
|
|
6
6
|
cwd?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the command sees this process's environment. Default true. With
|
|
9
|
+
* false it sees `env` alone, plus the in-flight record's variable, so a job
|
|
10
|
+
* the chant runner runs (`chant ci run`, #4094) gets a clean environment.
|
|
11
|
+
*/
|
|
12
|
+
inheritEnv?: boolean;
|
|
7
13
|
/**
|
|
8
14
|
* Exit codes that count as success. Default `[0]`.
|
|
9
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/op/activities/shell.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAgBD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAuBD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA0DhG"}
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/op/activities/shell.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAgBD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAuBD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA0DhG"}
|
|
@@ -54,7 +54,7 @@ export async function shellCmd(args, signal) {
|
|
|
54
54
|
cwd: args.cwd,
|
|
55
55
|
// In a run that keeps an in-flight record, CHANT_RUN_ACTIVITY names the
|
|
56
56
|
// file the command appends activity lines to (../run-live.ts).
|
|
57
|
-
env: { ...process.env, ...liveRunEnv(), ...args.env },
|
|
57
|
+
env: { ...(args.inheritEnv === false ? {} : process.env), ...liveRunEnv(), ...args.env },
|
|
58
58
|
maxBuffer: MAX_STDOUT_BYTES,
|
|
59
59
|
signal,
|
|
60
60
|
});
|
|
@@ -33,7 +33,7 @@ import { type WaitingPoint } from "./steward-points.js";
|
|
|
33
33
|
import type { OpRunRecord } from "./runtime.js";
|
|
34
34
|
import { type WorkLeaseRunResult } from "./work-lease-run.js";
|
|
35
35
|
import { type RunOrigin } from "../lifecycle/release-ledger.js";
|
|
36
|
-
import { type RunEventRuntime } from "../run-event.js";
|
|
36
|
+
import { type RunEventKind, type RunEventRuntime } from "../run-event.js";
|
|
37
37
|
import type { ActivityContract } from "./activity-contract.js";
|
|
38
38
|
export { parseDuration } from "./duration.js";
|
|
39
39
|
/**
|
|
@@ -268,6 +268,28 @@ export interface RunOpOptions {
|
|
|
268
268
|
runtime?: RunEventRuntime;
|
|
269
269
|
runOrigin?: RunOrigin;
|
|
270
270
|
};
|
|
271
|
+
/**
|
|
272
|
+
* What ran the Op, when a runner says so itself (#4094): `chant ci run`
|
|
273
|
+
* runs a pull-request job as an Op and passes `kind: "pipeline"`,
|
|
274
|
+
* `runtime: "ci"` and `runOrigin: { forge: "chant" }`. The run's events
|
|
275
|
+
* carry all three, kept on this host as well as written to
|
|
276
|
+
* {@link runEvents}, and the run record carries `runOrigin` in place of
|
|
277
|
+
* the CI run the environment names. Omitted, the run is an `op` run named
|
|
278
|
+
* as described on {@link runEvents}.
|
|
279
|
+
*/
|
|
280
|
+
runner?: {
|
|
281
|
+
kind: RunEventKind;
|
|
282
|
+
runtime: RunEventRuntime;
|
|
283
|
+
runOrigin: RunOrigin;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Says why a failed run failed (#4094), given the run's step records once
|
|
287
|
+
* it has settled `fail`. What it returns is stored on the record as
|
|
288
|
+
* `failure`, before the record is signed, and carried on the `run-settle`
|
|
289
|
+
* event. `chant ci run` reads the job's pull-request report here, while
|
|
290
|
+
* the checkout it ran in still exists.
|
|
291
|
+
*/
|
|
292
|
+
describeFailure?: (records: readonly StepRecord[]) => OpRunRecord["failure"];
|
|
271
293
|
/**
|
|
272
294
|
* Append the run's {@link OpRunRecord} to the run ledger
|
|
273
295
|
* (`../lifecycle/run-ledger.ts`) when the run settles (#2118). Opt-in on
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAwC,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQ7F,OAAO,EAAuF,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIlI,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAInG,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAsE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK/H,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAyB,KAAK,eAAe,EAA2B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OA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E,MAAM,CAAC;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACnD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,QAAQ,EAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAkDtB"}
|
|
@@ -1046,7 +1046,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1046
1046
|
const eventsWrite = teeLines(options.runEvents?.write, store?.write.bind(store));
|
|
1047
1047
|
const stream = eventsWrite
|
|
1048
1048
|
? openRunEventStream(runEventRunOf({
|
|
1049
|
-
kind: "op",
|
|
1049
|
+
kind: options.runner?.kind ?? "op",
|
|
1050
1050
|
name: config.name,
|
|
1051
1051
|
runId,
|
|
1052
1052
|
...(commit ? { gitSha: commit } : {}),
|
|
@@ -1054,6 +1054,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1054
1054
|
steward: options.steward !== undefined,
|
|
1055
1055
|
...(options.runEvents?.runtime ? { runtime: options.runEvents.runtime } : {}),
|
|
1056
1056
|
...(options.runEvents?.runOrigin ? { runOrigin: options.runEvents.runOrigin } : {}),
|
|
1057
|
+
...(options.runner ? { runtime: options.runner.runtime, runOrigin: options.runner.runOrigin } : {}),
|
|
1057
1058
|
}), eventsWrite)
|
|
1058
1059
|
: undefined;
|
|
1059
1060
|
events.stream = stream;
|
|
@@ -1178,9 +1179,14 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1178
1179
|
...(options.steward ? { steward: options.steward } : {}),
|
|
1179
1180
|
...(resumed ? { resumed } : {}),
|
|
1180
1181
|
...(commit ? { gitSha: commit } : {}),
|
|
1181
|
-
...(ciRun ? { runOrigin: ciRun.runOrigin } : {}),
|
|
1182
|
+
...(options.runner ? { runOrigin: options.runner.runOrigin } : ciRun ? { runOrigin: ciRun.runOrigin } : {}),
|
|
1182
1183
|
phaseDurations,
|
|
1183
1184
|
});
|
|
1185
|
+
if (status === "fail" && options.describeFailure) {
|
|
1186
|
+
const failure = options.describeFailure(settled);
|
|
1187
|
+
if (failure)
|
|
1188
|
+
input.failure = failure;
|
|
1189
|
+
}
|
|
1184
1190
|
let record = { version: 1, ...input, id: runId };
|
|
1185
1191
|
if (options.signRecord) {
|
|
1186
1192
|
try {
|
|
@@ -1194,7 +1200,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1194
1200
|
}
|
|
1195
1201
|
// The stream settles as the run does, with the first failing step's error.
|
|
1196
1202
|
const firstError = status === "fail" ? settled.find((r) => r.status === "fail")?.error : undefined;
|
|
1197
|
-
stream?.settle(status === "fail" ? "failed" : status, firstError);
|
|
1203
|
+
stream?.settle(status === "fail" ? "failed" : status, firstError, input.failure);
|
|
1198
1204
|
if (!options.ledger)
|
|
1199
1205
|
return record;
|
|
1200
1206
|
try {
|
package/dist/op/runtime.d.ts
CHANGED
|
@@ -211,7 +211,34 @@ export interface OpRunRecord {
|
|
|
211
211
|
sig: string;
|
|
212
212
|
}[];
|
|
213
213
|
};
|
|
214
|
+
/**
|
|
215
|
+
* Why a failed run failed (#4094), for a reader that acts on it without
|
|
216
|
+
* reading the log: a short `code`, a one-line `reason`, the phase that
|
|
217
|
+
* failed and the exit code of the command that failed. `chant ci run`
|
|
218
|
+
* writes it on every failed job, from the job's pull-request report when
|
|
219
|
+
* it wrote one (`not-a-reviewer`, `plan-failed`, `failed` and the other
|
|
220
|
+
* refusals and statuses), else `command-failed`, `setup-failed` or
|
|
221
|
+
* `build-failed`. Optional within contract 1, written by chant
|
|
222
|
+
* {@link OP_RUN_FAILURE_FLOOR} and newer; absent on a run that passed and
|
|
223
|
+
* on a run nothing explained.
|
|
224
|
+
*/
|
|
225
|
+
failure?: OpRunFailureReason;
|
|
226
|
+
}
|
|
227
|
+
/** Why a run failed, on {@link OpRunRecord.failure} and on the run's `run-settle` event (#4094). */
|
|
228
|
+
export interface OpRunFailureReason {
|
|
229
|
+
/** A short code: a pull-request report's refusal or status, or `command-failed`, `setup-failed`, `build-failed`. */
|
|
230
|
+
code: string;
|
|
231
|
+
/** One line a person reads. */
|
|
232
|
+
reason: string;
|
|
233
|
+
/** The phase that failed, when one did. */
|
|
234
|
+
phase?: string;
|
|
235
|
+
/** The exit code of the command that failed, when it exited with one. */
|
|
236
|
+
exitCode?: number;
|
|
214
237
|
}
|
|
238
|
+
/** The first chant that writes {@link OpRunRecord.failure} and `failure` on `run-settle` (#4094). */
|
|
239
|
+
export declare const OP_RUN_FAILURE_FLOOR = "0.124.30";
|
|
240
|
+
/** `value` as an {@link OpRunFailureReason}, or undefined when it is not one, so a reader drops a malformed field and keeps the record. */
|
|
241
|
+
export declare function opRunFailureOf(value: unknown): OpRunFailureReason | undefined;
|
|
215
242
|
/** An {@link OpRunRecord} before the ledger stamps its version and mints an id. */
|
|
216
243
|
export type OpRunRecordInput = Omit<OpRunRecord, "version" | "id"> & {
|
|
217
244
|
id?: string;
|