Skip to content

feat(carve): carve emit — adopt a TF resource + report its boundary (#197) - #995

Merged
lex00 merged 1 commit into
mainfrom
feat/terraform-carve-emit
Jul 22, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/terraform-carve-emit

Conversation

@lex00

@lex00 lex00 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

First emit step of the strangler-fig carve (#197), building on the #214 advisor. chant carve emit --from <tf-dir> --select <address> --env <env> classifies the boundary a carve would cut, adopts the live resource into typed chant source via the existing cloud→code live-import path, and writes a boundary report. Lands the resource at the observe position: emitted, reversible, nothing patched or applied.

This is PR A of 3 for the full boundary-bridging carve. The boundary bridge (patching the surviving Terraform to data sources / deferred inputs) is the centerpiece and comes next in PR B; apply graduation is PR C.

What's here

  • terraform/carve.ts — pure boundary analysis: the carve set (selected node + folded sub-resources), inbound edges (→ data-source patch, required immediately) and outbound edges (→ deferred deploy-time input, at apply). Internal edges (a folded sub-resource pointing at its parent) are dropped.
  • graph identity extraction + IDENTITY_ATTR — derive the resource's physical name from the HCL so the live-import selector targets the real cloud resource.
  • carve emit command — refuses types with no native mapping (won't adopt what it can't map); the live-import call is injected, so all tests run with zero cloud calls.

Notes

Verification

  • 11 new tests (boundary analysis + emit command); full 568-test CLI suite green.
  • Core tsc + eslint clean.

Part of #197.

…197)

First strangler-fig emit step. `chant carve emit --from <tf-dir> --select
<address> --env <env>` classifies the boundary a carve would cut, adopts the
live resource into typed chant source via the existing cloud→code live-import
path, and writes a boundary report. Lands the resource at the observe
position: emitted, reversible, nothing patched or applied.

- terraform/carve.ts: pure boundary analysis (carve set + folded sub-resources,
  inbound edges → data-source patch, outbound → deferred deploy-time input).
- graph identity extraction + tier-map IDENTITY_ATTR: derive the physical name
  for the live-import selector from the HCL.
- carve emit command: refuses types with no native mapping; live import is
  injected so tests run with no cloud calls.

PR A of 3 for the boundary-bridging carve (#197). Next: carve bridge (patch the
surviving Terraform) and apply graduation.
@lex00
lex00 merged commit 5ba1860 into main Jul 22, 2026
5 checks passed
@lex00
lex00 deleted the feat/terraform-carve-emit branch July 22, 2026 04:38
lex00 added a commit that referenced this pull request Jul 22, 2026
)

Apply graduation, the dial-turn from observe to apply. `chant carve apply
--from <tf-dir> --select <address> --env <env>` resolves the ownership marker
that makes the carved resource chant-owned (reusing core ownershipEntries) and
finalizes the ordered apply runbook.

BYOL-honest: no cloud call. It computes the marker + plan; the apply is your
lifecycle (native CLI / CI / ApplyOp), which stamps the marker the emitted
source carries. --write saves the graduation doc.

- terraform/graduate.ts: ownership marker + tags (chant:managed-by/stack/env,
  mirroring the AWS lexicon's tag channel) + reversible runbook.
- carve apply command: dry-run plan by default; --write emits the doc.
- docs: cli/carve-out.mdx documents the full emit → bridge → apply arc.
- carve-arc.test.ts: end-to-end, one resource through all three steps.

PR C of 3 — completes the boundary-bridging carve (#197). emit + bridge +
apply now compose end to end (advisor #214 → emit #995 → bridge #996 → apply).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant