confdb: support constrained set and unset [WIP] - #17709
Draft
miguelpires wants to merge 2 commits into
Draft
miguelpires wants to merge 2 commits into
miguelpires wants to merge 2 commits into
Conversation
This correct the ordering of path operations to be aware of whether we're writing or removing data, as appropriate. It also changes the ordering path removals regarding lists to be the opposite of the writes. For instance, we want to remove list[2] before list[1].field, for the same reason we do the write in the opposite order - to avoid changing the meaning of subsequent operations. The one case where operations should be sorted in a way that ignores whether it's a write or removal is when the paths are ancestor/descendant, in that case the more specific order should "win". This also filters unsets of paths fully included in more general unsets since removing either list[1] or list[1].field can both result in list[1] being fully removed which then changes the meaning of whichever path is removed after. Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
|
Thu Sep 24 16:31:20 UTC 2026 No spread result artifacts foundNo spread results JSON artifacts were available for this workflow run, so spread failures (if any) could not be reported. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #17709 +/- ##
==========================================
+ Coverage 78.36% 78.43% +0.07%
==========================================
Files 1417 1410 -7
Lines 200507 200852 +345
Branches 2503 2503
==========================================
+ Hits 157129 157548 +419
+ Misses 33953 33852 -101
- Partials 9425 9452 +27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
This is a proposal on how to support writing and removing confdb data while providing constraints. A filtered/constrained write should replace the entries that match the constraints with the supplied data. Writing to a request path with some constraints and then reading the same path with the same constraints should return the same data that was set. For example:
I experimented with different ways of implementing this because some were quite messy due to some inconsistencies with how we did things before. As a result, Set() and Unset() implement things differently.
Set()does a read of the path with inverted constraints (it reads the data that doesn't match them), merges that with the user provided data and writes that. The result is that the existing data that does match the constraints is replaced. This avoids doing a traversal of the existing data while merging new data which can be tricky, especially in the case of lists where write order can reshape the end result.Unset()simply traverses the databag as before and applies constraints before actually going through with the data removal. It's a bit simpler since there's no data to merge.https://warthogs.atlassian.net/browse/SNAPDENG-37194