@intentius/chant 0.124.87 → 0.124.89
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/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +47 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +56 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +203 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-commit.d.ts +1 -1
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +128 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +203 -0
- package/dist/ci-evidence-jobs.d.ts +68 -4
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +82 -5
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +65 -10
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +101 -22
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +62 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +52 -1
- package/dist/ci-product.d.ts +52 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +51 -2
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +37 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +255 -20
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +11 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +71 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +97 -14
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +36 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +60 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +82 -0
- package/dist/cli/registry.d.ts +35 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +18 -0
- package/dist/components/pr-checks.d.ts +169 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +180 -0
- package/dist/components/pr-pipeline.d.ts +38 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +6 -1
- package/dist/components/product-pipeline.d.ts +58 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +76 -9
- package/dist/components/product-plan.d.ts +445 -7
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +426 -15
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +52 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +46 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +81 -21
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +19 -1
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +8 -2
- package/dist/forge-check/index.d.ts +4 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +4 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -0
- package/dist/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +88 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +248 -0
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +27 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +26 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +76 -4
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +26 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +97 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +118 -0
- package/dist/op/op-waves-evidence.d.ts +12 -1
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +23 -2
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +14 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +56 -4
- package/dist/op/op-waves.d.ts +12 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +14 -1
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +148 -10
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +121 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +104 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +68 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +218 -13
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +90 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +155 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +100 -16
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +101 -17
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts +24 -1
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -4
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +307 -297
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +15 -8
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +27 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +52 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +25 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +28 -8
- package/dist/workspace/trust/check-evidence.d.ts +13 -1
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +8 -3
- package/dist/workspace/trust/evidence.d.ts +5 -0
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- package/dist/workspace/trust/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +93 -11
- package/dist/workspace/trust/ref-gate.d.ts +61 -2
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +72 -7
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/action-pins.ts +2 -0
- package/src/actor.test.ts +78 -0
- package/src/actor.ts +79 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +108 -1
- package/src/chant-install.ts +242 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +51 -6
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +165 -0
- package/src/ci-evidence-from-job.ts +251 -0
- package/src/ci-evidence-jobs.ts +88 -6
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +187 -16
- package/src/ci-image.ts +157 -25
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +89 -0
- package/src/ci-product.ts +62 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +37 -7
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +233 -18
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +69 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +93 -15
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +35 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +60 -4
- package/src/cli/parse-args.ts +58 -0
- package/src/cli/registry.ts +35 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/check-hooks.ts +22 -0
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/pr-checks.ts +254 -0
- package/src/components/pr-pipeline.ts +43 -1
- package/src/components/product-pipeline.ts +113 -9
- package/src/components/product-plan.test.ts +140 -1
- package/src/components/product-plan.ts +707 -20
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +45 -0
- package/src/drift-record.ts +71 -6
- package/src/floor-table.data.ts +81 -21
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +23 -2
- package/src/forge-check/forge-check.test.ts +25 -0
- package/src/forge-check/index.ts +4 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +118 -0
- package/src/generated-check.test.ts +170 -0
- package/src/generated-check.ts +310 -0
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +28 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +87 -4
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +100 -0
- package/src/lifecycle/release-images.ts +38 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +140 -0
- package/src/op/op-waves-evidence.test.ts +36 -3
- package/src/op/op-waves-evidence.ts +23 -3
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +59 -3
- package/src/op/op-waves.ts +16 -2
- package/src/op/schedule-overdue.test.ts +126 -1
- package/src/op/schedule-overdue.ts +164 -12
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +184 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +32 -1
- package/src/pr-post.ts +254 -15
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +208 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +139 -17
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +89 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -4
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +14 -7
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +104 -3
- package/src/workspace/release-workflow.ts +60 -9
- package/src/workspace/trust/check-evidence-report.ts +39 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/check-evidence.ts +17 -5
- package/src/workspace/trust/evidence.ts +5 -0
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/ref-gate-cli.ts +88 -10
- package/src/workspace/trust/ref-gate-pieces.test.ts +220 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/trust/ref-gate.ts +87 -6
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -24,6 +24,14 @@ import type { ParsedArgs } from "../registry";
|
|
|
24
24
|
import type { PendingGateRecord } from "../../lifecycle/gate-ledger";
|
|
25
25
|
import { CHANT_EXIT } from "../../exit-codes";
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The first chant with `confirmApproval` here, the type-the-name
|
|
29
|
+
* confirmation a product's approve word asks through (#4575). #4916
|
|
30
|
+
* declared it after the fact, so `chant dev dead-guards` sees a product's
|
|
31
|
+
* lazy load of this subpath.
|
|
32
|
+
*/
|
|
33
|
+
export const APPROVE_CONFIRM_FLOOR = "0.124.55";
|
|
34
|
+
|
|
27
35
|
/** The streams the terminal check reads. `process` in the CLI; tests pass their own. */
|
|
28
36
|
export interface ApprovalTerminal {
|
|
29
37
|
stdin: { isTTY?: boolean };
|
|
@@ -167,6 +175,8 @@ export async function confirmApproval(opName: string, gate: string, opts: Confir
|
|
|
167
175
|
err(`The stored plan can't be read: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
168
176
|
}
|
|
169
177
|
}
|
|
178
|
+
// #4928: a gated request's attachment (a state migration's roots and the product's record) is what its digest binds; show it.
|
|
179
|
+
if (!shown) shown = await showAttachment(opName, digest, cwd, out, err);
|
|
170
180
|
if (!shown) {
|
|
171
181
|
err(
|
|
172
182
|
`No plan is stored on chant/lifecycle under ${changeSet}. The run that stopped at the gate printed it; ` +
|
|
@@ -198,3 +208,37 @@ export async function confirmApproval(opName: string, gate: string, opts: Confir
|
|
|
198
208
|
}
|
|
199
209
|
return { status: "confirmed", plan: digest, target };
|
|
200
210
|
}
|
|
211
|
+
|
|
212
|
+
/** The most of an attachment `chant approve` prints before it says where the rest is (#4928). */
|
|
213
|
+
const ATTACHMENT_SHOWN_BYTES = 64 * 1024;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Print the attachment a gated request stored under `digest` (#4928), such
|
|
217
|
+
* as a state migration's roots and the product's record. JSON is printed
|
|
218
|
+
* indented, anything else as stored, and either is cut at
|
|
219
|
+
* {@link ATTACHMENT_SHOWN_BYTES} with the path of the whole. False when none is stored.
|
|
220
|
+
*/
|
|
221
|
+
export async function showAttachment(op: string, digest: string, cwd: string, out: (text: string) => void, err: (text: string) => void): Promise<boolean> {
|
|
222
|
+
const { gatedRequestAttachmentPath } = await import("../../lifecycle/gated-request-digest");
|
|
223
|
+
const { readBlobFromPath } = await import("../../lifecycle/git");
|
|
224
|
+
const { dir, file } = gatedRequestAttachmentPath(op, digest);
|
|
225
|
+
let text: string | null;
|
|
226
|
+
try {
|
|
227
|
+
text = await readBlobFromPath(dir, file, { cwd });
|
|
228
|
+
} catch (e) {
|
|
229
|
+
err(`The request's attachment can't be read: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
if (text === null) return false;
|
|
233
|
+
let shown = text;
|
|
234
|
+
try {
|
|
235
|
+
shown = `${JSON.stringify(JSON.parse(text), null, 2)}\n`;
|
|
236
|
+
} catch {
|
|
237
|
+
// Not JSON: shown as stored.
|
|
238
|
+
}
|
|
239
|
+
const cut = Buffer.byteLength(shown, "utf8") > ATTACHMENT_SHOWN_BYTES;
|
|
240
|
+
out(`The request binds ${dir}/${file}:\n`);
|
|
241
|
+
out(cut ? `${Buffer.from(shown, "utf8").subarray(0, ATTACHMENT_SHOWN_BYTES).toString("utf8")}\n...\n` : shown);
|
|
242
|
+
if (cut) err(`The attachment is longer than ${ATTACHMENT_SHOWN_BYTES} bytes; the whole is at ${dir}/${file} on chant/lifecycle.\n`);
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
@@ -35,6 +35,7 @@ import { readFileSync } from "node:fs";
|
|
|
35
35
|
import { resolve as resolvePath } from "node:path";
|
|
36
36
|
import { formatError, formatWarning, formatSuccess, formatInfo } from "../format";
|
|
37
37
|
import type { CommandContext } from "../registry";
|
|
38
|
+
import { actorFromEnv } from "../../actor";
|
|
38
39
|
|
|
39
40
|
// ── chant approve <op> <gate> ───────────────────────────────────────────────
|
|
40
41
|
|
|
@@ -623,7 +624,7 @@ async function approveGate(
|
|
|
623
624
|
// "unattested" reads as what it is; a name the model chose would read in
|
|
624
625
|
// the ledger exactly like a name a person gave.
|
|
625
626
|
? UNATTESTED_APPROVER
|
|
626
|
-
:
|
|
627
|
+
: actorFromEnv());
|
|
627
628
|
|
|
628
629
|
// #2508: who this is, as the gate's quorum and policy read it. A model on
|
|
629
630
|
// MCP or ACP is an agent whatever it claims, the same reasoning that gives
|
|
@@ -38,6 +38,10 @@ describe("a root build (#4794)", () => {
|
|
|
38
38
|
expect(await loaded(root, root)).toEqual(["infra.ts"]);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
test("nor its top-level migrations/, whose backfill scripts run on load (#4921)", async () => {
|
|
42
|
+
expect((await findInfraFiles(root)).map((f) => relative(root, f).split("\\").join("/"))).toEqual(["infra.ts"]);
|
|
43
|
+
});
|
|
44
|
+
|
|
41
45
|
test("include brings scripts/ back", async () => {
|
|
42
46
|
expect((await findInfraFiles(include)).map((f) => relative(include, f).split("\\").join("/")).sort()).toEqual(["infra.ts", "scripts/run-on-load.ts"]);
|
|
43
47
|
});
|
|
@@ -65,7 +65,11 @@ async function engineSetupFor(path: string): Promise<string[]> {
|
|
|
65
65
|
* `--merge auto --merge-token-env <VAR> [--merge-method <m>]` (#4636) merges
|
|
66
66
|
* the pull request after its update before merge. `--respond <list>`,
|
|
67
67
|
* `--decide-backend` and `--decide-model` (#4629) set the apply and note
|
|
68
|
-
* jobs' responses and the description check's service.
|
|
68
|
+
* jobs' responses and the description check's service.
|
|
69
|
+
* `--evidence-runner-key-secret <NAME>`, or `--evidence-identity oidc` with
|
|
70
|
+
* `--evidence-audience` (#4935), give the loop its runner identity: the note
|
|
71
|
+
* job signs `plan` and `policy`. `--check-job` and `--ref-gate-status`
|
|
72
|
+
* (#4935) write the check job and the ref gate's status job. {@link prLoopFlagsProblem}
|
|
69
73
|
* has checked all of them first.
|
|
70
74
|
*/
|
|
71
75
|
function prLoopOption(args: CommandContext["args"], reportUrl: string | undefined, requireReview = false, requireRunnerStart = false): PrLoopPipelineOptions {
|
|
@@ -105,6 +109,11 @@ function prLoopOption(args: CommandContext["args"], reportUrl: string | undefine
|
|
|
105
109
|
// #4629: the responses on the apply and note jobs, and the description check's service.
|
|
106
110
|
...(respond && Object.keys(respond).length > 0 ? { respond } : {}),
|
|
107
111
|
...(args.decideBackend && args.decideModel ? { decide: { backend: args.decideBackend, model: args.decideModel } } : {}),
|
|
112
|
+
// #4935: the runner identity the note job signs with, the check job and the ref gate's status job.
|
|
113
|
+
...(args.evidenceRunnerKeySecret ? { evidence: { runnerKeySecret: args.evidenceRunnerKeySecret } } : {}),
|
|
114
|
+
...(args.evidenceIdentity === "oidc" ? { evidence: { identity: "oidc" as const, ...(args.evidenceAudience ? { audience: args.evidenceAudience } : {}) } } : {}),
|
|
115
|
+
...(args.checkJob ? { checkJob: true } : {}),
|
|
116
|
+
...(args.refGateStatus ? { refGateStatus: true } : {}),
|
|
108
117
|
};
|
|
109
118
|
}
|
|
110
119
|
|
|
@@ -114,8 +123,13 @@ function prLoopOption(args: CommandContext["args"], reportUrl: string | undefine
|
|
|
114
123
|
* they do. Each value is refused by name, as `pr-apply` and `pr-post` refuse
|
|
115
124
|
* it, so a build never writes a job that fails on its own line.
|
|
116
125
|
*/
|
|
117
|
-
export function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents"> & Partial<Pick<CommandContext["args"], "controlRepo" | "controlSettings">>): string | undefined {
|
|
126
|
+
export function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" | "applyBeforeMerge" | "merge" | "mergeTokenEnv" | "mergeMethod" | "respond" | "decideBackend" | "decideModel" | "targetDependents"> & Partial<Pick<CommandContext["args"], "controlRepo" | "controlSettings" | "evidenceRunnerKeySecret" | "evidenceIdentity" | "evidenceAudience" | "checkJob" | "refGateStatus">>): string | undefined {
|
|
118
127
|
const given = [
|
|
128
|
+
...(args.evidenceRunnerKeySecret !== undefined ? ["--evidence-runner-key-secret"] : []),
|
|
129
|
+
...(args.evidenceIdentity !== undefined ? ["--evidence-identity"] : []),
|
|
130
|
+
...(args.evidenceAudience !== undefined ? ["--evidence-audience"] : []),
|
|
131
|
+
...(args.checkJob ? ["--check-job"] : []),
|
|
132
|
+
...(args.refGateStatus ? ["--ref-gate-status"] : []),
|
|
119
133
|
...(args.controlRepo !== undefined ? ["--control"] : []),
|
|
120
134
|
...(args.controlSettings !== undefined ? ["--control-setting"] : []),
|
|
121
135
|
...(args.merge !== undefined ? ["--merge"] : []),
|
|
@@ -140,6 +154,10 @@ export function prLoopFlagsProblem(args: Pick<CommandContext["args"], "prLoop" |
|
|
|
140
154
|
if (args.mergeMethod !== undefined && !(PR_MERGE_METHODS as readonly string[]).includes(args.mergeMethod)) return `--merge-method takes ${PR_MERGE_METHODS.join(", ")}, not ${args.mergeMethod}`;
|
|
141
155
|
}
|
|
142
156
|
if (args.controlSettings !== undefined && args.controlRepo === undefined) return "--control-setting sets the control repo's settings, so it needs --control <repo>";
|
|
157
|
+
// #4935: one runner identity, as PipelineEvidence takes it.
|
|
158
|
+
if (args.evidenceRunnerKeySecret !== undefined && args.evidenceIdentity !== undefined) return "--evidence-runner-key-secret and --evidence-identity each name the runner identity the jobs sign with; give one of them";
|
|
159
|
+
if (args.evidenceAudience !== undefined && args.evidenceIdentity === undefined) return "--evidence-audience is the keyless signing token's audience, so it goes with --evidence-identity oidc";
|
|
160
|
+
if (args.evidenceRunnerKeySecret !== undefined && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(args.evidenceRunnerKeySecret)) return `--evidence-runner-key-secret takes a secret name of letters, digits and _, not ${args.evidenceRunnerKeySecret}`;
|
|
143
161
|
const respond = args.respond ? parseRespondList(args.respond) : {};
|
|
144
162
|
if ("error" in respond) return respond.error;
|
|
145
163
|
const check = respond.description === "check";
|
|
@@ -20,8 +20,17 @@
|
|
|
20
20
|
* is signed as local evidence instead, under `refs/notes/chant/local-evidence`.
|
|
21
21
|
* Without one, a hook whose check `local.checks` at base names is skipped
|
|
22
22
|
* when current local evidence for the tree stands in for it; the rest run.
|
|
23
|
+
*
|
|
24
|
+
* #4914: `--summary <file>` appends the report's markdown section
|
|
25
|
+
* (`checkReportSummary`) to the file, as a product's check report keeps it,
|
|
26
|
+
* and a job with `GITHUB_STEP_SUMMARY` set gets it in its summary too.
|
|
27
|
+
*
|
|
28
|
+
* #4966: `--base` defaults to the job's base (`ciBaseRef`,
|
|
29
|
+
* `@intentius/chant/ci-base`), `--branch` naming the default branch on a
|
|
30
|
+
* forge whose job does not carry it.
|
|
23
31
|
*/
|
|
24
32
|
import { resolve } from "node:path";
|
|
33
|
+
import { ciBaseRef } from "../../ci-base";
|
|
25
34
|
import type { CheckStageEvidence, CheckStepsAdapter } from "../../components/check-steps";
|
|
26
35
|
import { CHANT_EXIT } from "../../exit-codes";
|
|
27
36
|
import { formatError } from "../format";
|
|
@@ -45,7 +54,7 @@ async function lexiconCheckSteps(ctx: CommandContext, cwd: string): Promise<Chec
|
|
|
45
54
|
return plugins.map((p) => p.checkSteps?.()).filter((a): a is CheckStepsAdapter => a !== undefined);
|
|
46
55
|
}
|
|
47
56
|
|
|
48
|
-
const USAGE = "chant ci check --base <rev> [<target>...] [--output <dir>] [--no-push] [--json]";
|
|
57
|
+
const USAGE = "chant ci check [--base <rev>] [--branch <default branch>] [<target>...] [--output <dir>] [--summary <file>] [--no-push] [--json]";
|
|
49
58
|
|
|
50
59
|
/**
|
|
51
60
|
* The check stage's signer (#4870), when the job has a runner identity: a
|
|
@@ -87,10 +96,17 @@ async function localEvidenceAt(base: string): Promise<{ base: string } | undefin
|
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
|
|
90
|
-
export async function runCiCheck(ctx: CommandContext): Promise<number> {
|
|
99
|
+
export async function runCiCheck(ctx: CommandContext, env: Record<string, string | undefined> = process.env): Promise<number> {
|
|
91
100
|
const { args } = ctx;
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
// #4966: with no --base, the job's own (`ciBaseRef`): a pull request's target branch, else the default branch (--branch) for a push to another branch.
|
|
102
|
+
const base = args.base ?? ciBaseRef(env, args.branch ? { defaultBranch: args.branch } : {});
|
|
103
|
+
if (!base) {
|
|
104
|
+
console.error(
|
|
105
|
+
formatError({
|
|
106
|
+
message: "chant ci check needs --base <rev>, the commit the change is measured from, and the job names no pull request target or default branch to take it from",
|
|
107
|
+
hint: `${USAGE}. The hooks are read at base, so a change cannot remove a required check.`,
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
94
110
|
return 1;
|
|
95
111
|
}
|
|
96
112
|
const targets = (args.positionals ?? []).slice(1);
|
|
@@ -98,14 +114,28 @@ export async function runCiCheck(ctx: CommandContext): Promise<number> {
|
|
|
98
114
|
let report;
|
|
99
115
|
try {
|
|
100
116
|
const adapters = await lexiconCheckSteps(ctx, process.cwd());
|
|
101
|
-
const evidence = await checkEvidenceSigner(
|
|
117
|
+
const evidence = await checkEvidenceSigner(base, args.noPush === true);
|
|
102
118
|
// #4868: a job that signs local evidence runs every hook; any other may skip one on local evidence.
|
|
103
|
-
const local = evidence && "class" in evidence.signer ? undefined : await localEvidenceAt(
|
|
104
|
-
report = await runCheckStage({ base
|
|
119
|
+
const local = evidence && "class" in evidence.signer ? undefined : await localEvidenceAt(base);
|
|
120
|
+
report = await runCheckStage({ base, targets, adapters, ...(args.output ? { dir: args.output } : {}), ...(evidence ? { evidence } : {}), ...(local ? { localEvidence: local } : {}) });
|
|
105
121
|
} catch (err) {
|
|
106
122
|
console.error(formatError({ message: err instanceof Error ? err.message : String(err), hint: USAGE }));
|
|
107
123
|
return CHANT_EXIT.failed;
|
|
108
124
|
}
|
|
125
|
+
// #4914: the report's markdown section, in the product's own report and the job summary of a forge that keeps one.
|
|
126
|
+
for (const file of [...new Set([args.checkSummary, process.env.GITHUB_STEP_SUMMARY].filter((f): f is string => Boolean(f)))]) {
|
|
127
|
+
const { checkReportSummary } = await import("../../components/check-hooks");
|
|
128
|
+
const lines = checkReportSummary(report);
|
|
129
|
+
if (lines.length === 0) continue;
|
|
130
|
+
try {
|
|
131
|
+
const { appendFileSync, mkdirSync } = await import("node:fs");
|
|
132
|
+
const { dirname } = await import("node:path");
|
|
133
|
+
mkdirSync(dirname(resolve(file)), { recursive: true });
|
|
134
|
+
appendFileSync(file, `${lines.join("\n")}\n`);
|
|
135
|
+
} catch (err) {
|
|
136
|
+
console.error(`ci check: could not write the summary to ${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
109
139
|
if (args.json) console.log(JSON.stringify(report, null, 2));
|
|
110
140
|
else if (report.status === "none") console.error("ci check: no ci.hooks.check at base and no lexicon check step, so nothing ran");
|
|
111
141
|
else {
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #4914: `chant ci evidence sign --open`, the GitLab signing job of the
|
|
3
|
+
* target branch's plan notes pipeline. For each open merge request it reads
|
|
4
|
+
* the newest plan or check job's report from its artifact, signs it for the
|
|
5
|
+
* head, keeps `<out>/<iid>/evidence.json` naming the head, and does not
|
|
6
|
+
* sign a head again once its evidence is current. The forge is a fake; the
|
|
7
|
+
* repository, the runner key and the notes are real.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
import { generateKeyPairSync } from "node:crypto";
|
|
12
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
import { afterEach, describe, expect, test, vi } from "vitest";
|
|
16
|
+
import { loadRunnerKey } from "../../workspace/trust/dsse";
|
|
17
|
+
import { readCheckEvidence } from "../../workspace/trust/check-evidence";
|
|
18
|
+
import { signOpenReports } from "../../workspace/trust/open-evidence";
|
|
19
|
+
import { parseArgs } from "../parse-args";
|
|
20
|
+
import type { CommandContext } from "../registry";
|
|
21
|
+
import type { MergeRequestJob, PrForge } from "../../pr-forge";
|
|
22
|
+
|
|
23
|
+
const forge = vi.hoisted(() => ({ current: undefined as unknown }));
|
|
24
|
+
vi.mock("../../pr-forge", async (actual) => ({ ...(await actual<typeof import("../../pr-forge")>()), forgeFromEnv: () => forge.current }));
|
|
25
|
+
|
|
26
|
+
const { runCiEvidence } = await import("./ci-evidence");
|
|
27
|
+
|
|
28
|
+
function git(cwd: string, ...args: string[]): string {
|
|
29
|
+
return execFileSync("git", ["-c", "user.name=t", "-c", "user.email=t@example.invalid", "-c", "init.defaultBranch=main", ...args], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** A repository whose base lists `ci`'s key as a runner, and a merge request's head on a branch beside it. */
|
|
33
|
+
function repo(): { dir: string; base: string; head: string; pem: string } {
|
|
34
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-4914-"));
|
|
35
|
+
const { privateKey } = generateKeyPairSync("ed25519");
|
|
36
|
+
const pem = privateKey.export({ format: "pem", type: "pkcs8" }).toString();
|
|
37
|
+
git(dir, "init", "--quiet");
|
|
38
|
+
mkdirSync(join(dir, ".chant"));
|
|
39
|
+
writeFileSync(join(dir, ".chant/trust.json"), JSON.stringify({ schema: 1, runners: [{ principal: "ci", class: "runner", key: loadRunnerKey(pem).publicKey }] }));
|
|
40
|
+
writeFileSync(join(dir, "main.tf"), "# base\n");
|
|
41
|
+
git(dir, "add", ".");
|
|
42
|
+
git(dir, "commit", "--quiet", "-m", "base");
|
|
43
|
+
const base = git(dir, "rev-parse", "HEAD");
|
|
44
|
+
git(dir, "checkout", "--quiet", "-b", "change");
|
|
45
|
+
writeFileSync(join(dir, "main.tf"), "# change\n");
|
|
46
|
+
git(dir, "commit", "--quiet", "-am", "change");
|
|
47
|
+
const head = git(dir, "rev-parse", "HEAD");
|
|
48
|
+
git(dir, "checkout", "--quiet", "main");
|
|
49
|
+
return { dir, base, head, pem };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A GitLab client with the merge requests' jobs, each job's artifact files, and the merge requests from a fork. */
|
|
53
|
+
function gitlab(jobs: MergeRequestJob[], artifacts: Record<number, Record<string, string>>, forks: number[] = []) {
|
|
54
|
+
const asked: string[] = [];
|
|
55
|
+
const client = {
|
|
56
|
+
kind: "gitlab",
|
|
57
|
+
async mergeRequestJobs(_branch: string, job: string) {
|
|
58
|
+
asked.push(job);
|
|
59
|
+
return jobs;
|
|
60
|
+
},
|
|
61
|
+
async openPullRequests(base: string) {
|
|
62
|
+
return jobs.map((j) => ({ number: j.pr, head: `mr-${j.pr}`, headSha: j.head, base, fork: forks.includes(j.pr) }));
|
|
63
|
+
},
|
|
64
|
+
async jobArtifact(id: number, path: string) {
|
|
65
|
+
return artifacts[id]?.[path];
|
|
66
|
+
},
|
|
67
|
+
} as unknown as PrForge;
|
|
68
|
+
return { client, asked };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const PLAN = JSON.stringify({ version: 1, policy: { result: "passed" } });
|
|
72
|
+
const CHECK = JSON.stringify({ version: 1, hooks: [{ name: "lint", exit: 0, outcome: "passed" }, { name: "tests", exit: 1, outcome: "failed" }] });
|
|
73
|
+
|
|
74
|
+
afterEach(() => {
|
|
75
|
+
vi.restoreAllMocks();
|
|
76
|
+
delete process.env.CHANT_RUNNER_KEY;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
async function run(dir: string, argv: string[]): Promise<number> {
|
|
80
|
+
vi.spyOn(process, "cwd").mockReturnValue(dir);
|
|
81
|
+
vi.spyOn(console, "error").mockImplementation(() => {});
|
|
82
|
+
return runCiEvidence({ args: parseArgs(["ci", "evidence", "sign", ...argv]) } as CommandContext);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
describe("ci evidence sign --open (#4914)", () => {
|
|
86
|
+
test("signs each open merge request's settled plan job for its head, keeps evidence.json naming it, and signs a head once", async () => {
|
|
87
|
+
const r = repo();
|
|
88
|
+
const g = gitlab(
|
|
89
|
+
[
|
|
90
|
+
{ pr: 7, head: r.head, id: 101, status: "success" },
|
|
91
|
+
{ pr: 8, head: r.head, id: 102, status: "running" },
|
|
92
|
+
],
|
|
93
|
+
{ 101: { ".chant/pr/pr-plan.json": PLAN } },
|
|
94
|
+
);
|
|
95
|
+
forge.current = g.client;
|
|
96
|
+
process.env.CHANT_RUNNER_KEY = r.pem;
|
|
97
|
+
const out = join(r.dir, ".chant/evidence/plan");
|
|
98
|
+
const argv = ["--open", "--job", "plan", "--from-report", ".chant/pr", "--base", r.base, "--branch", "main", "-o", out, "--no-push"];
|
|
99
|
+
expect(await run(r.dir, argv)).toBe(0);
|
|
100
|
+
expect(g.asked).toEqual(["plan"]);
|
|
101
|
+
const kept = JSON.parse(readFileSync(join(out, "7", "evidence.json"), "utf-8"));
|
|
102
|
+
expect(kept).toMatchObject({ pr: 7, head: r.head, skipped: [] });
|
|
103
|
+
expect(kept.signed.map((s: { check: string }) => s.check)).toEqual(["plan", "policy"]);
|
|
104
|
+
expect(existsSync(join(out, "8"))).toBe(false);
|
|
105
|
+
expect((await readCheckEvidence(r.dir, r.head, r.base, ["plan", "policy"])).map((v) => v.status)).toEqual(["current", "current"]);
|
|
106
|
+
// The next scheduled pipeline: the head's evidence is current, so nothing is signed again, and the file says it is signed.
|
|
107
|
+
const notes = git(r.dir, "notes", "--ref=refs/notes/chant/evidence", "list");
|
|
108
|
+
expect(await run(r.dir, argv)).toBe(0);
|
|
109
|
+
expect(git(r.dir, "notes", "--ref=refs/notes/chant/evidence", "list")).toBe(notes);
|
|
110
|
+
expect(JSON.parse(readFileSync(join(out, "7", "evidence.json"), "utf-8")).signed.map((s: { check: string; runner: string }) => `${s.check}:${s.runner}`)).toEqual(["plan:ci", "policy:ci"]);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
test("signs each hook that passed from a check job's artifact, and none of a fork's with --no-forks", async () => {
|
|
114
|
+
const r = repo();
|
|
115
|
+
const g = gitlab(
|
|
116
|
+
[
|
|
117
|
+
{ pr: 7, head: r.head, id: 201, status: "failed" },
|
|
118
|
+
{ pr: 9, head: r.head, id: 202, status: "success" },
|
|
119
|
+
],
|
|
120
|
+
{ 201: { ".chant/check/check-hooks.json": CHECK }, 202: { ".chant/check/check-hooks.json": CHECK } },
|
|
121
|
+
[9],
|
|
122
|
+
);
|
|
123
|
+
forge.current = g.client;
|
|
124
|
+
process.env.CHANT_RUNNER_KEY = r.pem;
|
|
125
|
+
const out = join(r.dir, ".chant/evidence/check");
|
|
126
|
+
expect(await run(r.dir, ["--open", "--job", "check", "--from-report", ".chant/check", "--base", r.base, "--branch", "main", "-o", out, "--no-push", "--no-forks"])).toBe(0);
|
|
127
|
+
const kept = JSON.parse(readFileSync(join(out, "7", "evidence.json"), "utf-8"));
|
|
128
|
+
expect(kept.signed.map((s: { check: string }) => s.check)).toEqual(["lint"]);
|
|
129
|
+
expect(kept.skipped).toEqual([{ check: "tests", reason: "the hook did not pass in the check job" }]);
|
|
130
|
+
expect(existsSync(join(out, "9"))).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test("refuses what it cannot sign for: no job, no output, a fixed head", async () => {
|
|
134
|
+
const r = repo();
|
|
135
|
+
forge.current = gitlab([], {}).client;
|
|
136
|
+
expect(await run(r.dir, ["--open", "--from-report", ".chant/pr", "-o", "x", "--branch", "main"])).toBe(1);
|
|
137
|
+
expect(await run(r.dir, ["--open", "--job", "plan", "--from-report", ".chant/pr", "--branch", "main"])).toBe(1);
|
|
138
|
+
expect(await run(r.dir, ["--open", "--job", "plan", "--from-report", ".chant/pr", "-o", "x", "--branch", "main", "--at", "HEAD"])).toBe(1);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe("signOpenReports (#4914)", () => {
|
|
143
|
+
test("a job that left no report, or whose head does not fetch, is said and signs nothing", async () => {
|
|
144
|
+
const out = mkdtempSync(join(tmpdir(), "chant-4914-open-"));
|
|
145
|
+
const g = gitlab(
|
|
146
|
+
[
|
|
147
|
+
{ pr: 1, head: "a".repeat(40), id: 1, status: "success" },
|
|
148
|
+
{ pr: 2, head: "b".repeat(40), id: 2, status: "success" },
|
|
149
|
+
],
|
|
150
|
+
{ 2: { ".chant/pr/pr-plan.json": PLAN } },
|
|
151
|
+
);
|
|
152
|
+
const sign = vi.fn();
|
|
153
|
+
const { done } = await signOpenReports({ forge: g.client, branch: "main", job: "plan", artifactDir: ".chant/pr/", out, fetchHead: () => false, sign });
|
|
154
|
+
expect(done.map((d) => [d.pr, d.skipped])).toEqual([
|
|
155
|
+
[1, "the plan job left no report under .chant/pr"],
|
|
156
|
+
[2, `the head ${"b".repeat(12)} did not fetch`],
|
|
157
|
+
]);
|
|
158
|
+
expect(sign).not.toHaveBeenCalled();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
test("a forge that cannot list merge request jobs is refused", async () => {
|
|
162
|
+
await expect(signOpenReports({ forge: { kind: "github" } as PrForge, branch: "main", job: "plan", artifactDir: ".chant/pr", out: "x", fetchHead: () => true, sign: vi.fn() })).rejects.toThrow(/it is for GitLab/);
|
|
163
|
+
});
|
|
164
|
+
});
|