fix(version): ignore non-version tags in latest-tag discovery#382
Merged
joshua-temple merged 1 commit intoJun 26, 2026
Merged
Conversation
git.GetLatestTag and GetLatestReleaseTag returned the newest tag by raw sort order without filtering to cascade's version format, so a vX.Y.Z-dryrun.N tag (cut by the nightly-release dry-run path) or any foreign tag outsorted real releases, was handed to version.Parse, and failed every orchestrate version calculation with invalid version format. Add an IsValidVersionTag predicate in internal/git (regex kept in sync with version.semverRegex by an external-package guard test, since git cannot import version) and filter both discovery functions to the valid-version set. Hardens discovery against any malformed or foreign tag, and lets the dry-run path cut its dryrun tag without breaking version calc. Part of #373. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
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.
Problem
The nightly-release dry-run path cuts a
vX.Y.Z-dryrun.Ngit tag to exercise Release and the fleet. Butgit.GetLatestTag/GetLatestReleaseTagtook the newest tag by raw sort order with no version-format filter, so the dryrun tag (or any foreign tag likevnightly) outsorted real releases, was handed toversion.Parse, and failed every orchestrate version calc withinvalid version format. Surfaced by the dry-run validation; the orchestrate tests and the Release Test gate failed whenever a dryrun tag was newest.Fix
Add
IsValidVersionTagininternal/git(regex kept in lockstep withversion.semverRegexby an external-package sync-guard test, sincegitcannot importversion) and filter both discovery functions to valid versions only. Hardens discovery against any malformed/foreign tag generally, and lets the dry-run cut its tag without breaking version calc.Tests
Red-without-fix unit tests in
internal/gitplus an orchestrate regression (TestSetup_DryrunTagPresent_DoesNotBreakVersionCalc) mirroring the exact production failure. go test ./... 2000 pass; lint clean. Part of #373.