Skip to content

merge_coverage: canonicalize file paths so aliases collapse - #86

Merged
jaltmayerpizzorno merged 1 commit into
mainfrom
202605-canonicalize-merge-paths
May 12, 2026
Merged

merge_coverage: canonicalize file paths so aliases collapse#86
jaltmayerpizzorno merged 1 commit into
mainfrom
202605-canonicalize-merge-paths

Conversation

@jaltmayerpizzorno

Copy link
Copy Markdown
Collaborator

merge_coverage keyed entries by exact filename string. When a workload runs the same physical file under different path spellings across steps — e.g. relative pkg/foo.py from a CLI invocation in cwd vs. absolute /.../pkg/foo.py from a pytest-driven import 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 on OSError (e.g. files not present on the merging host).

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
jaltmayerpizzorno force-pushed the 202605-canonicalize-merge-paths branch from a4351d9 to 44f8880 Compare May 12, 2026 17:28
@jaltmayerpizzorno
jaltmayerpizzorno merged commit dd9fdbb into main May 12, 2026
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant