@intentius/chant 0.124.27 → 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/README.md +1 -1
- package/dist/__golden__/wave-loop/fan-out-gated.json +8 -0
- package/dist/__golden__/wave-loop/fan-out-no-members.json +4 -0
- package/dist/__golden__/wave-loop/fan-out-only.json +6 -0
- package/dist/__golden__/wave-loop/op-by-apply-hold.json +2 -0
- package/dist/__golden__/wave-loop/op-cost-member.json +3 -0
- package/dist/__golden__/wave-loop/op-held-on-before-apply.json +1 -0
- package/dist/__golden__/wave-loop/op-held-on.json +2 -0
- package/dist/__golden__/wave-loop/op-hooks-held.json +2 -0
- package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +2 -0
- package/dist/__golden__/wave-loop/op-hooks-refused-at-base.json +3 -0
- package/dist/__golden__/wave-loop/op-hooks-share.json +3 -0
- package/dist/__golden__/wave-loop/op-per-run.json +7 -0
- package/dist/__golden__/wave-loop/op-pr-review.json +7 -0
- package/dist/__golden__/wave-loop/op-sealed.json +3 -0
- package/dist/__golden__/wave-loop/op-spend.json +3 -0
- package/dist/__golden__/wave-loop/op-wave-commands.json +7 -0
- package/dist/__golden__/wave-loop/op-wide-waiting.json +4 -0
- 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 +63 -0
- package/dist/change-set-graph.d.ts.map +1 -0
- package/dist/change-set-graph.js +130 -0
- package/dist/change-set.d.ts +62 -3
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +36 -4
- package/dist/chant-version.d.ts +9 -0
- package/dist/chant-version.d.ts.map +1 -0
- package/dist/chant-version.js +16 -0
- 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 +8 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +15 -11
- package/dist/cli/commands/check-lexicon-docs.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon-docs.js +30 -2
- package/dist/cli/commands/check-lexicon.d.ts.map +1 -1
- package/dist/cli/commands/check-lexicon.js +13 -2
- package/dist/cli/commands/init-lexicon/templates/docs.d.ts +4 -1
- package/dist/cli/commands/init-lexicon/templates/docs.d.ts.map +1 -1
- package/dist/cli/commands/init-lexicon/templates/docs.js +6 -6
- package/dist/cli/commands/init-lexicon.d.ts.map +1 -1
- package/dist/cli/commands/init-lexicon.js +17 -8
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +64 -4
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +43 -4
- package/dist/cli/handlers/change-set.d.ts +10 -0
- package/dist/cli/handlers/change-set.d.ts.map +1 -1
- package/dist/cli/handlers/change-set.js +51 -1
- package/dist/cli/handlers/fan-out.d.ts +10 -1
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +54 -6
- 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 +16 -2
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +269 -37
- 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 +440 -28
- package/dist/cli/handlers/release.d.ts +91 -0
- package/dist/cli/handlers/release.d.ts.map +1 -0
- package/dist/cli/handlers/release.js +589 -0
- package/dist/cli/handlers/run.d.ts +38 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +234 -16
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +143 -17
- package/dist/cli/mcp/workspace-tools.js +1 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +73 -5
- package/dist/cli/registry.d.ts +43 -5
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cli/run-events.d.ts +30 -0
- package/dist/cli/run-events.d.ts.map +1 -0
- package/dist/cli/run-events.js +49 -0
- package/dist/cli/version.d.ts +3 -5
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +3 -13
- package/dist/codegen/docs-in-site.d.ts +71 -0
- package/dist/codegen/docs-in-site.d.ts.map +1 -0
- package/dist/codegen/docs-in-site.js +177 -0
- package/dist/codegen/docs-types.d.ts +14 -1
- package/dist/codegen/docs-types.d.ts.map +1 -1
- package/dist/codegen/docs.d.ts +18 -1
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/codegen/docs.js +40 -7
- package/dist/codegen/rehype-base-url.mjs +15 -9
- package/dist/components/auto-release.d.ts +6 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +3 -0
- package/dist/components/capability.d.ts +9 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +6 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +10 -9
- package/dist/components/driver.d.ts +50 -9
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +116 -54
- 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 +7 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +85 -26
- 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/pr-run.d.ts +11 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +20 -1
- package/dist/components/promote-order.d.ts +38 -0
- package/dist/components/promote-order.d.ts.map +1 -0
- package/dist/components/promote-order.js +62 -0
- package/dist/components/promote.d.ts +38 -2
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +77 -2
- package/dist/components/release-compile.d.ts +142 -0
- package/dist/components/release-compile.d.ts.map +1 -0
- package/dist/components/release-compile.js +382 -0
- package/dist/components/release-gate.d.ts +135 -0
- package/dist/components/release-gate.d.ts.map +1 -0
- package/dist/components/release-gate.js +288 -0
- package/dist/components/release-promote.d.ts +96 -0
- package/dist/components/release-promote.d.ts.map +1 -0
- package/dist/components/release-promote.js +204 -0
- package/dist/components/run-progress.d.ts +7 -0
- package/dist/components/run-progress.d.ts.map +1 -1
- package/dist/components/wave-plan.d.ts +8 -1
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +11 -3
- package/dist/config.d.ts +45 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -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 +68 -0
- package/dist/lifecycle/change-set-store.d.ts.map +1 -0
- package/dist/lifecycle/change-set-store.js +97 -0
- package/dist/lifecycle/commit-sha.d.ts +13 -0
- package/dist/lifecycle/commit-sha.d.ts.map +1 -0
- package/dist/lifecycle/commit-sha.js +21 -0
- 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 +78 -0
- package/dist/lifecycle/gate-change-set.d.ts.map +1 -0
- package/dist/lifecycle/gate-change-set.js +138 -0
- package/dist/lifecycle/gate-ledger.d.ts +51 -4
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +18 -0
- 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 +154 -0
- package/dist/lifecycle/release-cut.d.ts.map +1 -0
- package/dist/lifecycle/release-cut.js +366 -0
- 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 +54 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +53 -20
- 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 +200 -0
- package/dist/lifecycle/release-store.d.ts.map +1 -0
- package/dist/lifecycle/release-store.js +320 -0
- 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 +4 -0
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +2 -0
- package/dist/op/activities/change-coverage.d.ts.map +1 -1
- package/dist/op/activities/change-coverage.js +4 -2
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +7 -3
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +7 -3
- package/dist/op/gate-name.d.ts +11 -2
- package/dist/op/gate-name.d.ts.map +1 -1
- package/dist/op/gate-name.js +12 -3
- package/dist/op/gate-run-locator.d.ts +22 -0
- package/dist/op/gate-run-locator.d.ts.map +1 -1
- package/dist/op/gate-run-locator.js +31 -0
- package/dist/op/gate.d.ts +27 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +57 -3
- package/dist/op/local-executor.d.ts +36 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +158 -52
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +4 -0
- package/dist/op/run-live.d.ts +2 -0
- package/dist/op/run-live.d.ts.map +1 -1
- package/dist/op/run-live.js +1 -1
- package/dist/op/runtime.d.ts +46 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtimes/local.d.ts.map +1 -1
- package/dist/op/runtimes/local.js +8 -0
- package/dist/plan-summary.d.ts.map +1 -1
- package/dist/plan-summary.js +8 -2
- package/dist/point-decision.d.ts +2 -0
- package/dist/point-decision.d.ts.map +1 -1
- package/dist/point-decision.js +9 -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 +104 -0
- package/dist/run-event-store.d.ts.map +1 -0
- package/dist/run-event-store.js +251 -0
- package/dist/run-event-stream.d.ts +133 -0
- package/dist/run-event-stream.d.ts.map +1 -0
- package/dist/run-event-stream.js +242 -0
- package/dist/run-event.d.ts +285 -0
- package/dist/run-event.d.ts.map +1 -0
- package/dist/run-event.js +209 -0
- package/dist/wave-runtime.mjs +262 -226
- 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/__fixtures__/run-event-check.d.ts +19 -0
- package/dist/workspace/__fixtures__/run-event-check.d.ts.map +1 -0
- package/dist/workspace/__fixtures__/run-event-check.js +59 -0
- package/dist/workspace/change-set-show.d.ts +56 -0
- package/dist/workspace/change-set-show.d.ts.map +1 -0
- package/dist/workspace/change-set-show.js +54 -0
- package/dist/workspace/change-set-show.schema.json +102 -0
- package/dist/workspace/change-set.schema.json +32 -1
- package/dist/workspace/changes-cli.d.ts.map +1 -1
- package/dist/workspace/changes-cli.js +10 -1
- package/dist/workspace/changes.d.ts +37 -0
- package/dist/workspace/changes.d.ts.map +1 -1
- package/dist/workspace/changes.js +49 -2
- package/dist/workspace/changes.schema.json +135 -0
- 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-cli.d.ts +19 -4
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +75 -12
- package/dist/workspace/ci-green-forge.d.ts +20 -3
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green-forge.js +6 -4
- package/dist/workspace/ci-green-workflow.d.ts +11 -0
- package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
- package/dist/workspace/ci-green-workflow.js +6 -0
- package/dist/workspace/ci-green.d.ts +281 -13
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +456 -38
- package/dist/workspace/ci-last-green.schema.json +32 -2
- package/dist/workspace/ci-list.schema.json +525 -0
- package/dist/workspace/commit-links.d.ts +85 -0
- package/dist/workspace/commit-links.d.ts.map +1 -0
- package/dist/workspace/commit-links.js +163 -0
- package/dist/workspace/declaration.d.ts +35 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +27 -1
- package/dist/workspace/declaration.schema.json +76 -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/identity-gate-rule.d.ts +37 -0
- package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
- package/dist/workspace/identity-gate-rule.js +72 -7
- package/dist/workspace/identity.d.ts +12 -0
- package/dist/workspace/identity.d.ts.map +1 -1
- package/dist/workspace/identity.js +13 -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 +36 -7
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +192 -22
- package/dist/workspace/intent.schema.json +702 -6
- package/dist/workspace/ls.d.ts +4 -0
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/ls.js +2 -0
- package/dist/workspace/ls.schema.json +3 -1
- package/dist/workspace/member-pipeline.d.ts +6 -0
- package/dist/workspace/member-pipeline.d.ts.map +1 -1
- package/dist/workspace/member-pipeline.js +6 -0
- 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/promotion-order.d.ts +41 -0
- package/dist/workspace/promotion-order.d.ts.map +1 -0
- package/dist/workspace/promotion-order.js +95 -0
- package/dist/workspace/reason-codes.d.ts +4 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +7 -1
- 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 +81 -0
- package/dist/workspace/releases.d.ts.map +1 -0
- package/dist/workspace/releases.js +103 -0
- package/dist/workspace/releases.schema.json +513 -0
- package/dist/workspace/run-event.schema.json +295 -0
- package/dist/workspace/status-gates.d.ts +34 -1
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/dist/workspace/status-gates.js +31 -2
- package/dist/workspace/status-stewards.d.ts +4 -0
- package/dist/workspace/status-stewards.d.ts.map +1 -1
- package/dist/workspace/status-stewards.js +2 -0
- package/dist/workspace/status.d.ts +117 -0
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/status.js +218 -4
- package/dist/workspace/status.schema.json +268 -2
- package/dist/workspace/trust/ci-tag-statement.d.ts +102 -0
- package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -0
- package/dist/workspace/trust/ci-tag-statement.js +123 -0
- package/dist/workspace/trust/op-run-statement.d.ts +91 -0
- package/dist/workspace/trust/op-run-statement.d.ts.map +1 -0
- package/dist/workspace/trust/op-run-statement.js +143 -0
- package/dist/workspace/trust/rotation.d.ts +18 -2
- package/dist/workspace/trust/rotation.d.ts.map +1 -1
- package/dist/workspace/trust/rotation.js +65 -16
- package/dist/workspace/trust/seal.d.ts +11 -0
- package/dist/workspace/trust/seal.d.ts.map +1 -1
- package/dist/workspace/trust/seal.js +9 -0
- package/dist/workspace/trust/ssh-commit.d.ts.map +1 -1
- package/dist/workspace/trust/ssh-commit.js +10 -10
- package/dist/workspace/wip.d.ts.map +1 -1
- package/dist/workspace/wip.js +11 -3
- package/package.json +1 -1
- package/src/__golden__/wave-loop/fan-out-gated.json +8 -0
- package/src/__golden__/wave-loop/fan-out-no-members.json +4 -0
- package/src/__golden__/wave-loop/fan-out-only.json +6 -0
- package/src/__golden__/wave-loop/op-by-apply-hold.json +2 -0
- package/src/__golden__/wave-loop/op-cost-member.json +3 -0
- package/src/__golden__/wave-loop/op-held-on-before-apply.json +1 -0
- package/src/__golden__/wave-loop/op-held-on.json +2 -0
- package/src/__golden__/wave-loop/op-hooks-held.json +2 -0
- package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +2 -0
- package/src/__golden__/wave-loop/op-hooks-refused-at-base.json +3 -0
- package/src/__golden__/wave-loop/op-hooks-share.json +3 -0
- package/src/__golden__/wave-loop/op-per-run.json +7 -0
- package/src/__golden__/wave-loop/op-pr-review.json +7 -0
- package/src/__golden__/wave-loop/op-sealed.json +3 -0
- package/src/__golden__/wave-loop/op-spend.json +3 -0
- package/src/__golden__/wave-loop/op-wave-commands.json +7 -0
- package/src/__golden__/wave-loop/op-wide-waiting.json +4 -0
- package/src/build-params.test.ts +46 -0
- package/src/build-params.ts +55 -1
- package/src/change-set-graph.test.ts +72 -0
- package/src/change-set-graph.ts +141 -0
- package/src/change-set.ts +87 -6
- package/src/chant-version.ts +16 -0
- package/src/cli/build-params-cli.ts +22 -9
- package/src/cli/commands/build.ts +25 -11
- package/src/cli/commands/check-lexicon-docs.test.ts +51 -0
- package/src/cli/commands/check-lexicon-docs.ts +39 -2
- package/src/cli/commands/check-lexicon.ts +14 -2
- package/src/cli/commands/init-lexicon/templates/docs.ts +7 -6
- package/src/cli/commands/init-lexicon.test.ts +25 -0
- package/src/cli/commands/init-lexicon.ts +18 -8
- package/src/cli/handlers/approve-release.test.ts +84 -0
- package/src/cli/handlers/approve-revoked.test.ts +155 -0
- package/src/cli/handlers/approve.ts +65 -2
- package/src/cli/handlers/build.test.ts +67 -0
- package/src/cli/handlers/build.ts +46 -4
- package/src/cli/handlers/change-set.ts +49 -1
- package/src/cli/handlers/fan-out.test.ts +228 -1
- package/src/cli/handlers/fan-out.ts +53 -6
- 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/operator.test.ts +37 -0
- package/src/cli/handlers/pr.test.ts +341 -0
- package/src/cli/handlers/pr.ts +292 -47
- package/src/cli/handlers/promote.test.ts +669 -7
- package/src/cli/handlers/promote.ts +464 -29
- package/src/cli/handlers/release-implicit.e2e.test.ts +161 -0
- 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 +199 -0
- package/src/cli/handlers/release.ts +593 -0
- package/src/cli/handlers/run-auto-release.test.ts +80 -0
- package/src/cli/handlers/run-events-cmd.test.ts +92 -0
- package/src/cli/handlers/run-release.test.ts +55 -0
- package/src/cli/handlers/run.test.ts +30 -0
- package/src/cli/handlers/run.ts +243 -18
- package/src/cli/main.test.ts +8 -0
- package/src/cli/main.ts +143 -17
- package/src/cli/mcp/never-over-mcp.test.ts +2 -0
- package/src/cli/mcp/workspace-tools.ts +1 -1
- package/src/cli/parse-args.ts +56 -5
- package/src/cli/registry.ts +43 -5
- package/src/cli/run-events.ts +57 -0
- package/src/cli/version.ts +3 -13
- package/src/codegen/docs-in-site.test.ts +166 -0
- package/src/codegen/docs-in-site.ts +182 -0
- package/src/codegen/docs-site/AgentPrompt.astro +26 -1
- package/src/codegen/docs-types.ts +14 -1
- package/src/codegen/docs.ts +60 -7
- package/src/codegen/rehype-base-url.d.mts +3 -1
- package/src/codegen/rehype-base-url.mjs +15 -9
- package/src/codegen/rehype-base-url.test.ts +34 -0
- package/src/components/auto-release.test.ts +30 -0
- package/src/components/auto-release.ts +9 -1
- package/src/components/capability.ts +9 -0
- package/src/components/cli-support.test.ts +82 -0
- package/src/components/cli-support.ts +16 -9
- package/src/components/driver.test.ts +24 -0
- package/src/components/driver.ts +165 -56
- 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 +104 -35
- package/src/components/fan-out.ts +4 -0
- package/src/components/pr-pipeline.ts +35 -4
- package/src/components/pr-run.ts +30 -1
- package/src/components/promote-order.test.ts +90 -0
- package/src/components/promote-order.ts +75 -0
- package/src/components/promote.test.ts +10 -1
- package/src/components/promote.ts +94 -3
- package/src/components/release-compile.test.ts +147 -0
- package/src/components/release-compile.ts +459 -0
- package/src/components/release-gate.test.ts +215 -0
- package/src/components/release-gate.ts +355 -0
- package/src/components/release-promote.test.ts +159 -0
- package/src/components/release-promote.ts +232 -0
- package/src/components/run-progress.ts +7 -0
- package/src/components/wave-plan.ts +16 -3
- package/src/config.ts +15 -1
- package/src/flag-params.test.ts +144 -0
- package/src/flag-params.ts +134 -0
- package/src/index.ts +2 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +351 -0
- package/src/lifecycle/change-set-store.test.ts +217 -0
- package/src/lifecycle/change-set-store.ts +113 -0
- package/src/lifecycle/commit-sha.ts +23 -0
- package/src/lifecycle/delivery-metrics.ts +263 -0
- package/src/lifecycle/deploy-outcome.ts +147 -0
- package/src/lifecycle/gate-change-set.e2e.test.ts +122 -0
- package/src/lifecycle/gate-change-set.ts +164 -0
- package/src/lifecycle/gate-ledger.test.ts +33 -0
- package/src/lifecycle/gate-ledger.ts +68 -3
- 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-signed.test.ts +180 -0
- package/src/lifecycle/release-cut.test.ts +483 -0
- package/src/lifecycle/release-cut.ts +503 -0
- 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.test.ts +14 -0
- package/src/lifecycle/release-ledger.ts +85 -17
- 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 +434 -0
- 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.test.ts +10 -0
- package/src/lifecycle/run-ledger.ts +6 -0
- package/src/op/activities/change-coverage.ts +4 -1
- package/src/op/activities/source-release.ts +8 -3
- package/src/op/activities/source-rollback.ts +8 -4
- package/src/op/commit-run-gate-deploy-join.test.ts +117 -0
- package/src/op/gate-name.ts +13 -3
- package/src/op/gate-release.test.ts +126 -0
- package/src/op/gate-run-locator.test.ts +110 -0
- package/src/op/gate-run-locator.ts +35 -0
- package/src/op/gate.ts +88 -6
- package/src/op/local-executor.ts +207 -52
- package/src/op/op-waves-run.ts +4 -0
- package/src/op/run-events.test.ts +166 -0
- package/src/op/run-live.ts +1 -1
- package/src/op/runtime.ts +39 -0
- package/src/op/runtimes/local.test.ts +16 -0
- package/src/op/runtimes/local.ts +9 -0
- package/src/plan-summary.test.ts +20 -0
- package/src/plan-summary.ts +8 -1
- package/src/point-decision.ts +12 -2
- 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.test.ts +144 -0
- package/src/run-event-store.ts +273 -0
- package/src/run-event-stream.test.ts +175 -0
- package/src/run-event-stream.ts +309 -0
- package/src/run-event.test.ts +277 -0
- package/src/run-event.ts +471 -0
- package/src/wave-loop-golden.test.ts +9 -0
- 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/__fixtures__/run-event-check.ts +58 -0
- package/src/workspace/ancestry-index.test.ts +93 -0
- package/src/workspace/change-set-show.schema.json +102 -0
- package/src/workspace/change-set-show.ts +72 -0
- package/src/workspace/change-set.schema.json +32 -1
- package/src/workspace/changes-cli.ts +10 -1
- package/src/workspace/changes.schema.json +135 -0
- package/src/workspace/changes.test.ts +1 -1
- package/src/workspace/changes.ts +84 -2
- 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-cli.ts +75 -13
- package/src/workspace/ci-green-forge.ts +24 -4
- package/src/workspace/ci-green-runs.test.ts +242 -0
- package/src/workspace/ci-green-signed.test.ts +302 -0
- package/src/workspace/ci-green-workflow.test.ts +16 -0
- package/src/workspace/ci-green-workflow.ts +12 -0
- package/src/workspace/ci-green.test.ts +131 -2
- package/src/workspace/ci-green.ts +635 -42
- package/src/workspace/ci-last-green.schema.json +32 -2
- package/src/workspace/ci-list.schema.json +525 -0
- package/src/workspace/commit-links.test.ts +279 -0
- package/src/workspace/commit-links.ts +183 -0
- package/src/workspace/declaration.schema.json +76 -0
- package/src/workspace/declaration.test.ts +28 -0
- package/src/workspace/declaration.ts +60 -2
- 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/identity-gate-rule.ts +91 -7
- package/src/workspace/identity.ts +14 -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 +196 -26
- package/src/workspace/ls.schema.json +3 -1
- package/src/workspace/ls.ts +6 -0
- package/src/workspace/member-pipeline.test.ts +17 -0
- package/src/workspace/member-pipeline.ts +9 -0
- 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/promotion-order.ts +97 -0
- package/src/workspace/read-contract.e2e.test.ts +5 -1
- package/src/workspace/reason-codes.test.ts +7 -1
- package/src/workspace/reason-codes.ts +7 -1
- 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 +513 -0
- package/src/workspace/releases.test.ts +108 -0
- package/src/workspace/releases.ts +133 -0
- package/src/workspace/run-event.schema.json +295 -0
- package/src/workspace/status-contract.test.ts +81 -1
- package/src/workspace/status-gates.ts +64 -1
- package/src/workspace/status-mixed.test.ts +152 -0
- package/src/workspace/status-revoked.test.ts +153 -0
- package/src/workspace/status-stewards.ts +6 -0
- package/src/workspace/status.schema.json +268 -2
- package/src/workspace/status.ts +334 -4
- package/src/workspace/trust/ci-tag-statement.ts +151 -0
- package/src/workspace/trust/op-run-statement.ts +148 -0
- package/src/workspace/trust/rotation.ts +61 -14
- package/src/workspace/trust/seal.ts +10 -0
- package/src/workspace/trust/ssh-commit.ts +10 -9
- package/src/workspace/wip.ts +11 -2
- package/src/cli/commands/__fixtures__/init-lexicon-output/docs/astro.config.mjs +0 -14
- package/src/cli/commands/__fixtures__/init-lexicon-output/docs/package.json +0 -16
- package/src/cli/commands/__fixtures__/init-lexicon-output/docs/src/content/docs/index.mdx +0 -8
- package/src/cli/commands/__fixtures__/init-lexicon-output/docs/src/content.config.ts +0 -15
- package/src/cli/commands/__fixtures__/init-lexicon-output/docs/tsconfig.json +0 -10
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4031: who may cut a release, and the cut's signature. The declaration's
|
|
3
|
+
* `identity.gates.release` names the class that may cut; a cut is signed
|
|
4
|
+
* with the actor's ssh key over the release digest, label, actor and time,
|
|
5
|
+
* and `release list` and `workspace status` verify it on every read. With
|
|
6
|
+
* `ci.green.signedSince`, a hand-pushed green tag cuts nothing.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { spawnSync } from "node:child_process";
|
|
10
|
+
import { afterAll, describe, expect, test } from "vitest";
|
|
11
|
+
import { cutRelease, ReleaseCutError } from "./release-cut";
|
|
12
|
+
import { readCuts, type ReleaseArtifact } from "./release-store";
|
|
13
|
+
import type { CompiledTarget, TargetCompiler } from "../components/release-compile";
|
|
14
|
+
import { hasSshKeygen, TestRepo, type Key } from "../workspace/trust/test-repo";
|
|
15
|
+
import { releasesDocument } from "../workspace/releases";
|
|
16
|
+
import { workspaceStatus, type StatusDocument } from "../workspace/status";
|
|
17
|
+
import { checkReleaseSignature, type GateAdmissionRule } from "../workspace/identity-gate-rule";
|
|
18
|
+
import { contract } from "../workspace/__fixtures__/contract-repo";
|
|
19
|
+
import releasesSchema from "../workspace/releases.schema.json";
|
|
20
|
+
import statusSchema from "../workspace/status.schema.json";
|
|
21
|
+
import { rmSync } from "node:fs";
|
|
22
|
+
import { dirname } from "node:path";
|
|
23
|
+
|
|
24
|
+
const repos: TestRepo[] = [];
|
|
25
|
+
afterAll(() => {
|
|
26
|
+
for (const r of repos) rmSync(dirname(r.dir), { recursive: true, force: true });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
function compiler(): TargetCompiler {
|
|
30
|
+
return {
|
|
31
|
+
async compile(env): Promise<CompiledTarget> {
|
|
32
|
+
return {
|
|
33
|
+
env,
|
|
34
|
+
params: [],
|
|
35
|
+
components: ["api"],
|
|
36
|
+
buildSteps: { api: [{ kind: "docker-build", context: "api", into: "api.tar" }] },
|
|
37
|
+
buildInputs: { api: ["api"] },
|
|
38
|
+
componentFiles: { api: "api.component.ts" },
|
|
39
|
+
templates: [{ component: "api", path: "dist/api.json", content: `{"env":"${env}"}\n` }],
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
async buildArtifacts(_env, components): Promise<ReleaseArtifact[]> {
|
|
43
|
+
return components.map((c) => ({ component: c, kind: "image" as const, path: `${c}.tar`, digest: `sha256:${"b".repeat(64)}` }));
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** A domain class, `releaser`, from a path pin, granted by the `releaser` role. */
|
|
49
|
+
const PLUGIN = {
|
|
50
|
+
"classes/package.json": JSON.stringify({ name: "@acme/classes", version: "1.0.0", exports: { "./workspace-principals": "./principals.json" } }),
|
|
51
|
+
"classes/principals.json": JSON.stringify({ schema: 1, classes: [{ name: "releaser", description: "people who may cut a release", role: "releaser" }] }),
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A workspace whose root member is a chant project with three environments,
|
|
56
|
+
* signed by alice and bob, with alice holding the releaser role. `extra`
|
|
57
|
+
* goes into the declaration.
|
|
58
|
+
*/
|
|
59
|
+
function setup(extra: Record<string, unknown>): { r: TestRepo; alice: Key; bob: Key; head: string } {
|
|
60
|
+
const r = new TestRepo("release-cut");
|
|
61
|
+
repos.push(r);
|
|
62
|
+
const alice = r.key("alice");
|
|
63
|
+
const bob = r.key("bob");
|
|
64
|
+
r.write("chant.workspace.json", JSON.stringify({ name: "acme", schema: 1, pins: [{ path: "classes" }], members: [{ name: "root", dir: ".", kind: "other", because: "the release fixture" }], ...extra }, null, 2));
|
|
65
|
+
for (const [path, text] of Object.entries(PLUGIN)) r.write(path, text);
|
|
66
|
+
r.write(".chant/allowed_signers", `alice ${alice.pub}\nbob ${bob.pub}\n`);
|
|
67
|
+
r.write(".chant/trust.json", JSON.stringify({ schema: 1, roles: { releaser: ["alice"] } }));
|
|
68
|
+
r.write("chant.config.ts", `export default { environments: ["dev", "prod"] };\n`);
|
|
69
|
+
r.write("api.component.ts", "export const api = {};\n");
|
|
70
|
+
r.write("api/Dockerfile", "FROM scratch\n");
|
|
71
|
+
const head = r.commit("init");
|
|
72
|
+
return { r, alice, bob, head };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const NOW = () => new Date("2026-10-16T10:00:00.000Z");
|
|
76
|
+
const cut = (r: TestRepo, actor: string, sign?: Key, label: string | null = "v1.0.0") =>
|
|
77
|
+
cutRelease({ cwd: r.dir, compiler: compiler(), label, actor, env: {}, now: NOW, ...(sign ? { sign: sign.file } : {}) });
|
|
78
|
+
const code = async (p: Promise<unknown>) => ((await p.catch((e: unknown) => e)) as ReleaseCutError).code;
|
|
79
|
+
const noLedger = (r: TestRepo) => spawnSync("git", ["rev-parse", "--verify", "--quiet", "refs/heads/chant/lifecycle"], { cwd: r.dir }).status !== 0;
|
|
80
|
+
|
|
81
|
+
describe.skipIf(!hasSshKeygen)("who may cut a release (#4031)", () => {
|
|
82
|
+
const RELEASE_GATE = { identity: { gates: { release: { class: "releaser" } } } };
|
|
83
|
+
|
|
84
|
+
test("cutting as someone outside the release gate's class is refused, and nothing is written", async () => {
|
|
85
|
+
const { r, bob } = setup(RELEASE_GATE);
|
|
86
|
+
r.git(["tag", `ci/green/${r.git(["rev-parse", "HEAD"]).trim()}`]);
|
|
87
|
+
const err = await cut(r, "bob", bob).catch((e: unknown) => e);
|
|
88
|
+
expect(err).toBeInstanceOf(ReleaseCutError);
|
|
89
|
+
expect((err as ReleaseCutError).code).toBe("release-signer-refused");
|
|
90
|
+
expect((err as ReleaseCutError).message).toMatch(/bob is not in the class releaser that gate release needs/);
|
|
91
|
+
expect(noLedger(r)).toBe(true);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("an unsigned cut, or one signed with another signer's key, is refused under the gate", async () => {
|
|
95
|
+
const { r, alice, bob } = setup(RELEASE_GATE);
|
|
96
|
+
r.git(["tag", `ci/green/${r.git(["rev-parse", "HEAD"]).trim()}`]);
|
|
97
|
+
expect(await code(cut(r, "alice"))).toBe("release-unsigned");
|
|
98
|
+
const forged = await cut(r, "alice", bob).catch((e: unknown) => e);
|
|
99
|
+
expect((forged as ReleaseCutError).code).toBe("release-signer-refused");
|
|
100
|
+
expect((forged as ReleaseCutError).message).toMatch(/does not verify for alice/);
|
|
101
|
+
expect(noLedger(r)).toBe(true);
|
|
102
|
+
expect(alice.name).toBe("alice");
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
test("a cut by a releaser carries a signature that release list and workspace status verify", async () => {
|
|
106
|
+
const { r, alice } = setup(RELEASE_GATE);
|
|
107
|
+
const head = r.git(["rev-parse", "HEAD"]).trim();
|
|
108
|
+
r.git(["tag", `ci/green/${head}`]);
|
|
109
|
+
const result = await cut(r, "alice", alice);
|
|
110
|
+
expect(result.cut?.signature).toMatch(/^-----BEGIN SSH SIGNATURE-----/);
|
|
111
|
+
const { cuts } = await readCuts({ cwd: r.dir });
|
|
112
|
+
expect(cuts).toHaveLength(1);
|
|
113
|
+
expect(cuts[0]).toMatchObject({ label: "v1.0.0", actor: "alice", signature: result.cut!.signature });
|
|
114
|
+
|
|
115
|
+
const list = await releasesDocument({ cwd: r.dir });
|
|
116
|
+
contract(releasesSchema).expectValid(list);
|
|
117
|
+
const entry = (list as Extract<typeof list, { releases: unknown }>).releases[0];
|
|
118
|
+
expect(entry.cuts[0].signatureCheck).toMatchObject({ status: "verified", key: expect.stringMatching(/^SHA256:/), reason: "signed by alice, in the class releaser" });
|
|
119
|
+
|
|
120
|
+
const status = (await workspaceStatus({ cwd: r.dir, env: "dev" })) as Extract<StatusDocument, { members: unknown }>;
|
|
121
|
+
contract(statusSchema).expectValid(status);
|
|
122
|
+
expect(status.members[0].releaseCuts).toEqual([
|
|
123
|
+
{
|
|
124
|
+
releaseDigest: result.release.releaseDigest,
|
|
125
|
+
label: "v1.0.0",
|
|
126
|
+
commit: head,
|
|
127
|
+
actor: "alice",
|
|
128
|
+
timestamp: "2026-10-16T10:00:00.000Z",
|
|
129
|
+
signature: result.cut!.signature,
|
|
130
|
+
signatureCheck: { status: "verified", key: entry.cuts[0].signatureCheck.key, reason: "signed by alice, in the class releaser" },
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
// A cut line edited after the fact no longer verifies: the label is signed.
|
|
135
|
+
const rule: GateAdmissionRule = { gate: "release", class: null, signers: { signersPath: ".chant/allowed_signers", active: true, signers: [{ principal: "alice", key: alice.pub, line: 1 }] }, roles: {}, classes: [] };
|
|
136
|
+
expect(checkReleaseSignature(rule, { ...cuts[0] }).status).toBe("verified");
|
|
137
|
+
expect(checkReleaseSignature(rule, { ...cuts[0], label: "v9.9.9" })).toMatchObject({ status: "unverified", reason: expect.stringMatching(/does not verify for alice/) });
|
|
138
|
+
expect(checkReleaseSignature(rule, { ...cuts[0], signature: null }).status).toBe("unsigned");
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("without a release gate a cut may be unsigned, and a signed one is still verified on read", async () => {
|
|
142
|
+
const { r, bob } = setup({});
|
|
143
|
+
r.git(["tag", `ci/green/${r.git(["rev-parse", "HEAD"]).trim()}`]);
|
|
144
|
+
const plain = await cut(r, "carol", undefined, "v1");
|
|
145
|
+
expect(plain.cut?.signature).toBeNull();
|
|
146
|
+
r.write("README.md", "next\n");
|
|
147
|
+
const next = r.commit("next");
|
|
148
|
+
r.git(["tag", `ci/green/${next}`]);
|
|
149
|
+
const signed = await cut(r, "bob", bob, "v2");
|
|
150
|
+
expect(signed.cut?.signature).toMatch(/BEGIN SSH SIGNATURE/);
|
|
151
|
+
const list = (await releasesDocument({ cwd: r.dir })) as Extract<Awaited<ReturnType<typeof releasesDocument>>, { releases: unknown }>;
|
|
152
|
+
// Both cuts share one time, so the list's order between them is the digests'.
|
|
153
|
+
expect(list.releases.map((x) => [x.label, x.cuts[0].signatureCheck.status]).sort()).toEqual([
|
|
154
|
+
["v1", "unsigned"],
|
|
155
|
+
["v2", "verified"],
|
|
156
|
+
]);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test("with ci.green.signedSince, a hand-pushed green tag cuts nothing", async () => {
|
|
160
|
+
const green = { branch: "main", phases: { test: ["test"] }, require: ["test"] };
|
|
161
|
+
const { r, alice, head: pivot } = setup({ ...RELEASE_GATE, ci: { green } });
|
|
162
|
+
// Tags on commits from the pivot on need a statement; the declaration says so in the next commit.
|
|
163
|
+
const decl = JSON.parse(r.git(["show", "HEAD:chant.workspace.json"]));
|
|
164
|
+
r.write("chant.workspace.json", JSON.stringify({ ...decl, ci: { green: { ...green, signedSince: pivot } } }, null, 2));
|
|
165
|
+
const head = r.commit("require signed ci tags");
|
|
166
|
+
r.git(["tag", "-a", "-m", "ci: by hand", `ci/green/${head}`, head]);
|
|
167
|
+
const err = await cut(r, "alice", alice).catch((e: unknown) => e);
|
|
168
|
+
expect((err as ReleaseCutError).code).toBe("release-commit-not-green");
|
|
169
|
+
expect((err as ReleaseCutError).message).toMatch(/no ci\/green tag that counts.*ignored: ci\/green\/[0-9a-f]+ \(unsigned\)/);
|
|
170
|
+
expect(noLedger(r)).toBe(true);
|
|
171
|
+
|
|
172
|
+
// A signedSince that names no commit here refuses the cut.
|
|
173
|
+
r.write("chant.workspace.json", JSON.stringify({ ...decl, ci: { green: { ...green, signedSince: "f".repeat(40) } } }, null, 2));
|
|
174
|
+
const broken = r.commit("a signedSince from another clone");
|
|
175
|
+
r.git(["tag", `ci/green/${broken}`, broken]);
|
|
176
|
+
const refused = await cut(r, "alice", alice).catch((e: unknown) => e);
|
|
177
|
+
expect((refused as ReleaseCutError).code).toBe("declaration-invalid");
|
|
178
|
+
expect(noLedger(r)).toBe(true);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The release cut from a green commit (#4026, ws-104), against temp git repos
|
|
3
|
+
* and a compiler that hands back fixtures.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, test, expect } from "vitest";
|
|
7
|
+
import { withTestDir } from "@intentius/chant-test-utils";
|
|
8
|
+
import { spawnSync } from "node:child_process";
|
|
9
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
import { cutRelease, differingBuildSteps, planRelease, ReleaseCutError } from "./release-cut";
|
|
12
|
+
import {
|
|
13
|
+
appendCut,
|
|
14
|
+
computeReleaseDigest,
|
|
15
|
+
makeRelease,
|
|
16
|
+
persistRelease,
|
|
17
|
+
readAllReleases,
|
|
18
|
+
readCuts,
|
|
19
|
+
readRelease,
|
|
20
|
+
readReleaseTemplate,
|
|
21
|
+
ReleaseLabelError,
|
|
22
|
+
resolveRelease,
|
|
23
|
+
verifyReleaseDigest,
|
|
24
|
+
type ReleaseArtifact,
|
|
25
|
+
} from "./release-store";
|
|
26
|
+
import { readBlobFromPath, writeLedgerFiles } from "./git";
|
|
27
|
+
import { contentDigest } from "../content-digest";
|
|
28
|
+
import type { CompiledTarget, TargetCompiler } from "../components/release-compile";
|
|
29
|
+
import { isImplicitRelease } from "../components/release-promote";
|
|
30
|
+
import { releasesDocument } from "../workspace/releases";
|
|
31
|
+
|
|
32
|
+
function git(dir: string, ...args: string[]): string {
|
|
33
|
+
const r = spawnSync("git", args, { cwd: dir, encoding: "utf-8" });
|
|
34
|
+
if (r.status !== 0) throw new Error(`git ${args.join(" ")}: ${r.stderr}`);
|
|
35
|
+
return r.stdout.trim();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function initRepo(dir: string): string {
|
|
39
|
+
git(dir, "init", "-q", "-b", "main");
|
|
40
|
+
git(dir, "config", "user.email", "test@chant.dev");
|
|
41
|
+
git(dir, "config", "user.name", "Test");
|
|
42
|
+
writeFileSync(join(dir, "chant.config.ts"), `export default { environments: ["dev", "staging", "prod"] };\n`);
|
|
43
|
+
mkdirSync(join(dir, "api"), { recursive: true });
|
|
44
|
+
writeFileSync(join(dir, "api", "Dockerfile"), "FROM scratch\n");
|
|
45
|
+
writeFileSync(join(dir, "api.component.ts"), "export const api = {};\n");
|
|
46
|
+
writeFileSync(join(dir, "README.md"), "fixture\n");
|
|
47
|
+
git(dir, "add", ".");
|
|
48
|
+
git(dir, "commit", "-q", "-m", "init");
|
|
49
|
+
return git(dir, "rev-parse", "HEAD");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function commitFile(dir: string, file: string, content: string): string {
|
|
53
|
+
writeFileSync(join(dir, file), content);
|
|
54
|
+
git(dir, "add", ".");
|
|
55
|
+
git(dir, "commit", "-q", "-m", `change ${file}`);
|
|
56
|
+
return git(dir, "rev-parse", "HEAD");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const green = (dir: string, sha: string) => git(dir, "tag", `ci/green/${sha}`, sha);
|
|
60
|
+
const revoke = (dir: string, sha: string) => git(dir, "tag", `ci/revoked/${sha}`, sha);
|
|
61
|
+
|
|
62
|
+
/** A compiler that compiles each environment to its own template and builds one image. */
|
|
63
|
+
function fixtureCompiler(opts: { buildArgs?: (env: string) => string; imageDigest?: string } = {}): TargetCompiler & { built: string[][]; compiled: string[] } {
|
|
64
|
+
const built: string[][] = [];
|
|
65
|
+
const compiled: string[] = [];
|
|
66
|
+
return {
|
|
67
|
+
built,
|
|
68
|
+
compiled,
|
|
69
|
+
async compile(env): Promise<CompiledTarget> {
|
|
70
|
+
compiled.push(env);
|
|
71
|
+
return {
|
|
72
|
+
env,
|
|
73
|
+
params: [
|
|
74
|
+
{ name: "tier", value: env === "prod" ? "large" : "small", source: "default" },
|
|
75
|
+
{ name: "region", value: "eu", source: "env" },
|
|
76
|
+
],
|
|
77
|
+
components: ["api"],
|
|
78
|
+
buildSteps: { api: [{ kind: "docker-build", context: "api", into: "api.tar", buildArgs: { ENV: opts.buildArgs?.(env) ?? "same" } }] },
|
|
79
|
+
buildInputs: { api: ["api", "api/Dockerfile"] },
|
|
80
|
+
componentFiles: { api: "api.component.ts" },
|
|
81
|
+
templates: [{ component: "api", path: "dist/api.template.json", content: `{"env":"${env}"}\n` }],
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
async buildArtifacts(env, components): Promise<ReleaseArtifact[]> {
|
|
85
|
+
built.push([env, ...components]);
|
|
86
|
+
return components.map((c) => ({ component: c, kind: "image" as const, path: `${c}.tar`, digest: opts.imageDigest ?? `sha256:${"a".repeat(64)}` }));
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const cut = (dir: string, compiler: TargetCompiler, label: string | null, actor = "alice") =>
|
|
92
|
+
cutRelease({ cwd: dir, compiler, label, actor, env: {}, now: () => new Date("2026-10-16T10:00:00.000Z") });
|
|
93
|
+
|
|
94
|
+
describe("the release digest", () => {
|
|
95
|
+
const subject = {
|
|
96
|
+
member: null,
|
|
97
|
+
commit: "c".repeat(40),
|
|
98
|
+
artifactDigests: [{ component: "api", kind: "image" as const, path: "api.tar", digest: "sha256:1" }],
|
|
99
|
+
targets: [{ env: "dev", templates: [{ component: "api", path: "t.json", digest: "sha256:2" }], params: [{ name: "tier", value: "small", source: "default" }] }],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
test("is a jcs1 plan digest of kind release, unchanged by list order and by a param's source", () => {
|
|
103
|
+
const digest = computeReleaseDigest(subject);
|
|
104
|
+
expect(digest).toMatch(/^jcs1-sha256:[0-9a-f]{64}$/);
|
|
105
|
+
const reordered = { ...subject, targets: [{ ...subject.targets[0], params: [{ name: "tier", value: "small", source: "cli" }] }] };
|
|
106
|
+
expect(computeReleaseDigest(reordered)).toBe(digest);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("changes with a param's value, a template's digest, the commit or the member", () => {
|
|
110
|
+
const digest = computeReleaseDigest(subject);
|
|
111
|
+
expect(computeReleaseDigest({ ...subject, targets: [{ ...subject.targets[0], params: [{ name: "tier", value: "large", source: "default" }] }] })).not.toBe(digest);
|
|
112
|
+
expect(computeReleaseDigest({ ...subject, targets: [{ ...subject.targets[0], templates: [{ component: "api", path: "t.json", digest: "sha256:3" }] }] })).not.toBe(digest);
|
|
113
|
+
expect(computeReleaseDigest({ ...subject, commit: "d".repeat(40) })).not.toBe(digest);
|
|
114
|
+
expect(computeReleaseDigest({ ...subject, member: "api" })).not.toBe(digest);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test("verifyReleaseDigest catches a release whose content no longer matches its digest", () => {
|
|
118
|
+
const release = makeRelease(subject);
|
|
119
|
+
expect(verifyReleaseDigest(release)).toBe(true);
|
|
120
|
+
expect(verifyReleaseDigest({ ...release, commit: "e".repeat(40) })).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
describe("cutRelease", () => {
|
|
125
|
+
test("cuts a release from a green commit and stores it apart from the deploy records", async () => {
|
|
126
|
+
await withTestDir(async (dir) => {
|
|
127
|
+
const sha = initRepo(dir);
|
|
128
|
+
green(dir, sha);
|
|
129
|
+
const compiler = fixtureCompiler();
|
|
130
|
+
const result = await cut(dir, compiler, "v1.0.0");
|
|
131
|
+
|
|
132
|
+
expect(compiler.compiled).toEqual(["dev", "staging", "prod"]);
|
|
133
|
+
expect(compiler.built).toEqual([["dev", "api"]]);
|
|
134
|
+
expect(result.label).toBe("v1.0.0");
|
|
135
|
+
expect(result.stored).toBe(true);
|
|
136
|
+
const { release } = result;
|
|
137
|
+
expect(release).toMatchObject({ version: 1, member: null, commit: sha });
|
|
138
|
+
expect(release.artifactDigests).toEqual([{ component: "api", kind: "image", path: "api.tar", digest: `sha256:${"a".repeat(64)}` }]);
|
|
139
|
+
expect(release.targets.map((t) => t.env)).toEqual(["dev", "prod", "staging"]);
|
|
140
|
+
const prod = release.targets.find((t) => t.env === "prod")!;
|
|
141
|
+
expect(prod.templates).toEqual([{ component: "api", path: "dist/api.template.json", digest: contentDigest(`{"env":"prod"}\n`) }]);
|
|
142
|
+
expect(prod.params).toEqual([
|
|
143
|
+
{ name: "region", value: "eu", source: "env" },
|
|
144
|
+
{ name: "tier", value: "large", source: "default" },
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
// Stored under _releases/, never in a releases.jsonl.
|
|
148
|
+
expect(await readRelease(release.releaseDigest, { cwd: dir })).toEqual(release);
|
|
149
|
+
expect(await readReleaseTemplate(prod.templates[0].digest, { cwd: dir })).toBe(`{"env":"prod"}\n`);
|
|
150
|
+
const { cuts } = await readCuts({ cwd: dir });
|
|
151
|
+
expect(cuts).toEqual([
|
|
152
|
+
{
|
|
153
|
+
version: 1,
|
|
154
|
+
releaseDigest: release.releaseDigest,
|
|
155
|
+
label: "v1.0.0",
|
|
156
|
+
actor: "alice",
|
|
157
|
+
timestamp: "2026-10-16T10:00:00.000Z",
|
|
158
|
+
runId: `local-${Date.parse("2026-10-16T10:00:00.000Z")}`,
|
|
159
|
+
runOrigin: { forge: "local" },
|
|
160
|
+
signature: null,
|
|
161
|
+
},
|
|
162
|
+
]);
|
|
163
|
+
expect(git(dir, "ls-tree", "-r", "--name-only", "chant/lifecycle").split("\n").filter((p) => p.endsWith("releases.jsonl"))).toEqual([]);
|
|
164
|
+
expect(await resolveRelease("v1.0.0", { cwd: dir })).toEqual({ release, label: "v1.0.0" });
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test("refuses a commit that isn't green, and writes nothing", async () => {
|
|
169
|
+
await withTestDir(async (dir) => {
|
|
170
|
+
initRepo(dir);
|
|
171
|
+
const compiler = fixtureCompiler();
|
|
172
|
+
const err = await cut(dir, compiler, "v1").catch((e: unknown) => e);
|
|
173
|
+
expect(err).toBeInstanceOf(ReleaseCutError);
|
|
174
|
+
expect((err as ReleaseCutError).code).toBe("release-commit-not-green");
|
|
175
|
+
expect(compiler.compiled).toEqual([]);
|
|
176
|
+
expect(spawnSync("git", ["rev-parse", "--verify", "--quiet", "refs/heads/chant/lifecycle"], { cwd: dir }).status).not.toBe(0);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test("refuses a green commit that was revoked", async () => {
|
|
181
|
+
await withTestDir(async (dir) => {
|
|
182
|
+
const sha = initRepo(dir);
|
|
183
|
+
green(dir, sha);
|
|
184
|
+
revoke(dir, sha);
|
|
185
|
+
const err = await cut(dir, fixtureCompiler(), "v1").catch((e: unknown) => e);
|
|
186
|
+
expect((err as ReleaseCutError).code).toBe("release-commit-revoked");
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
test("refuses a working tree with uncommitted changes to tracked files", async () => {
|
|
191
|
+
await withTestDir(async (dir) => {
|
|
192
|
+
const sha = initRepo(dir);
|
|
193
|
+
green(dir, sha);
|
|
194
|
+
writeFileSync(join(dir, "README.md"), "edited\n");
|
|
195
|
+
const err = await cut(dir, fixtureCompiler(), "v1").catch((e: unknown) => e);
|
|
196
|
+
expect((err as ReleaseCutError).code).toBe("release-worktree-dirty");
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test("two cuts of one commit give the same releaseDigest; the second is a no-op that keeps the label", async () => {
|
|
201
|
+
await withTestDir(async (dir) => {
|
|
202
|
+
const sha = initRepo(dir);
|
|
203
|
+
green(dir, sha);
|
|
204
|
+
const first = await cut(dir, fixtureCompiler(), "v1.0.0", "alice");
|
|
205
|
+
const second = await cutRelease({ cwd: dir, compiler: fixtureCompiler(), label: null, actor: "bob", env: { GITHUB_RUN_ID: "9" }, now: () => new Date("2026-10-17T00:00:00.000Z") });
|
|
206
|
+
expect(second.release.releaseDigest).toBe(first.release.releaseDigest);
|
|
207
|
+
expect(second.cut).toBeNull();
|
|
208
|
+
expect(second.label).toBe("v1.0.0");
|
|
209
|
+
expect(second.stored).toBe(false);
|
|
210
|
+
expect((await readCuts({ cwd: dir })).cuts).toHaveLength(1);
|
|
211
|
+
|
|
212
|
+
// The same digest under another label is refused.
|
|
213
|
+
const err = await cut(dir, fixtureCompiler(), "v2.0.0").catch((e: unknown) => e);
|
|
214
|
+
expect(err).toBeInstanceOf(ReleaseLabelError);
|
|
215
|
+
expect((err as ReleaseLabelError).code).toBe("release-already-labelled");
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("a label names one digest: a second release under a taken label is refused", async () => {
|
|
220
|
+
await withTestDir(async (dir) => {
|
|
221
|
+
const first = initRepo(dir);
|
|
222
|
+
green(dir, first);
|
|
223
|
+
await cut(dir, fixtureCompiler(), "v1");
|
|
224
|
+
const second = commitFile(dir, "api/main.go", "package main\n");
|
|
225
|
+
green(dir, second);
|
|
226
|
+
const err = await cut(dir, fixtureCompiler({ imageDigest: `sha256:${"b".repeat(64)}` }), "v1").catch((e: unknown) => e);
|
|
227
|
+
expect((err as ReleaseLabelError).code).toBe("release-label-taken");
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test("refuses a component whose build steps differ between environments, before anything is built", async () => {
|
|
232
|
+
await withTestDir(async (dir) => {
|
|
233
|
+
const sha = initRepo(dir);
|
|
234
|
+
green(dir, sha);
|
|
235
|
+
const compiler = fixtureCompiler({ buildArgs: (env) => env });
|
|
236
|
+
const err = await cut(dir, compiler, "v1").catch((e: unknown) => e);
|
|
237
|
+
expect((err as ReleaseCutError).code).toBe("release-build-inputs-differ");
|
|
238
|
+
expect((err as Error).message).toMatch(/"api"/);
|
|
239
|
+
expect(compiler.built).toEqual([]);
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("a config-only commit gets a release of its own that carries the previous artifact digests", async () => {
|
|
244
|
+
await withTestDir(async (dir) => {
|
|
245
|
+
const first = initRepo(dir);
|
|
246
|
+
green(dir, first);
|
|
247
|
+
const r1 = await cut(dir, fixtureCompiler(), "v1");
|
|
248
|
+
|
|
249
|
+
const second = commitFile(dir, "flags.json", `{"newCheckout":true}\n`);
|
|
250
|
+
green(dir, second);
|
|
251
|
+
// A rebuild would give another digest; the source did not change, so nothing is rebuilt.
|
|
252
|
+
const compiler = fixtureCompiler({ imageDigest: `sha256:${"f".repeat(64)}` });
|
|
253
|
+
const r2 = await cut(dir, compiler, "v2");
|
|
254
|
+
expect(compiler.built).toEqual([]);
|
|
255
|
+
expect(r2.reused).toEqual([{ component: "api", from: r1.release.releaseDigest }]);
|
|
256
|
+
expect(r2.release.artifactDigests).toEqual(r1.release.artifactDigests);
|
|
257
|
+
expect(r2.release.releaseDigest).not.toBe(r1.release.releaseDigest);
|
|
258
|
+
|
|
259
|
+
// A change under the build context is built again.
|
|
260
|
+
const third = commitFile(dir, "api/main.go", "package main\n");
|
|
261
|
+
green(dir, third);
|
|
262
|
+
const rebuilt = fixtureCompiler({ imageDigest: `sha256:${"f".repeat(64)}` });
|
|
263
|
+
const r3 = await cut(dir, rebuilt, "v3");
|
|
264
|
+
expect(rebuilt.built).toEqual([["dev", "api"]]);
|
|
265
|
+
expect(r3.release.artifactDigests[0].digest).toBe(`sha256:${"f".repeat(64)}`);
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test("refuses a member that declares no environments", async () => {
|
|
270
|
+
await withTestDir(async (dir) => {
|
|
271
|
+
const sha = initRepo(dir);
|
|
272
|
+
green(dir, sha);
|
|
273
|
+
const err = await cutRelease({ cwd: dir, compiler: fixtureCompiler(), label: null, actor: "a", environments: [], env: {} }).catch((e: unknown) => e);
|
|
274
|
+
expect((err as ReleaseCutError).code).toBe("release-no-environments");
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
/** A project with no components (#4046): each environment compiles to the files its build writes, with no component. */
|
|
280
|
+
function implicitCompiler(): TargetCompiler & { built: string[][] } {
|
|
281
|
+
const built: string[][] = [];
|
|
282
|
+
return {
|
|
283
|
+
built,
|
|
284
|
+
async compile(env): Promise<CompiledTarget> {
|
|
285
|
+
return {
|
|
286
|
+
env,
|
|
287
|
+
params: [{ name: "replicas", value: env === "prod" ? 3 : 1, source: "params-file" }],
|
|
288
|
+
components: [],
|
|
289
|
+
buildSteps: {},
|
|
290
|
+
buildInputs: {},
|
|
291
|
+
componentFiles: {},
|
|
292
|
+
templates: [
|
|
293
|
+
{ component: null, path: "dist/build.yaml", content: `replicas: ${env === "prod" ? 3 : 1}\n` },
|
|
294
|
+
{ component: null, path: "dist/ops/deploy/op.json", content: `{"name":"deploy"}\n` },
|
|
295
|
+
],
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
async buildArtifacts(env, components): Promise<ReleaseArtifact[]> {
|
|
299
|
+
built.push([env, ...components]);
|
|
300
|
+
return [];
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
describe("an implicit release, of a project with no components (#4046)", () => {
|
|
306
|
+
function initPlainRepo(dir: string): string {
|
|
307
|
+
git(dir, "init", "-q", "-b", "main");
|
|
308
|
+
git(dir, "config", "user.email", "test@chant.dev");
|
|
309
|
+
git(dir, "config", "user.name", "Test");
|
|
310
|
+
writeFileSync(join(dir, "chant.config.ts"), `export default { environments: ["dev", "prod"] };\n`);
|
|
311
|
+
git(dir, "add", ".");
|
|
312
|
+
git(dir, "commit", "-q", "-m", "init");
|
|
313
|
+
return git(dir, "rev-parse", "HEAD");
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
test("is cut with no artifacts and a target per environment holding the build output, and lists like any release", async () => {
|
|
317
|
+
await withTestDir(async (dir) => {
|
|
318
|
+
const sha = initPlainRepo(dir);
|
|
319
|
+
green(dir, sha);
|
|
320
|
+
const compiler = implicitCompiler();
|
|
321
|
+
const result = await cut(dir, compiler, "v1");
|
|
322
|
+
expect(compiler.built).toEqual([]);
|
|
323
|
+
const { release } = result;
|
|
324
|
+
expect(release.artifactDigests).toEqual([]);
|
|
325
|
+
expect(release.targets).toEqual([
|
|
326
|
+
{
|
|
327
|
+
env: "dev",
|
|
328
|
+
templates: [
|
|
329
|
+
{ component: null, path: "dist/build.yaml", digest: contentDigest("replicas: 1\n") },
|
|
330
|
+
{ component: null, path: "dist/ops/deploy/op.json", digest: contentDigest(`{"name":"deploy"}\n`) },
|
|
331
|
+
],
|
|
332
|
+
params: [{ name: "replicas", value: 1, source: "params-file" }],
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
env: "prod",
|
|
336
|
+
templates: [
|
|
337
|
+
{ component: null, path: "dist/build.yaml", digest: contentDigest("replicas: 3\n") },
|
|
338
|
+
{ component: null, path: "dist/ops/deploy/op.json", digest: contentDigest(`{"name":"deploy"}\n`) },
|
|
339
|
+
],
|
|
340
|
+
params: [{ name: "replicas", value: 3, source: "params-file" }],
|
|
341
|
+
},
|
|
342
|
+
]);
|
|
343
|
+
expect(await readReleaseTemplate(contentDigest("replicas: 3\n"), { cwd: dir })).toBe("replicas: 3\n");
|
|
344
|
+
expect(isImplicitRelease(release)).toBe(true);
|
|
345
|
+
|
|
346
|
+
// A second cut of the commit is the same release.
|
|
347
|
+
const again = await cut(dir, implicitCompiler(), null, "bob");
|
|
348
|
+
expect(again.release.releaseDigest).toBe(release.releaseDigest);
|
|
349
|
+
expect(again.cut).toBeNull();
|
|
350
|
+
|
|
351
|
+
const doc = await releasesDocument({ cwd: dir });
|
|
352
|
+
if ("error" in doc) throw new Error(doc.error.message);
|
|
353
|
+
expect(doc.releases).toHaveLength(1);
|
|
354
|
+
expect(doc.releases[0]).toMatchObject({ releaseDigest: release.releaseDigest, label: "v1", artifactDigests: [], environments: [] });
|
|
355
|
+
expect(doc.releases[0].targets[1].templates[0]).toEqual({ component: null, path: "dist/build.yaml", digest: contentDigest("replicas: 3\n") });
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
test("is still refused when components are declared but none is enabled and nothing was compiled", async () => {
|
|
360
|
+
await withTestDir(async (dir) => {
|
|
361
|
+
const sha = initPlainRepo(dir);
|
|
362
|
+
green(dir, sha);
|
|
363
|
+
const empty: TargetCompiler = {
|
|
364
|
+
async compile(env) {
|
|
365
|
+
return { env, params: [], components: [], buildSteps: {}, buildInputs: {}, componentFiles: {}, templates: [] };
|
|
366
|
+
},
|
|
367
|
+
async buildArtifacts() {
|
|
368
|
+
return [];
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
const err = await cut(dir, empty, "v1").catch((e: unknown) => e);
|
|
372
|
+
expect((err as ReleaseCutError).code).toBe("release-no-components");
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
describe("the release store", () => {
|
|
378
|
+
test("a release is written once and never rewritten", async () => {
|
|
379
|
+
await withTestDir(async (dir) => {
|
|
380
|
+
initRepo(dir);
|
|
381
|
+
const release = makeRelease({ member: null, commit: "c".repeat(40), artifactDigests: [], targets: [{ env: "dev", templates: [], params: [] }] });
|
|
382
|
+
expect((await persistRelease(release, [], { cwd: dir })).written).toBe(true);
|
|
383
|
+
const tip = git(dir, "rev-parse", "chant/lifecycle");
|
|
384
|
+
expect((await persistRelease(release, [], { cwd: dir })).written).toBe(false);
|
|
385
|
+
expect(git(dir, "rev-parse", "chant/lifecycle")).toBe(tip);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
test("a stored release whose content does not hash to its digest is not read, and counts as malformed", async () => {
|
|
390
|
+
await withTestDir(async (dir) => {
|
|
391
|
+
initRepo(dir);
|
|
392
|
+
const release = makeRelease({ member: null, commit: "c".repeat(40), artifactDigests: [], targets: [{ env: "dev", templates: [], params: [] }] });
|
|
393
|
+
await persistRelease(release, [], { cwd: dir });
|
|
394
|
+
const name = `${release.releaseDigest.replace(/:/g, "_")}.json`;
|
|
395
|
+
const stored = (await readBlobFromPath("_releases", name, { cwd: dir }))!;
|
|
396
|
+
await writeLedgerFiles([{ path: `_releases/${name}`, content: stored.replace("c".repeat(40), "d".repeat(40)) }], "tamper", { cwd: dir });
|
|
397
|
+
expect(await readRelease(release.releaseDigest, { cwd: dir })).toBeNull();
|
|
398
|
+
expect(await readAllReleases({ cwd: dir })).toEqual({ releases: [], malformed: 1 });
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
test("an unlabelled cut can be labelled once; an invalid label is refused", async () => {
|
|
403
|
+
await withTestDir(async (dir) => {
|
|
404
|
+
initRepo(dir);
|
|
405
|
+
const base = { releaseDigest: `jcs1-sha256:${"1".repeat(64)}`, actor: "a", timestamp: "2026-10-16T00:00:00.000Z", runOrigin: null };
|
|
406
|
+
expect(await appendCut({ ...base, label: null }, { cwd: dir })).toMatchObject({ appended: true });
|
|
407
|
+
expect(await appendCut({ ...base, label: null }, { cwd: dir })).toEqual({ appended: false, label: null });
|
|
408
|
+
expect(await appendCut({ ...base, label: "v1" }, { cwd: dir })).toMatchObject({ appended: true });
|
|
409
|
+
expect(await appendCut({ ...base, label: "v1" }, { cwd: dir })).toEqual({ appended: false, label: "v1" });
|
|
410
|
+
await expect(appendCut({ ...base, label: "has space" }, { cwd: dir })).rejects.toMatchObject({ code: "release-label-invalid" });
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
describe("differingBuildSteps", () => {
|
|
416
|
+
test("names the components whose steps differ, and ignores one present in only some environments", () => {
|
|
417
|
+
const t = (env: string, steps: Record<string, unknown[]>): CompiledTarget => ({ env, params: [], components: Object.keys(steps), buildSteps: steps, buildInputs: {}, componentFiles: {}, templates: [] });
|
|
418
|
+
expect(differingBuildSteps([t("dev", { a: [{ x: 1 }], b: [{ y: 1 }] }), t("prod", { a: [{ x: 2 }], b: [{ y: 1 }] }), t("qa", { c: [] })])).toEqual([{ component: "a", envs: ["dev", "prod"] }]);
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
describe("the dry run of a cut (#4027)", () => {
|
|
423
|
+
const plan = (dir: string, compiler: TargetCompiler, label: string | null) =>
|
|
424
|
+
planRelease({ cwd: dir, compiler, label, actor: "alice", env: {}, now: () => new Date("2026-10-16T10:00:00.000Z") });
|
|
425
|
+
|
|
426
|
+
test("compiles every environment and says what it would build, without building, storing or cutting", () =>
|
|
427
|
+
withTestDir(async (dir) => {
|
|
428
|
+
green(dir, initRepo(dir));
|
|
429
|
+
const compiler = fixtureCompiler();
|
|
430
|
+
const p = await plan(dir, compiler, "v1.0.0");
|
|
431
|
+
expect(compiler.compiled).toEqual(["dev", "staging", "prod"]);
|
|
432
|
+
expect(compiler.built).toEqual([]);
|
|
433
|
+
expect(p).toMatchObject({ label: "v1.0.0", releaseDigest: null, alreadyCut: null, build: [{ component: "api", env: "dev" }], reused: [], signatureRequired: false });
|
|
434
|
+
expect(p.targets.map((t) => [t.env, t.templates])).toEqual([
|
|
435
|
+
["dev", [{ component: "api", path: "dist/api.template.json" }]],
|
|
436
|
+
["staging", [{ component: "api", path: "dist/api.template.json" }]],
|
|
437
|
+
["prod", [{ component: "api", path: "dist/api.template.json" }]],
|
|
438
|
+
]);
|
|
439
|
+
expect(spawnSync("git", ["rev-parse", "--verify", "--quiet", "refs/heads/chant/lifecycle"], { cwd: dir }).status).not.toBe(0);
|
|
440
|
+
}));
|
|
441
|
+
|
|
442
|
+
test("knows the digest when every artifact is carried, and that it is already cut", () =>
|
|
443
|
+
withTestDir(async (dir) => {
|
|
444
|
+
green(dir, initRepo(dir));
|
|
445
|
+
const first = await cut(dir, fixtureCompiler(), "v1.0.0");
|
|
446
|
+
const sha = commitFile(dir, "README.md", "docs only\n");
|
|
447
|
+
green(dir, sha);
|
|
448
|
+
const p = await plan(dir, fixtureCompiler(), "v1.1.0");
|
|
449
|
+
expect(p.build).toEqual([]);
|
|
450
|
+
expect(p.reused).toEqual([{ component: "api", from: first.release.releaseDigest }]);
|
|
451
|
+
const second = await cut(dir, fixtureCompiler(), "v1.1.0");
|
|
452
|
+
expect(p.releaseDigest).toBe(second.release.releaseDigest);
|
|
453
|
+
expect((await plan(dir, fixtureCompiler(), "v1.1.0")).alreadyCut).toBe(second.release.releaseDigest);
|
|
454
|
+
expect((await plan(dir, fixtureCompiler(), null)).alreadyCut).toBe(second.release.releaseDigest);
|
|
455
|
+
}));
|
|
456
|
+
|
|
457
|
+
test("refuses a label another commit's release holds, and one that is not a label", () =>
|
|
458
|
+
withTestDir(async (dir) => {
|
|
459
|
+
green(dir, initRepo(dir));
|
|
460
|
+
await cut(dir, fixtureCompiler(), "v1.0.0");
|
|
461
|
+
green(dir, commitFile(dir, "api/Dockerfile", "FROM busybox\n"));
|
|
462
|
+
const taken = await plan(dir, fixtureCompiler(), "v1.0.0").catch((e: unknown) => e);
|
|
463
|
+
expect(taken).toBeInstanceOf(ReleaseLabelError);
|
|
464
|
+
expect((taken as ReleaseLabelError).code).toBe("release-label-taken");
|
|
465
|
+
expect((taken as ReleaseLabelError).message).toMatch(/cut from commit [0-9a-f]{12}/);
|
|
466
|
+
expect(((await plan(dir, fixtureCompiler(), "-bad").catch((e: unknown) => e)) as ReleaseLabelError).code).toBe("release-label-invalid");
|
|
467
|
+
}));
|
|
468
|
+
|
|
469
|
+
test("lists each component's publish steps with the environments whose deploy runs them", () =>
|
|
470
|
+
withTestDir(async (dir) => {
|
|
471
|
+
green(dir, initRepo(dir));
|
|
472
|
+
const base = fixtureCompiler();
|
|
473
|
+
const compiler: TargetCompiler = {
|
|
474
|
+
...base,
|
|
475
|
+
async compile(env) {
|
|
476
|
+
const t = await base.compile(env);
|
|
477
|
+
return { ...t, publishSteps: { api: [{ kind: "publish-image", from: "archive", to: "$env.registry" }] } };
|
|
478
|
+
},
|
|
479
|
+
};
|
|
480
|
+
const p = await plan(dir, compiler, null);
|
|
481
|
+
expect(p.publishSteps).toEqual([{ component: "api", kind: "publish-image", to: "$env.registry", envs: ["dev", "staging", "prod"] }]);
|
|
482
|
+
}));
|
|
483
|
+
});
|