feat: implement handling for deprecated versions in version selection logic#16247
Open
skywing918 wants to merge 6 commits into
Open
feat: implement handling for deprecated versions in version selection logic#16247skywing918 wants to merge 6 commits into
skywing918 wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the JS SDK release tooling’s npm version-selection helpers to treat npm deprecate-marked versions as invalid baselines, preventing changelog/breaking-change workflows from selecting deprecated dist-tag targets that may not have corresponding changelog content (fixing #15981).
Changes:
- Add packument-aware detection of deprecated versions and a helper to select the newest non-deprecated version by semver.
- Update
getNextBetaVersionandgetLatestStableVersionto fall back from deprecated dist-tag targets to non-deprecated candidates. - Add regression tests covering deprecated
latestandbetafallback behavior plus a no-regression case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tools/js-sdk-release-tools/src/utils/version.ts | Adds deprecation-aware version selection and fallback logic for latest/beta/next dist-tag baselines. |
| tools/js-sdk-release-tools/src/test/version/version.test.ts | Adds regression tests for deprecated dist-tag fallback behavior and preserves prior expected selection behavior. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
fixes #15981
Summary
npm deprecatemarks a version but does not move dist-tags. Sodist-tags.latest/beta/nextcan still point to a deprecated version that has no matching CHANGELOG entry or git-tag content. The JS release tooling used that version as the changelog / breaking-change baseline, causing the failures reported in #15981.Real example (from #15981)
@azure/arm-computeschedule— thebetadist-tag pointed to1.2.0-beta.1, an accidentally published and later deprecated version that has no changelog. The changelog step then failed:(The
deprecatedflag lives on the packument atversions["<ver>"].deprecatedas a non-empty string.)Handling logic
getLatestStableVersionandgetNextBetaVersionare now deprecation-aware (src/utils/version.ts):isVersionDeprecated(view, v)→truewhenview.versions[v].deprecatedis a non-empty string.getLatestNonDeprecatedVersion(view, predicate)→ newest (semver) non-deprecated version matching a channel predicate.getNextBetaVersion: if the selectedbeta/nexttarget is deprecated, fall back to the latest non-deprecated beta.getLatestStableVersion: if thelatest/betatarget is deprecated, fall back to the latest non-deprecated GA, then to the latest non-deprecated beta.deprecatedfield; every other case behaves exactly as before. If all candidates are deprecated (whole-package retirement), the original value is returned unchanged.Tests
Added regression tests in
src/test/version/version.test.tscovering the deprecated-latestand deprecated-betafallback paths, plus a no-regression case.