-
Notifications
You must be signed in to change notification settings - Fork 18
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
Ensure that deleted nodes are removed from the schema_branch #5183
Conversation
CodSpeed Performance ReportMerging #5183 will not alter performanceComparing Summary
|
a579bf6
to
bd482ce
Compare
generics=[ | ||
key for key, value in other.generics.items() if key not in self.generics or self.generics[key] != value | ||
], | ||
removed_generics=[key for key in self.generics if key not in other.generics], | ||
) |
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.
it might be cleaner if these used sets instead of lists for this logic, but I understand if it is out of scope for this small change
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.
You mean all of the objects in SchemaBranchDiff
? If so perhaps we can do that once it's brought back into develop
?
a446ed5
to
74e0e16
Compare
47d71d3
to
b07cc0b
Compare
b07cc0b
to
3164949
Compare
The root cause here is that when we delete a nodeschema it will be removed from the current SchemaBranch object on the API worker that handled the request. On other workers in the system the old deleted nodes are still cached in the SchemaBranch within the registry and never cleared out (until the worker is restarted).
Within infrahub/core/merge.py I also completely removed the get_schema_diff() method that appeared to be dead code that wasn't reached by any path.
Initially I added all modified nodes to SchemaBranchDiff (the current compare function only looks add added nodes from one side), however this was a bit problematic as we couldn't see which ones were added and as such it was complicated to remove nodes as it wasn't clear about what action to take.
This PR modifies the SchemaBranchDiff object to specifically include a section for specific actions on nodes and generics, i.e. added/changed/removed. This changed forced some additional changes around the logic of this object.
I've added a test to validate that this works. However for now that pipeline is disabled due to problems related to starting the actual containers. The tests work locally though (however we have to switch back and forth between which environment variables are active when doing so), as a follow up to enable that pipeline I've opened #5205.
Fixes #4836