Repository navigation
Commit 4d1a7fd
conformance: derive CUR_VERSION from RUBY_VERSION — one fact, one place (#845)
Closes the last item of #799: the version the gate resolves `ruby_version_is`
guards at stops being a second hardcoded copy of what the runtime already
reports.
-CUR_VERSION = "3.4.1"
+CUR_VERSION = RUBY_VERSION
## Why this is worth a PR of its own
`CUR_VERSION` selects the **population** the whole conformance figure is counted
over. At 3.4.1 every example behind a `ruby_version_is "4.0"` guard is removed
from the suite before anything runs — 61 block guards and 5 inline sites at that
boundary, and 41 guards asserting what 4.0 changed away from (#836's census).
The two copies agreed, so nothing was wrong on any given day. The defect #799
names is that **half a version change could land**: `rubyVersion` bumped in
internal/vm/kernel_introspect.go, this file forgotten, and the gate goes on
measuring the 3.4 population while every page claims the new version. Both
halves look correct read on their own, which is exactly why nothing would have
said so.
This lands **before** the move to 4.0.x rather than with it, so the move is a
one-line change to one place whose effect the ratchet can then attribute
cleanly.
## Measured: a true no-op today
`RUBY_VERSION` is `"3.4.1"`, the same string the literal held, so the population
does not move. Measured rather than asserted — the derived shim run against
`main`'s own binary (3a3fb81, so nothing else of mine is in the reading), on a
private two-file corpus:
$ rbgo core/builtin_constants/builtin_constants_spec.rb
RBGO_RESULT pass=17 fail=0 error=0 skip=0
`BASELINE` records `17` for that file. **A green ratchet on this PR is therefore
itself the proof of equivalence**, across all 2,206 files rather than the one I
could run here.
## Upstream behaviour, not a local convenience
mspec reads RUBY_VERSION for this too. The chain, at mspec b79c65e:
guards/version.rb:67 VersionGuard.new(VersionGuard::FULL_RUBY_VERSION, …)
guards/version.rb:6 FULL_RUBY_VERSION = SpecVersion.new SpecGuard.ruby_version(:full)
guards/guard.rb:41 def self.ruby_version(which = :minor)
guards/guard.rb:51 RUBY_VERSION.split('.')[0,n].join('.') # n = 3 for :full
i.e. RUBY_VERSION itself for a three-part version. A consequence worth having:
run under a different interpreter, the shim now measures at THAT interpreter's
version.
## Two tests, and what each one cannot see
`TestShimVersionIsTheRuntimesNotASecondCopy` asserts the equality through the
**real shim** rather than by matching the file's text, because what matters is
not how the line is spelled but what the constant holds at run time.
`TestShimVersionGuardsResolveAtThatVersion` proves CUR_VERSION actually feeds
`_version_in_range`: a guard at the running version keeps its example, one above
it removes its example (removes, not skips — a block guard below the threshold
deletes rather than counting, so the deliberately-failing example inside it
contributes to no counter).
⛔ **The control, planted:** with the shim set back to a literal
`CUR_VERSION = "9.9.9"`, the first test fails and names the disagreement
(`expected "9.9.9" to == "3.4.1"`) — while **the second still passes**, because a
guard at `>= RUBY_VERSION` is satisfied by any higher value. So the second test
proves the wiring and the first proves the value; reading the second alone as the
guard against a hardcode would be wrong, and the comment says so at the site.
## Not in this PR
- The move to 4.0.x itself. #799 asks for it with the baseline **not**
regenerated, so the ratchet names every file that shifts in both directions;
that reading is only clean once missing capabilities have landed separately
(#844 is the first).
- `PLATFORMS = [:darwin, :bsd, :unix]`, three lines below and the same shape of
defect — a hardcoded copy of something `RUBY_PLATFORM` already knows (#837).
It is left alone deliberately: unlike this change it is **not** a no-op, it
moves the population on the Linux lane, and it needs its own measurement.
The documentation side is go-embedded-ruby/docs#41, which makes the stated
version a checked claim and already recognises this derived spelling — so that
guard does not break on the day this merges.
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 30d788d commit 4d1a7fd
2 files changed
Lines changed: 86 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
23 | 47 | | |
24 | 48 | | |
25 | 49 | | |
| |||
0 commit comments