@intentius/chant 0.124.55 → 0.124.57
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/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +1 -2
- package/dist/ci-audit/attribution.d.ts +111 -0
- package/dist/ci-audit/attribution.d.ts.map +1 -0
- package/dist/ci-audit/attribution.js +194 -0
- package/dist/ci-audit/audit-log.d.ts +144 -0
- package/dist/ci-audit/audit-log.d.ts.map +1 -0
- package/dist/ci-audit/audit-log.js +149 -0
- package/dist/ci-audit/index.d.ts +12 -0
- package/dist/ci-audit/index.d.ts.map +1 -0
- package/dist/ci-audit/index.js +11 -0
- package/dist/ci-audit/unrecorded.d.ts +74 -0
- package/dist/ci-audit/unrecorded.d.ts.map +1 -0
- package/dist/ci-audit/unrecorded.js +95 -0
- package/dist/ci-audit.d.ts +3 -0
- package/dist/ci-audit.d.ts.map +1 -0
- package/dist/ci-audit.js +2 -0
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +3 -4
- package/dist/ci-estate.d.ts +24 -0
- package/dist/ci-estate.d.ts.map +1 -1
- package/dist/ci-estate.js +1 -2
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +2 -3
- package/dist/ci-job-guard.d.ts +139 -0
- package/dist/ci-job-guard.d.ts.map +1 -0
- package/dist/ci-job-guard.js +287 -0
- package/dist/ci-jobs.d.ts +7 -0
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -0
- package/dist/ci-product-words.d.ts +7 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +38 -4
- package/dist/ci-product.d.ts +35 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +38 -4
- package/dist/ci-respond-run.d.ts +73 -0
- package/dist/ci-respond-run.d.ts.map +1 -0
- package/dist/ci-respond-run.js +247 -0
- package/dist/ci-respond.d.ts +189 -0
- package/dist/ci-respond.d.ts.map +1 -0
- package/dist/ci-respond.js +285 -0
- package/dist/cli/handlers/audit-log.d.ts +12 -0
- package/dist/cli/handlers/audit-log.d.ts.map +1 -0
- package/dist/cli/handlers/audit-log.js +81 -0
- package/dist/cli/handlers/build.d.ts +7 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +81 -0
- package/dist/cli/handlers/ci-check-job.d.ts +11 -0
- package/dist/cli/handlers/ci-check-job.d.ts.map +1 -0
- package/dist/cli/handlers/ci-check-job.js +27 -0
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +38 -9
- package/dist/cli/handlers/e2e-safe-run.d.ts +12 -0
- package/dist/cli/handlers/e2e-safe-run.d.ts.map +1 -0
- package/dist/cli/handlers/e2e-safe-run.js +23 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +14 -0
- package/dist/cli/handlers/pr.d.ts +5 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +346 -36
- package/dist/cli/handlers/run-wave.js +89 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +56 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +107 -0
- package/dist/cli/registry.d.ts +38 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/adoption.d.ts.map +1 -1
- package/dist/components/adoption.js +1 -2
- package/dist/components/auto-release.d.ts +5 -2
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +9 -4
- package/dist/components/capability.d.ts +47 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/capability.js +25 -0
- package/dist/components/check-hooks.d.ts +4 -1
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-steps.d.ts +74 -0
- package/dist/components/check-steps.d.ts.map +1 -0
- package/dist/components/check-steps.js +102 -0
- package/dist/components/ci-services.d.ts.map +1 -1
- package/dist/components/ci-services.js +1 -2
- package/dist/components/deploy-units.d.ts +12 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +20 -1
- package/dist/components/driver.d.ts +12 -0
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +35 -1
- package/dist/components/groups.d.ts.map +1 -1
- package/dist/components/groups.js +4 -3
- package/dist/components/pr-env-ledger.d.ts.map +1 -1
- package/dist/components/pr-env-ledger.js +1 -2
- package/dist/components/pr-environment.d.ts +1 -1
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +1 -1
- package/dist/components/pr-pipeline.d.ts +137 -5
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +164 -20
- package/dist/components/pr-run.d.ts +8 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +9 -4
- package/dist/components/product-pipeline.d.ts +35 -2
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +24 -5
- package/dist/components/row-lease.d.ts +22 -1
- package/dist/components/row-lease.d.ts.map +1 -1
- package/dist/components/row-lease.js +32 -6
- package/dist/components/wave-plan.d.ts +8 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +18 -2
- package/dist/e2e-harness/bucket.d.ts +21 -0
- package/dist/e2e-harness/bucket.d.ts.map +1 -0
- package/dist/e2e-harness/bucket.js +61 -0
- package/dist/e2e-harness/claim.d.ts +70 -0
- package/dist/e2e-harness/claim.d.ts.map +1 -0
- package/dist/e2e-harness/claim.js +98 -0
- package/dist/e2e-harness/driver.d.ts +64 -0
- package/dist/e2e-harness/driver.d.ts.map +1 -0
- package/dist/e2e-harness/driver.js +243 -0
- package/dist/e2e-harness/forgejo.d.ts +77 -0
- package/dist/e2e-harness/forgejo.d.ts.map +1 -0
- package/dist/e2e-harness/forgejo.js +205 -0
- package/dist/e2e-harness/git.d.ts +32 -0
- package/dist/e2e-harness/git.d.ts.map +1 -0
- package/dist/e2e-harness/git.js +67 -0
- package/dist/e2e-harness/index.d.ts +22 -0
- package/dist/e2e-harness/index.d.ts.map +1 -0
- package/dist/e2e-harness/index.js +47 -0
- package/dist/e2e-harness/jobs.d.ts +8 -0
- package/dist/e2e-harness/jobs.d.ts.map +1 -0
- package/dist/e2e-harness/jobs.js +34 -0
- package/dist/e2e-harness/pins.d.ts +45 -0
- package/dist/e2e-harness/pins.d.ts.map +1 -0
- package/dist/e2e-harness/pins.js +44 -0
- package/dist/e2e-harness/ports.d.ts +113 -0
- package/dist/e2e-harness/ports.d.ts.map +1 -0
- package/dist/e2e-harness/ports.js +4 -0
- package/dist/e2e-harness/reports.d.ts +45 -0
- package/dist/e2e-harness/reports.d.ts.map +1 -0
- package/dist/e2e-harness/reports.js +57 -0
- package/dist/e2e-harness/safe-run-cli.d.ts +17 -0
- package/dist/e2e-harness/safe-run-cli.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run-cli.js +43 -0
- package/dist/e2e-harness/safe-run.d.ts +61 -0
- package/dist/e2e-harness/safe-run.d.ts.map +1 -0
- package/dist/e2e-harness/safe-run.js +172 -0
- package/dist/e2e-harness/scenario.d.ts +11 -0
- package/dist/e2e-harness/scenario.d.ts.map +1 -0
- package/dist/e2e-harness/scenario.js +89 -0
- package/dist/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/dist/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/dist/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/dist/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/dist/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/dist/e2e-harness/schemas/index.d.ts +191 -0
- package/dist/e2e-harness/schemas/index.d.ts.map +1 -0
- package/dist/e2e-harness/schemas/index.js +62 -0
- package/dist/e2e-harness/stack.d.ts +124 -0
- package/dist/e2e-harness/stack.d.ts.map +1 -0
- package/dist/e2e-harness/stack.js +207 -0
- package/dist/e2e-harness/steps.d.ts +11 -0
- package/dist/e2e-harness/steps.d.ts.map +1 -0
- package/dist/e2e-harness/steps.js +22 -0
- package/dist/e2e-harness.d.ts +3 -0
- package/dist/e2e-harness.d.ts.map +1 -0
- package/dist/e2e-harness.js +2 -0
- package/dist/exit-codes.d.ts +7 -1
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +7 -1
- package/dist/lexicon.d.ts +55 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +2 -3
- package/dist/lifecycle/gated-request.d.ts.map +1 -1
- package/dist/lifecycle/gated-request.js +1 -2
- package/dist/lifecycle/git.d.ts +39 -3
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +223 -15
- package/dist/lifecycle/lock-rows.d.ts +23 -0
- package/dist/lifecycle/lock-rows.d.ts.map +1 -1
- package/dist/lifecycle/lock-rows.js +47 -8
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +4 -5
- package/dist/lifecycle/release-catalog.d.ts.map +1 -1
- package/dist/lifecycle/release-catalog.js +1 -1
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +1 -2
- package/dist/lifecycle/release-status.d.ts +20 -0
- package/dist/lifecycle/release-status.d.ts.map +1 -1
- package/dist/lifecycle/release-status.js +1 -22
- package/dist/lifecycle/resource-lock.d.ts +70 -0
- package/dist/lifecycle/resource-lock.d.ts.map +1 -1
- package/dist/lifecycle/resource-lock.js +241 -5
- package/dist/lifecycle/wave-plans.d.ts +23 -7
- package/dist/lifecycle/wave-plans.d.ts.map +1 -1
- package/dist/lifecycle/wave-plans.js +9 -2
- package/dist/op/approval-status.d.ts +103 -0
- package/dist/op/approval-status.d.ts.map +1 -0
- package/dist/op/approval-status.js +197 -0
- package/dist/op/gate.js +21 -4
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/op-waves-capability-spec.d.ts +8 -0
- package/dist/op/op-waves-capability-spec.d.ts.map +1 -1
- package/dist/op/op-waves-capability-spec.js +21 -0
- package/dist/op/op-waves-release-port.js +1 -1
- package/dist/op/op-waves-release.d.ts +2 -1
- package/dist/op/op-waves-release.d.ts.map +1 -1
- package/dist/op/op-waves-release.js +1 -2
- package/dist/op/op-waves-run.d.ts +15 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +195 -31
- package/dist/op/op-waves-stand-down.d.ts.map +1 -1
- package/dist/op/op-waves-stand-down.js +1 -2
- package/dist/op/op-waves.d.ts +53 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +62 -6
- package/dist/op/runtime.d.ts +4 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +2 -3
- package/dist/otlp.d.ts.map +1 -1
- package/dist/otlp.js +1 -2
- package/dist/parallelism.d.ts +17 -0
- package/dist/parallelism.d.ts.map +1 -0
- package/dist/parallelism.js +33 -0
- package/dist/policy-source.d.ts.map +1 -1
- package/dist/policy-source.js +1 -2
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -39
- package/dist/pr-loop.d.ts +9 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +22 -4
- package/dist/pr-merge.d.ts +64 -0
- package/dist/pr-merge.d.ts.map +1 -0
- package/dist/pr-merge.js +78 -0
- package/dist/pr-post.d.ts +70 -1
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +116 -5
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +1 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +1 -2
- package/dist/scheduled-op-cloud.d.ts +32 -0
- package/dist/scheduled-op-cloud.d.ts.map +1 -0
- package/dist/scheduled-op-cloud.js +69 -0
- package/dist/wave-runtime.mjs +351 -328
- package/dist/workspace/ci-lock-grain.d.ts +5 -0
- package/dist/workspace/ci-lock-grain.d.ts.map +1 -1
- package/dist/workspace/ci-lock-grain.js +1 -7
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +5 -1
- package/dist/workspace/pr-report.schema.json +5 -0
- package/package.json +1 -1
- package/src/ci-agent.ts +1 -2
- package/src/ci-audit/__fixtures__/cloudtrail-lookup-bucket.json +37 -0
- package/src/ci-audit/__fixtures__/cloudtrail-writes-window.json +59 -0
- package/src/ci-audit/attribution.ts +260 -0
- package/src/ci-audit/audit-log.ts +220 -0
- package/src/ci-audit/ci-audit.test.ts +175 -0
- package/src/ci-audit/index.ts +14 -0
- package/src/ci-audit/unrecorded.ts +140 -0
- package/src/ci-audit.ts +2 -0
- package/src/ci-control.ts +3 -4
- package/src/ci-estate.ts +1 -2
- package/src/ci-identity-database.test.ts +2 -3
- package/src/ci-identity-targets.test.ts +1 -3
- package/src/ci-identity.ts +2 -3
- package/src/ci-job-guard.test.ts +154 -0
- package/src/ci-job-guard.ts +319 -0
- package/src/ci-jobs.ts +8 -0
- package/src/ci-product-comment-targets.test.ts +45 -0
- package/src/ci-product-words.ts +35 -6
- package/src/ci-product.ts +55 -4
- package/src/ci-respond-run.ts +291 -0
- package/src/ci-respond.test.ts +264 -0
- package/src/ci-respond.ts +412 -0
- package/src/cli/handlers/audit-log.ts +74 -0
- package/src/cli/handlers/build-pr-loop-flags.test.ts +98 -0
- package/src/cli/handlers/build.ts +69 -0
- package/src/cli/handlers/ci-check-job.test.ts +114 -0
- package/src/cli/handlers/ci-check-job.ts +33 -0
- package/src/cli/handlers/ci-check.ts +38 -8
- package/src/cli/handlers/e2e-safe-run.ts +27 -0
- package/src/cli/handlers/lifecycle.ts +13 -0
- package/src/cli/handlers/pr-before-merge.test.ts +1 -1
- package/src/cli/handlers/pr-deploy-inputs.test.ts +1 -1
- package/src/cli/handlers/pr-endpoint.test.ts +1 -1
- package/src/cli/handlers/pr-green.test.ts +1 -1
- package/src/cli/handlers/pr-plan-comment-targets.test.ts +166 -0
- package/src/cli/handlers/pr-plan-flags.test.ts +161 -0
- package/src/cli/handlers/pr-plan-targets.test.ts +1 -1
- package/src/cli/handlers/pr-record.test.ts +34 -2
- package/src/cli/handlers/pr-waves-blocked.test.ts +1 -1
- package/src/cli/handlers/pr-waves.test.ts +1 -1
- package/src/cli/handlers/pr.test.ts +1 -1
- package/src/cli/handlers/pr.ts +311 -32
- package/src/cli/handlers/run-wave.ts +79 -1
- package/src/cli/main.test.ts +1 -1
- package/src/cli/main.ts +56 -2
- package/src/cli/parse-args.ts +77 -0
- package/src/cli/registry.ts +38 -0
- package/src/components/adoption.ts +1 -2
- package/src/components/auto-release.test.ts +4 -2
- package/src/components/auto-release.ts +9 -5
- package/src/components/capability.ts +60 -0
- package/src/components/check-hooks.ts +4 -1
- package/src/components/check-steps.test.ts +70 -0
- package/src/components/check-steps.ts +158 -0
- package/src/components/ci-services.ts +1 -2
- package/src/components/deploy-units.test.ts +18 -1
- package/src/components/deploy-units.ts +26 -1
- package/src/components/driver.ts +35 -1
- package/src/components/groups.ts +4 -2
- package/src/components/plan-flags.test.ts +46 -0
- package/src/components/pr-comment-preview-targets.test.ts +34 -0
- package/src/components/pr-env-ledger.ts +1 -2
- package/src/components/pr-env-run-bundle.test.ts +0 -20
- package/src/components/pr-environment.ts +1 -1
- package/src/components/pr-pipeline-runners.test.ts +80 -0
- package/src/components/pr-pipeline.ts +244 -20
- package/src/components/pr-run.ts +17 -6
- package/src/components/pr-stale-job.test.ts +34 -0
- package/src/components/product-pipeline.ts +50 -8
- package/src/components/row-lease.test.ts +61 -1
- package/src/components/row-lease.ts +48 -7
- package/src/components/wave-plan.ts +18 -2
- package/src/e2e-harness/__project__/chant.config.ts +4 -0
- package/src/e2e-harness/__project__/src/compose.ts +33 -0
- package/src/e2e-harness/bucket.ts +69 -0
- package/src/e2e-harness/claim.test.ts +150 -0
- package/src/e2e-harness/claim.ts +140 -0
- package/src/e2e-harness/driver.test.ts +304 -0
- package/src/e2e-harness/driver.ts +294 -0
- package/src/e2e-harness/forgejo.ts +267 -0
- package/src/e2e-harness/git.ts +96 -0
- package/src/e2e-harness/index.ts +49 -0
- package/src/e2e-harness/jobs.ts +35 -0
- package/src/e2e-harness/pins.ts +52 -0
- package/src/e2e-harness/ports.ts +130 -0
- package/src/e2e-harness/reports.ts +79 -0
- package/src/e2e-harness/safe-run-cli.test.ts +102 -0
- package/src/e2e-harness/safe-run-cli.ts +54 -0
- package/src/e2e-harness/safe-run.ts +198 -0
- package/src/e2e-harness/scenario.ts +89 -0
- package/src/e2e-harness/schemas/README.md +62 -0
- package/src/e2e-harness/schemas/demo-cycle.schema.json +282 -0
- package/src/e2e-harness/schemas/demo-step.schema.json +245 -0
- package/src/e2e-harness/schemas/e2e-claim-row.schema.json +33 -0
- package/src/e2e-harness/schemas/e2e-claims.schema.json +18 -0
- package/src/e2e-harness/schemas/e2e-scenario.schema.json +150 -0
- package/src/e2e-harness/schemas/index.ts +220 -0
- package/src/e2e-harness/schemas.test.ts +145 -0
- package/src/e2e-harness/stack.test.ts +124 -0
- package/src/e2e-harness/stack.ts +306 -0
- package/src/e2e-harness/steps.ts +30 -0
- package/src/e2e-harness.ts +2 -0
- package/src/exit-codes.test.ts +3 -2
- package/src/exit-codes.ts +7 -1
- package/src/gate-decision-bundle.test.ts +0 -2
- package/src/lexicon.ts +57 -0
- package/src/lifecycle/control-entries-ledger.test.ts +2 -3
- package/src/lifecycle/gate-ledger.ts +2 -3
- package/src/lifecycle/gated-request.ts +1 -2
- package/src/lifecycle/git.test.ts +155 -0
- package/src/lifecycle/git.ts +213 -17
- package/src/lifecycle/lock-rows.test.ts +6 -1
- package/src/lifecycle/lock-rows.ts +58 -7
- package/src/lifecycle/query.ts +4 -5
- package/src/lifecycle/release-catalog.test.ts +3 -4
- package/src/lifecycle/release-catalog.ts +1 -1
- package/src/lifecycle/release-ledger.ts +1 -2
- package/src/lifecycle/release-status.test.ts +3 -4
- package/src/lifecycle/release-status.ts +1 -2
- package/src/lifecycle/resource-lock-wait.test.ts +292 -0
- package/src/lifecycle/resource-lock.ts +261 -7
- package/src/lifecycle/wave-plans.ts +33 -5
- package/src/op/approval-status.test.ts +134 -0
- package/src/op/approval-status.ts +235 -0
- package/src/op/gate-review.test.ts +2 -1
- package/src/op/gate.test.ts +7 -5
- package/src/op/gate.ts +20 -4
- package/src/op/index.ts +2 -0
- package/src/op/op-waves-after-plan.test.ts +11 -0
- package/src/op/op-waves-capability-spec.ts +20 -0
- package/src/op/op-waves-ledger-lock.test.ts +208 -0
- package/src/op/op-waves-parallelism.test.ts +89 -0
- package/src/op/op-waves-pull-request.test.ts +78 -1
- package/src/op/op-waves-release-port.ts +1 -1
- package/src/op/op-waves-release.ts +2 -3
- package/src/op/op-waves-run.ts +196 -31
- package/src/op/op-waves-stand-down.ts +1 -2
- package/src/op/op-waves.ts +81 -6
- package/src/op/runtime.ts +6 -3
- package/src/otlp.ts +1 -2
- package/src/parallelism.test.ts +38 -0
- package/src/parallelism.ts +33 -0
- package/src/policy-source.ts +1 -2
- package/src/pr-forge-bundle.test.ts +1 -1
- package/src/pr-forge.ts +54 -35
- package/src/pr-loop-bundle.test.ts +0 -2
- package/src/pr-loop-narrowed.test.ts +63 -0
- package/src/pr-loop.ts +30 -4
- package/src/pr-merge.test.ts +100 -0
- package/src/pr-merge.ts +105 -0
- package/src/pr-post-stale.test.ts +163 -0
- package/src/pr-post.ts +159 -5
- package/src/pr-report-url.ts +1 -2
- package/src/product-subpaths-plain-node.e2e.test.ts +1 -0
- package/src/release-floors.ts +1 -1
- package/src/run-event.ts +1 -2
- package/src/scheduled-op-cloud.ts +68 -0
- package/src/stage-hooks-bundle.test.ts +0 -2
- package/src/workspace/ci-lock-grain.ts +1 -2
- package/src/workspace/ci-run.ts +5 -1
- package/src/workspace/pr-report.schema.json +5 -0
|
@@ -6,14 +6,20 @@
|
|
|
6
6
|
* `ci.lockGrain` (ruling A) says what one apply holds while it applies, and,
|
|
7
7
|
* under `ci.locks`, what a pull request's target locks name (ruling D):
|
|
8
8
|
*
|
|
9
|
-
* - `target`: the component, member, root or stack.
|
|
10
|
-
*
|
|
9
|
+
* - `target`: the component, member, root or stack. A lexicon that names
|
|
10
|
+
* the target's row (`targetLockRow`: `stack <project>/<stack>` for stock
|
|
11
|
+
* Pulumi, `root <root>` for Terraform, tofu and Terragrunt) has the apply
|
|
12
|
+
* wait for that row on the ledger, oldest commit first, up to the job's
|
|
13
|
+
* timeout (ruling for ci-products 2026-10-28, "Ledger lock"). Any other
|
|
14
|
+
* lexicon takes no row lease, and the engine's own lock keeps one
|
|
15
|
+
* target's applies apart.
|
|
11
16
|
* - `resource`: one row per resource the plan changes, from the lexicon's
|
|
12
17
|
* `lockRows` hook. The apply leases those rows before it applies and lets
|
|
13
18
|
* go after, and a pull request under `ci.locks` locks the same keys in
|
|
14
19
|
* place of its component names.
|
|
15
|
-
* - `repo`: one apply at a time in the repository
|
|
16
|
-
*
|
|
20
|
+
* - `repo`: one apply at a time in the repository: the apply waits for the
|
|
21
|
+
* `repo` row, which meets every other row, in the same queue. The waves
|
|
22
|
+
* pipelines carry no concurrency group of their own.
|
|
17
23
|
*
|
|
18
24
|
* Absent, each member takes its lexicon's `defaultLockGrain`, else `target`.
|
|
19
25
|
*
|
|
@@ -21,7 +27,10 @@
|
|
|
21
27
|
* of cover (ruling C): a `stack <project>/<stack>` row conflicts with every
|
|
22
28
|
* `urn urn:pulumi:<stack>::<project>::...` row of that stack, which is how a
|
|
23
29
|
* plunge apply whose components may register children only at apply locks
|
|
24
|
-
* the whole stack and still meets a run holding one of its resources.
|
|
30
|
+
* the whole stack and still meets a run holding one of its resources. A
|
|
31
|
+
* waiting grain's rows ({@link PlannedLock.queue}) use the same keys: a stock
|
|
32
|
+
* stack waits on `stack <project>/<stack>`, so a plunge run on that stack's
|
|
33
|
+
* URNs meets it too, and the `repo` row meets every row.
|
|
25
34
|
*/
|
|
26
35
|
import { parsePulumiUrn } from "../pulumi-urn";
|
|
27
36
|
|
|
@@ -48,6 +57,13 @@ export interface PlannedLock {
|
|
|
48
57
|
source: "step" | "declared" | "lexicon" | "default";
|
|
49
58
|
/** The rows, sorted by key. Empty on any grain but `resource`. */
|
|
50
59
|
rows: LockRow[];
|
|
60
|
+
/**
|
|
61
|
+
* The rows the apply waits for on the `target` and `repo` grains (ruling
|
|
62
|
+
* for ci-products 2026-10-28): the target's own row, from the lexicon's
|
|
63
|
+
* `targetLockRow`, or the `repo` row. Absent when the grain is `resource`
|
|
64
|
+
* or the lexicon names no target row.
|
|
65
|
+
*/
|
|
66
|
+
queue?: LockRow[];
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
/** A lexicon refused the grain asked of a member, by name (#4552: `resource` on Terraform, tofu, Terragrunt and stock Pulumi). */
|
|
@@ -67,6 +83,19 @@ export function stackRowKey(project: string, stack: string): string {
|
|
|
67
83
|
return `stack ${project}/${stack}`;
|
|
68
84
|
}
|
|
69
85
|
|
|
86
|
+
/** The key of the row that stands for a whole Terraform, tofu or Terragrunt root. A choudoufu root keys its resources `root <root> <address>` on the resource grain and never takes this row. */
|
|
87
|
+
export function rootRowKey(root: string): string {
|
|
88
|
+
return `root ${root}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The key of the row a `repo`-grain apply waits for: it meets every other row. */
|
|
92
|
+
export const REPO_ROW_KEY = "repo";
|
|
93
|
+
|
|
94
|
+
/** The row a `repo`-grain apply waits for. */
|
|
95
|
+
export function repoLockRow(target: string): LockRow {
|
|
96
|
+
return { key: REPO_ROW_KEY, target, address: "the repository" };
|
|
97
|
+
}
|
|
98
|
+
|
|
70
99
|
/** The key of a URN's row. */
|
|
71
100
|
export function urnRowKey(urn: string): string {
|
|
72
101
|
return `urn ${urn}`;
|
|
@@ -86,7 +115,7 @@ export function lockRowCover(key: string): string | undefined {
|
|
|
86
115
|
|
|
87
116
|
/** Whether a holder of row `a` keeps row `b` from being taken: the same key, or one covers the other. */
|
|
88
117
|
export function lockRowsConflict(a: string, b: string): boolean {
|
|
89
|
-
return a === b || lockRowCover(a) === b || lockRowCover(b) === a;
|
|
118
|
+
return a === b || a === REPO_ROW_KEY || b === REPO_ROW_KEY || lockRowCover(a) === b || lockRowCover(b) === a;
|
|
90
119
|
}
|
|
91
120
|
|
|
92
121
|
/** Rows deduplicated by key and sorted, so two takes of the same rows write the same file. */
|
|
@@ -102,6 +131,7 @@ export interface LockGrainHooks {
|
|
|
102
131
|
defaultLockGrain?(input: never, plan?: never): LockGrain | Promise<LockGrain>;
|
|
103
132
|
lockGrainRefusal?(input: never, grain: LockGrain, plan?: never): string | undefined | Promise<string | undefined>;
|
|
104
133
|
lockRows?(input: never, plan: never): LockRow[] | Promise<LockRow[]>;
|
|
134
|
+
targetLockRow?(input: never, plan?: never): LockRow | undefined | Promise<LockRow | undefined>;
|
|
105
135
|
}
|
|
106
136
|
|
|
107
137
|
/**
|
|
@@ -118,11 +148,32 @@ export async function resolvePlannedLock(capability: LockGrainHooks, input: unkn
|
|
|
118
148
|
const grain: LockGrain = step ?? declared ?? (capability.defaultLockGrain ? await capability.defaultLockGrain(input as never, plan as never) : "target");
|
|
119
149
|
const refused = capability.lockGrainRefusal ? await capability.lockGrainRefusal(input as never, grain, plan as never) : undefined;
|
|
120
150
|
if (refused) throw new LockGrainRefusedError(plan.member, grain, refused);
|
|
121
|
-
if (grain !== "resource")
|
|
151
|
+
if (grain !== "resource") {
|
|
152
|
+
const queue = await queueRowsOf(capability, input, plan.member, grain, plan);
|
|
153
|
+
return { grain, source, rows: [], ...(queue.length > 0 ? { queue } : {}) };
|
|
154
|
+
}
|
|
122
155
|
if (!capability.lockRows) throw new LockGrainRefusedError(plan.member, grain, `${capability.kind} names no rows for its resources; set ci.lockGrain to target`);
|
|
123
156
|
return { grain, source, rows: sortedLockRows(await capability.lockRows(input as never, plan as never)) };
|
|
124
157
|
}
|
|
125
158
|
|
|
159
|
+
/**
|
|
160
|
+
* The rows an apply on the `target` or `repo` grain waits for (ruling for
|
|
161
|
+
* ci-products 2026-10-28): the `repo` row, or the target's row from the
|
|
162
|
+
* lexicon's `targetLockRow`. Empty for `resource`, and for a lexicon that
|
|
163
|
+
* names no target row.
|
|
164
|
+
*/
|
|
165
|
+
export async function queueRowsOf(capability: LockGrainHooks, input: unknown, member: string, grain: LockGrain, plan?: unknown): Promise<LockRow[]> {
|
|
166
|
+
if (grain === "repo") return [repoLockRow(member)];
|
|
167
|
+
if (grain !== "target" || !capability.targetLockRow) return [];
|
|
168
|
+
const row = await capability.targetLockRow(input as never, plan as never);
|
|
169
|
+
return row ? [row] : [];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Every row the waiting members of `locks` wait for, deduplicated and sorted. */
|
|
173
|
+
export function queueRowsOfLocks(locks: Readonly<Record<string, PlannedLock>> | undefined): LockRow[] {
|
|
174
|
+
return sortedLockRows(Object.values(locks ?? {}).flatMap((l) => l.queue ?? []));
|
|
175
|
+
}
|
|
176
|
+
|
|
126
177
|
/**
|
|
127
178
|
* A member's grain before anything planned (#4594), by the order
|
|
128
179
|
* {@link resolvePlannedLock} uses: the step input's own `lockGrain`, else the
|
package/src/lifecycle/query.ts
CHANGED
|
@@ -47,7 +47,6 @@ import type { LifecycleSnapshot } from "./types";
|
|
|
47
47
|
import { appliedGatePath, finishedApply, parseAppliedGateFile } from "./gate-applied";
|
|
48
48
|
import { PR_ENV_LEDGER_DIR, PR_ENV_LEDGER_FILE, parsePrEnvRecords } from "../components/pr-environment";
|
|
49
49
|
import { CONTROL_LEDGER_DIR, CONTROL_LEDGER_FILE, parseControlEntries } from "../control/records";
|
|
50
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
51
50
|
import { parseReleaseStatus, RELEASE_STATUS_FILE } from "./release-status";
|
|
52
51
|
|
|
53
52
|
/** The version of the table schema below. */
|
|
@@ -150,16 +149,16 @@ export const QUERY_OWNERSHIP_COLUMNS_FLOOR = "0.124.54";
|
|
|
150
149
|
* `request` on a `gates` row (#4551). Columns added within version 1: a row
|
|
151
150
|
* from an older chant lacks them.
|
|
152
151
|
*/
|
|
153
|
-
export const LEDGER_WAVE_COLUMNS_FLOOR =
|
|
152
|
+
export const LEDGER_WAVE_COLUMNS_FLOOR = "0.124.55";
|
|
154
153
|
|
|
155
154
|
/** The first chant with the `applies` and `pr_envs` tables (#4551), added within version 1. */
|
|
156
|
-
export const LEDGER_APPLIES_FLOOR =
|
|
155
|
+
export const LEDGER_APPLIES_FLOOR = "0.124.55";
|
|
157
156
|
|
|
158
157
|
/** The first chant with the `control_entries` table (#4593), added within version 1. */
|
|
159
|
-
export const LEDGER_CONTROL_ENTRIES_FLOOR =
|
|
158
|
+
export const LEDGER_CONTROL_ENTRIES_FLOOR = "0.124.55";
|
|
160
159
|
|
|
161
160
|
/** The first chant with the `release_status` table (#4596), added within version 1 (chant#4551's ruling C). */
|
|
162
|
-
export const LEDGER_RELEASE_STATUS_FLOOR =
|
|
161
|
+
export const LEDGER_RELEASE_STATUS_FLOOR = "0.124.55";
|
|
163
162
|
|
|
164
163
|
export type QueryTable = keyof typeof QUERY_TABLES;
|
|
165
164
|
|
|
@@ -11,7 +11,6 @@ import { spawnSync } from "node:child_process";
|
|
|
11
11
|
import { writeFileSync } from "node:fs";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import schema from "../workspace/release-catalog.schema.json";
|
|
14
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
15
14
|
import { appendReleaseRecord, InvalidReleaseRecordError, readReleaseLedger, RELEASE_VERSION_FLOOR, type ReleaseRecord } from "./release-ledger";
|
|
16
15
|
import { parseReleaseLedger } from "./release-read";
|
|
17
16
|
import {
|
|
@@ -45,9 +44,9 @@ describe("release catalog schema", () => {
|
|
|
45
44
|
expect(schema.$id).toBe(RELEASE_CATALOG_SCHEMA_ID);
|
|
46
45
|
});
|
|
47
46
|
|
|
48
|
-
test("its floors
|
|
49
|
-
expect(RELEASE_CATALOG_FLOOR).toBe(
|
|
50
|
-
expect(RELEASE_VERSION_FLOOR).toBe(
|
|
47
|
+
test("its floors shipped in 0.124.55", () => {
|
|
48
|
+
expect(RELEASE_CATALOG_FLOOR).toBe("0.124.55");
|
|
49
|
+
expect(RELEASE_VERSION_FLOOR).toBe("0.124.55");
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
|
|
@@ -25,7 +25,7 @@ import { NEXT_RELEASE } from "../release-floors";
|
|
|
25
25
|
import type { ReleaseRecord } from "./release-ledger";
|
|
26
26
|
|
|
27
27
|
/** The first chant that writes and reads a release catalog (#4595). */
|
|
28
|
-
export const RELEASE_CATALOG_FLOOR =
|
|
28
|
+
export const RELEASE_CATALOG_FLOOR = "0.124.55";
|
|
29
29
|
|
|
30
30
|
/** The catalog document's `$schema`. */
|
|
31
31
|
export const RELEASE_CATALOG_SCHEMA_ID: string = schema.$id;
|
|
@@ -33,7 +33,6 @@ import { warnOnLegacyDigests, withoutReadFlags, type LegacyDigestFlag } from "./
|
|
|
33
33
|
import { appendReleaseRecordLine, readReleaseLedgerLines, listLedgerEnvironments as gitListLedgerEnvironments, type LedgerLocation } from "./git";
|
|
34
34
|
import { parseReleaseLedger, validateReleaseRecord } from "./release-read";
|
|
35
35
|
import type { GateResolutionRecord } from "./gate-ledger";
|
|
36
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
37
36
|
|
|
38
37
|
// The pure readers live apart, so a bundle can import them without git (#3865).
|
|
39
38
|
export { validateReleaseRecord, parseReleaseLedger, releaseLedgerLines, readReleaseRecords, listReleaseEnvironmentsOn } from "./release-read";
|
|
@@ -81,7 +80,7 @@ export const RUN_ORIGIN_JOB_FLOOR = "0.124.32";
|
|
|
81
80
|
* (#4595). A record from an older chant has none, and a reader lists it by
|
|
82
81
|
* digest.
|
|
83
82
|
*/
|
|
84
|
-
export const RELEASE_VERSION_FLOOR =
|
|
83
|
+
export const RELEASE_VERSION_FLOOR = "0.124.55";
|
|
85
84
|
|
|
86
85
|
/**
|
|
87
86
|
* The gate resolution that admitted a deploy (#4020): the gate's address in the
|
|
@@ -8,7 +8,6 @@ import { execFileSync } from "node:child_process";
|
|
|
8
8
|
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { tmpdir } from "node:os";
|
|
10
10
|
import { dirname, join } from "node:path";
|
|
11
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
12
11
|
import { gitLedgerReadPort } from "./git";
|
|
13
12
|
import { readLedgerTable } from "./ledger-read";
|
|
14
13
|
import { clearMemberLedgerCache } from "./member-ledger";
|
|
@@ -77,9 +76,9 @@ const status = (over: Partial<ReleaseStatusInput> = {}): ReleaseStatusInput => (
|
|
|
77
76
|
});
|
|
78
77
|
|
|
79
78
|
describe("release status floors", () => {
|
|
80
|
-
test("
|
|
81
|
-
expect(RELEASE_STATUS_FLOOR).toBe(
|
|
82
|
-
expect(LEDGER_RELEASE_STATUS_FLOOR).toBe(
|
|
79
|
+
test("shipped in 0.124.55", () => {
|
|
80
|
+
expect(RELEASE_STATUS_FLOOR).toBe("0.124.55");
|
|
81
|
+
expect(LEDGER_RELEASE_STATUS_FLOOR).toBe("0.124.55");
|
|
83
82
|
});
|
|
84
83
|
});
|
|
85
84
|
|
|
@@ -18,13 +18,12 @@
|
|
|
18
18
|
* so `chant query` (./query.ts) and a product bundle read the table without
|
|
19
19
|
* it.
|
|
20
20
|
*/
|
|
21
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
22
21
|
import type { LedgerReadPort } from "./ledger-port";
|
|
23
22
|
import type { LedgerLocation } from "./git";
|
|
24
23
|
import type { CatalogStatusInput, ReleaseStatusValue } from "./release-catalog";
|
|
25
24
|
|
|
26
25
|
/** The first chant that writes and reads `<env>/release-status.jsonl`, and lists the `release_status` table (#4596). */
|
|
27
|
-
export const RELEASE_STATUS_FLOOR =
|
|
26
|
+
export const RELEASE_STATUS_FLOOR = "0.124.55";
|
|
28
27
|
|
|
29
28
|
/** The file a status record is appended to, in its environment's directory. */
|
|
30
29
|
export const RELEASE_STATUS_FILE = "release-status.jsonl";
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ruling for ci-products (2026-10-28), "Ledger lock": a stock Pulumi
|
|
3
|
+
* stack or a Terraform root waits for its row on chant's ledger, oldest
|
|
4
|
+
* commit first, up to the job's timeout, and plunge stacks on the resource
|
|
5
|
+
* grain lease their resource rows and never wait on another stack.
|
|
6
|
+
*
|
|
7
|
+
* Each test has a bare remote and one clone per writer, as two pushes'
|
|
8
|
+
* wave jobs have on a forge. The waits use a pause the test drives, so the
|
|
9
|
+
* order of reads is fixed and nothing sleeps.
|
|
10
|
+
*/
|
|
11
|
+
import { afterAll, describe, expect, test } from "vitest";
|
|
12
|
+
import { execFileSync } from "node:child_process";
|
|
13
|
+
import { mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
14
|
+
import { tmpdir } from "node:os";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { rootRowKey, stackRowKey, urnRowKey, type LockRow } from "./lock-rows";
|
|
17
|
+
import {
|
|
18
|
+
leaseLockRows,
|
|
19
|
+
lockWaitSeconds,
|
|
20
|
+
DEFAULT_LOCK_WAIT_SECONDS,
|
|
21
|
+
parseLockRows,
|
|
22
|
+
readLockRows,
|
|
23
|
+
renderLockRows,
|
|
24
|
+
waiterBefore,
|
|
25
|
+
withWaiter,
|
|
26
|
+
withRowsTaken,
|
|
27
|
+
type LockRowHolder,
|
|
28
|
+
} from "./resource-lock";
|
|
29
|
+
|
|
30
|
+
const dirs: string[] = [];
|
|
31
|
+
afterAll(() => {
|
|
32
|
+
for (const d of dirs) rmSync(d, { recursive: true, force: true });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function tmp(prefix: string): string {
|
|
36
|
+
const d = realpathSync(mkdtempSync(join(tmpdir(), prefix)));
|
|
37
|
+
dirs.push(d);
|
|
38
|
+
return d;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function git(cwd: string, ...args: string[]): string {
|
|
42
|
+
return execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A bare remote with one commit on main, and `n` clones of it, each a writer. */
|
|
46
|
+
function writers(n: number): { remote: string; clones: string[] } {
|
|
47
|
+
const remote = tmp("chant-lock-wait-remote-");
|
|
48
|
+
git(remote, "init", "-q", "--bare", "-b", "main");
|
|
49
|
+
const seed = tmp("chant-lock-wait-seed-");
|
|
50
|
+
git(seed, "init", "-q", "-b", "main");
|
|
51
|
+
git(seed, "config", "user.email", "seed@chant.dev");
|
|
52
|
+
git(seed, "config", "user.name", "Seed");
|
|
53
|
+
git(seed, "config", "commit.gpgsign", "false");
|
|
54
|
+
writeFileSync(join(seed, "README.md"), "# t\n");
|
|
55
|
+
git(seed, "add", "README.md");
|
|
56
|
+
git(seed, "commit", "-q", "-m", "init");
|
|
57
|
+
git(seed, "remote", "add", "origin", remote);
|
|
58
|
+
git(seed, "push", "-q", "origin", "main");
|
|
59
|
+
const clones: string[] = [];
|
|
60
|
+
for (let i = 0; i < n; i++) {
|
|
61
|
+
const c = tmp(`chant-lock-wait-clone-${i}-`);
|
|
62
|
+
git(c, "clone", "-q", remote, ".");
|
|
63
|
+
git(c, "config", "user.email", `w${i}@chant.dev`);
|
|
64
|
+
git(c, "config", "user.name", `Writer ${i}`);
|
|
65
|
+
git(c, "config", "commit.gpgsign", "false");
|
|
66
|
+
clones.push(c);
|
|
67
|
+
}
|
|
68
|
+
return { remote, clones };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const holder = (run: string, sha?: string): LockRowHolder => ({ run, at: new Date().toISOString(), ...(sha ? { sha } : {}) });
|
|
72
|
+
const alive = async () => "alive" as const;
|
|
73
|
+
const stackRow = (stack: string): LockRow => ({ key: stackRowKey("shop", stack), target: `shop/${stack}`, address: `shop/${stack}` });
|
|
74
|
+
const urnRow = (stack: string, name: string): LockRow => {
|
|
75
|
+
const urn = `urn:pulumi:${stack}::shop::aws:sqs/queue:Queue::${name}`;
|
|
76
|
+
return { key: urnRowKey(urn), target: `shop/${stack}`, address: urn };
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** A promise and its resolver. */
|
|
80
|
+
function signal(): { promise: Promise<void>; fire: () => void } {
|
|
81
|
+
let fire!: () => void;
|
|
82
|
+
const promise = new Promise<void>((r) => (fire = r));
|
|
83
|
+
return { promise, fire };
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
describe("the queue in the rows file", () => {
|
|
87
|
+
test("a waiter round-trips, and the file leaves `waiting` out when nobody waits", () => {
|
|
88
|
+
const empty = parseLockRows(null);
|
|
89
|
+
expect(renderLockRows(empty)).not.toContain("waiting");
|
|
90
|
+
const queued = withWaiter(empty, { run: "12", at: "2026-10-28T10:00:00.000Z", keys: ["stack shop/staging"], commitAt: "2026-10-28T09:59:00Z" });
|
|
91
|
+
const back = parseLockRows(renderLockRows(queued));
|
|
92
|
+
expect(back.waiting).toEqual({ "12": { run: "12", at: "2026-10-28T10:00:00.000Z", keys: ["stack shop/staging"], commitAt: "2026-10-28T09:59:00Z" } });
|
|
93
|
+
// Taking the rows takes the run out of the queue.
|
|
94
|
+
const took = withRowsTaken(back, ["stack shop/staging"], holder("12"), []);
|
|
95
|
+
expect(took.waiting).toBeUndefined();
|
|
96
|
+
expect(took.rows).toEqual({ "stack shop/staging": "12" });
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("the older commit goes first, then the lower run id, then the commit sha; no commit time goes last", () => {
|
|
100
|
+
expect(waiterBefore({ run: "20", commitAt: "2026-10-28T10:00:00Z" }, { run: "9", commitAt: "2026-10-28T10:05:00Z" })).toBe(true);
|
|
101
|
+
expect(waiterBefore({ run: "9", commitAt: "2026-10-28T10:00:00Z" }, { run: "20", commitAt: "2026-10-28T10:00:00Z" })).toBe(true);
|
|
102
|
+
expect(waiterBefore({ run: "20", commitAt: "2026-10-28T10:00:00Z" }, { run: "9", commitAt: "2026-10-28T10:00:00Z" })).toBe(false);
|
|
103
|
+
expect(waiterBefore({ run: "local:a:1", commitAt: "2026-10-28T10:00:00Z" }, { run: "local:b:1", commitAt: "2026-10-28T10:00:00Z" })).toBe(true);
|
|
104
|
+
expect(waiterBefore({ run: "7", commitAt: "2026-10-28T10:00:00Z", sha: "aaa" }, { run: "7", commitAt: "2026-10-28T10:00:00Z", sha: "bbb" })).toBe(true);
|
|
105
|
+
expect(waiterBefore({ run: "1" }, { run: "2", commitAt: "2026-10-28T10:00:00Z" })).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test("CHANT_LOCK_WAIT sets the wait; the default sits under a Forgejo runner's three hours", () => {
|
|
109
|
+
expect(lockWaitSeconds({ CHANT_LOCK_WAIT: "600" })).toBe(600);
|
|
110
|
+
expect(lockWaitSeconds({})).toBe(DEFAULT_LOCK_WAIT_SECONDS);
|
|
111
|
+
expect(DEFAULT_LOCK_WAIT_SECONDS).toBeLessThan(3 * 3600);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("a root row is the root's key, apart from a choudoufu root's resource rows", () => {
|
|
115
|
+
expect(rootRowKey("stacks/net")).toBe("root stacks/net");
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe("two writers on a bare-remote ledger", () => {
|
|
120
|
+
test("the second writer waits for the stack row the first holds, then takes it once the first lets go", async () => {
|
|
121
|
+
const { remote, clones } = writers(2);
|
|
122
|
+
const [a, b] = clones as [string, string];
|
|
123
|
+
const first = await leaseLockRows("pr-apply", [stackRow("staging")], { cwd: a, alive, holder: holder("101") });
|
|
124
|
+
expect(first.ok).toBe(true);
|
|
125
|
+
if (!first.ok) return;
|
|
126
|
+
|
|
127
|
+
const lines: string[] = [];
|
|
128
|
+
let pauses = 0;
|
|
129
|
+
let queuedOnRemote: unknown;
|
|
130
|
+
const second = await leaseLockRows("pr-apply", [stackRow("staging")], {
|
|
131
|
+
cwd: b,
|
|
132
|
+
alive,
|
|
133
|
+
holder: holder("102"),
|
|
134
|
+
wait: {
|
|
135
|
+
deadline: Date.now() + 60_000,
|
|
136
|
+
pollMs: 0,
|
|
137
|
+
commitAt: "2026-10-28T10:05:00Z",
|
|
138
|
+
log: (l) => lines.push(l),
|
|
139
|
+
sleep: async () => {
|
|
140
|
+
pauses++;
|
|
141
|
+
if (pauses === 1) {
|
|
142
|
+
// While B waits, the remote's file names it in the queue, behind A's hold.
|
|
143
|
+
queuedOnRemote = parseLockRows(git(remote, "show", "chant/lifecycle:_locks/rows/pr-apply.json")).waiting;
|
|
144
|
+
expect(await first.lease.release()).toBe(true);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
expect(second.ok).toBe(true);
|
|
150
|
+
expect(pauses).toBe(1);
|
|
151
|
+
expect(queuedOnRemote).toMatchObject({ "102": { run: "102", keys: ["stack shop/staging"], commitAt: "2026-10-28T10:05:00Z" } });
|
|
152
|
+
expect(lines.join("\n")).toContain("run 101 is applying shop/staging");
|
|
153
|
+
const now = await readLockRows("pr-apply", { cwd: a });
|
|
154
|
+
expect(now.rows).toEqual({ "stack shop/staging": "102" });
|
|
155
|
+
expect(now.waiting).toBeUndefined();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("two plunge stacks on the resource grain lease their URN rows side by side and never wait", async () => {
|
|
159
|
+
const { clones } = writers(2);
|
|
160
|
+
const [a, b] = clones as [string, string];
|
|
161
|
+
// Two pushes on one plunge stack that change disjoint resources (pw-disjoint), and a second stack beside them.
|
|
162
|
+
const events = await leaseLockRows("pr-apply", [urnRow("dev", "events")], { cwd: a, alive, holder: holder("201") });
|
|
163
|
+
const worker = await leaseLockRows("pr-apply", [urnRow("dev", "worker-3"), urnRow("prod-us", "orders")], { cwd: b, alive, holder: holder("202") });
|
|
164
|
+
expect(events.ok).toBe(true);
|
|
165
|
+
expect(worker.ok).toBe(true);
|
|
166
|
+
const now = await readLockRows("pr-apply", { cwd: a });
|
|
167
|
+
expect(Object.values(now.rows).sort()).toEqual(["201", "202", "202"]);
|
|
168
|
+
expect(now.waiting).toBeUndefined();
|
|
169
|
+
// A resource-grain take on a URN another run holds is refused at once, held, with no wait.
|
|
170
|
+
const clash = await leaseLockRows("pr-apply", [urnRow("dev", "events")], { cwd: b, alive, holder: holder("203") });
|
|
171
|
+
expect(clash.ok).toBe(false);
|
|
172
|
+
if (!clash.ok) expect(clash.timedOut).toBeUndefined();
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("a wait that reaches the job's deadline fails by name and leaves the queue", async () => {
|
|
176
|
+
const { clones } = writers(2);
|
|
177
|
+
const [a, b] = clones as [string, string];
|
|
178
|
+
const first = await leaseLockRows("pr-apply", [stackRow("prod-eu")], { cwd: a, alive, holder: holder("301") });
|
|
179
|
+
expect(first.ok).toBe(true);
|
|
180
|
+
let clock = 1_000_000;
|
|
181
|
+
let pauses = 0;
|
|
182
|
+
const second = await leaseLockRows("pr-apply", [stackRow("prod-eu")], {
|
|
183
|
+
cwd: b,
|
|
184
|
+
alive,
|
|
185
|
+
holder: holder("302"),
|
|
186
|
+
wait: {
|
|
187
|
+
deadline: clock + 30_000,
|
|
188
|
+
pollMs: 10_000,
|
|
189
|
+
now: () => clock,
|
|
190
|
+
sleep: async (ms) => {
|
|
191
|
+
pauses++;
|
|
192
|
+
clock += ms;
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
expect(second.ok).toBe(false);
|
|
197
|
+
if (second.ok) return;
|
|
198
|
+
expect(second.timedOut).toBe(true);
|
|
199
|
+
expect(second.message).toMatch(/^waited 30s for stack shop\/prod-eu of pr-apply and gave up at the job's deadline: run 301 is applying shop\/prod-eu/);
|
|
200
|
+
expect(pauses).toBe(3);
|
|
201
|
+
const now = await readLockRows("pr-apply", { cwd: a });
|
|
202
|
+
expect(now.rows).toEqual({ "stack shop/prod-eu": "301" });
|
|
203
|
+
expect(now.waiting).toBeUndefined();
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
test("of two waiters, the older commit takes the row first, whichever joined the queue first", async () => {
|
|
207
|
+
const { clones } = writers(3);
|
|
208
|
+
const [a, b, c] = clones as [string, string, string];
|
|
209
|
+
const holding = await leaseLockRows("pr-apply", [stackRow("staging")], { cwd: a, alive, holder: holder("401") });
|
|
210
|
+
expect(holding.ok).toBe(true);
|
|
211
|
+
if (!holding.ok) return;
|
|
212
|
+
|
|
213
|
+
const order: string[] = [];
|
|
214
|
+
const cJoined = signal();
|
|
215
|
+
const aReleased = signal();
|
|
216
|
+
const bSawC = signal();
|
|
217
|
+
const cTook = signal();
|
|
218
|
+
const cReleased = signal();
|
|
219
|
+
const bLines: string[] = [];
|
|
220
|
+
let bPauses = 0;
|
|
221
|
+
let cPauses = 0;
|
|
222
|
+
let older: Promise<Awaited<ReturnType<typeof leaseLockRows>>> | undefined;
|
|
223
|
+
|
|
224
|
+
const startOlder = () =>
|
|
225
|
+
leaseLockRows("pr-apply", [stackRow("staging")], {
|
|
226
|
+
cwd: c,
|
|
227
|
+
alive,
|
|
228
|
+
holder: holder("403"),
|
|
229
|
+
wait: {
|
|
230
|
+
deadline: Date.now() + 60_000,
|
|
231
|
+
pollMs: 0,
|
|
232
|
+
commitAt: "2026-10-28T10:00:00Z",
|
|
233
|
+
sleep: async () => {
|
|
234
|
+
cPauses++;
|
|
235
|
+
if (cPauses === 1) {
|
|
236
|
+
cJoined.fire();
|
|
237
|
+
await aReleased.promise;
|
|
238
|
+
// C reads again only once B has read the free row and stayed behind C.
|
|
239
|
+
await bSawC.promise;
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// B, the newer commit, joins the queue first.
|
|
246
|
+
const newer = leaseLockRows("pr-apply", [stackRow("staging")], {
|
|
247
|
+
cwd: b,
|
|
248
|
+
alive,
|
|
249
|
+
holder: holder("402"),
|
|
250
|
+
wait: {
|
|
251
|
+
deadline: Date.now() + 60_000,
|
|
252
|
+
pollMs: 0,
|
|
253
|
+
commitAt: "2026-10-28T10:05:00Z",
|
|
254
|
+
log: (l) => bLines.push(l),
|
|
255
|
+
sleep: async () => {
|
|
256
|
+
bPauses++;
|
|
257
|
+
if (bPauses === 1) {
|
|
258
|
+
older = startOlder().then((r) => {
|
|
259
|
+
order.push("403");
|
|
260
|
+
cTook.fire();
|
|
261
|
+
return r;
|
|
262
|
+
});
|
|
263
|
+
await cJoined.promise;
|
|
264
|
+
expect(await holding.lease.release()).toBe(true);
|
|
265
|
+
aReleased.fire();
|
|
266
|
+
} else if (bPauses === 2) {
|
|
267
|
+
bSawC.fire();
|
|
268
|
+
await cTook.promise;
|
|
269
|
+
} else if (bPauses === 3) {
|
|
270
|
+
await cReleased.promise;
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
}).then((r) => {
|
|
275
|
+
order.push("402");
|
|
276
|
+
return r;
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
await cTook.promise;
|
|
280
|
+
const c1 = await older!;
|
|
281
|
+
expect(c1.ok).toBe(true);
|
|
282
|
+
if (c1.ok) expect(await c1.lease.release()).toBe(true);
|
|
283
|
+
cReleased.fire();
|
|
284
|
+
const b1 = await newer;
|
|
285
|
+
expect(b1.ok).toBe(true);
|
|
286
|
+
expect(order).toEqual(["403", "402"]);
|
|
287
|
+
expect(bLines.join("\n")).toContain("run 403 waits ahead of it with an older commit");
|
|
288
|
+
const now = await readLockRows("pr-apply", { cwd: a });
|
|
289
|
+
expect(now.rows).toEqual({ "stack shop/staging": "402" });
|
|
290
|
+
expect(now.waiting).toBeUndefined();
|
|
291
|
+
});
|
|
292
|
+
});
|