@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
package/src/lexicon.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { InstanceObservation } from "./instance-nodes";
|
|
2
2
|
import type { CiRunner } from "./ci-jobs";
|
|
3
3
|
import type { OpAgentSpec } from "./ci-agent";
|
|
4
|
+
import type { CloudTradeSpec } from "./ci-identity";
|
|
4
5
|
import type { EngineFacts } from "./engine-facts";
|
|
5
6
|
import type { CapabilityPack } from "./capabilities/view";
|
|
6
7
|
import type { Serializer } from "./serializer";
|
|
@@ -934,6 +935,43 @@ export interface ScheduledOpSpec {
|
|
|
934
935
|
* branch. The model's job holds no write token; the push job does.
|
|
935
936
|
*/
|
|
936
937
|
agent?: OpAgentSpec;
|
|
938
|
+
/**
|
|
939
|
+
* The job's cloud identities (#4631), as an op wave's `cloud` (#4332,
|
|
940
|
+
* #4549): the three generators trade the job's OIDC token for them in a
|
|
941
|
+
* step before the checkout, and every later step drops the variables a
|
|
942
|
+
* token is requested with. The job alone gets `id-token: write`; the
|
|
943
|
+
* finding-mode's permissions stay as they are. Build one with
|
|
944
|
+
* `cloudIdentityWave` from `@intentius/chant/ci-identity`.
|
|
945
|
+
*/
|
|
946
|
+
cloud?: CloudTradeSpec;
|
|
947
|
+
/**
|
|
948
|
+
* An update the Op's run starts on drift (#4631): a job of its own after
|
|
949
|
+
* the Op's job, started only when the run exits with chant's drift code,
|
|
950
|
+
* which trades for `update.cloud` and runs `update.command`. The drift
|
|
951
|
+
* check never holds the update's identity, and the update never runs the
|
|
952
|
+
* check. A cron or pull_request trigger only.
|
|
953
|
+
*/
|
|
954
|
+
update?: ScheduledOpUpdate;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** A scheduled Op's update on drift (#4631). */
|
|
958
|
+
export interface ScheduledOpUpdate {
|
|
959
|
+
/** The shell line the update job runs, such as `npx --no-install plywood up`. */
|
|
960
|
+
command: string;
|
|
961
|
+
/** The identity only the update job holds. Absent: the update runs with no cloud identity of its own. */
|
|
962
|
+
cloud?: CloudTradeSpec;
|
|
963
|
+
/**
|
|
964
|
+
* Scopes the update job adds to `contents: read`, as
|
|
965
|
+
* {@link ScheduledOpSpec.permissions}. `contents: "write"` raises the
|
|
966
|
+
* update job's own contents scope (2026-10-28 ruling), so the update can
|
|
967
|
+
* record on `chant/lifecycle`; the Op's own job keeps its scopes. GitHub
|
|
968
|
+
* and Forgejo only: GitLab has no per-job token scopes.
|
|
969
|
+
*/
|
|
970
|
+
permissions?: Record<string, "read" | "write">;
|
|
971
|
+
/** The forge environment the update job runs in. */
|
|
972
|
+
environment?: OpEnvironment;
|
|
973
|
+
/** Variables for the update job alone. */
|
|
974
|
+
variables?: Record<string, string>;
|
|
937
975
|
}
|
|
938
976
|
|
|
939
977
|
/**
|
|
@@ -1011,6 +1049,15 @@ export interface OpWavesPipelineOptions
|
|
|
1011
1049
|
* fills it from the active product words. Absent: chant's.
|
|
1012
1050
|
*/
|
|
1013
1051
|
words?: import("./ci-product-words").CiProductWordsInput | import("./ci-product-words").CiProductWords;
|
|
1052
|
+
/**
|
|
1053
|
+
* Each wave job's timeout in minutes (ruling for ci-products 2026-10-28,
|
|
1054
|
+
* "Ledger lock"). The jobs carry it (`timeout-minutes`, GitLab's
|
|
1055
|
+
* `timeout`), and `CHANT_LOCK_WAIT` five minutes under it, so a run on
|
|
1056
|
+
* the `target` or `repo` grain waiting for its row on the ledger gives up
|
|
1057
|
+
* by name before the forge stops the job. Default
|
|
1058
|
+
* `OP_WAVE_JOB_TIMEOUT_MINUTES` (180).
|
|
1059
|
+
*/
|
|
1060
|
+
jobTimeoutMinutes?: number;
|
|
1014
1061
|
}
|
|
1015
1062
|
|
|
1016
1063
|
/** An Op waves pipeline: one file, and its jobs in order. */
|
|
@@ -1528,6 +1575,16 @@ export interface LexiconPlugin {
|
|
|
1528
1575
|
*/
|
|
1529
1576
|
prEnvTeardown?(ctx: { cwd: string }): import("./components/pr-environment").PrEnvTeardownAdapter | undefined;
|
|
1530
1577
|
|
|
1578
|
+
/**
|
|
1579
|
+
* This lexicon's steps in the check stage (#4633,
|
|
1580
|
+
* `./components/check-steps.ts`): `chant ci check` runs them after the
|
|
1581
|
+
* `ci.hooks.check` hooks for each workspace member of the adapter's kinds,
|
|
1582
|
+
* with the check job's environment (no forge token, no cloud credentials).
|
|
1583
|
+
* The pulumi lexicon runs `pulumi install`, a stack config check and
|
|
1584
|
+
* `pulumi about --json` per pulumi member. Return undefined for none.
|
|
1585
|
+
*/
|
|
1586
|
+
checkSteps?(): import("./components/check-steps").CheckStepsAdapter | undefined;
|
|
1587
|
+
|
|
1531
1588
|
/**
|
|
1532
1589
|
* Host Op runs — the seam `chant run <op> --on <this lexicon>` dispatches to
|
|
1533
1590
|
* (#2121, epic #2114). Core ships one provider of its own, `local`, and
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
import { describe, expect, test } from "vitest";
|
|
8
8
|
import { controlEntryDigest, type ControlEntryRecord } from "../control/records";
|
|
9
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
10
9
|
import type { LedgerReadPort } from "./ledger-port";
|
|
11
10
|
import { ledgerFields, LEDGER_TABLES, LEDGER_TIME_COLUMN } from "./ledger-read";
|
|
12
11
|
import { LEDGER_CONTROL_ENTRIES_FLOOR, loadQueryData, QUERY_TABLES, runQuery } from "./query";
|
|
@@ -64,7 +63,7 @@ describe("control_entries", () => {
|
|
|
64
63
|
expect(QUERY_TABLES.control_entries.map(([c]) => c)).toEqual(["member", "id", "entry", "project", "state", "product", "settings", "estates", "by", "timestamp", "digest", "prev_digest", "current"]);
|
|
65
64
|
});
|
|
66
65
|
|
|
67
|
-
test("the table's floor
|
|
68
|
-
expect(LEDGER_CONTROL_ENTRIES_FLOOR).toBe(
|
|
66
|
+
test("the table's floor shipped in 0.124.55", () => {
|
|
67
|
+
expect(LEDGER_CONTROL_ENTRIES_FLOOR).toBe("0.124.55");
|
|
69
68
|
});
|
|
70
69
|
});
|
|
@@ -48,14 +48,13 @@ import type { GateApprover, GatePolicyDecision, ResolvedGateApproval } from "../
|
|
|
48
48
|
import type { GateApprovalSource } from "../op/op-waves";
|
|
49
49
|
import type { GateRunLocator } from "../op/gate-run-locator";
|
|
50
50
|
import { readBlobFromPath, readPathSha, readBlobBySha, writeBlobToPath, RefCASConflictError, type LedgerLocation } from "./git";
|
|
51
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
52
51
|
import { gatedRequestOf, type GatedRequest } from "./gated-request-digest";
|
|
53
52
|
|
|
54
53
|
/** The first chant that writes `changeSet` on a pending fact and an approval (#4551). */
|
|
55
|
-
export const GATE_CHANGE_SET_FLOOR =
|
|
54
|
+
export const GATE_CHANGE_SET_FLOOR = "0.124.55";
|
|
56
55
|
|
|
57
56
|
/** The first chant that writes `request` on a pending fact and reads gated requests (#4551). */
|
|
58
|
-
export const GATED_REQUEST_FLOOR =
|
|
57
|
+
export const GATED_REQUEST_FLOOR = "0.124.55";
|
|
59
58
|
|
|
60
59
|
// The facts a pending record is written with live apart, so a bundle can import them without git (#3816).
|
|
61
60
|
export { DEFAULT_GATE_EXPIRY, isApprovalUrl, resolveApprovalUrl } from "./gate-pending";
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* `--no-record` through `./git.ts`.
|
|
24
24
|
*/
|
|
25
25
|
import { createHash } from "node:crypto";
|
|
26
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
27
26
|
import { sortedJsonReplacer } from "../utils";
|
|
28
27
|
import { approveCommand, evaluateGate, gitGateLedgerPort, type GateLedgerPort } from "../op/gate";
|
|
29
28
|
import type { GateApprovalSource } from "../op/op-waves";
|
|
@@ -48,7 +47,7 @@ export { GATED_REQUEST_FLOOR } from "./gate-ledger";
|
|
|
48
47
|
* `CHANT_HOLD_FINISHED` only once it wrote the applied line, so a hook reads
|
|
49
48
|
* that variable to know chant records the gate.
|
|
50
49
|
*/
|
|
51
|
-
export const OP_WAVE_HOLD_RECORD_FLOOR =
|
|
50
|
+
export const OP_WAVE_HOLD_RECORD_FLOOR = "0.124.55";
|
|
52
51
|
|
|
53
52
|
/** Which approvals count for a request: the block op waves read at base. */
|
|
54
53
|
export interface GatedRequestRules {
|
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
getHeadCommit,
|
|
14
14
|
pushLifecycle,
|
|
15
15
|
pushLifecycleReport,
|
|
16
|
+
pushLifecycleRebasing,
|
|
17
|
+
LifecyclePushLostError,
|
|
18
|
+
LIFECYCLE_PUSH_TRIES,
|
|
16
19
|
StaleLifecycleBranchError,
|
|
17
20
|
appendReleaseRecordLine,
|
|
18
21
|
readReleaseLedgerLines,
|
|
@@ -30,6 +33,8 @@ import {
|
|
|
30
33
|
fetchRefInto,
|
|
31
34
|
RefCASConflictError,
|
|
32
35
|
StaleLockError,
|
|
36
|
+
fetchLifecycleStatus,
|
|
37
|
+
requireLifecycleLedger,
|
|
33
38
|
} from "./git";
|
|
34
39
|
import { LIFECYCLE_LOCAL_NOTE } from "./local-note";
|
|
35
40
|
|
|
@@ -526,6 +531,156 @@ describe("lifecycle/git", () => {
|
|
|
526
531
|
expect(err.message).toContain("moved");
|
|
527
532
|
});
|
|
528
533
|
|
|
534
|
+
// #4551: a pr handler's push (the merge record pr-record writes) fetches, replays and pushes again, as publishRef does.
|
|
535
|
+
describe("pushLifecycleRebasing", () => {
|
|
536
|
+
/** A, and B with its own copy of the branch: the record job's checkout, taken before A pushes again. */
|
|
537
|
+
async function twoWriters(): Promise<{ a: string; b: string; remotePath: string; done: () => Promise<void> }> {
|
|
538
|
+
const { clonePath: a, remotePath, cleanup } = await setupClonePair();
|
|
539
|
+
const b = join(tmpdir(), `chant-state-clone-b-${Date.now()}-${Math.random()}`);
|
|
540
|
+
git(["clone", "-q", remotePath, b], tmpdir());
|
|
541
|
+
git(["config", "user.email", "record@chant.dev"], b);
|
|
542
|
+
git(["config", "user.name", "Record"], b);
|
|
543
|
+
await writeSnapshot("prod", "aws", JSON.stringify({ a: 1 }), { cwd: a });
|
|
544
|
+
expect(await pushLifecycle({ cwd: a })).toBe(true);
|
|
545
|
+
git(["fetch", "-q", "origin", "chant/lifecycle:chant/lifecycle"], b);
|
|
546
|
+
git(["fetch", "-q", "origin", "+refs/heads/chant/lifecycle:refs/remotes/origin/chant/lifecycle"], b);
|
|
547
|
+
return {
|
|
548
|
+
a,
|
|
549
|
+
b,
|
|
550
|
+
remotePath,
|
|
551
|
+
done: async () => {
|
|
552
|
+
await cleanup();
|
|
553
|
+
const { rm } = await import("node:fs/promises");
|
|
554
|
+
await rm(b, { recursive: true, force: true });
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
/** A moves the remote on behind B's back, as a wave job pushing beside the record job does. */
|
|
559
|
+
async function advance(a: string, filename: string, content: string): Promise<void> {
|
|
560
|
+
git(["fetch", "-q", "origin", "+refs/heads/chant/lifecycle:refs/remotes/origin/chant/lifecycle"], a);
|
|
561
|
+
await writeBlobToPath("prod", filename, content, `wave: ${filename}`, { cwd: a });
|
|
562
|
+
expect(await pushLifecycle({ cwd: a })).toBe(true);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
test("a push another writer beat between checkout and push replays on the remote's tip and lands, with both writes kept", async () => {
|
|
566
|
+
const { a, b, remotePath, done } = await twoWriters();
|
|
567
|
+
try {
|
|
568
|
+
await advance(a, "wave.json", '{"wave":1}');
|
|
569
|
+
await writeBlobToPath("prod", "merge.json", '{"merge":1}', "Merge record: abc", { cwd: b });
|
|
570
|
+
// The single push refuses, as pr-record's did before.
|
|
571
|
+
expect((await pushLifecycleReport({ cwd: b })).pushed).toBe(false);
|
|
572
|
+
|
|
573
|
+
expect(await pushLifecycleRebasing({ cwd: b })).toEqual({ pushed: true });
|
|
574
|
+
const tip = git(["rev-parse", "refs/heads/chant/lifecycle"], remotePath).stdout.trim();
|
|
575
|
+
expect(git(["rev-parse", "refs/heads/chant/lifecycle"], b).stdout.trim()).toBe(tip);
|
|
576
|
+
expect(git(["show", `${tip}:prod/merge.json`], remotePath).stdout).toBe('{"merge":1}');
|
|
577
|
+
expect(git(["show", `${tip}:prod/wave.json`], remotePath).stdout).toBe('{"wave":1}');
|
|
578
|
+
expect(git(["show", `${tip}:prod/aws.json`], remotePath).stdout).toBe(JSON.stringify({ a: 1 }));
|
|
579
|
+
// B's commit sits on A's, with its own message and author.
|
|
580
|
+
expect(git(["log", "-1", "--format=%s|%an|%ae", tip], remotePath).stdout.trim()).toBe("Merge record: abc|Record|record@chant.dev");
|
|
581
|
+
expect(git(["log", "-1", "--format=%s", `${tip}^`], remotePath).stdout.trim()).toBe("wave: wave.json");
|
|
582
|
+
// The lease now names the tip that landed, so the next push needs no retry.
|
|
583
|
+
expect(git(["rev-parse", "refs/remotes/origin/chant/lifecycle"], b).stdout.trim()).toBe(tip);
|
|
584
|
+
expect(git(["rev-parse", "--verify", "--quiet", "refs/chant/lifecycle-rebase"], b).exitCode).not.toBe(0);
|
|
585
|
+
} finally {
|
|
586
|
+
await done();
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
test("a commit that changes the file the other writer changed is refused by name, and the local write is kept", async () => {
|
|
591
|
+
const { a, b, done } = await twoWriters();
|
|
592
|
+
try {
|
|
593
|
+
await advance(a, "merge.json", '{"merge":"wave"}');
|
|
594
|
+
await writeBlobToPath("prod", "merge.json", '{"merge":"record"}', "Merge record: abc", { cwd: b });
|
|
595
|
+
const local = git(["rev-parse", "refs/heads/chant/lifecycle"], b).stdout.trim();
|
|
596
|
+
const err = await pushLifecycleRebasing({ cwd: b }).catch((e: unknown) => e);
|
|
597
|
+
expect(err).toBeInstanceOf(LifecyclePushLostError);
|
|
598
|
+
expect((err as LifecyclePushLostError).name).toBe("LifecyclePushLostError");
|
|
599
|
+
expect((err as Error).message).toContain('"Merge record: abc"');
|
|
600
|
+
expect((err as Error).message).toContain("changes files the other writer changed too");
|
|
601
|
+
expect(git(["rev-parse", "refs/heads/chant/lifecycle"], b).stdout.trim()).toBe(local);
|
|
602
|
+
} finally {
|
|
603
|
+
await done();
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
test(`a remote that refuses every push fails after ${LIFECYCLE_PUSH_TRIES} tries with LifecyclePushLostError`, async () => {
|
|
608
|
+
const { b, remotePath, done } = await twoWriters();
|
|
609
|
+
try {
|
|
610
|
+
const hook = join(remotePath, "hooks", "update");
|
|
611
|
+
writeFileSync(hook, "#!/bin/sh\necho 'another writer is mid-push' >&2\nexit 1\n", { mode: 0o755 });
|
|
612
|
+
await writeBlobToPath("prod", "merge.json", '{"merge":1}', "Merge record: abc", { cwd: b });
|
|
613
|
+
const err = await pushLifecycleRebasing({ cwd: b }).catch((e: unknown) => e);
|
|
614
|
+
expect(err).toBeInstanceOf(LifecyclePushLostError);
|
|
615
|
+
expect((err as LifecyclePushLostError).tries).toBe(LIFECYCLE_PUSH_TRIES);
|
|
616
|
+
expect((err as Error).message).toContain(`chant/lifecycle was not pushed to "origin" after ${LIFECYCLE_PUSH_TRIES} tries`);
|
|
617
|
+
} finally {
|
|
618
|
+
await done();
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
test("plywood#22 finding 9: two writers that append lines to one ledger file both land, in push order", async () => {
|
|
623
|
+
const { a, b, remotePath, done } = await twoWriters();
|
|
624
|
+
try {
|
|
625
|
+
// A, a wave job, appends its release record and pushes; B, the record job, appends to the same file from its older copy.
|
|
626
|
+
git(["fetch", "-q", "origin", "+refs/heads/chant/lifecycle:refs/remotes/origin/chant/lifecycle"], a);
|
|
627
|
+
await appendReleaseRecordLine("prod", '{"from":"wave"}', { cwd: a });
|
|
628
|
+
expect(await pushLifecycle({ cwd: a })).toBe(true);
|
|
629
|
+
await appendReleaseRecordLine("prod", '{"from":"record"}', { cwd: b });
|
|
630
|
+
expect(await pushLifecycleRebasing({ cwd: b })).toEqual({ pushed: true });
|
|
631
|
+
const tip = git(["rev-parse", "refs/heads/chant/lifecycle"], remotePath).stdout.trim();
|
|
632
|
+
expect(git(["show", `${tip}:prod/releases.jsonl`], remotePath).stdout).toBe('{"from":"wave"}\n{"from":"record"}\n');
|
|
633
|
+
expect(git(["log", "-1", "--format=%s", tip], remotePath).stdout.trim()).toBe("Release record");
|
|
634
|
+
} finally {
|
|
635
|
+
await done();
|
|
636
|
+
}
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
test("plywood#22 finding 9: a read that finds its unpushed commits diverged from the remote replays them on the remote's tip", async () => {
|
|
640
|
+
const { a, b, remotePath, done } = await twoWriters();
|
|
641
|
+
try {
|
|
642
|
+
await appendReleaseRecordLine("prod", '{"from":"unpushed"}', { cwd: b });
|
|
643
|
+
git(["fetch", "-q", "origin", "+refs/heads/chant/lifecycle:refs/remotes/origin/chant/lifecycle"], a);
|
|
644
|
+
await appendReleaseRecordLine("prod", '{"from":"other"}', { cwd: a });
|
|
645
|
+
expect(await pushLifecycle({ cwd: a })).toBe(true);
|
|
646
|
+
const remoteTip = git(["rev-parse", "refs/heads/chant/lifecycle"], remotePath).stdout.trim();
|
|
647
|
+
|
|
648
|
+
expect(await fetchLifecycleStatus({ cwd: b })).toEqual({ status: "ahead", remote: "origin" });
|
|
649
|
+
await expect(requireLifecycleLedger({ cwd: b })).resolves.toBeUndefined();
|
|
650
|
+
const local = git(["rev-parse", "refs/heads/chant/lifecycle"], b).stdout.trim();
|
|
651
|
+
expect(git(["merge-base", "--is-ancestor", remoteTip, local], b).exitCode).toBe(0);
|
|
652
|
+
expect(git(["show", `${local}:prod/releases.jsonl`], b).stdout).toBe('{"from":"other"}\n{"from":"unpushed"}\n');
|
|
653
|
+
// Nothing was pushed by the read; the next push carries the replayed commit.
|
|
654
|
+
expect(git(["rev-parse", "refs/heads/chant/lifecycle"], remotePath).stdout.trim()).toBe(remoteTip);
|
|
655
|
+
expect(await pushLifecycleRebasing({ cwd: b })).toEqual({ pushed: true });
|
|
656
|
+
} finally {
|
|
657
|
+
await done();
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
test("a read whose unpushed commit rewrote the file the other writer changed still finds the ledger diverged", async () => {
|
|
662
|
+
const { a, b, done } = await twoWriters();
|
|
663
|
+
try {
|
|
664
|
+
await writeBlobToPath("prod", "merge.json", '{"merge":"record"}', "Merge record: abc", { cwd: b });
|
|
665
|
+
await advance(a, "merge.json", '{"merge":"wave"}');
|
|
666
|
+
const got = await fetchLifecycleStatus({ cwd: b });
|
|
667
|
+
expect(got.status).toBe("diverged");
|
|
668
|
+
expect(got.status === "diverged" ? got.stderr : "").toContain("could not be replayed");
|
|
669
|
+
await expect(requireLifecycleLedger({ cwd: b })).rejects.toThrow(/has diverged/);
|
|
670
|
+
} finally {
|
|
671
|
+
await done();
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
test("no remote reads as the local note, as pushLifecycleReport says it", async () => {
|
|
676
|
+
await withTestDir(async (dir) => {
|
|
677
|
+
await initRepo(dir);
|
|
678
|
+
await writeSnapshot("prod", "aws", JSON.stringify({ a: 1 }), { cwd: dir });
|
|
679
|
+
expect(await pushLifecycleRebasing({ cwd: dir })).toEqual({ pushed: false, pushWarning: LIFECYCLE_LOCAL_NOTE });
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
});
|
|
683
|
+
|
|
529
684
|
// ── Release ledger plumbing (#568) ──────────────────────────────────────
|
|
530
685
|
|
|
531
686
|
describe("release ledger plumbing", () => {
|
package/src/lifecycle/git.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* All operations use git plumbing commands — no checkout, no branch switching,
|
|
5
5
|
* no working tree changes.
|
|
6
6
|
*/
|
|
7
|
+
import { unlinkSync } from "node:fs";
|
|
8
|
+
import { isAbsolute, join } from "node:path";
|
|
7
9
|
import { getRuntime } from "../runtime-adapter";
|
|
8
10
|
import { memberLedgerPrefix, resolveMemberLedger } from "./member-ledger";
|
|
9
11
|
import { LIFECYCLE_LOCAL_NOTE } from "./local-note";
|
|
@@ -896,24 +898,208 @@ export function describeLifecyclePush(result: LifecyclePushStatus): string | nul
|
|
|
896
898
|
*/
|
|
897
899
|
export async function pushLifecycleReport(opts?: { cwd?: string }): Promise<{ pushed: boolean; pushWarning?: string }> {
|
|
898
900
|
try {
|
|
899
|
-
|
|
900
|
-
switch (result.status) {
|
|
901
|
-
case "pushed":
|
|
902
|
-
return { pushed: true };
|
|
903
|
-
case "no-remote":
|
|
904
|
-
return { pushed: false, pushWarning: LIFECYCLE_LOCAL_NOTE };
|
|
905
|
-
case "not-recorded":
|
|
906
|
-
return { pushed: false, pushWarning: NO_RECORD_PUSH_NOTE };
|
|
907
|
-
case "stale":
|
|
908
|
-
return { pushed: false, pushWarning: new StaleLifecycleBranchError(result.expected, result.stderr).message };
|
|
909
|
-
case "failed":
|
|
910
|
-
return { pushed: false, pushWarning: describeLifecyclePush(result) ?? "the push did not land" };
|
|
911
|
-
}
|
|
901
|
+
return pushReportOf(await pushLifecycleStatus(opts));
|
|
912
902
|
} catch (err) {
|
|
913
903
|
return { pushed: false, pushWarning: err instanceof Error ? err.message : String(err) };
|
|
914
904
|
}
|
|
915
905
|
}
|
|
916
906
|
|
|
907
|
+
function pushReportOf(result: LifecyclePushStatus): { pushed: boolean; pushWarning?: string } {
|
|
908
|
+
switch (result.status) {
|
|
909
|
+
case "pushed":
|
|
910
|
+
return { pushed: true };
|
|
911
|
+
case "no-remote":
|
|
912
|
+
return { pushed: false, pushWarning: LIFECYCLE_LOCAL_NOTE };
|
|
913
|
+
case "not-recorded":
|
|
914
|
+
return { pushed: false, pushWarning: NO_RECORD_PUSH_NOTE };
|
|
915
|
+
case "stale":
|
|
916
|
+
return { pushed: false, pushWarning: new StaleLifecycleBranchError(result.expected, result.stderr).message };
|
|
917
|
+
case "failed":
|
|
918
|
+
return { pushed: false, pushWarning: describeLifecyclePush(result) ?? "the push did not land" };
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/** How many pushes {@link pushLifecycleRebasing} makes, as the snapshot store's `publishRef` does. */
|
|
923
|
+
export const LIFECYCLE_PUSH_TRIES = 3;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Thrown by {@link pushLifecycleRebasing} when the ledger branch did not reach
|
|
927
|
+
* the remote: another writer pushed before each of its tries, or this
|
|
928
|
+
* checkout's commits do not replay on the remote's tip. What this run wrote
|
|
929
|
+
* stays in this checkout's `chant/lifecycle` only.
|
|
930
|
+
*/
|
|
931
|
+
export class LifecyclePushLostError extends Error {
|
|
932
|
+
readonly remote: string;
|
|
933
|
+
readonly tries: number;
|
|
934
|
+
constructor(remote: string, tries: number, detail: string) {
|
|
935
|
+
super(
|
|
936
|
+
`${STATE_BRANCH} was not pushed to "${remote}" after ${tries} ${tries === 1 ? "try" : "tries"}: ${detail}. ` +
|
|
937
|
+
`The records this run wrote are only in this checkout; run the command again.`,
|
|
938
|
+
);
|
|
939
|
+
this.name = "LifecyclePushLostError";
|
|
940
|
+
this.remote = remote;
|
|
941
|
+
this.tries = tries;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/** Scratch ref for the remote tip while {@link rebaseLifecycleOnRemote} replays onto it. */
|
|
946
|
+
const REBASE_REF = "refs/chant/lifecycle-rebase";
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Put this checkout's `chant/lifecycle` commits that the remote lacks on top
|
|
950
|
+
* of the remote's tip (fetched again), and point the push's lease at that
|
|
951
|
+
* tip. Each commit is replayed with `git merge-tree --write-tree` against its
|
|
952
|
+
* own parent and keeps its author and message; nothing touches a work tree.
|
|
953
|
+
* Returns why it could not, such as a commit whose files the other writer
|
|
954
|
+
* changed too.
|
|
955
|
+
*/
|
|
956
|
+
async function rebaseLifecycleOnRemote(remote: string, cwd?: string): Promise<{ error: string } | { rebased: number }> {
|
|
957
|
+
const rt = getRuntime();
|
|
958
|
+
const run = (args: string[], env: Record<string, string> = {}) => rt.spawn(["git", ...args], { cwd, env: { ...C_LOCALE_ENV, ...env } });
|
|
959
|
+
const firstLine = (s: string | undefined) => (s ?? "").trim().split("\n")[0] ?? "";
|
|
960
|
+
try {
|
|
961
|
+
const fetched = await run(["fetch", "--no-tags", "--force", remote, `refs/heads/${STATE_BRANCH}:${REBASE_REF}`]);
|
|
962
|
+
if (fetched.exitCode !== 0) return { error: `the fetch of the remote's tip failed (git said: ${firstLine(fetched.stderr)})` };
|
|
963
|
+
const remoteTip = (await run(["rev-parse", "--verify", REBASE_REF])).stdout.trim();
|
|
964
|
+
const local = await getStateBranchTip(cwd);
|
|
965
|
+
if (!remoteTip || !local) return { error: "the remote's tip or the local branch could not be read" };
|
|
966
|
+
if ((await run(["merge-base", "--is-ancestor", remoteTip, local])).exitCode === 0) {
|
|
967
|
+
// Already on the remote's history: only the lease was behind.
|
|
968
|
+
await trackRemoteLifecycle(remote, remoteTip, cwd);
|
|
969
|
+
return { rebased: 0 };
|
|
970
|
+
}
|
|
971
|
+
const ours = (await run(["rev-list", "--reverse", "--first-parent", local, `^${remoteTip}`])).stdout.trim().split("\n").filter(Boolean);
|
|
972
|
+
const identityArgs = await ledgerCommitIdentityArgs(cwd);
|
|
973
|
+
let onto = remoteTip;
|
|
974
|
+
for (const commit of ours) {
|
|
975
|
+
const parent = await run(["rev-parse", "--verify", "--quiet", `${commit}^1`]);
|
|
976
|
+
if (parent.exitCode !== 0) return { error: `${commit.slice(0, 12)} shares no history with the remote's ${STATE_BRANCH}` };
|
|
977
|
+
const merged = await run(["merge-tree", "--write-tree", `--merge-base=${parent.stdout.trim()}`, onto, commit]);
|
|
978
|
+
const subject = firstLine((await run(["log", "-1", "--format=%s", commit])).stdout);
|
|
979
|
+
let tree: string;
|
|
980
|
+
if (merged.exitCode === 1) {
|
|
981
|
+
// plywood#22 finding 9: two writers that each appended lines to one ledger file (a run record, a release record, a gate line) meet here.
|
|
982
|
+
const appended = await replayAppends(parent.stdout.trim(), commit, onto, cwd);
|
|
983
|
+
if ("error" in appended) return { error: `"${subject}" (${commit.slice(0, 12)}) changes files the other writer changed too: ${appended.error}` };
|
|
984
|
+
tree = appended.tree;
|
|
985
|
+
} else if (merged.exitCode !== 0) {
|
|
986
|
+
return { error: `git merge-tree failed on ${commit.slice(0, 12)} (git said: ${firstLine(merged.stderr)})` };
|
|
987
|
+
} else {
|
|
988
|
+
tree = firstLine(merged.stdout);
|
|
989
|
+
}
|
|
990
|
+
const [name, email, date] = (await run(["log", "-1", "--format=%an%x00%ae%x00%aI", commit])).stdout.replace(/\n$/, "").split("\0");
|
|
991
|
+
const message = (await run(["log", "-1", "--format=%B", commit])).stdout;
|
|
992
|
+
const made = await rt.spawn(["git", ...identityArgs, "commit-tree", tree, "-p", onto, "-F", "-"], {
|
|
993
|
+
cwd,
|
|
994
|
+
stdin: message,
|
|
995
|
+
env: { ...C_LOCALE_ENV, GIT_AUTHOR_NAME: name ?? "", GIT_AUTHOR_EMAIL: email ?? "", GIT_AUTHOR_DATE: date ?? "" },
|
|
996
|
+
});
|
|
997
|
+
if (made.exitCode !== 0) return { error: `git commit-tree failed on ${commit.slice(0, 12)} (git said: ${firstLine(made.stderr)})` };
|
|
998
|
+
onto = made.stdout.trim();
|
|
999
|
+
}
|
|
1000
|
+
try {
|
|
1001
|
+
await updateRefCAS(`refs/heads/${STATE_BRANCH}`, onto, local, { cwd });
|
|
1002
|
+
} catch (err) {
|
|
1003
|
+
if (err instanceof RefCASConflictError) return { error: `${STATE_BRANCH} moved in this checkout while it was replayed` };
|
|
1004
|
+
throw err;
|
|
1005
|
+
}
|
|
1006
|
+
await trackRemoteLifecycle(remote, remoteTip, cwd);
|
|
1007
|
+
return { rebased: ours.length };
|
|
1008
|
+
} finally {
|
|
1009
|
+
await run(["update-ref", "-d", REBASE_REF]);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Replay a commit whose only changes are lines appended to `.jsonl` ledger
|
|
1015
|
+
* files, or new `.jsonl` files, onto `onto` (plywood#22 finding 9): each
|
|
1016
|
+
* file becomes `onto`'s copy with the commit's new lines after it, less any
|
|
1017
|
+
* line `onto` already holds. A run record, a release record and a gate line
|
|
1018
|
+
* are such appends, so two writers to one environment's file no longer lose
|
|
1019
|
+
* one of them on a replay. Any other change, or a file the commit rewrote
|
|
1020
|
+
* rather than appended to, returns why, and the replay stops as before.
|
|
1021
|
+
*/
|
|
1022
|
+
async function replayAppends(parent: string, commit: string, onto: string, cwd?: string): Promise<{ tree: string } | { error: string }> {
|
|
1023
|
+
const rt = getRuntime();
|
|
1024
|
+
const run = (args: string[], opts: { env?: Record<string, string>; stdin?: string } = {}) =>
|
|
1025
|
+
rt.spawn(["git", ...args], { cwd, env: { ...C_LOCALE_ENV, ...(opts.env ?? {}) }, ...(opts.stdin !== undefined ? { stdin: opts.stdin } : {}) });
|
|
1026
|
+
const diff = await run(["diff-tree", "-r", "--no-renames", "--name-status", "-z", parent, commit]);
|
|
1027
|
+
if (diff.exitCode !== 0) return { error: "git diff-tree failed" };
|
|
1028
|
+
const fields = diff.stdout.split("\0").filter((f) => f !== "");
|
|
1029
|
+
const changes: Array<{ status: string; path: string }> = [];
|
|
1030
|
+
for (let i = 0; i + 1 < fields.length; i += 2) changes.push({ status: fields[i]!, path: fields[i + 1]! });
|
|
1031
|
+
if (changes.length === 0) return { error: "nothing to replay" };
|
|
1032
|
+
const blob = async (rev: string, path: string): Promise<string | null> => {
|
|
1033
|
+
const out = await run(["cat-file", "blob", `${rev}:${path}`]);
|
|
1034
|
+
return out.exitCode === 0 ? out.stdout : null;
|
|
1035
|
+
};
|
|
1036
|
+
const files: Array<{ path: string; content: string }> = [];
|
|
1037
|
+
for (const { status, path } of changes) {
|
|
1038
|
+
if (!path.endsWith(".jsonl") || (status !== "M" && status !== "A")) return { error: `${path} is not a ledger line file this replay appends to` };
|
|
1039
|
+
const ours = (await blob(commit, path)) ?? "";
|
|
1040
|
+
const base = status === "M" ? ((await blob(parent, path)) ?? "") : "";
|
|
1041
|
+
if (!ours.startsWith(base)) return { error: `${path} was rewritten, not appended to` };
|
|
1042
|
+
const theirs = (await blob(onto, path)) ?? "";
|
|
1043
|
+
const have = new Set(theirs.split("\n").filter((l) => l !== ""));
|
|
1044
|
+
const added = ours.slice(base.length).split("\n").filter((l) => l !== "" && !have.has(l));
|
|
1045
|
+
const head = theirs === "" || theirs.endsWith("\n") ? theirs : `${theirs}\n`;
|
|
1046
|
+
files.push({ path, content: added.length > 0 ? `${head}${added.join("\n")}\n` : theirs });
|
|
1047
|
+
}
|
|
1048
|
+
const indexPath = (await run(["rev-parse", "--git-path", `chant-lifecycle-replay-${process.pid}.index`])).stdout.trim();
|
|
1049
|
+
if (!indexPath) return { error: "no scratch index path" };
|
|
1050
|
+
const index = isAbsolute(indexPath) || !cwd ? indexPath : join(cwd, indexPath);
|
|
1051
|
+
const env = { GIT_INDEX_FILE: index };
|
|
1052
|
+
try {
|
|
1053
|
+
if ((await run(["read-tree", onto], { env })).exitCode !== 0) return { error: "git read-tree failed" };
|
|
1054
|
+
for (const f of files) {
|
|
1055
|
+
const hashed = await run(["hash-object", "-w", "--stdin"], { stdin: f.content });
|
|
1056
|
+
if (hashed.exitCode !== 0) return { error: `git hash-object failed on ${f.path}` };
|
|
1057
|
+
const added = await run(["update-index", "--add", "--cacheinfo", `100644,${hashed.stdout.trim()},${f.path}`], { env });
|
|
1058
|
+
if (added.exitCode !== 0) return { error: `git update-index failed on ${f.path}` };
|
|
1059
|
+
}
|
|
1060
|
+
const written = await run(["write-tree"], { env });
|
|
1061
|
+
if (written.exitCode !== 0) return { error: "git write-tree failed" };
|
|
1062
|
+
return { tree: written.stdout.trim() };
|
|
1063
|
+
} finally {
|
|
1064
|
+
try {
|
|
1065
|
+
unlinkSync(index);
|
|
1066
|
+
} catch {
|
|
1067
|
+
// No index was written.
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* {@link pushLifecycleReport} for a writer whose records must reach the
|
|
1074
|
+
* remote, such as the merge record `pr-record` writes. A push refused because
|
|
1075
|
+
* another writer pushed first fetches the remote's tip, replays this
|
|
1076
|
+
* checkout's commits on it ({@link rebaseLifecycleOnRemote}) and pushes again,
|
|
1077
|
+
* up to {@link LIFECYCLE_PUSH_TRIES} pushes in all. After the last refusal, or
|
|
1078
|
+
* a replay that cannot be made, it throws {@link LifecyclePushLostError}. No
|
|
1079
|
+
* remote, recording off and a push git refused for another reason (no
|
|
1080
|
+
* network, no credentials) are returned as {@link pushLifecycleReport}
|
|
1081
|
+
* returns them.
|
|
1082
|
+
*/
|
|
1083
|
+
export async function pushLifecycleRebasing(opts?: { cwd?: string; tries?: number }): Promise<{ pushed: boolean; pushWarning?: string }> {
|
|
1084
|
+
const tries = Math.max(1, opts?.tries ?? LIFECYCLE_PUSH_TRIES);
|
|
1085
|
+
const cwd = opts?.cwd;
|
|
1086
|
+
for (let attempt = 1; ; attempt++) {
|
|
1087
|
+
let result: LifecyclePushStatus;
|
|
1088
|
+
try {
|
|
1089
|
+
result = await pushLifecycleStatus({ cwd });
|
|
1090
|
+
} catch (err) {
|
|
1091
|
+
return { pushed: false, pushWarning: err instanceof Error ? err.message : String(err) };
|
|
1092
|
+
}
|
|
1093
|
+
if (result.status !== "stale") return pushReportOf(result);
|
|
1094
|
+
if (attempt >= tries) {
|
|
1095
|
+
const said = result.stderr.trim().split("\n")[0];
|
|
1096
|
+
throw new LifecyclePushLostError(result.remote, attempt, `another writer pushed before each try${said ? ` (git said: ${said})` : ""}`);
|
|
1097
|
+
}
|
|
1098
|
+
const rebased = await rebaseLifecycleOnRemote(result.remote, cwd);
|
|
1099
|
+
if ("error" in rebased) throw new LifecyclePushLostError(result.remote, attempt, rebased.error);
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
917
1103
|
/**
|
|
918
1104
|
* Fetch the state branch from remote.
|
|
919
1105
|
*/
|
|
@@ -941,8 +1127,10 @@ export async function fetchLifecycle(opts?: { cwd?: string }): Promise<boolean>
|
|
|
941
1127
|
* lease already documents.
|
|
942
1128
|
* - `absent` — the remote answered and has no `chant/lifecycle`. The ledger
|
|
943
1129
|
* is genuinely empty; this is a project's first gate.
|
|
944
|
-
* - `diverged` — both sides have the branch
|
|
945
|
-
*
|
|
1130
|
+
* - `diverged` — both sides have the branch, neither contains the other, and
|
|
1131
|
+
* this checkout's unpushed commits could not be replayed on the remote's
|
|
1132
|
+
* tip. Appending here would drop one side's facts. (Commits that do
|
|
1133
|
+
* replay are put on the tip, and the fetch reports `ahead`.)
|
|
946
1134
|
* - `unreachable` — a remote is configured and did not answer (no network,
|
|
947
1135
|
* no credentials, a shallow-clone refspec that cannot resolve). Whether
|
|
948
1136
|
* anything is on the branch is unknown, which is exactly the state that
|
|
@@ -1060,7 +1248,12 @@ export async function fetchLifecycleStatus(opts?: { cwd?: string }): Promise<Lif
|
|
|
1060
1248
|
if (remoteTip) await trackRemoteLifecycle(remote, remoteTip, cwd);
|
|
1061
1249
|
return { status: "ahead", remote };
|
|
1062
1250
|
}
|
|
1063
|
-
|
|
1251
|
+
// plywood#22 finding 9: the commits this checkout wrote and never pushed go on top of the remote's tip, as a push that
|
|
1252
|
+
// lost its race replays them, and the read goes on from there. A local branch that shares no history with the remote's,
|
|
1253
|
+
// or whose commits change what the other writer changed, still reads as diverged.
|
|
1254
|
+
const replayed = await rebaseLifecycleOnRemote(remote, cwd);
|
|
1255
|
+
if (!("error" in replayed)) return { status: "ahead", remote };
|
|
1256
|
+
return { status: "diverged", remote, stderr: `${stderr}${stderr ? "\n" : ""}the unpushed commits could not be replayed on the remote's tip: ${replayed.error}` };
|
|
1064
1257
|
}
|
|
1065
1258
|
|
|
1066
1259
|
/**
|
|
@@ -1117,7 +1310,10 @@ export class LifecycleLedgerUnreadableError extends Error {
|
|
|
1117
1310
|
* So there is one rule now, for readers and writers alike:
|
|
1118
1311
|
*
|
|
1119
1312
|
* - `diverged` always refuses. A fork is not the ledger, and nothing good
|
|
1120
|
-
* comes of reading one as if it were.
|
|
1313
|
+
* comes of reading one as if it were. Before a fetch calls it diverged,
|
|
1314
|
+
* it replays this checkout's unpushed commits on the remote's tip
|
|
1315
|
+
* (plywood#22 finding 9), as a push that lost its race does; only a
|
|
1316
|
+
* branch whose commits cannot be replayed there stays diverged.
|
|
1121
1317
|
* - `unreachable` refuses only when the checkout has no local history at all,
|
|
1122
1318
|
* which is the case that would otherwise read as an empty ledger. With
|
|
1123
1319
|
* local history and no answer from the remote, the read proceeds and the
|
|
@@ -74,7 +74,12 @@ describe("resolvePlannedLock", () => {
|
|
|
74
74
|
|
|
75
75
|
test("the declared grain wins over the default, and the step's own over both", async () => {
|
|
76
76
|
expect(await resolvePlannedLock(choudoufu, {}, { member: "net" }, "target")).toEqual({ grain: "target", source: "declared", rows: [] });
|
|
77
|
-
expect(await resolvePlannedLock(choudoufu, { lockGrain: "repo" }, { member: "net" }, "resource")).toEqual({
|
|
77
|
+
expect(await resolvePlannedLock(choudoufu, { lockGrain: "repo" }, { member: "net" }, "resource")).toEqual({
|
|
78
|
+
grain: "repo",
|
|
79
|
+
source: "step",
|
|
80
|
+
rows: [],
|
|
81
|
+
queue: [{ key: "repo", target: "net", address: "the repository" }],
|
|
82
|
+
});
|
|
78
83
|
});
|
|
79
84
|
|
|
80
85
|
test("resource is refused by name where the lexicon refuses it, and where no hook names rows", async () => {
|