Repository navigation
conformance: a guard used as an expression yields its block's value, as mspec does (#962) - #965
Merged
Merged
Conversation
…962) mspec's SpecGuard#run_if is `yield if yield?(false)` (guard.rb:80), so with a block the guard's value is the block's value when it holds and nil when it does not. The shim's `_guard_run` ended in a hardcoded `nil`, so the open case returned nothing too. It is the same defect the comment above `_guard_run` already records fixing for the NO-block form, one form over: a guard used as an expression contributed nothing. Where it cost: core/file/stat/birthtime_spec.rb:3-5 splats exactly that value into a platform list, platform_is(:windows, :darwin, :freebsd, :netbsd, *ruby_version_is("4.0") { :linux }, ) do so `*nil` added nothing and the file was guarded for a list that never contained :linux -- skipped on the gate's own ubuntu runner, at a version where upstream runs it. It ran there only because the old literal PLATFORMS matched :darwin on every machine (#837): two defects cancelling, and #961 removing one is what made this one measurable. THE GATE, conformance_guard_value_test.go, has a witness on each side, because one side alone is a weaker rule that also passes: against the old helper the 4 OPEN rows go red (block value lost) against `yield` with no the 4 SHUT rows go red (block value returned `if match` where mspec returns nil) A helper returning the block's value unconditionally would ALSO turn birthtime_spec green, and would add :linux on a Ruby where the corpus says not to; only the shut rows tell the two fixes apart. Every row is platform-independent ("0.0" / "999" / RUBY_PLATFORM), and the no-block form is asserted unchanged. MEASURED. The corpus uses a guard with a block as a value in exactly two places in language/ + core/: core/file/stat/birthtime_spec.rb:4 value splatted -- THIS defect core/tracepoint/inspect_spec.rb:70 statement form, value discarded cmd/shimdelta on darwin over both, same binary, only the shim changed: 0 gained, 0 lost, 0 unmeasured -- as predicted, since :darwin is in that list either way. The ubuntu effect is the ratchet lane's to report. Citations moved by the 19-line comment, with measured values: two in the conformance README (gated) and one in the root README (not gated, #960). Nine more citations into this file live in cmd/specdelta's Go source, and on main they are ALREADY wrong by a uniform +48 -- pre-existing, written 2026-11-02 and never touched since. Recorded on #960 rather than hand-fixed here: they would be right until the next insertion, and the remedy is the gate that issue asks for. Refs #962, #837, #960 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
Ratchet: the red was noise at identical code; the effect is birthtime +1Same SHA
Not locked into 🤖 Generated with Claude Code |
tannevaled
added a commit
that referenced
this pull request
Nov 21, 2026
…); sum unchanged (#967) core/kernel/require_spec.rb read 68 in 2 of 4 ratchet attempts since BASELINE recorded 69, at code that cannot affect it: #965 868e42e attempt 1 68 red #965 868e42e attempt 2 69 green <- same SHA, both values #966 d66943c attempt 1 69 green #966 6f88f65 attempt 1 68 red <- a test-only change Pinned to its floor, as #885 pinned core/random/bytes_spec.rb -- the remedy #887 describes for a file with no honest single row. Which example flips is not measured: the ratchet keeps a count per file (#887). core/file/stat/birthtime_spec.rb 0 -> 1: what #965 made it on the gate's runner, read 1 in all 3 attempts whose logs were read. The 0 was absorbed for #961; leaving it unbanked meant a regression to 0 would pass. The two moves cancel: the sum stays 24106, so the figure gates of the README, docs and landing are untouched. The header records both edits. Co-authored-by: Claude Opus 5.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.
A guard used as an expression now yields its block's value, as mspec does
mspec's
SpecGuard#run_ifisyield if yield?(false)(guard.rb:80). With a block, a guard therefore evaluates to the block's value when it holds, and tonilwhen it does not. The shim's_guard_runended in a hardcodednil, so the open case returned nothing as well:Where it cost
core/file/stat/birthtime_spec.rb:3-5splats exactly that value into a platform list:*niladded nothing, so the file was guarded by a list that never contained:linux. It was skipped on the gate's own ubuntu runner, at a Ruby version where upstream runs it. It used to run there only because the old literalPLATFORMSmatched:darwinon every machine (#837). Two defects cancelled each other, and #961 removing one of them is what made this one measurable. #961's re-recordedBASELINEabsorbed the file's −1 for that reason, so expect the ratchet lane to report this file moving.The gate has a witness on each side
conformance_guard_value_test.go, 10 rows, each platform-independent ("0.0"/"999"/RUBY_PLATFORM):yieldwithoutif matchnil)A helper that returned the block's value unconditionally would also turn
birthtime_specgreen, and would add:linuxon a Ruby where the corpus says not to. Only the shut rows tell the two fixes apart.Measured
The corpus uses a guard-with-block as a value in exactly two places in
language/+core/:core/file/stat/birthtime_spec.rb:4: the value is splatted, which is this defectcore/tracepoint/inspect_spec.rb:70: statement form, the value is discardedcmd/shimdeltaon darwin over both, same binary, only the shim changed: 0 gained, 0 lost, 0 unmeasured. That was the prediction, since:darwinis in that list either way. The ubuntu effect is for the ratchet lane to report.Rebased onto
mainafter #961 was squash-merged; the change itself is unchanged.Citations
The 19-line comment moved three citations; they are updated to measured values: two in the conformance README (gated) and one in the root README (not gated, #960). Nine more citations into this file live in
cmd/specdelta's Go source. Onmainthey are already off by a uniform +48. That drift predates this PR (they were written 2026-11-02 and never touched since). It is recorded on #960 rather than fixed by hand here, because hand-fixed values would hold only until the next insertion; the remedy is the gate that issue asks for.Closes #962
Refs #837, #960, #961
🤖 Generated with Claude Code