Apply SimpleCov line_stub merge patch on affected CRuby 3.4.x versions too - #1349
Merged
Merged
Conversation
ellisandrews-toast
requested review from
BrianSigafoos-SQ,
bsorbo,
jwils,
jwondrusch,
marcdaniels-toast,
myronmarston and
rossroberts-toast
as code owners
August 14, 2026 14:39
myronmarston
approved these changes
Aug 14, 2026
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.
Why
script/quick_builddeterministically fails on CRuby 3.4.4 with ~72 phantom "uncovered" lines (all continuation lines of multi-line hash literals), while CI stays green. This is the sameCoverage.line_stubbug that #1334 patched, but that patch's version gate ("4.0.0"..."4.0.4") excludes the 3.4 series.The bisect fixture in #1334 missed the 3.4 variant because it lacked a
# frozen_string_literal: truemagic comment. With the magic comment (present in every file in this repo), CRuby folds all-static multi-line hash literals at compile time, so their continuation lines fire no runtime line events (nil) — yetCoverage.line_stub(used by SimpleCov 1.x to backfill tracked-but-unloaded files, e.g. from the flatware main process, which runs no tests) still marks them relevant (0). SimpleCov 1.x's merge lets the phantom0beat the realnil.The raw
.resultset.jsonfrom a failing run shows the mechanism directly: the one worker that actually ranmeta_schema_validator_spec.rbrecorded line 17 asnil(not relevant), while the flatware main process and the other three workers all stubbed it as0(relevant-but-uncovered). Merged:0— reported as a miss for a line that cannot be executed.Re-probing with a
Coverage.line_stub-vs-runtime script against dockerruby-slimimages, using a fixture with the magic comment: 3.4.1 through 4.0.3 are all affected. 3.4.0 and 4.0.4 are clean, and no 3.4.x release has the fix backported as of 3.4.7. (On 4.0.0–4.0.3 the folding happens even without the magic comment, which is why #1334 caught that range.)What
Widens the existing patch's version gate in
enable_simplecov.rbtoGem::Version.new("3.4.1")...Gem::Version.new("4.0.4"), and updates the comment to document the affected range, the probe method, and the magic-comment variant.Using
Gem::Versionalso fixes a latent issue with the previous gate's lexicographic string comparison (e.g."4.0.10" < "4.0.4"as strings).The merge patch itself is unchanged, and remains harmless anywhere it applies unnecessarily: it only converts
nil-vs-0merges tonil, which never hides a genuinely uncovered line — a real uncovered line is0on every side, and0-vs-0still merges to0.Verification
COVERAGE=1 script/run_specs(whatscript/quick_buildruns) on this branch: 5223 examples, 0 failures, 100.00% line and branch coverage (45057/45057 lines, 3152/3152 branches in 760 files). The same run on unpatched main reports 72 phantom uncovered lines and exits non-zero.