fix: Linking of v1api compatibility packages - #5720
Open
Bevan Arps (theunrepentantgeek) wants to merge 2 commits into
Open
Bevan Arps (theunrepentantgeek) wants to merge 2 commits into
Bevan Arps (theunrepentantgeek) wants to merge 2 commits into
Conversation
Bevan Arps (theunrepentantgeek)
requested review from
Matthew Christopher (matthchr) and
Alex Leites (tallaxes)
as code owners
September 22, 2026 02:10
Copilot started reviewing on behalf of
Bevan Arps (theunrepentantgeek)
September 22, 2026 02:10
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The unresolved lint failure and compatibility traversal issue must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR fixes generator conversion-graph linking between legacy v1api and new-style v packages regardless of sort order.
Changes:
- Makes compatibility linking order-independent.
- Adds regression coverage for hybrid preview renames.
- Addresses remaining critical lint and moderate traversal issues before approval.
| File | Summary |
|---|---|
v2/tools/generator/internal/codegen/storage/group_conversion_graph_builder.go |
Updates compatibility linking; unresolved critical lint issue (3 votes) and moderate traversal issue (1 vote). |
v2/tools/generator/internal/codegen/storage/conversion_graph_test.go |
Adds regression coverage for hybrid rename behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+120
to
123
| original, ok := asNewStylePackageReference(ref) | ||
| if !ok { | ||
| continue | ||
| } |
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.

What this PR does
There are two layers of conversion graph used by the code generator.
At the per resource level, we are correctly linking each
v1api*version to the new stylev*version.However, those resource level graphs are keyed by type-name; they thus cannot be used when looking up type-renames.
The resource level graphs for oldname and newname will be wholly disjoint, with no link.
We therefore also have a group level conversion graph used to navigate renames, identifying the transition points between the lower level.
We have been incorrectly constructing this higher level graph. The implementation of
compatibilityReferencesConvertToOriginalPackage()formerly assumed an interleaving sort order for package versions:However, the actual sorting order has all old-style packages preceding all new-style packages:
This resulted in the graph being constructed incorrectly and broke the type-lookup search associated with renaming.
To fix this,
compatibilityReferencesConvertToOriginalPackage()is now order agnostic, creating the necessary links regardless of sorting order.How does this PR make you feel?
Checklist