Relativize LCOV paths against a root, match coverage roots at segments - #73
Merged
Conversation
`write_lcov` emitted the absolute path `uri2filepath` hands back — and on Windows a backslashed one, which no LCOV consumer recognizes at all. Coverage services match `SF:` paths against paths in the repository, so the absolute paths of a CI runner match nothing, and a fully covered package can be reported as 0%. It gains a `root` keyword, the same one `write_junit_xml` already takes and now implemented by the same helper: `_relative_path` is split into `_report_path`, which returns `nothing` for a URI it cannot turn into a path, plus the URI-falling-back wrapper the JUnit classnames need. Paths always use `/` separators now, root or no root, so a Windows leg and a Linux leg of the same matrix contribute the same file names to a merged report. A file outside `root` keeps its absolute path rather than a `..`-heavy one — the choice the JUnit writer already makes, and the one that keeps a stray record looking like a stray record instead of a coverage regression. Separately, coverage root URIs are now matched at whole path segments. A root is a folder URI and `filepath2uri` never leaves a trailing slash, so the prefix test also accepted siblings whose names merely started with it: a root of `<workspace>/Foo` collected coverage for `<workspace>/Foo2`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 20, 2026
Merged
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.
Groundwork for julia-testitems/testitem-workflow#11 (Codecov reporting 0%). The workflow-side fix is julia-testitems/testitem-workflow#13; this PR fixes the LCOV output itself.
write_lcovgainsrootwrite_lcovemitted the absolute pathuri2filepathhands back — and on Windows a backslashed one, which no LCOV consumer recognizes at all, so a Windows matrix leg contributed nothing to a merged report even before the absolute-path problem. Coverage services matchSF:paths against paths in the repository, so the absolute paths of a CI runner match nothing, and a fully covered package can come out at 0%.It now takes the same
rootkeywordwrite_junit_xmlalready has, implemented by the same helper:_relative_pathis split into_report_path(returnsnothingfor a URI it cannot turn into a path) plus the URI-falling-back wrapper the JUnit classnames need. So both writers relativize identically,abspatha relative root the same way, and refuse to walk out of the root with..the same way./separators now, root or no root.rootkeeps its absolute path rather than a..-heavy one — the choice the JUnit writer already makes, and the one that keeps a stray record looking like a stray record rather than a coverage regression.write_lcovis itself unreleased (it is in the2.0.0section of the CHANGELOG), so the signature change is not breaking for anyone; the existing bullet is amended rather than a new one added.Coverage roots match whole path segments
Separate bug in the test process, found while making TestItemApp narrow its roots to
src/ext: a root is a folder URI andfilepath2urinever leaves a trailing slash, sostartswithalso accepted siblings whose names merely started with it — a root of<workspace>/Foocollected coverage for<workspace>/Foo2.Tests
Four new items, all passing; the whole of
test_junit.jl+test_coverage.jlis green (20/20).relpathtrap the JUnit test already guards).file:URIs skipped.Coverage roots match whole path segments— verified it fails on the old prefix match and passes with the fix.Note for whoever tags this
Project.tomlsays1.7.1-DEVwhile the CHANGELOG heads its unreleased section## [2.0.0] - Unreleasedand contains a breaking JSONRPC entry. Not touched here, but the two disagree.🤖 Generated with Claude Code