build(jacoco): scope coverage report to the JVM-testable surface #292
Closed
JMR-dev wants to merge 9 commits from
build-290-jacoco-scope into main
pull from: build-290-jacoco-scope
merge into: :main
:main
:feat-362-yahoo-imap-limits
:feat-34-debug-ingest
:spike-359-sqlcipher-ondevice
:build-290-jacoco-scope
:fix-172-license-gate-upgrade-users
No Reviewers
Labels
Clear labels
Compliance
Infrastructure
P0
P1
P2
P3
P4
P5
P6
P7
P8
P9
Release
broken
bug
dequeued
documentation
donotmerge
duplicate
enhancement
good first issue
help wanted
invalid
question
queued
wontfix
Priority P0 (P0=highest for CI runners, P9=lowest)
Priority P1 (P0=highest for CI runners, P9=lowest)
Priority P2 (P0=highest for CI runners, P9=lowest)
Priority P3 (P0=highest for CI runners, P9=lowest)
Priority P4 (P0=highest for CI runners, P9=lowest)
Priority P5 (P0=highest for CI runners, P9=lowest)
Priority P6 (P0=highest for CI runners, P9=lowest)
Priority P7 (P0=highest for CI runners, P9=lowest)
Priority P8 (P0=highest for CI runners, P9=lowest)
Priority P9 (P0=highest for CI runners, P9=lowest)
Deprioritize below all P-levels; higher-priority PRs may preempt it. Coordinator/owner only.
Something isn't working
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Further information is requested
This will not be worked on
No labels
P3
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JMR-dev/LibreMail#292
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #290
Result
Line coverage: 50% → 78% (4,519 of 5,787 lines). Verified via a clean
:app:jacocoTestReportrun (deletedapp/build/reports/jacocofirst, reran from scratch) — see the "78% vs. the ~85-90% ballpark" note below for why this lands under the issue's estimate, on purpose.ViewModels, repos, mappers, DAOs, utils, policies, richtext, mail, and reporting-logic are all still counted — spot-checked the per-package HTML (
AccountSettingsViewModel,SettingsViewModel,ReaderViewModel,MailboxViewModel,AppLockViewModel,MailRepositoryImpl,AccountRepositoryImpl,ReportStore,ReportSubmitter,DiagnosticsCollector, etc. all present) and confirmedorg.libremail.di/org.libremail.data.local.coldopenno longer appear as packages in the report at all.Exclusion globs added
Two things worth your review
1. Four Screen/component files were deliberately left OUT of the exclusion list, even though they live in packages the issue calls out (
ui/compose,ui/settings,ui/reader,ui/reporting):ui/compose/RichTextEditor.kt—RichTextEditorTest(17 tests) covers theAnnotatedString<->RichTextContenteditor-op functions (applyStyle/applyBlock/applyLink/toRichContent/toAnnotatedString/...).ui/settings/AccountReorderList.kt—AccountReorderListTestcoverscommitDrag's reorder maths ("Pure so the index maths is unit-testable without a gesture" per its own kdoc).ui/reader/HtmlBody.kt—HtmlBodyTest+InlineImageResolverTestcovercidKey/resolveInlineImage/wrapHtml/toCssHex.ui/reporting/ReportReviewScreen.kt—ReportReviewClipboardTestcoverscopyReportPayloadToClipboard("Kept as a plain suspend function... unit-testable... without a Compose UI test or emulator" per its own kdoc).JaCoCo excludes at class-file granularity, and Kotlin compiles every top-level function in a
.ktfile —@Composableor not — into the same facade class. Excluding these four files would have zeroed out those five dedicated test files' coverage along with the render code. I verified this concretely: temporarily adding these four to the exclusion list brought line coverage to 87% (matching the issue's ~85-90% estimate almost exactly), which is strong evidence the original audit's estimate assumed a blanket**/ui/**-style exclusion that didn't catch this mixed-file wrinkle. I kept them in scope and am reporting the more conservative 78% instead — happy to go the other way if you'd rather hit the estimate and accept losing that coverage signal (or if you'd prefer a third option: split each file so the pure functions live outside the render file, letting both goals be satisfied at once — that's more invasive than this ticket's scope, so I didn't do it here).2.
**/*Worker*removes coverage that is currently real, not just glue. All six Workers it excludes —SyncWorker,BackfillWorker,PruneWorker,SendWorker,ReportPurgeWorker,ReportUploadWorker— are directly unit-tested today (construct the worker with mocked collaborators, calldoWork(), assert theResult):SyncWorkerTest,BackfillWorkerTest,PruneWorkerTest,SendWorkerTest(272 lines testing a 182-line class),ReportPurgeWorkerTest,ReportUploadWorkerTest/ReportUploadWorkerHttpTest. I implemented the exclusion exactly as specified in the issue (framework entry points, by category, regardless of current test investment), but flagging it since it's a real, measurable tradeoff rather than a clear-cut "untestable glue" case likeMainActivity/IdleService/LibreMailBackupAgent(all zero JVM tests, no ambiguity there).Validation
:app:jacocoTestReport— clean, HTML/XML regenerated from scratch.:app:ktlintCheck :app:detekt— green.🤖 Generated with Claude Code
Superseded by #323, which incorporates this scoping, keeps the unit-tested Workers in-scope (fixing this PR's over-broad Worker exclusion), and adds the no-regression CI gate (#251).
Pull request closed