Skip to content

fix: order RoadRunner versions correctly in required-version lookup and Comparator::compare() - #22

Merged
roxblnfk merged 4 commits into
1.xfrom
coverage
Oct 9, 2026
Merged

roxblnfk merged 4 commits into
1.xfrom
coverage

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Oct 9, 2026 •

Copy link
Copy Markdown
Member
Q A
Bugfix? ✔️
Breaks BC? ❌
New feature? ❌
Issues —

Fixes two bugs in RoadRunner version ordering found while raising test coverage.

  • The required version derived from a || constraint is now the lowest alternative in RoadRunner release order (2.x < 2023–2025 < 3.x). Before, composer's numeric order made "spiral/roadrunner": "^2025.1 || ^3.0" require 3.0 and reject an installed 2025.x.
  • Comparator::compare() normalizes its arguments, so direct callers get the same answer as greaterThan()/lessThan()/equal(): v3.0.1 is newer than 3.0.0, 3.0 equals 3.0.0, and a release is newer than its own -dev. Unparsable input now throws \UnexpectedValueException, as the instance methods already did.

Tests

  • Line coverage 86.3% → 99.3% (120/139 → 148/149 statements), every method covered. Tests 119 → 162.

  • Newly covered: Package::getRequiredVersions() against fixture packages loaded through InstalledVersions::reload(), Process::exec() with a real PHP subprocess, Installed with a missing executable, and version edge cases (v prefixes, release candidates, dev-master, *, greaterThan('0')).

  • The InstalledTest helpers checking that RR_VERSION wins over rr --version were never run by Testo; they are tests now. The Installed tests also no longer read RR_VERSION from the CI environment.

  • RequiredTest::testGetRequiredVersion expected 2.0.0.0-dev to beat 2.0, which only held while compare() skipped normalization; it now expects 2.0.

  • Left uncovered: Package skipping a composer.json that exists but cannot be read.

  • How was this tested:

    • Testo, psalm and php-cs-fixer run locally (PHP 8.4, Windows)

The two InstalledTest helpers that checked RR_VERSION precedence over `rr --version` were never discovered by Testo; they now run as tests. Two skipped tests document bugs found along the way: Package derives the minimum of `^2025.1 || ^3.0` as 3.0 instead of 2025.1, and Comparator::compare() mis-orders unnormalized input such as `v3.0.1` or `3.0`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89167c0b-8d88-40a8-b790-64db2420f890

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Composer orders 3.0 below 2023.1, so a package requiring `^2025.1 || ^3.0` made 3.0 the required minimum and rejected an installed 2025.x.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Within a release line the raw strings went to composer/semver, so direct callers got `v3.0.1` older than `3.0.0` and `3.0` older than `3.0.0`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk roxblnfk changed the title test: increase test coverage fix: order RoadRunner versions correctly in required-version lookup and Comparator::compare() Oct 9, 2026
@roxblnfk
roxblnfk merged commit 5f7567d into 1.x Oct 9, 2026
14 checks passed
@roxblnfk
roxblnfk deleted the coverage branch October 9, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant