The finale runs a small package-resolver workload against everything you built - sort a set of versions including prereleases, answer satisfy questions across every range form, and pick the best match. Each layer proves itself at once.
Run a mixed workload of sorting, satisfaction, and selection, asserting every exact result.
This is the promise the whole project was built to keep: a real Semantic
Versioning library, exercised the way a package manager uses it. The workload
touches every layer at once. Sorting the eight versions runs the full precedence
engine, and the prereleases land first in their exact spec order before the
releases - 1.0.0-alpha, 1.0.0-beta.11, 1.0.0-rc.1, then 1.0.0 and the rest.
MaxSatisfying over the installed list answers the resolver’s real question, and
caret versus tilde pick different best matches from the same set.
The satisfaction checks close the loop across the range grammar: caret bounds
(1.5.0 in, 2.0.0 out of ^1.2.3), the zero-major tightening (0.3.0 out of
^0.2.3), a wildcard (1.9.0 in 1.x), and the prerelease guard doing its job -
1.2.3-beta.1 is rejected by 1.x because no comparator opted into prereleases.
Every one of these is a single call into code you already wrote; the capstone adds
no new logic, it just proves the parts agree. From a version string in to a precise
answer out, you have built the honest core of the tool every dependency you install
runs through - and it is yours.
// Everything composes with no new code:// Sort(versions) -> the full precedence order (prereleases first)// MaxSatisfying(installed, "^1.2.0") -> 1.3.0// MaxSatisfying(installed, "~1.2.0") -> 1.2.3// Satisfies(1.5.0, "^1.2.3") -> true ; Satisfies(2.0.0, "^1.2.3") -> false// Satisfies(1.2.3-beta.1, "1.x") -> false (no prerelease comparator opts in)