feat(iac): extract iac/specparse + add iac/specgen.SpecToYAML (infra-admin P2 PR2/12)#841
Merged
Conversation
…parse Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-trips iac/specparse) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gion-lister plan Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ParseResourceSpecs and SpecToYAML handled only Name/Type/Config/Size and silently dropped the remaining two ResourceSpec fields (Hints, DependsOn). The typed adapter dispatches Hints+DependsOn to provider plugins, so the serialize path stripped them. Tests now use a fully-populated fixture and prove symmetry via reflect.DeepEqual over the full SpecToYAML->Unmarshal-> ParseResourceSpecs round-trip. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR lays groundwork for infra-admin Phase 2 by extracting the in-memory IaC resource-spec parsing logic into a dedicated package and adding a YAML generator that round-trips with that parser, plus a couple of small documentation/comment updates.
Changes:
- Extracted
[]any→[]interfaces.ResourceSpecparsing into newiac/specparseand routed module call sites through a thin wrapper. - Added
iac/specgen.SpecToYAMLto serialize[]interfaces.ResourceSpecinto the resource-spec YAML shape consumable byspecparse. - Added focused tests for parsing + YAML round-trip, and updated a couple of docs/comments.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| module/pipeline_step_iac_provider_plan.go | Swaps the local parser implementation for a wrapper around specparse.ParseResourceSpecs. |
| iac/wfctlhelpers/state_test.go | Updates test comment to reflect current intent/coverage. |
| iac/specparse/specparse.go | New package implementing the in-memory ResourceSpec parser (no secret expansion). |
| iac/specparse/specparse_test.go | New tests covering parse shape, nil handling, and depends_on/hints mapping. |
| iac/specgen/specgen.go | New YAML serializer for authored specs that is intended to round-trip with specparse. |
| iac/specgen/specgen_test.go | New tests asserting YAML round-trip behavior and preservation of secret:// refs. |
| docs/plans/2026-06-01-iac-provider-region-lister.md | Marks the plan as superseded with a short note. |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR2/12 — extract
iac/specparse+ addiac/specgen.SpecToYAML(infra-admin Phase 2 foundation)Locked plan
docs/plans/2026-06-02-infra-admin-phase2-3.md(workspace), Tasks 2–4. Foundation for the Phase 2 dynamic-input apply (PR3) and commit-back (PR5). No runtime consumer yet — pure additive packages + doc fixes.Changes
iac/specparse(new) — extracts the in-memory[]any→[]interfaces.ResourceSpecconverter out ofmodule(was the privateparseResourceSpecsatpipeline_step_iac_provider_plan.go:57).modulekeeps a thin wrapper so the plan + apply step call sites are unchanged. Pure package (imports onlyinterfaces+stdlib); runs NO secret resolver —secret://refs pass through verbatim. (Thecmd/wfctlfile-readerparseInfraResourceSpecsis a different parser and is untouched.)iac/specgen.SpecToYAML(new) — serializes AUTHORED specs to the resource-spec YAML schema, the round-trip inverse ofspecparse. Round-trips all sixResourceSpecfields (Name/Type/Config/Size/Hints/DependsOn) withsecret://refs preserved verbatim. Proven byreflect.DeepEqualover a fully-populated spec.infra.admincomment iniac/wfctlhelpers/state_test.go; markdocs/plans/2026-06-01-iac-provider-region-lister.mdSUPERSEDED (shipped via the migration).Review note
Code review caught a round-trip field-drop (
DependsOn/Hintswere dropped by both directions; the original test fixture was too thin to catch it) — fixed in99e1875ccwith a fully-populated round-trip fixture + a dedicated parse test. Verified:go build ./...exit 0;iac/specparse+iac/specgen+module+plugins/alltests pass;golangci-lint --new-from-rev=origin/main0 issues.🤖 Generated with Claude Code