Skip to content

Commit 9327ba4

Browse files
celialaclaude
andcommitted
sql: sort rulesForRelease versions in descending order
This fix addresses incorrect ordering in the rulesForReleases array and adds a runtime check to prevent future ordering errors. Bug Summary: Location: pkg/sql/schemachanger/scplan/plan.go:157-162 Issue: The rulesForReleases array has incorrect ordering. Entries V25_2 and V25_3 are in ascending order, but the documented requirement (line 158) and the search logic in GetRulesRegistryForRelease() require descending order (newest first). Current (incorrect): {Latest}, // V25_4 {V25_2}, // ← wrong position {V25_3}, // ← wrong position Should be (descending): {Latest}, // V25_4 {V25_3}, // ← correct {V25_2}, // ← correct The GetRulesRegistryForRelease function iterates through rulesForReleases in order and returns the first entry where activeVersion.IsActive() is true. With ascending order, it would incorrectly return V25_2 rules when V25_3 is active. Changes: - Fixed ordering in pkg/sql/schemachanger/scplan/plan.go - Added init-time assertion to validate descending order - Fixed trailing space in error message in pkg/cli/declarative_print_rules.go Epic: None Release note (bug fix): Fix rulesForReleases ordering to correctly match cluster versions with schema changer rule sets. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 13e4984 commit 9327ba4

File tree

3 files changed

+282
-259
lines changed

3 files changed

+282
-259
lines changed

0 commit comments

Comments
 (0)