merge_coverage: canonicalize file paths so aliases collapse - #86
Merged
Conversation
When a workload runs the same source file under different path forms across steps — e.g. relative `pkg/foo.py` when invoked from cwd, and absolute `/.../pkg/foo.py` when imported as a package — the per-step coverage files record both spellings as separate keys. `merge_coverage` keyed by exact filename string, so the merged result listed the same physical file twice: one entry with the actual coverage, another empty. This roughly halved the headline percentage for workloads that mix CLI invocations and pytest-driven imports of the same package. Group entries by `Path(p).resolve()` and union the executed/missing lines and branches across aliases; use the shortest original spelling as the display key so output stays readable when one form is relative. Falls back to the original string on OSError (e.g. files not present on the merging host).
jaltmayerpizzorno
force-pushed
the
202605-canonicalize-merge-paths
branch
from
May 12, 2026 17:28
a4351d9 to
44f8880
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.
merge_coveragekeyed entries by exact filename string. When a workload runs the same physical file under different path spellings across steps — e.g. relativepkg/foo.pyfrom a CLI invocation in cwd vs. absolute/.../pkg/foo.pyfrom a pytest-drivenimport pkg.foo— the merge treated them as separate files and the headline percentage was roughly halved.This PR groups entries by
Path(p).resolve()and unions executed/missing lines and branches across aliases, using the shortest original spelling as the display key so output stays readable when one form is relative. Falls back to the original string onOSError(e.g. files not present on the merging host).