Raise test coverage: instrument context-tests and add tests#318
Conversation
The `context-tests` module ran its in-process compilation tests without the Kover plugin, so the coverage they produce for `:context` production classes (66 `RangeReaction` cases, `Min`/`Max`, and the other reaction/option specs) was never credited to the aggregated report. Those classes therefore showed large false coverage gaps. Apply the Kover plugin to `context-tests` so `KoverConfig` folds the module into the root rollup, and exclude the module's generated Protobuf test fixtures (the `io.spine.tools.validation.given` package) from the root report: `KoverConfig` only excludes generated classes discovered under `main` source sets, not `testFixtures`, so without this the generated fixtures would flood the report. This credits ~105 previously-uncounted production lines and ~34 branches with no new tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `ValidationSdkSpec`, covering the Maven coordinates and compiler-plugin class name exposed by the `ValidationSdk` object. Add `ValidateOptionSpec` (with the `ValidateOnNonMessageField` proto fixture), covering the previously untested field-type check in `ValidateReaction` that rejects the `(validate)` option on non-message fields. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Regenerated after `context-tests` began applying the Kover plugin, which brings its JaCoCo-engine dependencies into the aggregated graph. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `DeprecatedOptionsSpec` (with the `deprecated_options_spec.proto` fixtures), driving the compiler pipeline against messages that use the deprecated `(is_required)` oneof option and `(if_invalid)` field option, and asserting the deprecation warnings emitted by `IsRequiredReaction` and `IfInvalidReaction` via captured console output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add `ValidationGradlePluginSpec`, which applies the plugin to a `ProjectBuilder` project and verifies the configuration it performs eagerly: registering the `validation` extension, applying the Protobuf and Spine Compiler Gradle plugins, and adding the validation runtime as an `implementation` dependency. Applying the plugin in-process exercises the transitively-applied Spine Compiler plugin, which references `org.gradle.kotlin.dsl` extensions and requires the `JavaPluginExtension`; hence the `testImplementation(gradleKotlinDsl())` dependency and the `java` plugin applied first in the test. The plugin's `afterEvaluate` and per-task `doFirst` actions run only during a real build and remain covered by the integration projects under `:tests`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Raises JVM test coverage and improves coverage accounting by ensuring :context-tests contributes to the aggregated Kover report (while excluding generated Protobuf test fixtures), and by adding targeted tests for the Validation Gradle plugin and option reactions.
Changes:
- Apply Kover to
:context-testsand excludeio.spine.tools.validation.given.**from aggregated coverage to avoid generated-fixture noise. - Add new compilation/Gradle-plugin tests covering
(validate)misuse and deprecated-option warnings, plus Gradle plugin wiring expectations. - Bump snapshot version to
2.0.0-SNAPSHOT.449and regenerate dependency reports.
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
version.gradle.kts |
Bumps the published snapshot version. |
build.gradle.kts |
Adds root Kover report filter to exclude generated test fixtures. |
context-tests/build.gradle.kts |
Applies Kover so :context-tests coverage is included in aggregation. |
context-tests/src/testFixtures/proto/spine/validation/validate_option_spec.proto |
Adds fixture for (validate) option misuse case. |
context-tests/src/testFixtures/proto/spine/validation/deprecated_options_spec.proto |
Adds fixtures for deprecated option warning cases. |
context-tests/src/test/kotlin/io/spine/tools/validation/ValidateOptionSpec.kt |
Adds compilation-failure test for (validate) on non-message fields. |
context-tests/src/test/kotlin/io/spine/tools/validation/DeprecatedOptionsSpec.kt |
Adds tests asserting deprecation warnings are emitted. |
gradle-plugin/src/test/kotlin/io/spine/tools/validation/gradle/ValidationSdkSpec.kt |
Adds tests for exposed artifact coordinates and compiler-plugin FQN. |
gradle-plugin/src/test/kotlin/io/spine/tools/validation/gradle/ValidationGradlePluginSpec.kt |
Adds tests for plugin application behavior (extensions, plugins, deps). |
gradle-plugin/build.gradle.kts |
Adds gradleKotlinDsl() to test runtime to support ProjectBuilder-based tests. |
docs/dependencies/pom.xml |
Regenerates dependency POM with updated version and dependency graph changes. |
docs/dependencies/dependencies.md |
Regenerates dependency/license report with updated version and new deps. |
.agents/tasks/spine-task-group-constant.md |
Removes an obsolete agent task document. |
.agents/tasks/gradle-caching-plan.md |
Removes an obsolete agent task document. |
.agents/tasks/enforce-max-line-length.md |
Removes an obsolete agent task document. |
.agents/tasks/cross-agent-skill-best-practices.md |
Removes an obsolete agent task document. |
.agents/tasks/buildsrc-gradle-review-findings.md |
Removes an obsolete agent task document. |
.agents/tasks/archive/validating-builder-validate.md |
Adds an archived task note document. |
.agents/tasks/archive/setup-cross-tool-agent-instructions.md |
Removes an obsolete archived agent task document. |
.agents/tasks/archive/raise-coverage.md |
Removes an obsolete archived agent task document. |
.agents/tasks/archive/raise-coverage-kover-migration.md |
Removes an obsolete archived agent task document. |
.agents/tasks/archive/prompt-caching-org.md |
Removes an obsolete archived agent task document. |
.agents/tasks/archive/prohibit-automatic-commits.md |
Removes an obsolete archived agent task document. |
.agents/tasks/archive/api-discovery.md |
Removes an obsolete archived agent task document. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 825282bad4
ℹ️ 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".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #318 +/- ##
============================================
+ Coverage 82.64% 90.55% +7.90%
- Complexity 332 363 +31
============================================
Files 82 85 +3
Lines 2040 2138 +98
Branches 161 161
============================================
+ Hits 1686 1936 +250
+ Misses 289 158 -131
+ Partials 65 44 -21 🚀 New features to boost your workflow:
|
The `version.gradle.kts` bump migrated the publishing-version declaration from
the deprecated `val validationVersion by extra(...)` delegate to
`extra.set("validationVersion", ...)`. `build-and-release.md` embedded that line
via `start/end="val validationVersion"`, so the anchor no longer matched and
`:docs:checkSamples` failed (`Panic: there is no line matching Pattern
val validationVersion`).
Re-anchor the embed on `validationVersion` — unique in the file and stable
across version bumps — and regenerate the embedded snippet via
`:docs:embedCode`. Addresses the review comments on #318.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Fixed in bd0a068. The version bump migrated Rather than keep a |
Summary
Raises JVM test coverage for the validation compiler. Production-code coverage
improves from 301 → 166 missed lines (−135, ~45%) and 104 → 68 missed
branches, via a mix of a coverage-measurement fix and new tests.
What changed
Credit
context-testscoverage (the main lever)context-testsran its in-process compilation tests (66RangeReactioncases,Min/Max, and the other reaction/option specs) without the Kover plugin,so the coverage they produce for
:contextproduction classes was nevercredited to the aggregated report — those classes showed large false gaps.
context-tests/build.gradle.ktsnow appliesorg.jetbrains.kotlinx.kover, soKoverConfigfolds the module into the root rollup.build.gradle.ktsexcludes the module's generated Protobuf test fixtures(
io.spine.tools.validation.given.**) from the aggregated report.KoverConfigonly excludes generated classes discovered under
mainsource sets, nottestFixtures, so without this the generated fixtures would flood the report.This credits ~105 previously-uncounted production lines and ~34 branches with
no new tests.
New tests
ValidationSdkSpec— theValidationSdkartifact coordinates / compiler-plugin FQN.ValidateOptionSpec(+validate_option_spec.proto) — the previouslyuntested
(validate)-on-a-non-message-field error path.DeprecatedOptionsSpec(+deprecated_options_spec.proto) — thedeprecation warnings for
(is_required)and(if_invalid), captured viatapConsole.ValidationGradlePluginSpec— applies the plugin to aProjectBuilderproject and verifies the extension registration, transitive plugin
application, and the runtime dependency. Requires
testImplementation(gradleKotlinDsl())because the transitively-applied Spine Compiler plugin references
org.gradle.kotlin.dslextensions.Version + reports
version.gradle.ktsbumped2.0.0-SNAPSHOT.448→.449(also migrated thedeprecated
by extra(...)delegate toextra.set(...)).docs/dependencies/{pom.xml,dependencies.md}regenerated — applying Kover tocontext-testsbrings its JaCoCo-engine dependencies into the aggregated graph.Follow-up (not in this PR)
While raising coverage,
ValidatorGenerator/ApplyValidator(
java/.../generate/ValidatorGenerator.kt, ~49 lines) were found to be deadcode — never instantiated anywhere; the nested-message validation they were
meant to generate is handled at runtime by
ValidatorRegistry. They show as100% uncovered because they are unreachable. Removal is a separate production
change needing its own review.
The remaining gaps are the
SetOnceRenderer-style view-query renderers (notpopulated under
PipelineSetup), the gradle plugin'safterEvaluate/doFirstpaths (need a real build / TestKit), and non-actionable guards/throw-helpers.
Reviewer notes
clean build dokkaGeneratepassed;spine-code-review,kotlin-engineer, andreview-docsall returned APPROVE.given.**); nomainsourcedeclares that package, so no production coverage is masked.
🤖 Generated with Claude Code