Suggest extracting prerelease tag resolution into a testable function for #1657#1661
Draft
Copilot wants to merge 1 commit into
Draft
Suggest extracting prerelease tag resolution into a testable function for #1657#1661Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
Copilot
AI
changed the title
[WIP] Investigate suggested solution for code snippet issue
Suggest extracting prerelease tag resolution into a testable function for #1657
May 21, 2026
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.
PR #1657 fixes the
prereleasechannel ofcopilot-cliby replacinggit ls-remote | tail -1with asort -Vpipeline. Review feedback asks that the pipeline be moved into a function and covered by a regression test.This PR is advisory only — no repository changes were committed. Recommended changes for #1657:
resolve_prerelease_version()insrc/copilot-cli/install.shthat readsgit ls-remote --tagsoutput from stdin (for tests) or runs it against a repo URL passed as$1(for production), then pipes throughawk | sed | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$' | sort -V | tail -n1.prereleasebranch ofinstall_using_githubto callresolve_prerelease_version "https://github.com/github/copilot-cli".test/copilot-cli/scenarios.jsonregistering aresolve_prerelease_versionscenario onmcr.microsoft.com/devcontainers/base:ubuntu.test/copilot-cli/resolve_prerelease_version.shthat sources only the function (viaawk '/^resolve_prerelease_version\(\)/,/^}$/'+eval, avoiding the installer's root check) and asserts ordering against a hermetic fixture covering the regression cases:v1.0.45>v1.0.9(the original bug).v1.0.45-10>v1.0.45-2(numeric prerelease suffix).^{}) and non-vX.Y.Ztags are filtered out.Function snippet:
Run locally with:
Stdin-driven design keeps the regression test hermetic (no network) and pins both the lexicographic-sort bug and the prerelease-suffix ordering against future regressions.
Original prompt
Created from VS Code.