fwserver: set AttributePathExpression when modifying schema plans#1311
Open
emmayusufu wants to merge 1 commit into
Open
fwserver: set AttributePathExpression when modifying schema plans#1311emmayusufu wants to merge 1 commit into
emmayusufu wants to merge 1 commit into
Conversation
SchemaModifyPlan built the top-level ModifyAttributePlanRequest without AttributePathExpression, so every nested request built on an empty expression and plan modifiers received paths missing the root step (a modifier on nested.double_nested.str_a saw double_nested.str_a). Set it from path.MatchRoot for attributes and blocks, matching SchemaValidate.
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.
Related Issue
Fixes #1219
Description
SchemaModifyPlanbuilt the top-levelModifyAttributePlanRequestwithAttributePathset butAttributePathExpressionleft as the zero value. Every nested level then derived its expression from that empty root withAtName(...), so plan modifiers received expressions missing the root step. With the schema from the issue, the modifier onnested.double_nested.str_asawdouble_nested.str_a, and a modifier on a first-level nested attribute saw a single bare step.The fix sets
AttributePathExpression: path.MatchRoot(name)in both the attributes and blocks loops, which is exactly howSchemaValidatealready constructs its requests. The blocks loop had the same omission, and since both child-request sites inblock_plan_modification.goandattribute_plan_modification.goderive from the parent expression, fixing the root repairs expressions at every nesting depth for attributes and blocks alike.The new test runs the issue's two-level
SingleNestedAttributeshape throughSchemaModifyPlanand asserts the leaf modifier'sreq.PathExpression. Without the fix it fails with the exact output from the report (got: double_nested.str_a). The test covers the attribute path from the report; the block loop is the same one-line fix by symmetry, and I can add a block-shaped test if you would like one.One behavior note: providers that observed the truncated expression and matched against it will now see the corrected full expression.
Rollback Plan
Changes to Security Controls
No changes to security controls.