Skip to content

fix: SemverFilter must respect value2 with directional operators#77

Merged
turegjorup merged 2 commits into
developfrom
feature/semver-filter-upper-bound
May 18, 2026
Merged

fix: SemverFilter must respect value2 with directional operators#77
turegjorup merged 2 commits into
developfrom
feature/semver-filter-upper-bound

Conversation

@turegjorup
Copy link
Copy Markdown
Contributor

Summary

Filling the upper-bound field with a directional operator silently dropped the upper bound, so e.g. `?comparison=>=&value=11.0.0&value2=11.2.0` returned everything `>= 11.0.0` (including `11.3.5`) instead of `[11.0.0, 11.2.0]`.

`apply()` now auto-promotes to a range whenever `value2` is supplied with a directional operator. `>=` / `<=` produce an inclusive range; `>` / `<` produce an exclusive one. The two values are sorted numerically so the order the user typed them in doesn't matter. `=` and `!=` still ignore `value2` (exact-match semantics).

Files Changed

  • `src/Form/Type/Admin/SemverFilter.php` — auto-promote logic
  • `src/Form/Type/Admin/SemverFilterType.php` — placeholder reads "upper bound (optional, makes it a range)"
  • `tests/Form/Type/Admin/SemverFilterTest.php` — 4 new regression tests

Test Plan

  • `/admin/installation?filters[type]=drupal&filters[frameworkVersion][comparison]=>=&filters[frameworkVersion][value]=11.0.0&filters[frameworkVersion][value2]=11.2.0` returns only `11.1.8` (no `11.2.8`, `11.2.10`, `11.3.5`).
  • Same with `comparison=>` is exclusive — returns 11.1.8 only.
  • Reversing the values (e.g. `value=11.2.0&value2=11.0.0`) yields the same result.
  • `=` with `value2` set still matches only the single exact version.
  • `docker compose exec phpfpm composer tests` — 41/41 green.

Filling the upper-bound field together with >=, >, <=, or < used to
silently drop the upper bound, so ?comparison=>=&value=11.0.0&value2=11.2.0
returned everything >= 11.0.0 instead of [11.0.0, 11.2.0].

apply() now auto-promotes to a range whenever value2 is supplied with
a directional operator. The operator carries inclusivity (>=/<= →
inclusive, >/< → exclusive) and the two values are sorted numerically
so the order the user typed them in doesn't matter. = and != still
treat the second value as ignored (exact match semantics).

Form placeholder updated to "upper bound (optional, makes it a range)"
so it no longer reads as exclusive to between.
@github-actions
Copy link
Copy Markdown

API Specification - Non-breaking changes

API Changelog 1.0.0 vs. 1.0.0

No changes detected

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@25ab300). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/Form/Type/Admin/SemverFilterType.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop      #77   +/-   ##
==========================================
  Coverage           ?   41.18%           
  Complexity         ?      864           
==========================================
  Files              ?      125           
  Lines              ?     2722           
  Branches           ?        0           
==========================================
  Hits               ?     1121           
  Misses             ?     1601           
  Partials           ?        0           
Flag Coverage Δ
unittests 41.18% <95.23%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@turegjorup turegjorup self-assigned this May 18, 2026
@turegjorup turegjorup merged commit 038dea0 into develop May 18, 2026
10 checks passed
@turegjorup turegjorup deleted the feature/semver-filter-upper-bound branch May 18, 2026 22:40
@turegjorup turegjorup mentioned this pull request May 18, 2026
3 tasks
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.

2 participants