Support direct Location assignment to variant paths#230
Closed
lubomir wants to merge 1 commit intorelease-engineering:developmentfrom
Closed
Support direct Location assignment to variant paths#230lubomir wants to merge 1 commit intorelease-engineering:developmentfrom
lubomir wants to merge 1 commit intorelease-engineering:developmentfrom
Conversation
When users assign a Location object to variant.paths.repository[arch], the system now properly handles it instead of wrapping it in another Location during serialization. Changes: - Modified VariantPaths._serialize_v2() to detect when a value is already a Location object (from direct assignment) - Store the Location in _locations for v2.0 round-trip fidelity - Maintain backward compatibility with string assignments Fixes: release-engineering#227 Assisted-By: OpenCode (claude-sonnet-4-5@20250929)
Contributor
Author
|
This is marked as a draft, because I'm not sure this is the correct approach. It allows assigning Location directly into the path, but that leads to a weird situation where the variant paths return type can be a string or a Location depending on how the metadata was loaded or created. That is likely going to be confusing. |
Contributor
guillermodotn
left a comment
There was a problem hiding this comment.
Witing to _locations during serialization makes serialize() a mutating operation, which can backfire us back.
And if the field dict and _locations both hold a Location but get out of sync, the one in the field dict always wins because isinstance is checked first.
Checking _locations first and falling back to isinstance for direct assignment fixes both.
Contributor
Author
|
Let's close this in favor of #231 |
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.
When users assign a Location object to variant.paths.repository[arch], the system now properly handles it instead of wrapping it in another Location during serialization.
Changes:
Fixes: #227