Repository navigation
Description
terragucci runs tf-apply on chant's op waves, and the result works well for Terraform and OpenTofu users today. chant decides each wave's gate, records the pending fact and spends the approval. The engine calls themselves still happen in terragucci: the wave spec's planWave and applyWave hooks call back into terragucci's own process over a local socket, and terragucci plans and applies there.
Evidence (terragucci 4b9ba61, chant 930cb99):
terragucci/packages/terragucci/src/chant-waves.ts:8-12: the spec'splanWave,applyWaveand hooks call back into the job's own process, so the planning stays terragucci's.terragucci/packages/terragucci/src/chant-waves.ts:94-95:planWave: input.call("plan", ...)andapplyWave: input.call("apply", ...).terragucci/packages/terragucci/src/apply.ts:1539-1564: theplancall runsplanRootsorplanUnits(:1981,:3843), and theapplycall runs the job's ownj.apply(:2136,:4132).- chant core already plans wave components through the capability registry (
planWaveComponentinpackages/core/src/components/wave-plan.ts), andterraform-applyis a chant capability.
Ruling (maintainer, 2026-10-27, ruling 1 on INTENTIUS/plywood#1): the engine runs the same way for every product. The apply lives in chant, through the pulumi lexicon's apply capability (#4541) for Pulumi and plunge, and through chant for terragucci's waves too. Neither product holds apply capability. This is the #4530 rule.
plywood needs this because its up waves would otherwise copy terragucci's callbacks and run pulumi up inside the product. With the engine call in chant, terragucci and plywood apply through one path, and each product only switches it on in its own words.
Missing:
- An op wave that plans and applies its runs through the capability registry (
terraform-applynow, the pulumi capability from Pulumi and plunge stacks as components that plan and apply, so plywood can run them #4541 next), with noplanWaveorapplyWavecall back into the product. - A home in chant, or in a hook that runs no engine, for the other calls terragucci's callbacks serve today (
WaveCallinchant-waves.ts:39:hold,gate,migrate-check,migrate), plus Terragrunt unit discovery, share jobs, and the apply outcomesstood-down,heldandreplan(apply.ts:1579). - terragucci moved onto it, with its
planandapplycallbacks removed.
Acceptance:
- A terragucci
tf-applywave plans and applies through chant's capability, with noplanorapplycall back into terragucci. - The same wave path applies a Pulumi or plunge stack once Pulumi and plunge stacks as components that plan and apply, so plywood can run them #4541 lands.
- terragucci's wave tests and its recorded wave runs still pass.
Related: INTENTIUS/terragucci#1280 (the audit lists chant-waves.ts as a candidate), #4530, #4541, INTENTIUS/plywood#1.
Activity
lex00 commentedon Oct 27, 2026
From the chant-consumption audit (finding 1) and two new maintainer rulings on INTENTIUS/plywood#1:
terragucci's callbacks do more than plan and apply. Before they can go, each piece needs a chant home:
src/apply.ts:797)terraform-applysrc/apply.ts:781-792)src/apply.ts:793,:826-845)packages/core/src/op/op-waves.ts, #3762); run them around the capability stephold,gate,migrate-check,migratecalls (src/chant-waves.ts:39)Other runs of the binary outside waves also belong in the terraform lexicon: ephemeral copies (
src/ephemeral.ts:406,:810,:950), state migrations (src/migrate.ts:612) and the state-lock release (src/unlock.ts:269,:303).Related: #4530, INTENTIUS/terragucci#1280, #4550, #4551.
feat(op): op waves plan and apply through capabilities, with policy a…
Merge unit/cp-chant-4545: op waves plan and apply through capabilitie…
lex00 commentedon Oct 27, 2026
Built on
integration/ci-products, merge 45a43d0 (unit branchunit/cp-chant-4545, commit 0bbb3ad), on the rulings of #4550 (apply on merge on op waves through capabilities), #4551 (one run record perchant run wavejob) and #4553 (moved 4, held 5, denied 7).Core (
packages/core/src/op/)op-waves-capability.ts(new). An op-waves spec takesstep,{ kind, ...input }as a component's deploy step, in place ofplanandapply. Each string of the input gets{target},{op}and{wave}per run, and a run's newinputfield is laid over it. The deciding job, and each share or group job for its slice, plans every run withcapability.planin its own process.planDigestis the member digest,emptyanddestructivecome from the change-set part, and a member with holes and no artifact fails the plan with the holes' reasons. The apply iscapability.runwith the plan's artifact inctx.plans. A run refused withplanMovedis listed undermovedand the job exits 4; any other error fails the run. The runs' parts compose into the wave's change-set document, which the pending fact cites through CI products: gate, approval, apply and run records go on the workspace ledger through chant, not product git writes #4551'sstoreChangeSet. Each run's plan file at{plan}carries the digest, the member, the artifact and the part, soperRunhooks read the plan.stepand nothing else changes in the job (chant run wave --spec <file> --wave <k> [--decide | --share i | --group g]).runOpWavetakescapabilitiesfor a product that runs chant in process (ruling C); otherwise the registry is the project's (fanOutRegistry), loaded once per job behind a dynamic import sowave-runtime.mjsstays without the config loader. A spec with asteptherefore needs the full chant install or a product bin passingcapabilities.assertOpWavesSpecrefusesstepbesideplan,apply,planWaveorapplyWave, withdiscover, and withhooks.apply.runBy: "apply".holds, read at base with the policy (readOpWavePolicy,holdsAtBase).policy: truerunsci.policyfrom the declaration at base (prLoopPolicyAtandrunPrPolicy,packages/core/src/components/pr-policy.ts:71,:151) over each run's change-set part, and marks runsdeniedorheldexactly as a plan file's denials and holds do, so overrides,heldByand exit 7 are the existing paths. A policy that cannot run fails the wave.cost: { command, approveAbove, format?, currency? }prices each changing run ({target},{plan},{planJson}), reads infracost's JSON or{ "monthlyDelta" }, and sums the wave. OverapproveAbove, or with a run it could not price, the wave waits whatever its gate. The sum is a digest member,(monthly cost), and--record-plansadds the same member to the head's digest. A policy hold set at base or in the change holds; a cost hold at base wins over the change's. Command plan files may now carrychangeSetsoholds.policyworks without a step.terraform lexicon (
lexicons/terraform/src/)terraform-applytakeslockTimeout(default5m,falsefor none).planandapplypass-lock-timeoutunlessTF_CLI_ARGSorTF_CLI_ARGS_<command>already sets one (lock-timeout.ts, from terragucci'slockTimeoutArgs).cone: a revision. A live choudoufu root other than an estate file plans withplan -cone=<base>; the cone's targets join the plan digest throughconePlanDigestwith terragucci's digest kind kept, so approvals recorded before the move still match. Such a root plans withplan, never as a one-root set (cone.ts, moved from terragucci'scone.ts). The activity gainedconeandlockTimeoutargs and returnsconeon the plan result.reads: [{ var, root, output }]: vars read from anotherterraform.rootsentry's outputs, Atmos's!terraform.state. Each upstream is read once and passed as-varunder the step's ownvars. An upstream with no such output yet makes the member a hole naming the upstream to apply first.atmosStateReadsmaps terragucci's edges file into this form (state-reads.ts).show -jsonbeside the plan file and names it asartifact.planJson;cost-hold.tsexportsterraformCostHold({ approveAbove }), the infracost preset over it.Docs: guide/op-waves (two new sections and two refreshed line citations), the terraform lexicon's ops page (step inputs table), and a changelog entry, since
-lock-timeout=5mnow reaches everyterraform-applyrun. Prose lint has no regressions; docs citations pass.Tests:
packages/core/src/op/op-waves-capability.test.tsandlexicons/terraform/src/op-wave-step.test.ts. Onlynpm ci,scripts/ci-lexicon-artifacts.sh --steps generate,bundleandscripts/typecheck.tsran (no regressions). The suites wait for epic-ready, and no box is ticked.Still missing
step: { kind: "terraform-apply", root: "{target}", ... }, map its Atmos edges toreadsand its pull-request base tocone, swap itsheldhook andcost.approve_aboveforholds, and keep its socket calls only formigrate-check,migrateandgate, behind a feature-detect until chant's release. The migration gate stays a hook; standalone gated requests are CI products: gate, approval, apply and run records go on the workspace ledger through chant, not product git writes #4551'sgated-request.planWaveandapplyWave; a step covers one root per run.pulumi-upunder the same contract in Pulumi and plunge stacks as components that plan and apply, so plywood can run them #4541.Open question
A. Where does the 5m lock wait apply?
terraform-applyrun (fan-out,pr-apply, promote and op waves), withlockTimeout: falseto turn it off. (recommended) One behaviour for the capability, and a lock wait never changes a plan, only how long a run waits for a lock.lockTimeout, with no flag by default.I built (a).
lex00 commentedon Oct 27, 2026
Lock wait: option (a), the recommended one, as built. The 5m lock wait applies to every terraform-apply run (fan-out, pr-apply, promote and op waves), with
lockTimeout: falseto turn it off; the changelog records the change.feat(core): one product pipeline that takes a CI product's words (#4550)
lex00 commentedon Oct 28, 2026
Epic-ready fix, merged into integration/ci-products at 653e81e (unit commit 8a8cf89).
planRoot writes the plan document at join(planned.dir, ...), and the terraformPlan fake in lexicons/terraform/src/components/capability-plugin.test.ts returned no dir, so most plan tests threw on an undefined path. The fake now returns dir as the real TerraformPlanResult does. No code change.
fix(core): keep the small bundles small after ci-products
lex00 commentedon Oct 28, 2026
Epic-ready fix, merged into integration/ci-products at 9f00e0b (unit/cp-chant-fix-bundles).
op/op-waves.ts imported op/op-waves-capability.ts for opWaveStepProblems and opWaveHoldsProblems. That module also loads fan-out-support (config loader, zod, component discovery, esbuild) and pr-policy (declaration, picomatch, ajv), so the stage-hooks, gated-waves and gate-decision bundles went red once the release-port edge (#4615) was cut.
The step and holds shapes and checks (OpWaveStep, OpWaveHolds, OpWaveCostHold, OP_WAVE_COST_FORMATS, OP_WAVE_COST_MEMBER, opWaveStepProblems, opWaveHoldsProblems, opWaveHoldsAt) moved to packages/core/src/op/op-waves-capability-spec.ts, which imports one type. op-waves-capability.ts re-exports all of them, so no importer changed. op-waves.ts now imports the spec file. The bundle lists name it.
lex00 commentedon Oct 29, 2026
Close-out (2026-10-29)
On main: 45a43d0 (op waves plan and apply through the capability registry with a step, policy and cost holds, terraform-apply lockTimeout, cone and reads), 2c4690e (product pipeline), 653e81e and 9f00e0b (epic-ready fixes). The pulumi-up capability registers under the same contract (b6b425e), so box 2 is ticked.
Left unticked: box 1. terragucci main runs plain-root tf-apply waves through wavesStepSpec and chant's terraform-apply step, but Terragrunt, numeric-wave and grouped waves still use the planWave and applyWave callbacks (packages/terragucci/src/chant-waves.ts, apply.ts stepWaveReasons). Box 3 mixes terragucci's wave tests with its recorded wave runs, so it is left as is.
Remaining: terragucci moving Terragrunt and grouped waves onto the step (terragucci#1282) and removing the plan and apply callbacks.
lex00 commentedon Nov 2, 2026
Closing per the close-out comment of 2026-10-29 above: the work is on main and released.