@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
package/src/ci-note-commands.ts
CHANGED
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
|
|
30
30
|
import { GITLAB_AGENT_ASK_VAR, GITLAB_AGENT_PR_VAR } from "./ci-agent";
|
|
31
31
|
import { GITLAB_COMMIT_ARG_VAR, GITLAB_COMMIT_PR_VAR, GITLAB_COMMIT_WORD_VAR } from "./ci-commit";
|
|
32
|
-
import { parseProductComment, productStatusContext, type CiProductWords, type ParsedProductComment } from "./ci-product-words";
|
|
32
|
+
import { parseProductComment, productStatusContext, type CiProductCommand, type CiProductWords, type ParsedProductComment } from "./ci-product-words";
|
|
33
|
+
import { commandLine, commentTerms, forkReply, memberReply, notRunReply } from "./ci-comment-replies";
|
|
33
34
|
import { GITLAB_APPLY_PR_VAR, GITLAB_LOCK_PR_VAR, GITLAB_PREVIEW_PR_VAR, GITLAB_UNLOCK_PR_VAR, PREVIEW_COMMENT_ENV } from "./components/pr-pipeline";
|
|
34
|
-
import { ForgeApiError, type ForgeFetch, type GitlabForgeOptions, type PrForge } from "./pr-forge";
|
|
35
|
+
import { ForgeApiError, type ForgeFetch, type ForgeKind, type GitlabForgeOptions, type PrForge } from "./pr-forge";
|
|
35
36
|
import type { ForgeReads, PullRequestDetail, PullRequestNote, RunJob, WorkflowRun } from "./pr-forge-reads";
|
|
36
37
|
|
|
37
38
|
export { GITLAB_NOTE_COMMANDS_VAR } from "./components/pr-pipeline";
|
|
@@ -304,8 +305,11 @@ async function answer(o: NoteCommandsOptions, mr: PullRequestDetail, note: PullR
|
|
|
304
305
|
}
|
|
305
306
|
return reply(`started pipeline${link(started)} to ${run.doing} for ${note.author}`, true, started.url);
|
|
306
307
|
}
|
|
307
|
-
case "retry":
|
|
308
|
-
|
|
308
|
+
case "retry": {
|
|
309
|
+
const done = await retryApply(o, "gitlab", mr, note.author, run, gitlabRetry(o.pipelines));
|
|
310
|
+
if (done.kind === "fail") return broke(done.reason);
|
|
311
|
+
return reply(done.text, done.kind === "ran", done.kind === "ran" ? done.url : undefined);
|
|
312
|
+
}
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
|
|
@@ -314,17 +318,53 @@ export const APPLY_JOBS = /^(?:[a-z0-9][a-z0-9-]*-)?apply(?:-wave-([1-9][0-9]*)(
|
|
|
314
318
|
|
|
315
319
|
const NOT_DONE = new Set(["created", "pending", "running", "waiting_for_resource", "preparing", "scheduled"]);
|
|
316
320
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
/** What starting a merge commit's apply again came to: a reply alone, a run started (`ran`), or a forge answer that broke it. */
|
|
322
|
+
export type ApplyRetried = { kind: "reply"; text: string } | { kind: "ran"; text: string; url?: string } | { kind: "fail"; reason: string };
|
|
323
|
+
|
|
324
|
+
/** What {@link ApplyRerun} is told: the merge commit, the pull request's name in a reply, who asked, and the default branch. */
|
|
325
|
+
export interface ApplyRerunContext {
|
|
326
|
+
sha: string;
|
|
327
|
+
/** `!12`, or `pull request 12`. */
|
|
328
|
+
at: string;
|
|
329
|
+
user: string;
|
|
330
|
+
base: string;
|
|
331
|
+
/** The pattern the apply jobs matched, whose groups are the wave and the share. */
|
|
332
|
+
pattern: RegExp;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* How a forge starts a merge commit's apply again (#4946), once
|
|
337
|
+
* {@link retryApply} found the push run at the commit with apply jobs and no
|
|
338
|
+
* later apply. GitLab retries the first apply job that did not succeed
|
|
339
|
+
* ({@link gitlabRetry}); GitHub and Forgejo answer in ./ci-comment-commands.ts.
|
|
340
|
+
*/
|
|
341
|
+
export type ApplyRerun = (run: WorkflowRun, jobs: RunJob[], c: ApplyRerunContext) => Promise<ApplyRetried>;
|
|
342
|
+
|
|
343
|
+
/** What {@link retryApply} reads with. */
|
|
344
|
+
export interface ApplyRetryReads {
|
|
345
|
+
reads: ForgeReads;
|
|
346
|
+
/** chant's client: it reads the later commits' statuses. */
|
|
347
|
+
forge: Pick<PrForge, "commitStatuses">;
|
|
348
|
+
words: CiProductWords;
|
|
349
|
+
/** The default branch. */
|
|
350
|
+
base: string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Start a merged pull request's apply again (#4785; shared with GitHub and
|
|
355
|
+
* Forgejo in #4946): the newest push run at the merge commit that has an
|
|
356
|
+
* apply job, refused when a later commit of the default branch already
|
|
357
|
+
* carries the product's apply status, since going back to this one would
|
|
358
|
+
* undo it. `rerun` is the forge's own start.
|
|
359
|
+
*/
|
|
360
|
+
export async function retryApply(o: ApplyRetryReads, forgeKind: ForgeKind, mr: PullRequestDetail, user: string, run: Extract<NoteRun, { kind: "retry" }>, rerun: ApplyRerun): Promise<ApplyRetried> {
|
|
325
361
|
const { sha } = run;
|
|
326
362
|
const pattern = run.jobs ?? APPLY_JOBS;
|
|
327
|
-
const
|
|
363
|
+
const t = commentTerms(forgeKind);
|
|
364
|
+
const at = t.at(mr.number);
|
|
365
|
+
const gitlab = forgeKind === "gitlab";
|
|
366
|
+
const runWord = gitlab ? "pipeline" : "workflow run";
|
|
367
|
+
const reply = (text: string): ApplyRetried => ({ kind: "reply", text });
|
|
328
368
|
// The newest push pipeline at the merge commit with an apply job: a branch pipeline, or a ci/green tag's.
|
|
329
369
|
let pipeline: WorkflowRun | undefined;
|
|
330
370
|
let jobs: RunJob[] = [];
|
|
@@ -338,10 +378,10 @@ async function retry(
|
|
|
338
378
|
break;
|
|
339
379
|
}
|
|
340
380
|
}
|
|
341
|
-
if (!pipeline) return reply(`no
|
|
381
|
+
if (!pipeline) return reply(`no ${runWord} at the merge commit ${short(sha)} of ${at} has an apply job, so there is nothing to ${gitlab ? "retry" : "run again"}; push to ${o.base} again`);
|
|
342
382
|
newer = await o.reads.branchRuns(o.base, { event: "push", limit: NOTE_COMMANDS_NEWER_PIPELINES });
|
|
343
383
|
} catch (e) {
|
|
344
|
-
return
|
|
384
|
+
return { kind: "fail", reason: `could not read the ${runWord}s at ${short(sha)} (${message(e)})` };
|
|
345
385
|
}
|
|
346
386
|
// A later commit whose apply started applied a newer tree: going back to this one would undo it.
|
|
347
387
|
const applyContext = productStatusContext(o.words, "apply");
|
|
@@ -351,32 +391,40 @@ async function retry(
|
|
|
351
391
|
try {
|
|
352
392
|
applied = (await o.forge.commitStatuses?.(c))?.find((s) => s.context === applyContext);
|
|
353
393
|
} catch (e) {
|
|
354
|
-
return
|
|
394
|
+
return { kind: "fail", reason: `could not read the statuses of ${short(c)} (${message(e)})` };
|
|
355
395
|
}
|
|
356
396
|
if (applied) {
|
|
357
|
-
const
|
|
358
|
-
return reply(`a later apply already ran on ${o.base} at ${short(c)}${
|
|
397
|
+
const link = applied.targetUrl && /^https?:\/\//.test(applied.targetUrl) ? ` (${applied.targetUrl})` : "";
|
|
398
|
+
return reply(`a later apply already ran on ${o.base} at ${short(c)}${link}, so the merge commit ${short(sha)} of ${at} is not applied: comment on the ${t.request} that commit came from, or push again`);
|
|
359
399
|
}
|
|
360
400
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
401
|
+
return rerun(pipeline, jobs, { sha, at, user, base: o.base, pattern });
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/** GitLab's start: retry the first apply job, by wave and share, that did not succeed; the jobs after it follow by themselves. */
|
|
405
|
+
export function gitlabRetry(pipelines: Pick<GitlabPipelines, "retryJob">): ApplyRerun {
|
|
406
|
+
return async (pipeline, jobs, { sha, at, user, base, pattern }) => {
|
|
407
|
+
const reply = (text: string): ApplyRetried => ({ kind: "reply", text });
|
|
408
|
+
const order = (j: RunJob): [number, number] => {
|
|
409
|
+
const m = pattern.exec(j.name);
|
|
410
|
+
return [m?.[1] ? Number(m[1]) : 0, m?.[2] ? Number(m[2]) : 0];
|
|
411
|
+
};
|
|
412
|
+
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
413
|
+
const next = sorted.find((j) => j.status !== "success");
|
|
414
|
+
if (!next) return reply(`every apply job of ${at}'s merge commit ${short(sha)} already succeeded`);
|
|
415
|
+
if (NOT_DONE.has(next.status)) return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
416
|
+
if (next.status !== "failed" && next.status !== "canceled") {
|
|
417
|
+
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${base} again`);
|
|
418
|
+
}
|
|
419
|
+
let retried: StartedRun;
|
|
420
|
+
try {
|
|
421
|
+
retried = await pipelines.retryJob(next.id);
|
|
422
|
+
} catch (e) {
|
|
423
|
+
return { kind: "fail", reason: `could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})` };
|
|
424
|
+
}
|
|
425
|
+
const link = retried.url ? ` (${retried.url})` : "";
|
|
426
|
+
return { kind: "ran", text: `retried ${next.name} of ${at}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, ...(retried.url ? { url: retried.url } : {}) };
|
|
364
427
|
};
|
|
365
|
-
const sorted = [...jobs].sort((a, b) => order(a)[0] - order(b)[0] || order(a)[1] - order(b)[1]);
|
|
366
|
-
const next = sorted.find((j) => j.status !== "success");
|
|
367
|
-
if (!next) return reply(`every apply job of !${iid}'s merge commit ${short(sha)} already succeeded`);
|
|
368
|
-
if (NOT_DONE.has(next.status)) return reply(`${next.name} at ${short(sha)} is ${next.status} already, so it is not retried`);
|
|
369
|
-
if (next.status !== "failed" && next.status !== "canceled") {
|
|
370
|
-
return reply(`${next.name} at ${short(sha)} was ${next.status}, and GitLab retries only a failed or canceled job; push to ${o.base} again`);
|
|
371
|
-
}
|
|
372
|
-
let retried: StartedRun;
|
|
373
|
-
try {
|
|
374
|
-
retried = await o.pipelines.retryJob(next.id);
|
|
375
|
-
} catch (e) {
|
|
376
|
-
return broke(`could not retry ${next.name} of pipeline ${pipeline.id} (${message(e)})`);
|
|
377
|
-
}
|
|
378
|
-
const link = retried.url ? ` (${retried.url})` : "";
|
|
379
|
-
return reply(`retried ${next.name} of !${iid}'s merge commit ${short(sha)}${link} for ${user}; its gate decides again, and the jobs after it follow, each behind its own gate`, true, retried.url);
|
|
380
428
|
}
|
|
381
429
|
|
|
382
430
|
/** The jobs chant's GitLab pipeline has, which {@link chantNoteRuns} starts. */
|
|
@@ -393,17 +441,32 @@ export interface ChantNoteJobs {
|
|
|
393
441
|
agent?: boolean;
|
|
394
442
|
/** The commit jobs, started with `CHANT_COMMIT_PR`, `CHANT_COMMIT` and `CHANT_COMMIT_ARG`. */
|
|
395
443
|
commits?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* The members the pipeline was written with (#4946), such as terragucci's
|
|
446
|
+
* roots: a plan or an action naming any other gets the words' `member`
|
|
447
|
+
* reply, and nothing starts. Absent: any member a comment may name.
|
|
448
|
+
*/
|
|
449
|
+
members?: readonly string[];
|
|
396
450
|
}
|
|
397
451
|
|
|
398
|
-
/**
|
|
452
|
+
/**
|
|
453
|
+
* What a command runs in chant's own GitLab pipeline, for the jobs it has.
|
|
454
|
+
* A command no job runs gets the words' reply for it (`words.replies`,
|
|
455
|
+
* #4946), else chant's.
|
|
456
|
+
*/
|
|
399
457
|
export function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns {
|
|
400
458
|
return ({ mr, note, parsed, base, words }): NoteRun => {
|
|
401
459
|
const iid = String(mr.number);
|
|
402
460
|
const at = `!${mr.number}`;
|
|
403
|
-
const line = (kind:
|
|
404
|
-
|
|
461
|
+
const line = (kind: CiProductCommand): string => commandLine(words, kind);
|
|
462
|
+
// #4946: a member outside the pipeline's is refused before anything starts, a fork's included.
|
|
463
|
+
const member = parsed.kind === "plan" || parsed.kind === "action" ? parsed.member : undefined;
|
|
464
|
+
if (member !== undefined && jobs.members && !jobs.members.includes(member)) return { kind: "reply", text: memberReply(words, member, jobs.members, "gitlab") };
|
|
465
|
+
if (!mr.sameRepo) return { kind: "reply", text: forkReply(words, "gitlab") };
|
|
405
466
|
const open = mr.state === "open";
|
|
406
467
|
const intoBase = mr.base === undefined || mr.base === base;
|
|
468
|
+
// #4946: the product's sentence for an apply no job answers, in place of chant's, which say what the merge does.
|
|
469
|
+
if (parsed.kind === "apply" && !jobs.applyBeforeMerge && !jobs.applyOnMerge && words.replies?.apply !== undefined) return { kind: "reply", text: words.replies.apply };
|
|
407
470
|
switch (parsed.kind) {
|
|
408
471
|
case "plan":
|
|
409
472
|
if (!open) return { kind: "reply", text: `${at} is not open, so it is not ${words.verbs.plan[1]}` };
|
|
@@ -425,11 +488,11 @@ export function chantNoteRuns(jobs: ChantNoteJobs): NoteCommandRuns {
|
|
|
425
488
|
return { kind: "retry", sha: mr.mergeCommit };
|
|
426
489
|
case "lock":
|
|
427
490
|
case "unlock":
|
|
428
|
-
if (!jobs.locks) return { kind: "reply", text:
|
|
491
|
+
if (!jobs.locks) return { kind: "reply", text: notRunReply(words, parsed.kind, "gitlab") };
|
|
429
492
|
if (parsed.kind === "lock" && !open) return { kind: "reply", text: `${at} is not open, so it takes no lock` };
|
|
430
493
|
return { kind: "pipeline", ref: base, variables: { [parsed.kind === "lock" ? GITLAB_LOCK_PR_VAR : GITLAB_UNLOCK_PR_VAR]: iid }, doing: `${parsed.kind} the ${words.noun[1]} of ${at}` };
|
|
431
494
|
case "agent":
|
|
432
|
-
if (!jobs.agent) return { kind: "reply", text:
|
|
495
|
+
if (!jobs.agent) return { kind: "reply", text: notRunReply(words, "agent", "gitlab") };
|
|
433
496
|
if (!open) return { kind: "reply", text: `${at} is not open, so the agent does not run` };
|
|
434
497
|
if (mr.head === base) return { kind: "reply", text: `${at}'s source branch is the default branch, and an agent never pushes there` };
|
|
435
498
|
return { kind: "pipeline", ref: base, variables: { [GITLAB_AGENT_PR_VAR]: iid, [GITLAB_AGENT_ASK_VAR]: parsed.ask }, doing: `run the agent on ${at}` };
|
package/src/ci-product-words.ts
CHANGED
|
@@ -68,8 +68,48 @@ export interface CiProductAlias {
|
|
|
68
68
|
command: CiProductCommand;
|
|
69
69
|
/** The variable that turns the alias on in a job (terragucci's `TG_ATLANTIS_COMMENTS`). Absent: always on. */
|
|
70
70
|
when?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Flags of the other tool that the product has no counterpart for, each
|
|
73
|
+
* with the reply that refuses it (#4946), such as terragucci's `{ "-p":
|
|
74
|
+
* "a root goes by its path, not a project name: ..." }` on `atlantis
|
|
75
|
+
* plan`. A flag here is refused before the alias reads `-d`, so a product
|
|
76
|
+
* can refuse `atlantis apply -d` too. `--` refuses everything after it.
|
|
77
|
+
*/
|
|
78
|
+
refuse?: Record<string, string>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* What a comment job replies to a command the pipeline runs no job for
|
|
83
|
+
* (#4946), in the product's own sentences. Each slot left out takes
|
|
84
|
+
* chant's. The comment job on GitHub and Forgejo and the note poll on
|
|
85
|
+
* GitLab both read these.
|
|
86
|
+
*/
|
|
87
|
+
export interface CiProductCommentReplies {
|
|
88
|
+
/** A plan comment where no job plans on a comment (GitHub and Forgejo; GitLab starts a merge request pipeline). */
|
|
89
|
+
plan?: string;
|
|
90
|
+
/** An apply comment where no job applies on a comment: neither an apply before merge nor the re-run of a merged pull request's apply. */
|
|
91
|
+
apply?: string;
|
|
92
|
+
/** A lock comment where the pipeline takes no locks. */
|
|
93
|
+
lock?: string;
|
|
94
|
+
/** An unlock comment where the pipeline takes no locks. */
|
|
95
|
+
unlock?: string;
|
|
96
|
+
/** An action comment where no workflow runs actions (GitHub and Forgejo; GitLab names the checkout to run it from). */
|
|
97
|
+
action?: string;
|
|
98
|
+
/** An agent comment where the agent is off. */
|
|
99
|
+
agent?: string;
|
|
100
|
+
/** Any command on a pull request from a fork. */
|
|
101
|
+
fork?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A comment that names a member the pipeline was not written with, over
|
|
104
|
+
* `{member}` (the one named) and `{members}` (the pipeline's, each in
|
|
105
|
+
* backticks, sorted, comma separated).
|
|
106
|
+
*/
|
|
107
|
+
member?: string;
|
|
71
108
|
}
|
|
72
109
|
|
|
110
|
+
/** The reply slots, for checking a product's words. */
|
|
111
|
+
export const CI_PRODUCT_COMMENT_REPLIES: readonly (keyof CiProductCommentReplies)[] = ["plan", "apply", "lock", "unlock", "action", "agent", "fork", "member"];
|
|
112
|
+
|
|
73
113
|
/** The words a product passes. Every slot is optional; a missing one takes chant's. */
|
|
74
114
|
export interface CiProductWordsInput {
|
|
75
115
|
/** The status prefix, the note heading and the comment prefix: `chant`, `terragucci`, `plywood`. */
|
|
@@ -124,6 +164,8 @@ export interface CiProductWordsInput {
|
|
|
124
164
|
adoptMarkers?: string[];
|
|
125
165
|
/** What chant's notify sends under these words (#4610). */
|
|
126
166
|
notify?: CiProductNotifyWordsInput;
|
|
167
|
+
/** The replies to commands the pipeline runs no job for (#4946). Default: chant's. */
|
|
168
|
+
replies?: CiProductCommentReplies;
|
|
127
169
|
}
|
|
128
170
|
|
|
129
171
|
/** The notify slots a product passes (#4610). */
|
|
@@ -174,6 +216,8 @@ export interface CiProductWords {
|
|
|
174
216
|
bin?: string;
|
|
175
217
|
adoptMarkers: string[];
|
|
176
218
|
notify: CiProductNotifyWords;
|
|
219
|
+
/** The product's replies to commands no job runs (#4946), when it gives any. */
|
|
220
|
+
replies?: CiProductCommentReplies;
|
|
177
221
|
}
|
|
178
222
|
|
|
179
223
|
/** chant's own approve line. */
|
|
@@ -227,6 +271,7 @@ export function resolveProductWords(input: CiProductWordsInput | CiProductWords
|
|
|
227
271
|
headers: input.notify?.headers ?? `x-${product}`,
|
|
228
272
|
...(input.notify?.message ? { message: input.notify.message } : {}),
|
|
229
273
|
},
|
|
274
|
+
...(input.replies !== undefined ? { replies: input.replies } : {}),
|
|
230
275
|
};
|
|
231
276
|
}
|
|
232
277
|
|
|
@@ -278,6 +323,17 @@ export function productWordsProblems(words: CiProductWords, options: { jobs?: re
|
|
|
278
323
|
for (const a of words.aliases) {
|
|
279
324
|
if (!/^[a-z0-9][a-z0-9 -]*$/.test(a.from)) problems.push(`the alias ${JSON.stringify(a.from)} is lowercase words`);
|
|
280
325
|
if (!Object.values(words.commands).includes(a.command)) problems.push(`the alias ${JSON.stringify(a.from)} stands for ${a.command}, which no command names`);
|
|
326
|
+
// #4946: a refused flag is one word starting with -, and its reply one line.
|
|
327
|
+
for (const [flag, reason] of Object.entries(a.refuse ?? {})) {
|
|
328
|
+
if (!/^--?[A-Za-z0-9-]*$/.test(flag)) problems.push(`the alias ${JSON.stringify(a.from)} refuses ${JSON.stringify(flag)}, and a flag is - or -- then letters, digits and -`);
|
|
329
|
+
if (typeof reason !== "string" || reason.trim() === "" || /[\r\n]/.test(reason)) problems.push(`the alias ${JSON.stringify(a.from)} refuses ${flag} with no one-line reply`);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// #4946: each reply is one line of text; the member reply's placeholders are {member} and {members}.
|
|
333
|
+
for (const [slot, text] of Object.entries(words.replies ?? {})) {
|
|
334
|
+
if (!CI_PRODUCT_COMMENT_REPLIES.includes(slot as keyof CiProductCommentReplies)) problems.push(`replies.${slot} is not one of ${CI_PRODUCT_COMMENT_REPLIES.join(", ")}`);
|
|
335
|
+
else if (typeof text !== "string" || text.trim() === "" || /[\r\n]/.test(text)) problems.push(`replies.${slot} is one line of text`);
|
|
336
|
+
else for (const m of text.matchAll(/\{([^}]*)\}/g)) if (slot !== "member" || (m[1] !== "member" && m[1] !== "members")) problems.push(`replies.${slot} names {${m[1]}}, which chant does not fill`);
|
|
281
337
|
}
|
|
282
338
|
for (const [where, template] of [["approve", words.approve], ["override", words.override]] as const) {
|
|
283
339
|
for (const m of template.matchAll(/\{([^}]*)\}/g)) if (!PLACEHOLDERS.has(m[1]!)) problems.push(`${where} names {${m[1]}}, which chant does not fill`);
|
|
@@ -500,6 +556,26 @@ export const PRODUCT_COMMENT_ASK_MAX = 2000;
|
|
|
500
556
|
/** Commands a comment never runs, named in the reply so nobody waits on them. */
|
|
501
557
|
const NEVER = new Set(["approve", "override", "force-unlock", "unlock-state", "import", "state", "destroy", "merge"]);
|
|
502
558
|
|
|
559
|
+
/** {@link parseProductComment}'s options. */
|
|
560
|
+
export interface ProductCommentOptions {
|
|
561
|
+
/** Leave every comment for a commit word to the commit job (#4890): it is undefined here, a refused one included. */
|
|
562
|
+
leaveCommit?: boolean;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* The commit word a comment names (#4890): its first two words, split on
|
|
567
|
+
* any space, are `/<product> <word>` and the words map `<word>` onto
|
|
568
|
+
* `commit`. The commit job replies to a refused comment by this rule
|
|
569
|
+
* (#4838), so a comment job that skips these never answers a comment the
|
|
570
|
+
* commit job answers. Undefined for any other comment.
|
|
571
|
+
*/
|
|
572
|
+
export function commitWordOf(words: CiProductWords, body: unknown): string | undefined {
|
|
573
|
+
if (typeof body !== "string") return undefined;
|
|
574
|
+
const said = body.trim().split(/[ \t\r\n]+/);
|
|
575
|
+
if (said[0] !== `/${words.product}` || said[1] === undefined) return undefined;
|
|
576
|
+
return words.commands[said[1]] === "commit" ? said[1] : undefined;
|
|
577
|
+
}
|
|
578
|
+
|
|
503
579
|
/**
|
|
504
580
|
* Read a comment against the product's grammar (moved from terragucci's
|
|
505
581
|
* comment.ts). Undefined when it is not addressed to the product. A comment
|
|
@@ -512,14 +588,22 @@ const NEVER = new Set(["approve", "override", "force-unlock", "unlock-state", "i
|
|
|
512
588
|
* names the commit words that take one argument after them (#4820), each
|
|
513
589
|
* with the pattern it must match; it must also match
|
|
514
590
|
* {@link COMMIT_COMMENT_ARG}. Any other commit word takes nothing.
|
|
591
|
+
*
|
|
592
|
+
* `leaveCommit` (#4890) is for a comment job that is not the commit job: a
|
|
593
|
+
* comment for a commit word is undefined, a malformed one included
|
|
594
|
+
* ({@link commitWordOf}), because the commit job answers it, refusals and
|
|
595
|
+
* all (#4838). Without it, a malformed `/<product> <commit word> x` would
|
|
596
|
+
* get a reply from both jobs.
|
|
515
597
|
*/
|
|
516
598
|
export function parseProductComment(
|
|
517
599
|
words: CiProductWords,
|
|
518
600
|
body: unknown,
|
|
519
601
|
env: Record<string, string | undefined> = {},
|
|
520
602
|
commitArgs: Readonly<Record<string, RegExp>> = {},
|
|
603
|
+
options: ProductCommentOptions = {},
|
|
521
604
|
): ParsedProductComment | undefined {
|
|
522
605
|
if (typeof body !== "string") return undefined;
|
|
606
|
+
if (options.leaveCommit && commitWordOf(words, body) !== undefined) return undefined;
|
|
523
607
|
let text = body.trim();
|
|
524
608
|
const prefix = `/${words.product}`;
|
|
525
609
|
for (const a of words.aliases) {
|
|
@@ -532,6 +616,9 @@ export function parseProductComment(
|
|
|
532
616
|
const args: string[] = [];
|
|
533
617
|
for (let i = 0; i < rest.length; i++) {
|
|
534
618
|
const w = rest[i]!;
|
|
619
|
+
// #4946: a flag the product has no counterpart for gets the product's own reason.
|
|
620
|
+
const refused = a.refuse && Object.prototype.hasOwnProperty.call(a.refuse, w) ? a.refuse[w] : undefined;
|
|
621
|
+
if (refused !== undefined) return { kind: "refused", reason: refused };
|
|
535
622
|
if (w === "-d" || w === "--dir") {
|
|
536
623
|
const dir = rest[++i];
|
|
537
624
|
if (dir === undefined) return { kind: "refused", reason: `\`${w}\` names the ${words.noun[0]}'s directory` };
|
|
@@ -562,6 +649,8 @@ export function parseProductComment(
|
|
|
562
649
|
case "unlock":
|
|
563
650
|
return parts.length === 2 ? { kind: command } : { kind: "refused", reason: `${line} takes nothing after it` };
|
|
564
651
|
case "commit": {
|
|
652
|
+
// An alias for a commit word, which commitWordOf does not read, is the commit job's too.
|
|
653
|
+
if (options.leaveCommit) return undefined;
|
|
565
654
|
if (parts.length === 2) return { kind: "commit", word: typed };
|
|
566
655
|
const pattern = Object.prototype.hasOwnProperty.call(commitArgs, typed) ? commitArgs[typed] : undefined;
|
|
567
656
|
if (pattern === undefined) return { kind: "refused", reason: `${line} takes nothing after it` };
|
package/src/ci-product.ts
CHANGED
|
@@ -37,6 +37,7 @@ export {
|
|
|
37
37
|
CiProductWordsError,
|
|
38
38
|
commandWord,
|
|
39
39
|
commentLine,
|
|
40
|
+
commitWordOf,
|
|
40
41
|
isChantWords,
|
|
41
42
|
notifyWaveLabel,
|
|
42
43
|
overrideLine,
|
|
@@ -63,6 +64,7 @@ export {
|
|
|
63
64
|
type CiProductWordsInput,
|
|
64
65
|
type OverrideLineInput,
|
|
65
66
|
type ParsedProductComment,
|
|
67
|
+
type ProductCommentOptions,
|
|
66
68
|
type ProductActionRequest,
|
|
67
69
|
} from "./ci-product-words";
|
|
68
70
|
export { driftNotifyFields, NOTIFY_MESSAGE_WORDS_FLOOR, productNotifySource, productNotifyWords, productSendOptions, type DriftNotifyInput } from "./notify-product";
|
|
@@ -131,10 +133,69 @@ export { prActionJob, PR_ACTION_JOB, prApplyComment, prCommentLockJobs, prCommen
|
|
|
131
133
|
* `components/product-plan-pipeline`. A product feature-detects on this
|
|
132
134
|
* floor.
|
|
133
135
|
*/
|
|
134
|
-
export const PRODUCT_PLAN_FLOOR =
|
|
136
|
+
export const PRODUCT_PLAN_FLOOR = "0.124.86";
|
|
135
137
|
export { productPlanJobs, PR_PLAN_NOTE_WORDS_ENV, type ProductPlanJob, type ProductPlanOptions, type ProductPlanTarget } from "./components/product-plan";
|
|
136
138
|
export { planNoteHandoff, PR_PLAN_NOTE_FILE, type PrPlanNoteHandoff } from "./pr-plan-note";
|
|
137
139
|
|
|
140
|
+
/**
|
|
141
|
+
* The first chant whose product plan carries the plan-job steps beside the plan verb and the note job's own lines (#4899, #4931): `productPlan.login` and a target's `login` (ci-login) with the job's OIDC token, `idTokens`, `pending`, `controlRead`, `setup` steps, job-level `env`, `report`, `concurrency`, the comment re-plan `replan`, and `noteSteps`; a hand-off's `marker` kept under the note words' `productMarker`; and the note job's notices and overdue Ops under a hand-off's counts.
|
|
142
|
+
*/
|
|
143
|
+
export const PRODUCT_PLAN_STEPS_FLOOR = "0.124.88";
|
|
144
|
+
export { PLAN_ARGUMENT_ENV, PLAN_NOTE_NOTICES_ENV, type ProductPlanReplanJob, type ProductPlanSetupStep } from "./components/product-plan";
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* The first chant whose `parseProductComment` takes `leaveCommit` and that has `commitWordOf` (#4890): a comment job that is not the commit job leaves every comment for a commit word to it, a malformed one included, so the comment gets one reply.
|
|
148
|
+
*/
|
|
149
|
+
export const COMMENT_LEAVES_COMMIT_FLOOR = "0.124.88";
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The first chant with the comment job on GitHub and Forgejo and the replies to commands no job runs (#4946): `commentJob` in the product pipeline (`chant components pr-comment`, `answerProductComment` in `@intentius/chant/ci-comment-commands`), which replies to a refusal and to a command the pipeline runs no job for, and with waves on merge starts a merged pull request's apply again; the words' `replies` and an alias's `refuse`, which the GitLab note poll reads too, as `chantNoteRuns`' `members`; `retryApply`; and `locks: "plan"` in GitHub's and Forgejo's product plan, with the lock, unlock and comment lock jobs.
|
|
153
|
+
*/
|
|
154
|
+
export const COMMENT_COMMANDS_FLOOR = NEXT_RELEASE;
|
|
155
|
+
export { answerProductComment, answeredElsewhere, COMMENT_JOBS_ENV, commentRuns, PR_COMMENT_JOB, RERUN_APPLY_JOBS, type CommentJobs, type CommentOutcome, type CommentRuns, type AnswerCommentOptions } from "./ci-comment-commands";
|
|
156
|
+
export { forkReply, memberReply, notRunReply } from "./ci-comment-replies";
|
|
157
|
+
export type { CiProductCommentReplies } from "./ci-product-words";
|
|
158
|
+
export { productCommentJob, type ProductCommentJob } from "./components/product-pipeline";
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The first chant whose product plan locks what a change reaches (#4979): `productPlan.reach`, a reach line the lock job runs at the target branch's commit with `chant lock --reach` (`@intentius/chant/lifecycle/reach-locks`), on GitHub, Forgejo and GitLab, where the lock job runs in the plan notes pipeline with `--open` beside the comment lock and unlock jobs; and whose comment job answers a re-plan comment with flags the product plan's re-plan cannot take (`noPlanFlags`).
|
|
162
|
+
*/
|
|
163
|
+
export const PRODUCT_PLAN_REACH_LOCKS_FLOOR = NEXT_RELEASE;
|
|
164
|
+
export { LOCK_REACH_ENV, reachedTargets, reachOpen, type Reached, type ReachInput } from "./lifecycle/reach-locks";
|
|
165
|
+
export { productPlanReachLock, type ProductPlanReachLock } from "./components/product-plan";
|
|
166
|
+
export { planFlagsReply } from "./ci-comment-commands";
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* The first chant whose comment job stops a merged pull request's re-run at a wave (#4979): `/<product> apply wave-<n>` writes a stop for the merge commit on `chant/lifecycle` (`_waves/<op>.stops.json`, `@intentius/chant/op/wave-stop`) before GitHub's re-run or Forgejo's dispatch, and `chant run wave` leaves each wave after n waiting (exit 3).
|
|
170
|
+
*/
|
|
171
|
+
export const WAVE_STOP_FLOOR = NEXT_RELEASE;
|
|
172
|
+
export { setWaveStop, waveStopAt, waveStopLine, type WaveStop } from "./op/wave-stop";
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The first chant whose product plan takes `watches`, the product's own scheduled jobs the note job's `pr-post` checks for having stopped with the job's token (#4888), and whose `checkOverdueOps` and `overdueOpsAt` take a product's `logPrefix` and `label`.
|
|
176
|
+
*/
|
|
177
|
+
export const PRODUCT_PLAN_WATCHES_FLOOR = "0.124.88";
|
|
178
|
+
export { PLAN_WATCHES_ENV } from "./op/schedule-overdue";
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The first chant whose product plan takes `record` (#4899): the plan step writes the plan job's run record into the hand-off, and the note job keeps it as Op `pr-plan` on `chant/lifecycle` with `pr-post --record-run <plan job>` (`--open` on GitLab), as `chant ci run plan --in-place` records `pr-plan`'s.
|
|
182
|
+
*/
|
|
183
|
+
export const PRODUCT_PLAN_RECORD_FLOOR = "0.124.88";
|
|
184
|
+
export { PLAN_RUN_OP, PLAN_RUN_RECORD_FILE, readPlanRunRecord } from "./pr-plan-record";
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The first chant whose product plan carries what terragucci's and sql-yodeler's plan jobs did themselves (#4963, #4951): `trade` (a plan's or a target's) before the checkout, `replan: { dispatch, reply, notAffected }` (a re-plan from `workflow_dispatch`, a reply to a comment no other job takes, `pr-post --not-affected`), `previousMarker` (`CHANT_PLAN_PREVIOUS_MARKER`), `noteSteps.pullRequest`, a `PrReport`'s `marker`, and a hand-off of the product's own note text (`planBodyHandoff`).
|
|
188
|
+
*/
|
|
189
|
+
export const PRODUCT_PLAN_REPLAN_FLOOR = NEXT_RELEASE;
|
|
190
|
+
export { gitlabReplanArgumentLines, PREVIOUS_MARKER_JS, replanDecideJs, type ProductPlanReplanOptions } from "./components/product-plan";
|
|
191
|
+
export { planBodyHandoff, PLAN_BODY_LIMIT, type PrPlanBodyHandoff } from "./pr-plan-note";
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The first chant whose note job compares the plan's subject with the previous note's (#4972), on GitHub, Forgejo and GitLab: a plan note hand-off's `subject` (`PrPlanSubject`, an id and named parts) is kept in the note, and `pr-post` adds the note words' `sinceLast` line, naming the parts added, gone and changed (`subjectParts`), when the previous note kept another id. The plan job reads no note, and `previousMarker` is deprecated.
|
|
195
|
+
*/
|
|
196
|
+
export const PRODUCT_PLAN_SUBJECT_FLOOR = NEXT_RELEASE;
|
|
197
|
+
export { PLAN_SUBJECT_LIMIT, planSubjectProblem, sinceLastLine, subjectChanges, type PrPlanSubject, type PrPlanSubjectPartWords } from "./pr-plan-note";
|
|
198
|
+
|
|
138
199
|
/**
|
|
139
200
|
* Day-2 actions in the product pipeline (#4654): the `action` comment
|
|
140
201
|
* command counted as answered by the product's own workflow
|
|
@@ -770,6 +770,47 @@ export const testEntity = {
|
|
|
770
770
|
expect(existsSync(join(testDir, "dist", "ops", "alb-deploy", "worker.ts"))).toBe(true);
|
|
771
771
|
});
|
|
772
772
|
|
|
773
|
+
describe("--output naming a directory (#4950)", () => {
|
|
774
|
+
/** Stands in for the docker lexicon on a project of Dockerfiles alone: a blank compose file and one file per Dockerfile. */
|
|
775
|
+
const dockerfilesOnly = (primary = "\n"): Serializer => ({
|
|
776
|
+
name: "dock",
|
|
777
|
+
rulePrefix: "DOCK",
|
|
778
|
+
serialize: () => ({ primary, files: { "Dockerfile.tofu": "FROM tofu\n", "Dockerfile.node": "FROM node\n" } }),
|
|
779
|
+
});
|
|
780
|
+
const declare = () =>
|
|
781
|
+
writeFile(
|
|
782
|
+
join(testDir, "images.ts"),
|
|
783
|
+
`export const tofu = { [Symbol.for("chant.declarable")]: true, entityType: "Docker::Dockerfile", lexicon: "dock", kind: "resource", props: {}, attributes: {} };\n`,
|
|
784
|
+
);
|
|
785
|
+
|
|
786
|
+
test("writes the additional files into it and no primary file, when the primary output is blank", async () => {
|
|
787
|
+
await declare();
|
|
788
|
+
const dir = join(testDir, "out", "images");
|
|
789
|
+
const result = await buildCommand({ path: testDir, output: `${dir}/`, format: "yaml", serializers: [dockerfilesOnly()] });
|
|
790
|
+
expect(result.errors).toEqual([]);
|
|
791
|
+
expect(readFileSync(join(dir, "Dockerfile.tofu"), "utf8")).toBe("FROM tofu\n");
|
|
792
|
+
expect(readFileSync(join(dir, "Dockerfile.node"), "utf8")).toBe("FROM node\n");
|
|
793
|
+
expect(existsSync(join(testDir, "out", "images.yaml"))).toBe(false);
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
test("takes an existing directory without the trailing slash", async () => {
|
|
797
|
+
await declare();
|
|
798
|
+
const dir = join(testDir, "existing");
|
|
799
|
+
await mkdir(dir, { recursive: true });
|
|
800
|
+
const result = await buildCommand({ path: testDir, output: dir, format: "yaml", serializers: [dockerfilesOnly()] });
|
|
801
|
+
expect(result.errors).toEqual([]);
|
|
802
|
+
expect(readFileSync(join(dir, "Dockerfile.tofu"), "utf8")).toBe("FROM tofu\n");
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
test("refuses a build with a primary output, which needs a file", async () => {
|
|
806
|
+
await declare();
|
|
807
|
+
const result = await buildCommand({ path: testDir, output: `${join(testDir, "d")}/`, format: "yaml", serializers: [dockerfilesOnly("services:\n a: {}\n")] });
|
|
808
|
+
expect(result.success).toBe(false);
|
|
809
|
+
expect(result.errors.join("\n")).toContain("names a directory");
|
|
810
|
+
expect(existsSync(join(testDir, "d", "Dockerfile.tofu"))).toBe(false);
|
|
811
|
+
});
|
|
812
|
+
});
|
|
813
|
+
|
|
773
814
|
describe("committed-encrypted secret sidecars", () => {
|
|
774
815
|
const CIPHERTEXT = 'apiVersion: v1\nkind: Secret\nstringData:\n T: ENC[AES256_GCM,data:xx]\nsops:\n version: 3.9.4\n';
|
|
775
816
|
|
|
@@ -34,7 +34,7 @@ import { sortedJsonReplacer } from "../../utils";
|
|
|
34
34
|
import { rankFoldBlockers, toCollapsedFormat, type FoldRankResult } from "../../discovery/fold-rank";
|
|
35
35
|
import { foldExecutionCounts } from "../../discovery/fold-import";
|
|
36
36
|
import { formatError, formatWarning, formatSuccess, formatBold, formatInfo } from "../format";
|
|
37
|
-
import { writeFileSync, mkdirSync } from "fs";
|
|
37
|
+
import { existsSync, statSync, writeFileSync, mkdirSync } from "fs";
|
|
38
38
|
import { resolve, dirname, join, relative } from "path";
|
|
39
39
|
import { watchDirectory, formatTimestamp, formatChangedFiles } from "../watch";
|
|
40
40
|
|
|
@@ -924,7 +924,32 @@ export async function buildCommand(options: BuildOptions): Promise<BuildResult>
|
|
|
924
924
|
console.error(formatInfo(`Wrote ${irWritten} op.json file(s) under ${join(options.path ?? ".", "dist", "ops")}/`));
|
|
925
925
|
}
|
|
926
926
|
|
|
927
|
-
|
|
927
|
+
// #4950: `--output <dir>/` (or an existing directory) writes the
|
|
928
|
+
// additional files into that directory and no primary file, so a docker
|
|
929
|
+
// project of Dockerfiles alone renders them where they are committed
|
|
930
|
+
// (`chant build images -o images/`) with no compose file to throw away.
|
|
931
|
+
// A build whose primary output holds anything needs a file to put it in.
|
|
932
|
+
const outputDir =
|
|
933
|
+
options.output !== undefined && (/[\\/]$/.test(options.output) || (existsSync(options.output) && statSync(options.output).isDirectory()))
|
|
934
|
+
? resolve(options.output)
|
|
935
|
+
: undefined;
|
|
936
|
+
if (outputDir !== undefined) {
|
|
937
|
+
if (output.trim() !== "") {
|
|
938
|
+
errors.push(
|
|
939
|
+
formatError({
|
|
940
|
+
message: `--output ${options.output} names a directory, which takes a build's additional files (a docker project's Dockerfiles) but not its primary output; this build has one, so name a file for it`,
|
|
941
|
+
}),
|
|
942
|
+
);
|
|
943
|
+
} else if (additionalFiles.size === 0) {
|
|
944
|
+
errors.push(formatError({ message: `--output ${options.output} names a directory, but this build has no files to write into it` }));
|
|
945
|
+
} else {
|
|
946
|
+
try {
|
|
947
|
+
for (const [filename, entry] of additionalFiles) writeOutput(join(outputDir, filename), entry.content);
|
|
948
|
+
} catch (err) {
|
|
949
|
+
errors.push(formatError({ message: `Failed to write output file: ${err instanceof Error ? err.message : String(err)}` }));
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
} else if (options.output) {
|
|
928
953
|
// Write to file — ensure parent directories exist for both the primary
|
|
929
954
|
// output path and any nested additional-file paths (e.g. ops/<name>/...).
|
|
930
955
|
try {
|
|
@@ -14,6 +14,8 @@ import { composeChangeSet, lifecyclePlanPart, type ChangeSetDocument } from "../
|
|
|
14
14
|
import type { ChangeSet as LifecycleChangeSet } from "../../lifecycle/change-set";
|
|
15
15
|
import { persistChangeSet } from "../../lifecycle/change-set-store";
|
|
16
16
|
import { appendPendingGate, readGateLedger } from "../../lifecycle/gate-ledger";
|
|
17
|
+
import { gatedRequestAttachmentPath } from "../../lifecycle/gated-request-digest";
|
|
18
|
+
import { writeBlobToPath } from "../../lifecycle/git";
|
|
17
19
|
import { resetGateOrigin } from "../../lifecycle/gate-origin";
|
|
18
20
|
import { CHANT_EXIT } from "../../exit-codes";
|
|
19
21
|
import type { ParsedArgs } from "../registry";
|
|
@@ -203,6 +205,39 @@ describe("confirmApproval (#4575)", () => {
|
|
|
203
205
|
});
|
|
204
206
|
});
|
|
205
207
|
|
|
208
|
+
describe("confirmApproval on a gated request's attachment (#4928)", () => {
|
|
209
|
+
const cwd = process.cwd();
|
|
210
|
+
afterEach(() => {
|
|
211
|
+
process.chdir(cwd);
|
|
212
|
+
resetGateOrigin();
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test("a migration's request shows its roots and the product's record, which its digest binds", async () => {
|
|
216
|
+
await withTestDir(async (dir) => {
|
|
217
|
+
git(["init", "-q", "-b", "main"], dir);
|
|
218
|
+
git(["config", "user.email", "t@chant.dev"], dir);
|
|
219
|
+
git(["config", "user.name", "T"], dir);
|
|
220
|
+
writeFileSync(join(dir, "README.md"), "x\n");
|
|
221
|
+
git(["add", "."], dir);
|
|
222
|
+
git(["commit", "-q", "-m", "init"], dir);
|
|
223
|
+
const digest = `sha256:${"a".repeat(64)}`;
|
|
224
|
+
const attachment = `${JSON.stringify({ name: "move-queues", roots: [{ root: "queues", location: "s3://acme/queues.tfstate" }], record: { moves: [{ addresses: ["aws_sqs_queue.jobs"], from: "platform", to: "queues" }], stamps: [] } })}\n`;
|
|
225
|
+
const { dir: at, file } = gatedRequestAttachmentPath("tf-migrate", digest);
|
|
226
|
+
await writeBlobToPath(at, file, attachment, "Request migrate on move-queues", { cwd: dir });
|
|
227
|
+
await appendPendingGate({ op: "tf-migrate", gate: "move-queues", timestamp: "2026-11-09T00:00:00.000Z", expiresAt: "2999-01-01T00:00:00.000Z", planDigest: digest, description: "migration move-queues: queues" }, { cwd: dir });
|
|
228
|
+
process.chdir(dir);
|
|
229
|
+
let shown = "";
|
|
230
|
+
let said = "";
|
|
231
|
+
const c = await confirmApproval("tf-migrate", "move-queues", { cwd: dir, out: (t) => (shown += t), err: (t) => (said += t), ask: async () => "move-queues" });
|
|
232
|
+
expect(c).toEqual({ status: "confirmed", plan: digest, target: "move-queues" });
|
|
233
|
+
expect(shown).toContain(`The request binds _gates/tf-migrate/requests/sha256_${"a".repeat(64)}.json`);
|
|
234
|
+
expect(shown).toContain('"aws_sqs_queue.jobs"');
|
|
235
|
+
expect(shown).toContain('"record"');
|
|
236
|
+
expect(said).not.toContain("No plan is stored");
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
206
241
|
describe("chant approve with a faked terminal (#4575)", () => {
|
|
207
242
|
const cwd = process.cwd();
|
|
208
243
|
const stdinTTY = Object.getOwnPropertyDescriptor(process.stdin, "isTTY");
|