Skip to content

fix(coverage): resolve per-test coverage records with the same path resolver as the aggregate - #4328

Merged
swati510 merged 1 commit into
mainfrom
fix/coverage-per-test-resolve
Oct 21, 2026
Merged

swati510 merged 1 commit into
mainfrom
fix/coverage-per-test-resolve

Conversation

@RaghavChamadiya

Copy link
Copy Markdown
Member

Per-test records matched report paths on their own, without the report's directory. In a monorepo, a package's per-test lcov (or a .coverage with relative paths) tied between packages and was dropped, while the aggregate read of the same report mapped every file.

  • resolve_test_reports now resolves both the source path and the test's own file through _resolve_path, the aggregate resolver. That resolver takes the report's directory and roots as arguments.
  • coverage add records each context report's directory, so per-test and per-file coverage map alike.

Stacked on #4327.

Verification

  • A monorepo unit test where per-test records used to drop now maps them to the same files as the aggregate, test files included.
  • A coverage add test stores both the per-file rows and the per-test map under the package.
  • pytest tests/unit -k "coverage or test_map or impacted or test_impact or selection": 1,471 passed.
  • ruff check clean.

@RaghavChamadiya
RaghavChamadiya force-pushed the fix/coverage-per-test-resolve branch from d1f13d4 to b727c23 Compare October 21, 2026 04:36
@RaghavChamadiya
RaghavChamadiya force-pushed the fix/coverage-reingest-newer-reports branch 2 times, most recently from b938593 to 59d0c7c Compare October 21, 2026 05:31
@RaghavChamadiya
RaghavChamadiya force-pushed the fix/coverage-per-test-resolve branch from b727c23 to 9c91913 Compare October 21, 2026 05:31
Base automatically changed from fix/coverage-reingest-newer-reports to main October 21, 2026 08:50
…esolver as the aggregate

Per-test records matched report paths on their own, without the report's
directory, so in a monorepo a package's per-test lcov (or a .coverage with
relative paths) tied between packages and was dropped while the aggregate
read of the same report mapped every file.

resolve_test_reports now resolves the source path and the test's own file
through _resolve_path, the aggregate resolver, which takes the report's
directory and roots as arguments. coverage add records each context report's
directory (report_origin_dir) so per-test and per-file coverage map alike.
@RaghavChamadiya
RaghavChamadiya force-pushed the fix/coverage-per-test-resolve branch from 9c91913 to c3b12e7 Compare October 21, 2026 08:56
@swati510
swati510 merged commit ca27270 into main Oct 21, 2026
10 checks passed
@swati510
swati510 deleted the fix/coverage-per-test-resolve branch October 21, 2026 08:58
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.

2 participants