Skip to content

feat: wire up JaCoCo coverage reporting and enforcement#28

Merged
sagile merged 6 commits into
mainfrom
feature/GTI-847-add-jacoco
Jun 5, 2026
Merged

feat: wire up JaCoCo coverage reporting and enforcement#28
sagile merged 6 commits into
mainfrom
feature/GTI-847-add-jacoco

Conversation

@sagile

@sagile sagile commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Closes #29

Summary

  • Add lombok.config so Lombok marks generated code with @Generated and JaCoCo skips it
  • Exclude no-logic classes (constants, pure enums, exception types, pure DTOs) from coverage metrics
  • Wire jacocoTestCoverageVerification into check/build with a 42% instruction-coverage gate (reflects unit-test-only coverage; integration tests require Docker/Redis and run separately)
  • Add CI steps to run coverage verification and upload HTML+XML reports as a coverage-reports artifact on every PR (uploads even when the gate fails)
  • Add unit tests for TokenEscaper, ArrayUtils, Utils, FullTextQueryHelper, EmbeddedSentence, and SentenceSplitter

Test plan

  • PR CI passes (style → compile → test → coverage verification)
  • ./gradlew :core:check passes locally
  • Coverage reports artifact appears in the Actions run summary

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to build/CI configuration and additive unit tests; no production runtime behavior is modified.

Overview
This PR turns JaCoCo from optional reporting into an enforced quality gate and surfaces coverage in CI.

Build / Gradle: Adds lombok.config so Lombok-generated code is marked @Generated (and stops config bubbling). JaCoCo report/verification now share the same filtered class set—excluding exceptions, constants, pure enums, and thin DTO/config types. The coverage rule switches to instruction COVEREDRATIO with a 42% minimum (down from the prior 80% default), and check depends on jacocoTestCoverageVerification so local/CI builds fail when coverage is below the bar.

CI: After unit tests, the workflow runs JaCoCo verify/report for core and both VCR demo modules, then uploads HTML/XML reports as a coverage-reports artifact (if: always() so reports remain even when the gate fails).

Tests: New unit tests cover TokenEscaper, ArrayUtils, Utils (cosine distance helpers), FullTextQueryHelper, EmbeddedSentence, and SentenceSplitter to help meet the new gate.

Reviewed by Cursor Bugbot for commit 4634851. Bugbot is set up for automated code reviews on this repo. Configure here.

- Add lombok.config to mark Lombok-generated code with @generated so
  JaCoCo skips boilerplate methods when computing coverage
- Exclude synthetic inner classes and exception types from coverage
- Wire jacocoTestCoverageVerification into check/build so the 80%
  instruction-coverage gate blocks failing builds
- Add CI steps to generate JaCoCo reports after tests and upload
  HTML+XML as a build artifact on every PR

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread .github/workflows/build.yml Outdated
Comment thread build.gradle.kts Outdated
@jit-ci

jit-ci Bot commented Jun 4, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

- Run jacocoTestCoverageVerification explicitly in CI so the 80% gate
  actually blocks PRs (not just jacocoTestReport)
- Remove broad **/*$*.class exclusion that was silently skipping all
  inner classes; rely on lombok.config @generated instead

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sagile sagile changed the title feat(GTI-847): wire up JaCoCo coverage reporting and enforcement feat: wire up JaCoCo coverage reporting and enforcement Jun 4, 2026
Comment thread .github/workflows/build.yml
sagile and others added 3 commits June 4, 2026 10:26
Add if: always() so the coverage artifact is available for inspection
regardless of whether jacocoTestCoverageVerification passes or fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Exclude constants classes, pure enums, and pure DTO/config value objects
from coverage metrics — these have no branching logic worth testing and
were dragging the reported ratio below the 80% threshold.

Classes excluded:
- Constants, ExtensionConstants (static fields only)
- FieldType, StorageType, ReducerFunction, DistanceAggregationMethod (pure enums)
- RouteMatch, SortField, RedisConnectionConfig (Lombok-only DTOs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sses

Lower threshold to 42% to reflect actual coverage from unit tests alone
(most of the remaining gap is integration tests that require Docker/Redis).

Add unit tests for:
- TokenEscaper: escape logic, null handling, special characters
- ArrayUtils: float/byte round-trips, null handling, double conversion
- Utils: cosine distance normalization/denormalization, timestamp
- FullTextQueryHelper: stopword loading, tokenization, escaping
- EmbeddedSentence: cosine similarity edge cases
- SentenceSplitter: split, null/blank handling, span detection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit dfeffe1. Configure here.

Comment thread build.gradle.kts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sagile sagile merged commit 5767501 into main Jun 5, 2026
6 checks passed
@sagile sagile deleted the feature/GTI-847-add-jacoco branch June 5, 2026 13:47
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.

Wire up JaCoCo coverage reporting and enforcement

1 participant