Repository navigation
conformance: one source for what platform this is, and sizes in bits - #961
Open
tannevaled wants to merge 1 commit into
Open
tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
The shim had TWO platform sources under a comment saying it had one:
PLATFORMS = [:darwin, :bsd, :unix] # a literal
class PlatformGuard
PLATFORM = RUBY_PLATFORM # derived
On darwin they agree, so the split is invisible from the machine the work
is done on. On the ubuntu lane that enforces the gate, `platform_is
:linux` was false while `PlatformGuard.os?(:linux)` was true.
mspec has no list either (ruby/mspec lib/mspec/guards/platform.rb:26-38,
read at the tip): every name but :windows and :wsl is a plain substring
of RUBY_PLATFORM. So platform_is / platform_is_not now call
PlatformGuard, PLATFORMS is gone, and nothing is typed twice.
Three defects the issue did not name, found by reading the reference
rather than the issue:
1. :pointer_size was compared against WORDSIZE / 8 — BYTES against a
value the corpus writes in BITS (platform.rb:61-66 is SIZEOF * 8).
So `pointer_size: 64` AND `pointer_size: 32` were both false, on
every machine, and every guard written that way was shut. Nothing
looked wrong, because a shut guard is what a guard does.
2. platform_is_not rebuilt its own negation by OR-ing the parts. mspec
is run_unless over the SAME match? platform_is runs on (:116-122),
and the two differ as soon as a site carries a name AND an option.
3. The `os:` option was not read at all.
MEASURED, same binary, same corpus, only the shim changed (cmd/shimdelta
on darwin):
+188 core/array/pack/j_spec.rb (0 -> 188)
+216 core/string/unpack/j_spec.rb (0 -> 216)
Both were recorded as 0 in BASELINE — what a file contributing nothing
looks like from the outside. Their whole contents sit behind
`platform_is pointer_size: 64`.
And in the other direction, which is why the two are never summed:
core/file/sticky_spec.rb went pass=4 fail=1 -> pass=4 fail=0. The
literal's :bsd matched no RUBY_PLATFORM this project runs on, so a
BSD-only expectation was being asserted on a mac.
The static census, over the pinned corpus (2206 files — the gate's own
count — and 420 guard sites, 3 of which the reader REFUSES rather than
guesses at, because they do not close on their line):
x86_64-linux skipped but should run 20 guards >=29 ex 19 files
ran but should not 11 guards >=11 ex 10 files
arm64-darwin skipped but should run 2 guards 2 files
ran but should not 1 guard >=1 ex 1 file
Two instruments, because neither axis existed:
cmd/platguard reads the corpus and says which guards the two answers
disagree about, for a NAMED machine. It has to be
named: the defect is invisible on darwin, so a tool
that could only answer about its own host would have
reported a clean corpus from here.
cmd/shimdelta runs ONE interpreter over the same files under two
spec_helper.rb. cmd/specdelta compares two engines
through one shim, which is the wrong axis when the
engine is fixed and the shim decides which examples
exist. It refuses two byte-identical shims, counts a
missing tally as DIDNOTRUN and never as zero, and
prints the two directions on separate lines.
THE GATE is conformance_platform_guard_test.go, and every assertion in
it is platform-independent: it asserts that the two sources AGREE, not
what they answer, plus three facts true of every machine. Verified by
running it against main's shim, where it goes red six times on darwin
alone — :bsd, :unix, the pointer_size pair, the shut-both-ways
absolute, the negation, and the full triple.
A second test refuses a PLATFORMS literal in code at all, because a list
that happened to agree with RUBY_PLATFORM on the runner would satisfy
every runtime assertion while putting the second source back for every
other machine.
Also corrected: the four README citations my own insertion moved, with
MEASURED values, not computed ones. Three of them are outside the gate
that checks such citations (#960).
NOT DONE HERE: BASELINE. It is recorded where it is enforced, through
the rubyspec-baseline dispatch on ubuntu, and this change moves the
population on that machine in both directions. The ratchet lane on this
PR is the measurement.
Refs #837, #960
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The shim had two sources for what platform this is
…under a comment saying the literal was the single source of truth. On darwin
the two agree, so the split is invisible from the machine the work is done
on. On the ubuntu lane that enforces the gate,
platform_is :linuxwas falsewhile
PlatformGuard.os?(:linux)was true.The fix is not to derive the list. mspec has no list — read at the tip of
ruby/mspec,lib/mspec/guards/platform.rb:26-38: every name but:windowsand
:wslis a plain substring ofRUBY_PLATFORM. Soplatform_isandplatform_is_notnow callPlatformGuard,PLATFORMSis gone, and nothing istyped twice.
Three defects the issue did not name
Found by reading the reference rather than the issue.
:pointer_sizecompared againstWORDSIZE / 8platform.rb:61-66isSIZEOF * 8). Both the 64 and the 32 branch of every such guard were false, on every machine. Nothing looked wrong, because a shut guard is what a guard does.platform_is_notrebuilt its own negation by OR-ing the partsrun_unlessover the samematch?(:116-122). The two differ as soon as a site carries a name AND an option.os:optionMeasured, not argued
Same binary, same corpus, only the shim changed —
cmd/shimdeltaon darwin:Both were recorded as
0inBASELINE, which is what a file contributingnothing looks like from the outside. Their entire contents sit behind
platform_is pointer_size: 64.And in the other direction, which is why the two are never summed:
core/file/sticky_spec.rbwentpass=4 fail=1→pass=4 fail=0. The literal's:bsdmatched noRUBY_PLATFORMthis project runs on, so a BSD-onlyexpectation was being asserted on a mac.
Static census over the pinned corpus — 2206 files, which is the gate's own
count, and 420 guard sites, 3 of which the reader refuses rather than
guesses at because they do not close on their line:
x86_64-linuxarm64-darwinTwo instruments, because neither axis existed
cmd/platguardreads the corpus and says which guards the two answersdisagree about, for a named machine. It has to be named: the defect is
invisible on darwin, so a tool that could only answer about its own host would
have reported a clean corpus from here.
cmd/shimdeltaruns one interpreter over the same files under twospec_helper.rb.cmd/specdeltacompares two engines through one shim,which is the wrong axis when the engine is fixed and the shim decides which
examples exist. It refuses two byte-identical shims, counts a missing tally as
DIDNOTRUNand never as zero, and prints the two directions on separate lines.The gate
conformance_platform_guard_test.go, and every assertion in it isplatform-independent: it asserts that the two sources agree, not what they
answer, plus three facts true of every machine. This test runs on ubuntu, macos
and windows; one that spelled out an expected answer would be asserting which
runner it is on.
Verified the way a gate has to be — run against
main's shim, where it goes redsix times on darwin alone:
:bsd,:unix, thepointer_sizepair, theshut-both-ways absolute, the negation, and the full triple. A second test
refuses a
PLATFORMSliteral in code at all, because a list that happened toagree with
RUBY_PLATFORMon the runner would satisfy every runtime assertionwhile putting the second source back for every other machine.
The census table was checked the same way: reintroducing the bits/bytes
comparison in Go turns two rows red.
Issues
that it does not mention. It stays open until
BASELINEis re-recorded,since its own text asks for the move to be measured before the regeneration.
measured values, not computed ones. Three of them are outside the gate
that checks such citations, which is exactly what Three of the six README line-number citations are outside the only gate that checks them, and all three had drifted #960 is about; it stays
open, since widening the gate is not done here.
move before
UPDATE_BASELINE=1absorbs it" is written down, and this changefollows it.
explain why
cmd/shimdeltareads the pass count alone: the four-field linelives on stdout, which the judge must not read. No change to it here.
Not done here, on purpose
BASELINEis not regenerated in this commit. It is recorded where it isenforced — the
rubyspec-baselinedispatch onubuntu-24.04— and this changemoves the population on that machine in both directions. The ratchet lane on
this PR is the measurement, and the re-record follows it.
⛔
cmd/shimdeltameasures passing examples and nothing else. A guard changethat removes a failure is invisible to it —
sticky_spec.rbabove is thewitness, and the limitation is stated in the command's own doc comment rather
than left to be discovered.
Refs #837, #960, #799, #843 — all four stay open: #837 until
BASELINEisre-recorded on the lane that enforces it, #960 until the citation gate is
widened to all six, and #799 and #843 are named here for context only.
🤖 Generated with Claude Code