fix(pkl-schema): emit hints for fields under SubResources without a FieldHint#428
Merged
Conversation
…ieldHint The hints flattener skipped any nested SubResource-typed field whose declaration did not carry its own @FieldHint. Annotations on fields three or more levels deep (e.g. Volumes.EFSVolumeConfiguration.RootDirectory) never reached the compiled schema, so the recursive patch-time stripper had no hint path to walk and AWS-populated provider defaults stayed in the stored state — causing spurious replacements on reapply of createOnly ancestors. Descend into any SubResource-typed field regardless of whether the declaration is annotated, and fall back to the default key transformation when no FieldHint is present to supply outputField. Adds a regression test that reproduces the ECS TaskDefinition Volumes.EFSVolumeConfiguration.RootDirectory pattern: outer field annotated, intermediate field unannotated, deepest field annotated. Previously the 3-level hint was missing; now it emits.
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.
Summary
internal/schema/pkl/schema/formae.pklskipped any nested SubResource-typed field whose declaration did not carry its own@FieldHint.@FieldHintannotations on fields three or more levels deep — e.g.Volumes.EFSVolumeConfiguration.RootDirectoryonAWS::ECS::TaskDefinition— never reached the compiled schema.createOnlyancestor triggered a spurious resource replacement on reapply. This is the root cause behind the lgtm-task spurious-replace investigation onfix/ecs-spurious-replace-investigationand the reason the plugin-side annotation added in formae-plugin-aws#47 appeared to have no effect end-to-end.@FieldHint, and fall back to the default key transformation when noFieldHintis present to supplyoutputField. Same change in bothhints()and the recursivesubHintsWithVisited().internal/schema/pkl/schema/tests/formae.pklthat models the ECS pattern (outer field annotated, intermediate SubResource field unannotated, deepest field annotated) and asserts the 3-level hint emits with its annotations intact. The fulltest-pkl,lint, andtest-allsuites pass.