← Back to PRs

#23660: fix(update): compare numeric -N suffix as build revision

by rylena open 2026-02-22 15:17 View on GitHub →
size: S
## Summary\n uses numeric suffixes (for example ) as build revisions.\n\n treated as equal to , which can misclassify status/update output when the local build suffix should be considered newer.\n\nThis patch adds suffix-aware comparison rules:\n- numeric suffix => treated as a build revision newer than base release\n- non-numeric suffixes (e.g. ) => treated as prerelease below base release\n\n## Changes\n- add comparable version parser in \n- update to include suffix precedence and numeric build comparison\n- add tests for build suffix and prerelease ordering in \n\n## Validation\n- > openclaw@2026.2.22 test /tmp/openclaw-fix/openclaw > node scripts/test-parallel.mjs "src/infra/update-check.test.ts" "src/commands/status.update.test.ts"  RUN  v4.0.18 /tmp/openclaw-fix/openclaw ✓ src/commands/status.update.test.ts (6 tests) 7ms ✓ src/infra/update-check.test.ts (4 tests) 8ms  Test Files  2 passed (2)  Tests  10 passed (10)  Start at  15:17:57  Duration  482ms (transform 561ms, setup 541ms, import 138ms, tests 15ms, environment 0ms)\n\nCloses #23647 <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds version comparison logic to properly handle numeric `-N` build suffixes (e.g., `2026.2.21-2`) as revisions newer than their base release, while preserving the existing behavior where non-numeric suffixes (e.g., `-beta.1`) are treated as prereleases. **Key changes:** - Introduced `ParsedComparableVersion` type with `suffixKind` field distinguishing "prerelease", "release", and "build" versions - Added `parseComparableVersion` function that parses suffixes and classifies them based on whether they're purely numeric - Updated `compareSemverStrings` to use a three-tier ranking system: prerelease (0) < release (1) < build (2) - Added tests confirming numeric suffix ordering and prerelease behavior The implementation correctly addresses issue #23647 where versions like `2026.2.21-2` were incorrectly treated as equal to `2026.2.21`. <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with only minor edge case considerations - The implementation is well-structured and logically sound, with appropriate tests covering the main scenarios. The three-tier ranking system correctly handles the stated requirements. Score is 4 rather than 5 due to limited edge case test coverage (e.g., comparing two different numeric build suffixes like `-2` vs `-3`, or unusual suffix formats like `-1.2`), though the implementation should handle these correctly. - No files require special attention <sub>Last reviewed commit: 0713d95</sub> <!-- greptile_other_comments_section --> <sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub> <!-- /greptile_comment -->

Most Similar PRs