A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
fix beta channel version ordering (#3452)
kt2e10018f88c1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 1a70571b75..a80a43b3b4 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -220,6 +220,7 @@ jobs:python3 scripts/release/test_native_compat.pypython3 scripts/release/test_npm_bridge.pypython3 scripts/release/test_restamp.py+ python3 scripts/release/test_channel_version.pyclippy-test:name: check + clippy (workspace)diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex d69d3a8167..71f0dc7462 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1009,14 +1009,20 @@ jobs:a="${1#v}"; b="${2#v}"[ "$a" = "$b" ] && return 1a_n="${a%%-*}"; b_n="${b%%-*}"- awk -v an="$a_n" -v bn="$b_n" 'BEGIN {- split(an, A, "."); split(bn, B, ".")- for (i = 1; i <= 3; i++) { if (A[i] + 0 > B[i] + 0) exit 0; if (A[i] + 0 < B[i] + 0) exit 1 }- exit 1- }' && return 0- # same numeric base: the prerelease ordering (beta.N)+ if [ "$a_n" != "$b_n" ]; then+ # A lower numeric version must not fall through to beta.N ordering.+ awk -v an="$a_n" -v bn="$b_n" 'BEGIN {+ split(an, A, "."); split(bn, B, ".")+ for (i = 1; i <= 3; i++) { if (A[i] + 0 > B[i] + 0) exit 0; if (A[i] + 0 < B[i] + 0) exit 1 }+ exit 1+ }'+ return $?+ fi+ # Same numeric base: stable sorts after prereleases, then compare beta.N.a_pre="${a#*-}"; b_pre="${b#*-}"- [ "$a_pre" != "$a" ] && [ "$(printf '%s\n' "$a_pre" "$b_pre" | sort -V | tail -1)" = "$a_pre" ] && [ "$a_pre" != "$b_pre" ]+ [ "$a_pre" = "$a" ] && return 0+ [ "$b_pre" = "$b" ] && return 1+ [ "$(printf '%s\n' "$a_pre" "$b_pre" | sort -V | tail -1)" = "$a_pre" ]}publish_pointer_pair() {# $1 = the manifest name (latest.json | beta.json), $2 = thediff --git a/scripts/release/test_channel_version.py b/scripts/release/test_channel_version.pynew file mode 100644index 0000000000..cd401120e4--- /dev/null+++ b/scripts/release/test_channel_version.py@@ -0,0 +1,45 @@+#!/usr/bin/env python3+"""Exercise the release workflow's actual channel-advance comparator."""++from pathlib import Path+import subprocess+import textwrap+import unittest+++WORKFLOW = Path(__file__).resolve().parents[2] / '.github/workflows/release.yml'+FUNCTION = textwrap.dedent(+ WORKFLOW.read_text().split(' version_gt() {', 1)[1]+ .split(' publish_pointer_pair()', 1)[0]+)+FUNCTION = 'version_gt() {' + FUNCTION+++class ChannelVersionTest(unittest.TestCase):+ def test_channel_version_ordering(self):+ cases = [+ ('v0.9.9-beta.61', 'v0.10.1-beta.2', False),+ ('v0.10.1-beta.2', 'v0.9.9-beta.61', True),+ ('v0.10.0-beta.99', 'v0.10.1-beta.1', False),+ ('v0.10.1-beta.1', 'v0.10.0-beta.99', True),+ ('v1.0.0-beta.1', 'v0.99.99-beta.99', True),+ ('v0.99.99-beta.99', 'v1.0.0-beta.1', False),+ ('v0.10.1-beta.10', 'v0.10.1-beta.2', True),+ ('v0.10.1-beta.2', 'v0.10.1-beta.10', False),+ ('v0.10.1', 'v0.10.1-beta.99', True),+ ('v0.10.1-beta.99', 'v0.10.1', False),+ ('v0.10.1', 'v0.10.1', False),+ ('v0.10.1-beta.2', '0.10.1-beta.2', False),+ ]+ for current, candidate, newer in cases:+ with self.subTest(current=current, candidate=candidate):+ result = subprocess.run(+ ['bash', '-e', '-c', FUNCTION + '\nversion_gt "$1" "$2"',+ 'channel-version-test', current, candidate],+ check=False, capture_output=True, text=True,+ )+ self.assertEqual(result.returncode, 0 if newer else 1, result.stderr)+++if __name__ == '__main__':+ unittest.main()