Repository navigation
Description
Part of #4419 (ruling 6, 2026-10-25). Filed so it is tracked; the epic does not build it. #4419 is closed; this now sits under epic:engine-ship.
A Terraform component whose upstream outputs are unknown at plan time, and which does not join a composed group (it falls back, per ruling 1), is a hole today: it gets no plan until its upstream applies, and it needs its own approval. In code: plan returns waitingRoot(...) as soon as ctx.unresolvedInputs is non-empty (lexicons/terraform/src/components/capability-plugin.ts:313-314), since terraform takes no unknown variable (same file, lines 40-43).
AWS previews such a member with placeholders and re-checks the real change set on apply (#4423; cfnPlaceholder in lexicons/aws/src/components/apply.ts:342, used at line 459). Terraform could do the same: plan the root with placeholder values for the unknown reads, record the plan shape (#4436, terraformPlanShape, already returned by plan), and on apply compare the real plan against it through the lexicon contract (#4425), so one approval covers it when the shapes match.
Acceptance criteria
- A Terraform root outside a group, with unknown upstream reads, gets a preview plan in the pull-request run.
- On apply, the real plan is compared against the previewed shape; a match needs no second approval, a mismatch stops for one.
- The report says the member was previewed with placeholders, and which reads were placeholders.
- Each placeholder is typed from the root's
variableblock (a string, number, bool, list or map stand-in), asserted by a unit test per type. - A root whose placeholder plan cannot run is handled per the decision below, asserted by a test.
-
docs/src/content/docs/components/plan-previews.mdx:212, which saysterraform-applyreports a hole for an unresolved reference, says instead that a root outside a group is previewed with placeholders, and theterraform-applysection (line 160) says what the preview covers. - A recorded pull-request run over a fixture with one fallen-back root reading another shows the preview and a single approval (maintainer run).
Depends on
#4436 (plan shape), #4447 (terraform-apply through core's interface). Both closed.
Open questions
- What happens when a Terraform root's placeholder plan fails, for example a
validationblock rejects the stand-in or acountorfor_eachdepends on the unknown value?- (a) The member stays a hole as today, and the report says why the preview was not possible.
- (b) The member is plan-failed, and the pull request cannot pass until its upstream applies.
Recommended: (a), because the preview is an improvement over the hole, and a failed preview should not leave the member worse off than today.
Activity
lex00 commentedon Oct 26, 2026
Maintainer rulings on this issue's open questions (2026-10-25, epic:engine-ship refinement):
Ruling: Stays a hole
terraform-apply: preview a root outside a group with typed placeholde…
lex00 commentedon Oct 26, 2026
Merged into integration/engine-ship at 139eb32 (unit branch unit/es-chant-4463).
What landed:
lexicons/terraform/src/components/placeholder-preview.ts(new).terraformPlaceholdertypes a stand-in from the root'svariableblock:known-after-applyfor string/any/untyped, 0 for number, false for bool, [] for list and set, {} for map, one stand-in per element for a tuple and per attribute for an object (optional(t)read ast).markPlaceholderDrivenreads the plan'sconfigurationand marks every attribute whose expression references a stand-in variable (through module inputs too), plus any value carrying theknown-after-applystring, as unknown after apply. Root outputs get the same treatment. No stand-in value reaches the change set, the shape or the digest.lexicons/terraform/src/components/capability-plugin.ts:plannow previews a root withunresolvedInputs. It plans to.chant-preview.tfplanwithtext: false(pr-loop.tofu.test.ts five-roots cases sit at the 5s unit budget since plans run show -json #4479), deletes that file, and returns the marked change set, the planned outputs and a shape whoseunknownInputsare the upstreams. The artifact is aterraform-apply-shapeartifact, never a plan file. The digest is taken over the preview's shape and entries. Core'scoveredRoundcovers the round after the upstream applies when it stays within the shape, so a match needs no second approval and a mismatch asks for one. Arunhanded the shape itself plans with the real values and throwsPlanShapeMovedError(exit 3) on any difference, without applying.inputs from <c>; planned again once they apply; no preview: <why>. That covers a root missing from terraform.roots, an undeclared variable, an unknown nested inside a larger value, acount/for_eachthat reads a stand-in, and a failed placeholder plan (the first lines of terraform's error, e.g. avalidationblock).ChangeSetMember.placeholders(new optional field inpackages/core/src/change-set.tsandworkspace/change-set.schema.json, documented in reference/change-set.mdx) lists the variables asvar.<name>. The PR note's member row sayspreviewed with placeholders for var.<name>, and the existing "Known only after apply" line still names the reads.components/plan-previews.mdx(the terraform-apply section says what the preview covers and when it stays a hole, the Outputs paragraph no longer lists terraform-apply as reporting a hole, and the generated row is updated inscripts/plan-previews.tstoo).guide/apply-on-merge.mdxgets one sentence.placeholder-preview.test.ts(one test per type: string, number, bool, list, map, plus object and tuple; the no-preview reasons; marking through module inputs and outputs; the count refusal) and new cases incapability-plugin.test.ts(preview with placeholders, a failed placeholder plan stays a hole with the reason, a count over a stand-in, run applying a matching real plan, run refusing one that adds a resource). The two existing hole tests were updated for the new reason text.Decision recorded (no open question covered it): a stand-in that reaches an attribute by some other route (a number through a
local) is not marked. The real plan then differs from the preview and asks for its own approval, so the cost is an extra round and never an unapproved apply.Still missing: the recorded pull-request run over a fixture with one fallen-back root reading another, showing the preview and a single approval (maintainer run). tsc --noEmit is clean on packages/core and lexicons/terraform, apart from the TS6059 rootDir noise that was already there.
test(terraform): pr-loop over five roots expects app's placeholder pr…
lex00 commentedon Oct 26, 2026
Epic-ready fix merged into integration/engine-ship at d02d65d (unit commit 33ac284).
lexicons/terraform/src/components/pr-loop.tofu.test.ts went red once this unit landed: app reads a.id, so it is now previewed with placeholders instead of being a hole, and its round 2 plan is covered by the first approval. The code does what this issue's acceptance says, so the test changed: app has update 1, placeholders var.subnet and no hole in the first change set; on merge both roots apply in one run with round 2 covered (filledInputs a.id); the stored change set holds app's entry too. The test that approved a separate pr-apply-round-2 gate and resumed was removed, since this estate no longer reaches that state. The not-covered round and the resume path are still tested in core (pr-waves, pr-run, promote-rounds) but no longer over real tofu; a fixture whose round goes uncovered would bring that back if wanted.
lex00 commentedon Oct 26, 2026
Ticked the six code items: on chant main e17daa8 (merge of integration/engine-ship, tree identical to tested tip 9ae806b; vitest --project unit 29243 passed, 0 failed). placeholder-preview.test.ts, capability-plugin.test.ts and pr-loop.tofu.test.ts (expectations updated in fix d02d65d: app is now previewed with a placeholder for var.subnet and its round is covered by the first approval) passed. Ready for the maintainer: the recorded pull-request run. On a workspace like pr-loop.tofu.test.ts's (a root outside a group reading another's output), run
chant components pr-planon the pull request andchant components pr-applyon the merge with chant built from main, and record that the note says "previewed with placeholders for var." and that the merge applies with one approval.lex00 commentedon Oct 26, 2026
Audit correction (2026-10-26): the ready comment named no fixture. Round 2's #4487 unit adds a fixture whose dependent's real plan exceeds its placeholder preview, and the recorded PR run for this issue should use pr-loop.tofu.test.ts's workspace shape. Exact steps follow when it lands.
Main is now 1b233ff (tree equal to tested tip 991ca77; unit suite 29255 passed). The only change since e17daa8 is #4475's drift-record files.
lex00 commentedon Oct 26, 2026
The fixture for this issue's recorded pull-request run landed with #4487 (merge 1fe37d6 on integration/engine-ship):
lexicons/terraform/src/__fixtures__/pr-loop/. Its README.md gives the steps; thea-v2pull request is the single-approval path (app previewed with placeholders for var.subnet, covered on merge). Thea-widepath in the same README is #4487's uncovered round. The run stays the maintainer's.lex00 commentedon Oct 26, 2026
Ready for the maintainer (epic:engine-ship round 2, 2026-10-26).
chant main is 9b8fa99 (the merge of integration/engine-ship, tree equal to the tested tip 280be4e; unit suite 29365 passed, 2 budget-only failures under load, no assertion failure). Push CI on main passed (chant run 40407754959).
Left: the (maintainer run) item, the recorded pull-request run. The fixture is lexicons/terraform/src/fixtures/pr-loop/ (from #4487, merge 1fe37d6), and its README has the steps. Use the
a-v2path. pr-loop.tofu.test.ts, placeholder-preview.test.ts and capability-plugin.test.ts passed on 280be4e.With chant from main 9b8fa99 and
tofu(orterraform) on PATH, in a scratch copy of that directory:git init -b main. Add a .gitignore listingnode_modules,.terraform,.terraform.lock.hcl,*.tfstate*,chant.tfplanand.chant, then commit.all.jsonas{"changed":["net","dns"]}and runchant components fan-out --from-affected all.json.a-v1toa-v2inroots/a/main.tfand commit. Runchant components pr-plan --base main --pr <n> --forge github. The note's app row should saypreviewed with placeholders for var.subnet.chant approve pr-<n> pr-apply --plan <digest> --approver github:<your-login> --sign). Merge, then runchant components pr-apply --base <main before the merge> --forge github --require-review. Both roots should apply in one run, with app's round covered by the first approval anda.idfilled in.Every root uses
terraform_datawith local state, so this needs no cloud and no emulator. Post the note and pr-apply's output here.lex00 commentedon Oct 27, 2026
Ready for the maintainer (consolidation-graph, 2026-10-27)
chant main is now 47b8594 (tree equal to the tested tip b6281ef; full unit project green there, 30275 tests, including pr-loop.tofu.test.ts, placeholder-preview.test.ts and capability-plugin.test.ts).
Left: the (maintainer run) item, the recorded pull-request run over lexicons/terraform/src/fixtures/pr-loop. A correction to the round-2 comment, which said this needs no cloud: the roots are local, but
--forge githubposts to and reads a real GitHub pull request, and--require-reviewneeds an approving review from a second GitHub account. So the run sheet puts it with the real-service runs. It costs nothing and touches no cloud. One thing to check before running: whether--signon the approve line needs a configured signing key.Commands: run sheet entry H1 in Run sheet: engine-wt/goals/consolidation-graph-1-runs.md.