Repository navigation
Closed
Labels
epic:ci-productsCI products share chant CI: terragucci, plywood, ledger, pipeline, applyepic:plywoodplywood: Pulumi pull request automation on chant (tracker in INTENTIUS/plywood)
Description
Reader problem
From a Hacker News comment the blog draft answers: "rollback would be targeting the last revision at the service level". The draft post on branch draft/agents-propose-ci-applies of lex00/lex00.github.io shows chant release cut, chant components promote --release and chant components rollback --release as the way to roll back to a named release. Today that works for components that publish an artifact or deploy templates, and the post says Terraform roots roll back through chant lifecycle rollback --to instead. This issue is the gap that keeps the post from saying "every component".
What exists today (chant 930cb99)
- Promote, rollback and redeploy strip build steps and refuse a component with no publish step unless the release recorded its templates:
packages/core/src/components/promote.ts:522("has no publish step, so nothing in its deploy carries a recorded digest"). templatesPinnedcomes fromreleaseTemplatesDigest(packages/core/src/components/release-promote.ts:68), which reads onlytarget.templates(thetemplate,manifestandvaluesfields).terraform-applynames its root by key (root: "net"), andDEPLOY_INPUT_FIELDS(packages/core/src/components/deploy-inputs.ts:47) has no entry for it, so a release records no copy of a root's files andchant components rollback prod --release v1.4.0refuses a Terraform-only component.terraform-applydeclaresrollbackPolicy: "needs-opt-out"(lexicons/terraform/src/components/capability-plugin.ts:430): undoing an apply is applying the previous configuration.chant lifecycle rollback [env] --to <ref>(packages/core/src/lifecycle/rollback.ts) opens a pull request restoringsourceDir, which covers a root in source but outside the release model.
What's missing
- A release cut records each
terraform-applyroot's files (the root directory, its local modules and var files, the same set the pull-request plan treats as the root's change) as a tree, as components: bind a gate's plan digest to the contents a non-planning step deploys, so a change after review needs a new approval #4155 does for other deploy inputs. promote --releaseandrollback --releasepoint the step at the recorded root, plan it against the environment, and bind the gate to that plan, so rolling back is a new plan of the old configuration under its own approval.- The same for a Pulumi/plunge stack once it is a component (see the companion chant issue for a Pulumi deploy capability).
Acceptance criteria
-
chant release cutrecords a terraform-apply component's root tree;chant release list/verifyshow it. -
chant components rollback prod --release <label>on a project of Terraform roots plans each root at the release's recorded files, waits at the release gate with that change set, and applies it on approval. -
chant components rollback prod --component netrestores the previous recorded release of a root, with the same plan-and-gate step. - A rollback whose plan is empty passes without an approval, as an empty change set does today.
- Docs (
cli/components.mdx,cli/release.mdx) say which capabilities roll back by release, with Terraform included.
Metadata
Metadata
Assignees
Labels
epic:ci-productsCI products share chant CI: terragucci, plywood, ledger, pipeline, applyepic:plywoodplywood: Pulumi pull request automation on chant (tracker in INTENTIUS/plywood)
Activity
Merge unit/cp-chant-4542: terraform rollback by release (#4542)
lex00 commentedon Oct 27, 2026
Items 1 and 2 (the Terraform part) merged into
integration/ci-productsat eb8e081 (unit branchunit/cp-chant-4542, commit b848a0e). Compile check only; nothing was run.Behaviour on the branch:
releaseInputs(input, { memberDir })(packages/core/src/components/capability.ts). It answers the files a step deploys from when its input names them by key, the field to point at the copy, and the directory the step runs in, or{ unbound: reason }.terraform-applyanswers it fromlexicons/terraform/src/components/release-inputs.ts: the root's directory and the local modules it reaches (rootWatchPaths, the set the pull-request plan uses), plus var files and backend-config files. A root on thelocalbackend is unbound, because a plan run in a copy would read no state. Such a root still rolls back throughchant lifecycle rollback --to.release cut(compileEnvironmentinpackages/core/src/components/release-compile.ts) records those files for the component and lists each directory in the target'strees. An unbound step, or one that reads a path outside the member directory, is left out and the cut prints the reason. The cut dry run now lists each recorded tree, andrelease list --jsonalready includestrees.pinReleaseTemplates(packages/core/src/components/release-promote.ts) writes every file the target records for the component to.chant/release-templates/<layout digest>/at its member-relative path, so../modules/xstill resolves. It then sets the step'sdirto the copy of the root.terraform-applyand the activities takedirin place of the entry'sdir(resolveRootinlexicons/terraform/src/op/activities/terraform.ts) and keep the entry's workspace, var files, backend config and estate. The existing release gate binds the plan of that copy. Because the release records the component's templates,templatesPinnedholds and the Terraform-only component is no longer refused.components rollback <env> --component <name>: when the record being restored hasdigestKind: "templates"and areleaseDigest, the rollback now runs under that release, so the root goes through the same plan-and-gate step (runComponentsRollbackinpackages/core/src/cli/handlers/promote.ts). Template-onlycfn-deploycomponents also get this path.groupFallbackkeeps any member pointed at a recorded copy out of a composed group, because the composition reads the declared roots.cli/release.mdx(components: bind a gate's plan digest to the contents a non-planning step deploys, so a change after review needs a new approval #4155 section) andcli/components.mdx(which capabilities roll back by release, and--componentfor a template-only record).Still to do:
releaseInputs.chant.config.*lives above the member directory would resolvediragainst the wrong base. That layout is unusual for chant members and is not handled.feat(pulumi): pulumi-up, Pulumi and plunge stacks as components that …
feat(pulumi): Pulumi and plunge stacks roll back by release, with an …
Merge unit/cp-chant-4542: Pulumi and plunge stacks roll back by relea…
lex00 commentedon Oct 28, 2026
Item 3 (Pulumi and plunge stacks) merged to integration/ci-products at 745afb0 (unit branch
unit/cp-chant-4542, commit 3e966e3 and a merge commit that runs the install through #4592's pinned binary). Compile check only:npm ci,scripts/ci-lexicon-artifacts.sh --steps generate,bundleandnpx tsx scripts/typecheck.tspass with no regressions, and the docs prose lint shows 0 regressions on the merged tree. Nothing ran pulumi or plunge; the tests use a fake runner and were not run.Behaviour on the branch:
releaseInputswith no core change.pulumi-upanswers the stack's directory (plusmainwhen it points outside it), the cut records its tracked files, and under a release core points the step'sdirat the copy in.chant/release-templates/<digest>/.promote --release,rollback --releaseandrollback --component(for a templates record) then preview the recorded program against the stack and bind the release gate to that preview, the same path Roll back a Terraform root to a named release: record root trees in release cut, plan them on promote and rollback --release #4542 gave Terraform roots. A stack whose backend is afile://path relative to its directory stays unbound and is printed by the cut.node_modules. I chose an install step in the copy, with a refusal by name where an install would not reproduce the release.lexicons/pulumi/src/release-copy.tsprepareReleaseCopyruns before the copy's first preview, in bothplanandrun, once per copy per process. It runs exactlypulumi install(plunge installon plunge, through the step's pinned binary when it setsengineVersion). That is the CLI's own install of dependencies and plugins, and it followsPulumi.yaml's runtime options. It runs only when needed:nodejswith nonode_modulesin the copy. A Node copy with no recorded lockfile (package-lock.json,npm-shrinkwrap.json,yarn.lock,pnpm-lock.yaml,bun.lock,bun.lockb) is refused withPulumiReleaseCopyRefusedError, because an install would take today's versions rather than the release's.pythonwithoptions.virtualenvnaming a missing directory, or apoetryoruvtoolchain.go,dotnet,javaandyamlnever install. A directory outside a release copy is never touched.PULUMI_INSTALL_COMMANDSandrunReleaseInstallinlexicons/pulumi/src/run.tsacceptinstallwith no flag and nothing else.cli/components.mdxnow listspulumi-upamong the capabilities that roll back by release, and drops "A Pulumi stack does not roll back by release yet".cli/release.mdxdescribes what apulumi-upstep records and the install in the copy. The lexicon README is updated too.Tests written, not run:
release-copy.test.ts(copy detection, one install for a Node copy with a lockfile, refusal with no lockfile and nothing run, the Python cases, Go and YAML never installing, a non-copy left alone, the install argv refusals).Still missing:
pulumi installon a Node program runs the package manager's install against the recorded lockfile. Whether it ever rewrites the lock under 3.272 is unchecked, and the recorded run should confirm it.Pulumi.<stack>.yamlis not tracked has no config in the copy, as for any untracked file.lex00 commentedon Oct 29, 2026
Close-out (2026-10-29)
On main: eb8e081 (release cut records terraform-apply roots; promote and rollback under a release plan the recorded copy, rollback --component), 745afb0 (the same for Pulumi and plunge stacks through releaseInputs, with the install in the copy). Docs are in cli/release.mdx and cli/components.mdx, which now list pulumi-up and Terraform among the capabilities that roll back by release.
All five boxes are ticked on the code, tests and docs on main (release-compile.ts and its test, release-promote, handlers/promote and promote.test.ts, lexicons/terraform release-inputs, lexicons/pulumi release-copy). No floci run was made.
Closing: the described work is on main.