Repository navigation
Conversation
This branch has not been deployed
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.
VersionComparator.compare_version()currently lowercases the entire version and removes everyv. This changes valid prerelease identifiers before comparison:1.0.0-v1compares equal to1.0.0-1, and1.0.0-devcompares lower than1.0.0-delta. Mixed-case identifiers also lose the ASCII ordering required by SemVer section 11.The comparator is used by core update checks, version sorting, and CLI plugin update detection, so these inputs can hide an available update or report the wrong precedence.
Modifications
Strip only an optional leading
vorVin both the core and CLI comparators; preserve prerelease identifiers unchanged.Add focused tests for both actual implementations: internal
v, case-sensitive ordering, version prefixes, ignored build metadata, numeric precedence, and the SemVer ordering example.The test module loads the production comparator files with
runpyso this pure utility can be tested without initializing AstrBot's database and provider integrations.This is NOT a breaking change.
Verification Steps and Test Results
On Python 3.13.7:
Running the same new test file against the unmodified comparator files from
master@dad255cproduced 10 failed, 18 passed. No comparator logic is mocked or rewritten in these tests.The full backup tests/application suite were not run. An attempted
pytest tests/test_backup.py -k VersionComparisonstopped during collection because the environment lacksgoogle.genai; the focused module above passes through normal pytest collection without those integrations.Checklist
AI assistance: this patch and its tests were developed and checked with OpenAI Codex. The validation results above are executed checks, not a claim of a human review or full application testing.
Summary by Sourcery
Correct version comparison so valid prerelease identifiers retain their SemVer ordering.
Bug Fixes:
Tests: