@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/dist/pr-post.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ import { type PrOverdue, type PrReport } from "./pr-loop.js";
|
|
|
32
32
|
import { type PrForge } from "./pr-forge.js";
|
|
33
33
|
import { type CiProductWords } from "./ci-product-words.js";
|
|
34
34
|
import { type ControlEdgeFacts } from "./control/edges.js";
|
|
35
|
-
import
|
|
35
|
+
import type { OpRunRecordInput } from "./op/runtime.js";
|
|
36
|
+
import type { RunOrigin } from "./lifecycle/release-ledger.js";
|
|
37
|
+
import { type PrPlanBodyHandoff, type PrPlanNoteHandoff, type PrPlanNoteWords, type PrPlanSubject } from "./pr-plan-note.js";
|
|
36
38
|
/** The plan report's file under the report directory. */
|
|
37
39
|
export declare const PR_PLAN_REPORT_FILE = "pr-plan.json";
|
|
38
40
|
/** What {@link postPlanReport} posts for. */
|
|
@@ -82,6 +84,34 @@ export interface PlanPostInput {
|
|
|
82
84
|
* from the pipeline, never from the report.
|
|
83
85
|
*/
|
|
84
86
|
noteWords?: PrPlanNoteWords;
|
|
87
|
+
/**
|
|
88
|
+
* Notices the note job's own lines wrote (#4931), each added under a
|
|
89
|
+
* product's plan note hand-off's counts, after its own. Default: the
|
|
90
|
+
* lines of the file `CHANT_PLAN_NOTE_NOTICES` names, which the generated
|
|
91
|
+
* note job sets to a file outside the report the plan job handed on.
|
|
92
|
+
*/
|
|
93
|
+
notices?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* Keep the plan job's run record (#4899, ./pr-plan-record.ts), when it
|
|
96
|
+
* wrote one into the hand-off: read as data, with `origin` naming the plan
|
|
97
|
+
* job's run, and handed to `keep`, which appends it to the run ledger and
|
|
98
|
+
* pushes. `keep` returns a warning to say, when there is one.
|
|
99
|
+
*/
|
|
100
|
+
recordRun?: PlanRunRecorder;
|
|
101
|
+
/**
|
|
102
|
+
* The one argument a re-plan was narrowed to (#4963), such as a
|
|
103
|
+
* terragucci root: when the report or the hand-off says the change
|
|
104
|
+
* reaches nothing, the pull request gets a reply that the argument is not
|
|
105
|
+
* affected, and the note and the status stay as they were. Ignored when
|
|
106
|
+
* empty or not one plain word.
|
|
107
|
+
*/
|
|
108
|
+
notAffected?: string;
|
|
109
|
+
}
|
|
110
|
+
/** How the note job keeps the plan job's run record (#4899). */
|
|
111
|
+
export interface PlanRunRecorder {
|
|
112
|
+
/** The plan job's run, as the note job names it. */
|
|
113
|
+
origin?: RunOrigin;
|
|
114
|
+
keep(record: OpRunRecordInput): Promise<string | undefined>;
|
|
85
115
|
}
|
|
86
116
|
/** What {@link postPlanReport} did. */
|
|
87
117
|
export interface PlanPostResult {
|
|
@@ -91,6 +121,8 @@ export interface PlanPostResult {
|
|
|
91
121
|
noted: boolean;
|
|
92
122
|
/** Why the report was not used, when it was not. */
|
|
93
123
|
refused?: string;
|
|
124
|
+
/** The id of the plan job's run record kept on chant/lifecycle (#4899), when one was. */
|
|
125
|
+
recorded?: string;
|
|
94
126
|
warnings: string[];
|
|
95
127
|
}
|
|
96
128
|
/**
|
|
@@ -107,11 +139,22 @@ export declare function readPlanReport(input: Pick<PlanPostInput, "dir" | "pr" |
|
|
|
107
139
|
* The note for `report`, rendered here, with every `<!--` after the marker
|
|
108
140
|
* line written as `<!--`, so the note carries no hidden marker but its own.
|
|
109
141
|
*/
|
|
110
|
-
export declare function planNoteFor(report: PrReport, forge: Pick<PrForge, "kind" | "host">, marker: string, baseTip?: string): string;
|
|
142
|
+
export declare function planNoteFor(report: PrReport, forge: Pick<PrForge, "kind" | "host">, marker: string, baseTip?: string, own?: string): string;
|
|
111
143
|
/** The hidden line a note carries with the target branch's commit it was posted against (#4628). */
|
|
112
144
|
export declare function prNoteTipMarker(sha: string): string;
|
|
113
145
|
/** The hidden line a note marked stale carries, with the commit it was marked at (#4628). */
|
|
114
146
|
export declare function prNoteStaleMarker(sha: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* The hidden line a note keeps its plan's subject in (#4972): base64url of
|
|
149
|
+
* the subject's JSON, `{ id }` alone when its parts would make the line
|
|
150
|
+
* longer than {@link PLAN_SUBJECT_LIMIT}. Undefined when even that is.
|
|
151
|
+
*/
|
|
152
|
+
export declare function prNoteSubjectMarker(subject: PrPlanSubject): string | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* The subject a note kept (#4972), checked again: the line was chant's, but
|
|
155
|
+
* what it holds came from an earlier plan job. Undefined when there is none.
|
|
156
|
+
*/
|
|
157
|
+
export declare function subjectInNote(body: string): PrPlanSubject | undefined;
|
|
115
158
|
/** The note as the job summary shows it (#4628): the hidden lines dropped. */
|
|
116
159
|
export declare function planNoteSummary(note: string): string;
|
|
117
160
|
/**
|
|
@@ -125,10 +168,18 @@ export declare function postPlanReport(input: PlanPostInput): Promise<PlanPostRe
|
|
|
125
168
|
* one the caller ran, as {@link readPlanReport} checks a report.
|
|
126
169
|
*/
|
|
127
170
|
export declare function readPlanNoteHandoff(input: Pick<PlanPostInput, "dir" | "pr" | "head" | "env" | "member">): {
|
|
128
|
-
handoff: PrPlanNoteHandoff;
|
|
171
|
+
handoff: PrPlanNoteHandoff | PrPlanBodyHandoff;
|
|
129
172
|
} | {
|
|
130
173
|
refused: string;
|
|
131
174
|
};
|
|
175
|
+
/**
|
|
176
|
+
* The note for a hand-off of the product's own text (#4963): chant's
|
|
177
|
+
* marker, the product's line, the body with every `<!--` defused, the
|
|
178
|
+
* notices as quoted lines under it, the tip line, cut to the forge's limit.
|
|
179
|
+
*/
|
|
180
|
+
export declare function planBodyHandoffNote(handoff: PrPlanBodyHandoff, forge: Pick<PrForge, "kind">, marker: string, noteWords?: PrPlanNoteWords, baseTip?: string, notices?: readonly string[]): string;
|
|
181
|
+
/** The notices in the file `CHANT_PLAN_NOTE_NOTICES` names (#4931), one a line, or none when unset or unreadable. */
|
|
182
|
+
export declare function noticesFromEnv(env?: NodeJS.ProcessEnv): string[];
|
|
132
183
|
/**
|
|
133
184
|
* The note for a product's plan note hand-off (#4799): rendered here with
|
|
134
185
|
* the pipeline's note words, every `<!--` after the marker line defused as
|
|
@@ -161,6 +212,20 @@ export interface OpenPlanPostInput {
|
|
|
161
212
|
description?: (report: PrReport) => Promise<void>;
|
|
162
213
|
/** The target branch's commit this pipeline runs at (#4628), for each note's tip line. */
|
|
163
214
|
baseTip?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Keep each plan job's run record (#4899) from its artifacts, the job
|
|
217
|
+
* named as its run origin's `jobId`. `repo` is the project's path.
|
|
218
|
+
*/
|
|
219
|
+
recordRun?: {
|
|
220
|
+
repo?: string;
|
|
221
|
+
keep: PlanRunRecorder["keep"];
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Where the signing job of this pipeline kept each merge request's
|
|
225
|
+
* `evidence.json` (#4914), `<dir>/<iid>/evidence.json`: the note of a
|
|
226
|
+
* merge request whose file names its head ends with the checks line.
|
|
227
|
+
*/
|
|
228
|
+
evidenceDir?: string;
|
|
164
229
|
}
|
|
165
230
|
/** What {@link postOpenPlanReports} did for one merge request. */
|
|
166
231
|
export interface OpenPlanPost {
|
package/dist/pr-post.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-post.d.ts","sourceRoot":"","sources":["../src/pr-post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,
|
|
1
|
+
{"version":3,"file":"pr-post.d.ts","sourceRoot":"","sources":["../src/pr-post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAKH,OAAO,EAA+C,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEvG,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5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yC;AACzC,MAAM,WAAW,cAAc;IAC7B,iFAAiF;IACjF,KAAK,EAAE,OAAO,CAAC;IACf,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB;AAED,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,wDAAwD;IACxD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAiD/G"}
|
package/dist/pr-post.js
CHANGED
|
@@ -31,13 +31,15 @@
|
|
|
31
31
|
import { appendFileSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
32
32
|
import { tmpdir } from "node:os";
|
|
33
33
|
import { join } from "node:path";
|
|
34
|
-
import { prNoteMarker, prStatusContext,
|
|
34
|
+
import { prNoteMarker, prStatusContext, renderPrNote } from "./pr-loop.js";
|
|
35
|
+
import { prStatusDescription, prStatusState } from "./pr-status.js";
|
|
35
36
|
import { forgePrincipalOf } from "./pr-forge.js";
|
|
36
|
-
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "./plan-summary.js";
|
|
37
|
+
import { fitNote, GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "./plan-summary.js";
|
|
37
38
|
import { activeProductWords, commentLine } from "./ci-product-words.js";
|
|
38
39
|
import { controlEdgeFactsFromEnv, remarkCrossStackEdges } from "./control/edges.js";
|
|
39
|
-
import { checkEvidenceNoteLine } from "./workspace/trust/check-evidence-report.js";
|
|
40
|
-
import {
|
|
40
|
+
import { CHECK_EVIDENCE_FILE, checkEvidenceNoteLine, openEvidenceFor } from "./workspace/trust/check-evidence-report.js";
|
|
41
|
+
import { PLAN_RUN_RECORD_FILE, readPlanRunRecord } from "./pr-plan-record.js";
|
|
42
|
+
import { isPlanNote, PLAN_BODY_LIMIT, PLAN_SUBJECT_LIMIT, planNoteMarker, planSubjectProblem, PR_PLAN_NOTE_CONTRACT, PR_PLAN_NOTE_FILE, PRODUCT_MARKER_BODY, PRODUCT_MARKER_LIMIT, PRODUCT_MARKER_NAME, productMarkerLine, renderPlanNote, sinceLastLine } from "./pr-plan-note.js";
|
|
41
43
|
/** The plan report's file under the report directory. */
|
|
42
44
|
export const PR_PLAN_REPORT_FILE = "pr-plan.json";
|
|
43
45
|
const SHA = /^[0-9a-f]{40}$/;
|
|
@@ -79,7 +81,7 @@ export function readPlanReport(input) {
|
|
|
79
81
|
* The note for `report`, rendered here, with every `<!--` after the marker
|
|
80
82
|
* line written as `<!--`, so the note carries no hidden marker but its own.
|
|
81
83
|
*/
|
|
82
|
-
export function planNoteFor(report, forge, marker, baseTip) {
|
|
84
|
+
export function planNoteFor(report, forge, marker, baseTip, own) {
|
|
83
85
|
const note = renderPrNote(report, {
|
|
84
86
|
limit: forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT,
|
|
85
87
|
approver: forgePrincipalOf(forge.kind, forge.host, "<your-login>"),
|
|
@@ -88,7 +90,42 @@ export function planNoteFor(report, forge, marker, baseTip) {
|
|
|
88
90
|
const rest = (at < 0 ? "" : note.slice(at + 1)).split("<!--").join("<!--");
|
|
89
91
|
// #4628: the tip line is written after the defusing, from the caller's sha, never the report's.
|
|
90
92
|
const tip = baseTip && SHA.test(baseTip) ? `${rest.endsWith("\n") ? "" : "\n"}${prNoteTipMarker(baseTip)}\n` : "";
|
|
91
|
-
|
|
93
|
+
// #4963: the product's own line, already checked, under chant's marker.
|
|
94
|
+
return `${marker}\n${own ? `${own}\n` : ""}${rest}${tip}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The product's hidden line for a report or a hand-off (#4931, #4963): from
|
|
98
|
+
* the pipeline's `productMarker` and the file's `marker`, checked against
|
|
99
|
+
* {@link PRODUCT_MARKER_BODY}. Undefined when either is missing or the
|
|
100
|
+
* marker is not plain words.
|
|
101
|
+
*/
|
|
102
|
+
function productLineOf(name, marker) {
|
|
103
|
+
if (name === undefined || !PRODUCT_MARKER_NAME.test(name) || typeof marker !== "string" || marker.length > PRODUCT_MARKER_LIMIT)
|
|
104
|
+
return undefined;
|
|
105
|
+
if (marker !== "" && !PRODUCT_MARKER_BODY.test(marker))
|
|
106
|
+
return undefined;
|
|
107
|
+
return productMarkerLine(name, marker);
|
|
108
|
+
}
|
|
109
|
+
/** The one plain word a re-plan was narrowed to (#4963), or undefined. */
|
|
110
|
+
function narrowedTo(input) {
|
|
111
|
+
const a = input.notAffected?.trim();
|
|
112
|
+
return a && /^[A-Za-z0-9_.\/@+=,:-]+$/.test(a) ? a : undefined;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The reply for a re-plan narrowed to an argument the change does not
|
|
116
|
+
* reach (#4963), in place of the note and the status, as terragucci's
|
|
117
|
+
* plan-note job replied (plan-note.ts).
|
|
118
|
+
*/
|
|
119
|
+
async function replyNotAffected(input, argument, state, warnings) {
|
|
120
|
+
const description = `${argument} is not affected by this pull request, so nothing was planned.`;
|
|
121
|
+
try {
|
|
122
|
+
await input.forge.addComment(input.pr, `${activeProductWords().product}: ${description}`);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
warnings.push(`could not reply on #${input.pr}: ${err instanceof Error ? err.message : String(err)}`);
|
|
126
|
+
}
|
|
127
|
+
const recorded = await keepRunRecord(input, warnings);
|
|
128
|
+
return { state, description: cut(description), noted: false, ...(recorded ? { recorded } : {}), warnings };
|
|
92
129
|
}
|
|
93
130
|
/** The hidden line a note carries with the target branch's commit it was posted against (#4628). */
|
|
94
131
|
export function prNoteTipMarker(sha) {
|
|
@@ -98,6 +135,55 @@ export function prNoteTipMarker(sha) {
|
|
|
98
135
|
export function prNoteStaleMarker(sha) {
|
|
99
136
|
return `<!-- chant-pr-stale:${sha} -->`;
|
|
100
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* The hidden line a note keeps its plan's subject in (#4972): base64url of
|
|
140
|
+
* the subject's JSON, `{ id }` alone when its parts would make the line
|
|
141
|
+
* longer than {@link PLAN_SUBJECT_LIMIT}. Undefined when even that is.
|
|
142
|
+
*/
|
|
143
|
+
export function prNoteSubjectMarker(subject) {
|
|
144
|
+
const line = (s) => `<!-- chant-pr-subject:${Buffer.from(JSON.stringify(s), "utf8").toString("base64url")} -->`;
|
|
145
|
+
const full = line(subject);
|
|
146
|
+
if (full.length <= PLAN_SUBJECT_LIMIT)
|
|
147
|
+
return full;
|
|
148
|
+
const bare = line({ id: subject.id });
|
|
149
|
+
return bare.length <= PLAN_SUBJECT_LIMIT ? bare : undefined;
|
|
150
|
+
}
|
|
151
|
+
const SUBJECT_LINE = /^<!-- chant-pr-subject:([A-Za-z0-9_-]+) -->$/m;
|
|
152
|
+
/**
|
|
153
|
+
* The subject a note kept (#4972), checked again: the line was chant's, but
|
|
154
|
+
* what it holds came from an earlier plan job. Undefined when there is none.
|
|
155
|
+
*/
|
|
156
|
+
export function subjectInNote(body) {
|
|
157
|
+
const m = SUBJECT_LINE.exec(body.replace(/\r\n/g, "\n"));
|
|
158
|
+
if (!m?.[1] || m[1].length > PLAN_SUBJECT_LIMIT)
|
|
159
|
+
return undefined;
|
|
160
|
+
try {
|
|
161
|
+
const s = JSON.parse(Buffer.from(m[1], "base64url").toString("utf8"));
|
|
162
|
+
return planSubjectProblem(s) === undefined ? s : undefined;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The line saying what changed since the previous note (#4972): the
|
|
170
|
+
* previous note of the same environment and member is read with the job's
|
|
171
|
+
* token, and its kept subject compared with the hand-off's. Undefined when
|
|
172
|
+
* there is no previous note, it kept no subject, or the id is the same. A
|
|
173
|
+
* forge that refuses the read is a warning.
|
|
174
|
+
*/
|
|
175
|
+
async function sinceLastOf(input, subject, words, warnings) {
|
|
176
|
+
let found;
|
|
177
|
+
try {
|
|
178
|
+
found = await input.forge.findComment(input.pr, prNoteMarker(input.env, input.member));
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
warnings.push(`could not read the previous note on #${input.pr}, so the note does not say what changed since it: ${err instanceof Error ? err.message : String(err)}`);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
const previous = found ? subjectInNote(found.body) : undefined;
|
|
185
|
+
return previous ? sinceLastLine(previous, subject, words ?? {}) : undefined;
|
|
186
|
+
}
|
|
101
187
|
const TIP_LINE = /<!-- chant-pr-tip:([0-9a-f]{40}) -->/;
|
|
102
188
|
const STALE_LINE = /<!-- chant-pr-stale:([0-9a-f]{40}) -->/;
|
|
103
189
|
const STALE_PREFIX = "> Stale: ";
|
|
@@ -134,6 +220,10 @@ export async function postPlanReport(input) {
|
|
|
134
220
|
}
|
|
135
221
|
else {
|
|
136
222
|
let report = read.report;
|
|
223
|
+
// #4963: a re-plan narrowed to an argument the change does not reach.
|
|
224
|
+
const narrowed = narrowedTo(input);
|
|
225
|
+
if (narrowed && report.status === "nothing" && !failedJob)
|
|
226
|
+
return replyNotAffected(input, narrowed, "success", warnings);
|
|
137
227
|
if (input.overdue) {
|
|
138
228
|
const { overdue: _forged, ...rest } = report;
|
|
139
229
|
const found = await input.overdue().catch(() => []);
|
|
@@ -148,8 +238,10 @@ export async function postPlanReport(input) {
|
|
|
148
238
|
state = prStatusState(report);
|
|
149
239
|
description = prStatusDescription(report);
|
|
150
240
|
// A member the change does not reach has nothing to say on the pull request (as pr-plan's own publish).
|
|
241
|
+
// #4963: the report's own `marker`, under the pipeline's productMarker, as a hand-off's.
|
|
242
|
+
const own = productLineOf((input.noteWords ?? noteWordsFromEnv())?.productMarker, read.report.marker);
|
|
151
243
|
if (!(input.member && report.status === "nothing" && !report.overdue?.length && !report.migrations?.length))
|
|
152
|
-
note = planNoteFor(report, input.forge, prNoteMarker(input.env, input.member), input.baseTip);
|
|
244
|
+
note = planNoteFor(report, input.forge, prNoteMarker(input.env, input.member), input.baseTip, own);
|
|
153
245
|
}
|
|
154
246
|
catch (err) {
|
|
155
247
|
refused = `the plan report does not render: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -171,7 +263,42 @@ export async function postPlanReport(input) {
|
|
|
171
263
|
warnings.push(`the description check did not run: ${err instanceof Error ? err.message : String(err)}`);
|
|
172
264
|
}
|
|
173
265
|
}
|
|
174
|
-
|
|
266
|
+
const recorded = await keepRunRecord(input, warnings);
|
|
267
|
+
return { state, description: cut(description), noted: note !== undefined, ...(refused ? { refused } : {}), ...(recorded ? { recorded } : {}), warnings };
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Keep the plan job's run record on chant/lifecycle (#4899), with
|
|
271
|
+
* `input.recordRun`. A record that is missing, refused or not kept is a
|
|
272
|
+
* warning: the note and the status stand. Returns the record's id once kept.
|
|
273
|
+
*/
|
|
274
|
+
async function keepRunRecord(input, warnings) {
|
|
275
|
+
if (!input.recordRun)
|
|
276
|
+
return undefined;
|
|
277
|
+
const read = readPlanRunRecord(input.dir, {
|
|
278
|
+
env: input.env,
|
|
279
|
+
head: input.head,
|
|
280
|
+
...(input.member ? { target: input.member } : {}),
|
|
281
|
+
...(input.result ? { result: input.result } : {}),
|
|
282
|
+
...(input.recordRun.origin ? { origin: input.recordRun.origin } : {}),
|
|
283
|
+
});
|
|
284
|
+
if (!read) {
|
|
285
|
+
warnings.push("the plan job wrote no run record, so none is kept");
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
if ("refused" in read) {
|
|
289
|
+
warnings.push(`the plan job's run record was not kept: ${read.refused}`);
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
try {
|
|
293
|
+
const said = await input.recordRun.keep(read.record);
|
|
294
|
+
if (said)
|
|
295
|
+
warnings.push(said);
|
|
296
|
+
return read.record.id;
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
warnings.push(`the plan job's run record was not kept on chant/lifecycle: ${err instanceof Error ? err.message : String(err)}`);
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
175
302
|
}
|
|
176
303
|
/**
|
|
177
304
|
* Set the plan status, post the note when there is one, and add it to the
|
|
@@ -240,11 +367,55 @@ export function readPlanNoteHandoff(input) {
|
|
|
240
367
|
return { refused: `the plan note's state ${JSON.stringify(r.state)} is not success, failure or pending` };
|
|
241
368
|
if (typeof r.description !== "string")
|
|
242
369
|
return { refused: "the plan note has no description" };
|
|
243
|
-
|
|
370
|
+
// #4963: the product's own text in place of a plan note.
|
|
371
|
+
if (r.body !== undefined) {
|
|
372
|
+
if (r.note !== undefined)
|
|
373
|
+
return { refused: "the plan note gives both a note and a body; give one" };
|
|
374
|
+
if (typeof r.body !== "string" || r.body.length > PLAN_BODY_LIMIT)
|
|
375
|
+
return { refused: `the plan note's body is not text of at most ${PLAN_BODY_LIMIT} characters` };
|
|
376
|
+
}
|
|
377
|
+
else if (!isPlanNote(r.note) || r.note.head !== r.head || !Array.isArray(r.note.waves) || !Array.isArray(r.note.groups) || !Array.isArray(r.note.named)) {
|
|
244
378
|
return { refused: "the plan note's note is not a plan note for its head" };
|
|
245
379
|
}
|
|
380
|
+
// #4931: the product's hidden line is the change's too, so it holds only plain words.
|
|
381
|
+
if (r.marker !== undefined && (typeof r.marker !== "string" || r.marker.length > PRODUCT_MARKER_LIMIT || (r.marker !== "" && !PRODUCT_MARKER_BODY.test(r.marker)))) {
|
|
382
|
+
return { refused: `the plan note's marker is not words of letters, digits and _.,/@+=:- of at most ${PRODUCT_MARKER_LIMIT} characters` };
|
|
383
|
+
}
|
|
384
|
+
// #4972: the subject is kept in the note and said back in a later one, so it holds only plain words too.
|
|
385
|
+
const subjectProblem = r.subject !== undefined ? planSubjectProblem(r.subject) : undefined;
|
|
386
|
+
if (subjectProblem)
|
|
387
|
+
return { refused: `the plan note's subject ${subjectProblem}` };
|
|
246
388
|
return { handoff: doc };
|
|
247
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* The note for a hand-off of the product's own text (#4963): chant's
|
|
392
|
+
* marker, the product's line, the body with every `<!--` defused, the
|
|
393
|
+
* notices as quoted lines under it, the tip line, cut to the forge's limit.
|
|
394
|
+
*/
|
|
395
|
+
export function planBodyHandoffNote(handoff, forge, marker, noteWords, baseTip, notices = []) {
|
|
396
|
+
const limit = forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT;
|
|
397
|
+
const line = productLineOf(noteWords?.productMarker, handoff.marker);
|
|
398
|
+
const head = `${marker}\n${line ? `${line}\n` : ""}`;
|
|
399
|
+
const said = notices.length > 0 ? `\n${notices.map((n) => `> ${n.split("<!--").join("<!--")}`).join("\n")}\n` : "";
|
|
400
|
+
const tip = baseTip && SHA.test(baseTip) ? `${prNoteTipMarker(baseTip)}\n` : "";
|
|
401
|
+
// #4972: the subject, kept for the next note to compare with.
|
|
402
|
+
const kept = handoff.subject ? prNoteSubjectMarker(handoff.subject) : undefined;
|
|
403
|
+
const subject = kept ? `${kept}\n` : "";
|
|
404
|
+
const body = handoff.body.split("<!--").join("<!--").replace(/\n*$/, "\n");
|
|
405
|
+
return `${head}${fitNote(body, { limit: Math.max(0, limit - head.length - said.length - tip.length - subject.length) })}${said}${tip}${subject}`;
|
|
406
|
+
}
|
|
407
|
+
/** The notices in the file `CHANT_PLAN_NOTE_NOTICES` names (#4931), one a line, or none when unset or unreadable. */
|
|
408
|
+
export function noticesFromEnv(env = process.env) {
|
|
409
|
+
const file = env.CHANT_PLAN_NOTE_NOTICES;
|
|
410
|
+
if (!file || !existsSync(file))
|
|
411
|
+
return [];
|
|
412
|
+
try {
|
|
413
|
+
return readFileSync(file, "utf-8").split("\n").map((l) => l.trim()).filter((l) => l !== "");
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
return [];
|
|
417
|
+
}
|
|
418
|
+
}
|
|
248
419
|
/** The note words from `CHANT_PLAN_NOTE_WORDS` (#4799), or undefined when unset or not an object. */
|
|
249
420
|
function noteWordsFromEnv() {
|
|
250
421
|
const raw = process.env.CHANT_PLAN_NOTE_WORDS;
|
|
@@ -266,14 +437,21 @@ function noteWordsFromEnv() {
|
|
|
266
437
|
*/
|
|
267
438
|
export function planNoteHandoffNote(handoff, forge, marker, noteWords, baseTip) {
|
|
268
439
|
const words = activeProductWords();
|
|
269
|
-
|
|
440
|
+
// #4972: the subject, kept for the next note to compare with, within the forge's limit.
|
|
441
|
+
const kept = handoff.subject ? prNoteSubjectMarker(handoff.subject) : undefined;
|
|
442
|
+
const limit = (forge.kind === "gitlab" ? GITLAB_NOTE_LIMIT : GITHUB_COMMENT_LIMIT) - (kept ? kept.length + 1 : 0);
|
|
443
|
+
const rendered = renderPlanNote(handoff.note, { limit, words, ...(noteWords ? { note: noteWords } : {}) });
|
|
270
444
|
let body = rendered.split("<!--").join("<!--");
|
|
271
445
|
const n = handoff.note;
|
|
272
446
|
const previews = n.previews ?? [];
|
|
273
447
|
const waves = planNoteMarker(noteWords?.marker ?? `${words.product}:waves`, { head: n.head, waves: n.waves.map((x) => ({ number: x.number, digest: x.digest ?? null, waits: x.waits === true })), ...(previews.length ? { previews } : {}) });
|
|
274
448
|
body = body.replace(`<!--${waves.slice(4)}`, waves);
|
|
275
449
|
const tip = baseTip && SHA.test(baseTip) ? `${body.endsWith("\n") ? "" : "\n"}${prNoteTipMarker(baseTip)}\n` : "";
|
|
276
|
-
|
|
450
|
+
// #4931: the product's own line, from the pipeline's name and the hand-off's checked body, under chant's marker.
|
|
451
|
+
const name = noteWords?.productMarker;
|
|
452
|
+
const own = name !== undefined && PRODUCT_MARKER_NAME.test(name) && handoff.marker !== undefined ? `${productMarkerLine(name, handoff.marker)}\n` : "";
|
|
453
|
+
const subject = kept ? `${body.endsWith("\n") || tip ? "" : "\n"}${kept}\n` : "";
|
|
454
|
+
return `${marker}\n${own}${body}${tip}${subject}`;
|
|
277
455
|
}
|
|
278
456
|
/** {@link postPlanReport} for a product's plan note hand-off (#4799). */
|
|
279
457
|
async function postPlanNoteHandoff(input) {
|
|
@@ -293,8 +471,23 @@ async function postPlanNoteHandoff(input) {
|
|
|
293
471
|
else {
|
|
294
472
|
state = read.handoff.state;
|
|
295
473
|
description = read.handoff.description;
|
|
474
|
+
const h = read.handoff;
|
|
475
|
+
// #4963: a re-plan narrowed to an argument the change does not reach.
|
|
476
|
+
const narrowed = narrowedTo(input);
|
|
477
|
+
if (narrowed && "note" in h && h.note.nothing === true && !failedJob)
|
|
478
|
+
return replyNotAffected(input, narrowed, state, warnings);
|
|
479
|
+
// #4931: the overdue Ops (#4289), asked here with the job's token, and the note job's own notices, under the counts.
|
|
480
|
+
const given = "note" in h ? (h.note.notices ?? []) : [];
|
|
481
|
+
// An Op the product's own notices already call overdue is not said twice.
|
|
482
|
+
const overdue = input.overdue ? (await input.overdue().catch(() => [])).filter((o) => !given.some((g) => g.includes(`\`${o.op}\``) && g.includes("overdue"))).map((o) => o.message) : [];
|
|
483
|
+
const noteWords = input.noteWords ?? noteWordsFromEnv();
|
|
484
|
+
// #4972: what changed since the previous note, from the subject it kept, read here with the job's token.
|
|
485
|
+
const since = h.subject ? await sinceLastOf(input, h.subject, noteWords, warnings) : undefined;
|
|
486
|
+
const added = [...(since ? [since] : []), ...overdue, ...(input.notices ?? noticesFromEnv())].filter((n, i, all) => !given.includes(n) && all.indexOf(n) === i);
|
|
296
487
|
try {
|
|
297
|
-
note =
|
|
488
|
+
note = "note" in h
|
|
489
|
+
? planNoteHandoffNote(added.length > 0 ? { ...h, note: { ...h.note, notices: [...given, ...added] } } : h, input.forge, prNoteMarker(input.env, input.member), noteWords, input.baseTip)
|
|
490
|
+
: planBodyHandoffNote(h, input.forge, prNoteMarker(input.env, input.member), noteWords, input.baseTip, added);
|
|
298
491
|
}
|
|
299
492
|
catch (err) {
|
|
300
493
|
refused = `the plan note does not render: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -307,7 +500,8 @@ async function postPlanNoteHandoff(input) {
|
|
|
307
500
|
}
|
|
308
501
|
}
|
|
309
502
|
note = await postOutcome(input, context, state, description, note, refused, warnings);
|
|
310
|
-
|
|
503
|
+
const recorded = await keepRunRecord(input, warnings);
|
|
504
|
+
return { state, description: cut(description), noted: note !== undefined, ...(refused ? { refused } : {}), ...(recorded ? { recorded } : {}), warnings };
|
|
311
505
|
}
|
|
312
506
|
/**
|
|
313
507
|
* Post the plan note, or update it. Under a product's words that carry
|
|
@@ -367,6 +561,14 @@ export async function postOpenPlanReports(input) {
|
|
|
367
561
|
const handoff = text === undefined ? await forge.jobArtifact(job.id, `${input.artifactDir.replace(/\/+$/, "")}/${PR_PLAN_NOTE_FILE}`) : undefined;
|
|
368
562
|
if (handoff !== undefined)
|
|
369
563
|
writeFileSync(join(dir, PR_PLAN_NOTE_FILE), handoff);
|
|
564
|
+
// #4899: the plan job's run record, kept with its note.
|
|
565
|
+
const runRecord = input.recordRun ? await forge.jobArtifact(job.id, `${input.artifactDir.replace(/\/+$/, "")}/${PLAN_RUN_RECORD_FILE}`) : undefined;
|
|
566
|
+
if (runRecord !== undefined)
|
|
567
|
+
writeFileSync(join(dir, PLAN_RUN_RECORD_FILE), runRecord);
|
|
568
|
+
// #4914: what the signing job signed for this head, which the note's checks line says.
|
|
569
|
+
const evidence = input.evidenceDir ? openEvidenceFor(input.evidenceDir, job.pr, job.head) : undefined;
|
|
570
|
+
if (evidence !== undefined)
|
|
571
|
+
writeFileSync(join(dir, CHECK_EVIDENCE_FILE), evidence);
|
|
370
572
|
const posted = await postPlanReport({
|
|
371
573
|
// The status links to the plan job it reports on, which is how the next run knows it is posted.
|
|
372
574
|
forge: job.url ? { ...forge, runUrl: job.url } : forge,
|
|
@@ -379,6 +581,9 @@ export async function postOpenPlanReports(input) {
|
|
|
379
581
|
...(overdueOnce ? { overdue: overdueOnce } : {}),
|
|
380
582
|
...(input.description ? { description: input.description } : {}),
|
|
381
583
|
...(input.baseTip ? { baseTip: input.baseTip } : {}),
|
|
584
|
+
...(input.recordRun
|
|
585
|
+
? { recordRun: { origin: { forge: "gitlab", ...(input.recordRun.repo ? { repo: input.recordRun.repo } : {}), ...(job.url ? { url: job.url } : {}), jobId: String(job.id) }, keep: input.recordRun.keep } }
|
|
586
|
+
: {}),
|
|
382
587
|
});
|
|
383
588
|
posts.push({ pr: job.pr, head: job.head, posted });
|
|
384
589
|
}
|
package/dist/pr-requires.d.ts
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
* without the TypeScript toolchain.
|
|
16
16
|
*/
|
|
17
17
|
import type { PrApproverFilter, PrExcludedApprover, PrForge, PrRequireResult } from "./pr-forge.js";
|
|
18
|
+
/** `require` in {@link PrRequiresOptions} (#4913). */
|
|
19
|
+
export { REF_GATE_PIECES_FLOOR } from "./release-floors.js";
|
|
18
20
|
/** The four checks, in the order they run and the report lists them. */
|
|
19
21
|
export declare const PR_APPLY_REQUIRES: readonly ["approved", "mergeable", "undiverged", "checks"];
|
|
20
22
|
export type PrApplyRequire = (typeof PR_APPLY_REQUIRES)[number];
|
|
@@ -36,6 +38,12 @@ export interface PrRequiresOptions {
|
|
|
36
38
|
approvers?: PrApproverFilter;
|
|
37
39
|
/** Status names the `checks` require leaves out: the apply's own. */
|
|
38
40
|
ignore?: readonly string[];
|
|
41
|
+
/**
|
|
42
|
+
* Statuses the `checks` require needs to have reported and passed (#4913),
|
|
43
|
+
* such as the ref gate's: `refGateRulesAt(...).status` from
|
|
44
|
+
* `@intentius/chant/ref-gate-rules`. One not reported yet is pending.
|
|
45
|
+
*/
|
|
46
|
+
require?: readonly string[];
|
|
39
47
|
/** How many times a pending check is asked in all. Default 5. */
|
|
40
48
|
reads?: number;
|
|
41
49
|
/** The wait between reads. Default 3 seconds. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-requires.d.ts","sourceRoot":"","sources":["../src/pr-requires.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEjG,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,YAAI,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,CAAU,CAAC;AAE5F,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,cAAc,CAAC;IACrB,gGAAgG;IAChG,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjC,gGAAgG;IAChG,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,qEAAqE;IACrE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAKD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IA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AAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAKD;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAkCzI;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,MAAM,EAAE,cAAc,EAAE,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAM7G;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,GAAG,IAAI,CAIlF"}
|
package/dist/pr-requires.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** `require` in {@link PrRequiresOptions} (#4913). */
|
|
2
|
+
export { REF_GATE_PIECES_FLOOR } from "./release-floors.js";
|
|
1
3
|
/** The four checks, in the order they run and the report lists them. */
|
|
2
4
|
export const PR_APPLY_REQUIRES = ["approved", "mergeable", "undiverged", "checks"];
|
|
3
5
|
const READS = 5;
|
|
@@ -14,7 +16,7 @@ export async function checkPrRequires(forge, pr, head, opts = {}) {
|
|
|
14
16
|
approved: forge.prApproved ? () => forge.prApproved(pr, head, opts.approvers) : undefined,
|
|
15
17
|
mergeable: forge.prMergeable ? () => forge.prMergeable(pr, head) : undefined,
|
|
16
18
|
undiverged: forge.prUndiverged ? () => forge.prUndiverged(pr, head) : undefined,
|
|
17
|
-
checks: forge.prChecksPassed ? () => forge.prChecksPassed(pr, head, opts.ignore ?? []) : undefined,
|
|
19
|
+
checks: forge.prChecksPassed ? () => forge.prChecksPassed(pr, head, opts.ignore ?? [], opts.require ?? []) : undefined,
|
|
18
20
|
};
|
|
19
21
|
const out = [];
|
|
20
22
|
const asked = new Set(opts.only ?? PR_APPLY_REQUIRES);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pull-request loop's commit status (#3183): its description and its
|
|
3
|
+
* state, from the report `chant components pr-plan` and `pr-apply` write.
|
|
4
|
+
*
|
|
5
|
+
* They lived in `./pr-loop.ts` until #4966 moved them here, so the bundle
|
|
6
|
+
* a product builds from `pr-loop.ts` and `pr-forge.ts` (the report, the note
|
|
7
|
+
* and the forge clients, `pr-loop-bundle.test.ts`) keeps room under its
|
|
8
|
+
* ceiling. chant's own handlers post the status; no product reads these.
|
|
9
|
+
*/
|
|
10
|
+
import { type CiProductWords } from "./ci-product-words.js";
|
|
11
|
+
import { type PrReport } from "./pr-loop.js";
|
|
12
|
+
/** A commit status's description, at most 140 characters (GitHub's limit). */
|
|
13
|
+
export declare function prStatusDescription(report: PrReport, words?: CiProductWords): string;
|
|
14
|
+
/** The commit status state for a report: success, failure, or pending while it waits on approval. */
|
|
15
|
+
export declare function prStatusState(report: PrReport): "success" | "failure" | "pending";
|
|
16
|
+
//# sourceMappingURL=pr-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-status.d.ts","sourceRoot":"","sources":["../src/pr-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE7D,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAE,cAAqC,GAAG,MAAM,CAgE1G;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CASjF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pull-request loop's commit status (#3183): its description and its
|
|
3
|
+
* state, from the report `chant components pr-plan` and `pr-apply` write.
|
|
4
|
+
*
|
|
5
|
+
* They lived in `./pr-loop.ts` until #4966 moved them here, so the bundle
|
|
6
|
+
* a product builds from `pr-loop.ts` and `pr-forge.ts` (the report, the note
|
|
7
|
+
* and the forge clients, `pr-loop-bundle.test.ts`) keeps room under its
|
|
8
|
+
* ceiling. chant's own handlers post the status; no product reads these.
|
|
9
|
+
*/
|
|
10
|
+
import { activeProductWords } from "./ci-product-words.js";
|
|
11
|
+
import { memberHoleReasons } from "./pr-loop.js";
|
|
12
|
+
/** A commit status's description, at most 140 characters (GitHub's limit). */
|
|
13
|
+
export function prStatusDescription(report, words = activeProductWords()) {
|
|
14
|
+
const n = report.members.length;
|
|
15
|
+
const many = (k) => `${k} ${words.noun[k === 1 ? 0 : 1]}`;
|
|
16
|
+
const sum = report.members.reduce((acc, m) => ({ change: acc.change + m.counts.create + m.counts.update + m.counts.replace, destroy: acc.destroy + m.counts.delete + m.counts.replace }), { change: 0, destroy: 0 });
|
|
17
|
+
const digest = report.digest ? `; plan ${report.digest.replace(/^(?:jcs1-)?sha256:/, "").slice(0, 12)}` : "";
|
|
18
|
+
let text;
|
|
19
|
+
switch (report.status) {
|
|
20
|
+
case "nothing":
|
|
21
|
+
text = "nothing to plan";
|
|
22
|
+
break;
|
|
23
|
+
case "planned": {
|
|
24
|
+
const unknown = report.members.filter((m) => memberHoleReasons(report, m.member).length > 0).length;
|
|
25
|
+
// #4626: a narrowed plan says so in its status.
|
|
26
|
+
const narrowed = Object.values(report.narrowed ?? {}).filter((a) => a.length > 0).length;
|
|
27
|
+
text = `${many(n)}${narrowed > 0 ? ` (${narrowed} narrowed with --target)` : ""}: ${sum.change} to change, ${sum.destroy} to destroy or replace${unknown > 0 ? `, ${unknown} with holes` : ""}${digest}`;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "plan-failed":
|
|
31
|
+
text = `a ${words.noun[0]} failed to ${words.verbs.plan[0]}${digest}`;
|
|
32
|
+
break;
|
|
33
|
+
case "recorded":
|
|
34
|
+
text = `recorded ${many(n)}: ${report.approval.status === "approved" ? "the approved plan" : report.approval.status === "changed" ? "the plan differs from the approved one" : "no approval for this plan"}${digest}`;
|
|
35
|
+
break;
|
|
36
|
+
case "applied":
|
|
37
|
+
text = `${words.verbs.apply[1]} ${many(n)}${digest}`;
|
|
38
|
+
break;
|
|
39
|
+
case "wave-applied": {
|
|
40
|
+
const last = (report.waves ?? []).filter((w) => w.status === "applied").at(-1);
|
|
41
|
+
text = `applied wave ${last?.wave ?? "?"} of ${report.selection.waves.length}${last ? ` under ${last.approval === "pull-request" ? "the pull request's approval" : `${last.gate}`}` : ""}`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "failed":
|
|
45
|
+
text = `apply failed for ${report.members.filter((m) => m.status === "failed").map((m) => m.member).join(", ")}`;
|
|
46
|
+
break;
|
|
47
|
+
case "waiting":
|
|
48
|
+
text = `waiting: ${report.members.filter((m) => m.status === "waiting").map((m) => m.member).join(", ")} planned again after an upstream applied, not approved yet`;
|
|
49
|
+
break;
|
|
50
|
+
case "refused": {
|
|
51
|
+
const waiting = report.waves?.find((w) => w.status === "waiting");
|
|
52
|
+
if (waiting && (report.refusal === "wave-not-approved" || report.refusal === "wave-plan-changed")) {
|
|
53
|
+
text = `wave ${waiting.wave} waits at ${waiting.gate}: ${report.refusal === "wave-plan-changed" ? "its plan changed after its approval" : "its plan moved, approve it"}`;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
if (report.refusal === "earlier-wave") {
|
|
57
|
+
text = "refused: an earlier wave has not applied";
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
if (report.refusal === "requires-unmet" || report.refusal === "before-merge-off") {
|
|
61
|
+
const unmet = (report.beforeMerge?.requires ?? []).filter((r) => !r.passed).map((r) => r.name);
|
|
62
|
+
text = report.refusal === "before-merge-off" ? "refused: this workspace does not apply before merge" : `refused: ${unmet.join(", ") || "a require"} unmet for an apply before merge`;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (report.refusal === "policy-denied" || report.refusal === "policy-error") {
|
|
66
|
+
text = report.refusal === "policy-denied" ? `refused: the policy denied the plan (${(report.policy?.rules ?? []).join(", ")})` : "refused: the policy could not be checked";
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
text = `refused: ${report.refusal === "plan-changed" ? "the plan changed after review" : report.refusal === "not-a-reviewer" ? "the approver has not approved the pull request" : report.refusal === "author-approved" ? "the approver wrote the change" : report.refusal === "no-pull-request" ? "no pull request merged this commit" : report.refusal === "locked" ? "another pull request holds a target lock" : "the plan is not approved"}`;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return text.length > 140 ? text.slice(0, 137) + "..." : text;
|
|
74
|
+
}
|
|
75
|
+
/** The commit status state for a report: success, failure, or pending while it waits on approval. */
|
|
76
|
+
export function prStatusState(report) {
|
|
77
|
+
// #4168 decision 1: a merge whose plan differs from the approved one is recorded, and its status fails.
|
|
78
|
+
if (report.status === "recorded")
|
|
79
|
+
return report.approval.status === "changed" ? "failure" : "success";
|
|
80
|
+
// #4294: a plan the policy denied, with no override, or one it could not check, fails at the plan stage as it would at the apply.
|
|
81
|
+
if (report.status === "planned" && report.policy && (report.policy.result === "error" || (report.policy.result === "denied" && !report.policy.override)))
|
|
82
|
+
return "failure";
|
|
83
|
+
if (report.status === "planned" || report.status === "applied" || report.status === "wave-applied" || report.status === "nothing")
|
|
84
|
+
return "success";
|
|
85
|
+
if (report.status === "refused" && (report.refusal === "not-approved" || report.refusal === "wave-not-approved"))
|
|
86
|
+
return "pending";
|
|
87
|
+
if (report.status === "waiting")
|
|
88
|
+
return "pending";
|
|
89
|
+
return "failure";
|
|
90
|
+
}
|