Repository navigation
Keep branch and method data the resultsets carried - #1256
Merged
Merged
Conversation
sferik
force-pushed
the
merge-preserves-measured-criteria
branch
from
August 8, 2026 01:53
e422117 to
16e05c4
Compare
A merge runs on behalf of the processes that produced the resultsets and
does not necessarily share their configuration. `simplecov merge` only
requires the library, so it never runs SimpleCov.start and measures
nothing, and a SimpleCov.collate block need not repeat enable_coverage
:branch. Such a process dropped the branch table from every file that
appeared in more than one resultset, while passing through untouched the
table of any file that appeared in only one:
merging process branch_coverage? false
sample.rb keys=["lines"] branches GONE
resultset1.rb keys=["lines", "branches"] branches kept
So the merged output was both lossy and internally inconsistent, and
merge_and_store wrote that state back to disk for the next collate to
read.
A criterion is now in play when the merging process measures it or when
tuples that survive reconciliation carried it. Nothing measured is lost,
and a process that does measure a criterion still always gets a table,
even an empty one, which is what lets SourceFile tell "no branches in
this file" apart from "branch coverage was off".
Which tuples survive needs two things said. A simulated side's
synthesized tuples are dropped when the other side ran, and the criterion
goes with them: keeping an empty table there would claim the file has no
branches when the truth is that nobody measured them in the run that
executed it. The side that ran therefore decides which criteria the file
carries, not only their tuples, which is also what keeps the answer
independent of which side is absorbed first.
And a side is only judged when it can be. Absent lines do not mean a side
never ran: a branch-only or method-only run omits them even for the files
it loaded, so judging on their absence discarded the real branch counts
such a run had measured. Unknown now means union, which is already what
happened when neither side carried lines. never_executed_files guards the
same conflation for the same reason.
This predates the accumulator. FilesCombiner gated on the same
configuration before it, so the behaviour goes back well beyond the merge
rewrite.
sferik
force-pushed
the
merge-preserves-measured-criteria
branch
from
August 8, 2026 02:07
16e05c4 to
5ecb8bc
Compare
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 merge runs on behalf of the processes that produced the resultsets, and does not necessarily share their configuration.
simplecov mergeonly requires the library, so it never runsSimpleCov.startand measures nothing at all. ASimpleCov.collateblock need not repeatenable_coverage :brancheither.Such a process dropped the branch table from every file that appeared in more than one resultset, while passing through untouched the table of any file that appeared in only one:
So the merged output was both lossy and internally inconsistent, and
merge_and_storewrote that state back to disk for the nextcollateto read.A criterion is in play when the merging process measures it or when the data carries a table for it, and it stays in play once any absorbed side has carried one. Nothing a producer measured is lost, and a process that does measure a criterion still always gets a table, even an empty one, which is what lets
SourceFiletell "no branches in this file" apart from "branch coverage was off".That second half is why this is a union rather than a swap. Deciding purely from the data looks cleaner, and I tried it first, but it drops the guarantee that an enabled criterion always yields a table.
spec/combine/results_combiner_spec.rbpins that guarantee for a reason, and removing it would handSourceFilea nil where it expects a hash.This predates the accumulator.
FilesCombinergated on the same configuration before #1254 replaced it, so the behavior goes back well beyond the merge rewrite.