Skip to content

Credit sibling-module test coverage in Kover reports#687

Merged
alexander-yevsyukov merged 4 commits into
masterfrom
changes-from-tool-base
Jun 10, 2026
Merged

Credit sibling-module test coverage in Kover reports#687
alexander-yevsyukov merged 4 commits into
masterfrom
changes-from-tool-base

Conversation

@alexander-yevsyukov

@alexander-yevsyukov alexander-yevsyukov commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Overview

Applies changes brought over from the ToolBase repository. Three independent edits:

1. Credit sibling-module test coverage — SiblingCoverage.kt (new)

Adds Project.creditTestCoverageFrom(contributor). Some modules' production
classes are exercised only by a sibling module's tests (e.g. the language-neutral
psi classes are tested through the psi-java fixtures). Kover's per-module
report — the one Codecov consumes — sees only the module's own test execution
data, so that cross-module coverage is otherwise lost from the per-module report.

The function feeds the contributor's JaCoCo execution data into this project's
total report as an additional binary report (only this project's classes are
credited from it) and wires the report/verify tasks to run after the
contributor's test task. A cross-project task dependency is used rather
than a project dependency, so no dependency cycle is introduced even when the
contributor already depends on this project.

2. Tests for File.classNamesInFileExtensionsTest.kt (new)

Covers the source-file → fully-qualified-class-name mapping: Java sources, Kotlin
sources (declared class + synthetic …Kt file class), the Kt-suffixed names
emitted by protoc-gen-kotlin, the two-part .proto.kt suffix, and the
unsupported-input fallbacks (non-source files and files outside the source root).

To make the helper testable, the existing File.fqnsRelativeTo in
KoverConfig.kt was renamed to classNamesIn and widened from private to
internal — matching the name the applied test expects.

3. Dependency bump — Base.kt

spine-base: 2.0.0-SNAPSHOT.4002.0.0-SNAPSHOT.404.

@alexander-yevsyukov alexander-yevsyukov self-assigned this Jun 10, 2026
@alexander-yevsyukov alexander-yevsyukov moved this to 🏗 In progress in v2.0 Jun 10, 2026
@alexander-yevsyukov alexander-yevsyukov changed the base branch from master to claude/modest-thompson-0aqffs June 10, 2026 02:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR appears to sync buildSrc coverage-related utilities/tests (and a local dependency version) from an upstream “ToolBase” source, adding support code for cross-module Kover coverage attribution and tests for deriving class FQNs from source file paths.

Changes:

  • Added Project.creditTestCoverageFrom(contributor) to feed a sibling module’s JaCoCo/Kover binary data into the current module’s Kover total report.
  • Added FileExtensionsTest covering expected class-name derivation rules for .java, .kt, and .proto.kt sources.
  • Bumped the local Base dependency snapshot version from 2.0.0-SNAPSHOT.400 to 2.0.0-SNAPSHOT.404.

Reviewed changes

Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.

File Description
buildSrc/src/test/kotlin/io/spine/gradle/report/coverage/FileExtensionsTest.kt New tests for File.classNamesIn(...) behavior across Java/Kotlin/proto-Kotlin filenames.
buildSrc/src/main/kotlin/io/spine/gradle/report/coverage/SiblingCoverage.kt New helper to include sibling module execution data in Kover reports and wire report tasks after contributor tests.
buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt Updates the pinned snapshot version for Spine Base dependencies.

@alexander-yevsyukov alexander-yevsyukov changed the title Apply changes from ToolBase Credit sibling-module test coverage in Kover reports; bump spine-base Jun 10, 2026
Rename the private `File.fqnsRelativeTo` helper to `classNamesIn` and
make it `internal` so `FileExtensionsTest` (applied from ToolBase) can
exercise it. The test referenced `classNamesIn`, which did not exist in
this repo, so the branch did not compile.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexander-yevsyukov alexander-yevsyukov marked this pull request as ready for review June 10, 2026 02:28
@alexander-yevsyukov alexander-yevsyukov changed the title Credit sibling-module test coverage in Kover reports; bump spine-base Credit sibling-module test coverage in Kover reports Jun 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6d03294c30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread buildSrc/src/main/kotlin/io/spine/gradle/report/coverage/SiblingCoverage.kt Outdated
Base automatically changed from claude/modest-thompson-0aqffs to master June 10, 2026 13:27
alexander-yevsyukov and others added 2 commits June 10, 2026 14:28
`creditTestCoverageFrom` hard-coded the `test` task name and a single
`kover/bin-reports/test.exec` file. A `kmp-module` contributor runs its
JVM tests through `jvmTest`, so the wiring either failed task resolution
or missed the contributor's actual binary report.

Discover the contributor's JVM test tasks by type (`Test`), derive one
exec file per task name, and depend on the whole collection. Non-JVM
Kotlin test tasks are not of type `Test` and are correctly ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alexander-yevsyukov alexander-yevsyukov merged commit 234233e into master Jun 10, 2026
2 checks passed
@alexander-yevsyukov alexander-yevsyukov deleted the changes-from-tool-base branch June 10, 2026 13:38
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in v2.0 Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants