-
Notifications
You must be signed in to change notification settings - Fork 186
direct: ignore remote-only changes on name-based ID fields #5599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f4d366c
direct: add named_id_fields, ignore remote-only changes on ID fields
denik 253c476
Keep update_id_on_changes name; document local-only semantics
denik 2d2cdd8
Rename named_id_fields -> provided_id_fields
denik 940140f
Drop normalize_case; refresh model_serving_endpoints cloud golden
denik 7e574b2
Rename IsFieldInRecreateOnChanges -> FieldTriggersRecreate
denik 21d8833
Consolidate ID-field classification into classifyIDField
denik f905dd5
Restore UC lowercasing comment on schemas provided_id_fields
denik d7f269e
Enforce action categories are mutually exclusive
denik 4efe92d
Rename update_id_on_changes -> updatable_id_fields
denik 0001365
Add PR link to changelog entry
denik 22f0bf9
Shorten changelog entry
denik ffb887f
Fix ProvidedIDFields/UpdatableIDFields doc: DoRead fetches by stored ID
denik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -346,12 +346,12 @@ func (a *Adapter) validate() error { | |
|
|
||
| // Validate resourceConfig consistency with DoUpdateWithID | ||
| if a.overrideChangeDesc == nil { | ||
| hasUpdateWithIDTrigger := a.resourceConfig != nil && len(a.resourceConfig.UpdateIDOnChanges) > 0 | ||
| hasUpdateWithIDTrigger := a.resourceConfig != nil && len(a.resourceConfig.UpdatableIDFields) > 0 | ||
| if hasUpdateWithIDTrigger && a.doUpdateWithID == nil { | ||
| return errors.New("resourceConfig has update_id_on_changes but DoUpdateWithID is not implemented") | ||
| return errors.New("resourceConfig has updatable_id_fields but DoUpdateWithID is not implemented") | ||
| } | ||
| if a.doUpdateWithID != nil && !hasUpdateWithIDTrigger { | ||
| return errors.New("DoUpdateWithID is implemented but resourceConfig lacks update_id_on_changes") | ||
| return errors.New("DoUpdateWithID is implemented but resourceConfig lacks updatable_id_fields") | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -378,12 +378,20 @@ func (a *Adapter) GeneratedResourceConfig() *ResourceLifecycleConfig { | |
| return a.generatedResourceConfig | ||
| } | ||
|
|
||
| func (a *Adapter) IsFieldInRecreateOnChanges(path *structpath.PathNode) bool { | ||
| // FieldTriggersRecreate reports whether a local change to the field forces a | ||
| // delete + create. Both recreate_on_changes and provided_id_fields do this, so a | ||
| // caller that knows the ID is preserved can conclude the field is unchanged. | ||
| func (a *Adapter) FieldTriggersRecreate(path *structpath.PathNode) bool { | ||
| for _, p := range a.resourceConfig.RecreateOnChanges { | ||
| if path.HasPatternPrefix(p.Field) { | ||
| return true | ||
| } | ||
| } | ||
| for _, p := range a.resourceConfig.ProvidedIDFields { | ||
| if path.HasPatternPrefix(p.Field) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Q: why prefix and not exact match?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We always use prefix for declarative fields config. Does not matter for top level scalar fields of course. |
||
| return true | ||
| } | ||
| } | ||
| return false | ||
| } | ||
|
|
||
|
|
||
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sentence is hard to parse. How would a caller know the ID is preserved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caller is bundle_plan.go which knows action