Skip to content

Test coverage follow-up: CI paths-filter fix, cloudtts gate, Phase 7 (Settings + partial Reader) - #512

Merged
libravault-xyz merged 5 commits into
devfrom
fix/test-coverage-plan-followup
Aug 24, 2026
Merged

libravault-xyz merged 5 commits into
devfrom
fix/test-coverage-plan-followup

Conversation

@libravault-xyz

@libravault-xyz libravault-xyz commented Aug 24, 2026 •

Copy link
Copy Markdown
Collaborator

Implements the prioritized plan from the 08-24 test coverage review (docs/TEST_COVERAGE_PRD.md).

What's in this PR

  1. Coverage refresh + core:cloudtts gate — re-measured coverage (was stale since 08-17/18, predating the whole Cloud TTS module). core:cloudtts added to GATED_PREFIXES since it holds user API keys/vendor credentials, same risk class as the three vault modules already gated.
  2. Phase 7 (screen extraction) — scoped in PR docs(test): scope Phase 7 — make screens renderable, then render them #278 but never executed:
    • SettingsScreenKt: full thin-wrapper + pure-content split (PlayerScreen template), 10 new tests + 3 Roborazzi baselines. Found and fixed a real bug while inspecting the first baseline: the reading-theme filter-chip row had no wrap/scroll, so AppReadingTheme's 5th entry ("System") broke mid-word into "Syst"/"em" in every theme (Settings: reading theme 'System' filter chip wraps mid-word ('Syst'/'em') in all themes #515).
    • ReaderScreenKt: does not fit the template (its epubViewModel/markdownViewModel are obtained via sibling hiltViewModel() calls specifically to share a ViewModelStoreOwner with child screens — extracting a "pure" content composable risks silently breaking that). Re-scoped in the PRD instead of forced through; covered the two genuinely-pure untested pieces (ReaderMiniPlayerBar/ReaderReadAloudMiniBar) for display state.
    • CreateVaultScreenKt/EpubReaderScreenKt/PdfReaderScreenKt not started — tracked as follow-up in Phase 7 remaining: CreateVaultScreenKt, EpubReaderScreenKt, PdfReaderScreenKt + a ReaderScreenKt design pass #521.
  3. docs/TEST_COVERAGE_PRD.md — dated status-update sections (§1a, §1b) recording all of the above without rewriting the original 08-16 audit.

Android coverage: 46.9% → 50.4% (feature:settings 58.4%→87.5%, feature:reader 40.3%→45.1%).

Deliberately not in this PR

Closes #515, Closes #518, Closes #520

🤖 Generated with Claude Code

libravault-xyz and others added 4 commits August 24, 2026 08:43
…verage docs

- jvm-tests.yml and ios-app-build.yml's `changes` job ran dorny/paths-filter
  with no actions/checkout step. paths-filter diffs via the GitHub API on
  pull_request events (no checkout needed) but needs local git history on
  push, so every push-triggered run to dev/main has been failing at
  'Detect Changed Paths' with 'fatal: not a git repository', skipping the
  test job entirely. Verified against the last 15 jvm-tests.yml runs:
  100% of push runs failed, 100% of pull_request runs passed. Fixed by
  adding actions/checkout@v4 to both jobs.
- Re-ran koverXmlReportDebug across all 18 modules (was last measured
  2026-08-17 against 16). Android overall 40.1% -> 46.9%. core:cloudtts
  and core:billing (both new since the last audit) are now measured;
  core:cloudtts holds user API keys/vendor credentials so it's added to
  GATED_PREFIXES alongside the three vault modules, and
  coverage-baseline.json is regenerated via --write-baseline.
- docs/TEST_COVERAGE_PRD.md gets a dated status-update section (does not
  rewrite the original 08-16 audit) covering the above plus: PR #265
  merged so Phase 7's feature:library sequencing blocker is cleared;
  #253/#256 already closed; #273 stays status:blocked pending a human
  decision on iOS snapshot approval, deliberately not implemented blind.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tingsContent (Phase 7)

Per docs/TEST_COVERAGE_PRD.md Phase 7's PlayerScreen template: SettingsScreen
was 0% covered because it takes viewModel = hiltViewModel() directly and reads
its StateFlows/callbacks inline, so it can't render without a Hilt graph.

- SettingsScreen(viewModel) is now a thin wrapper: it collects the ViewModel's
  state flows, resolves the Activity/Context-dependent bits (SAF folder
  picker, external browser intent, billing purchase calls), and hands
  everything else to a new pure SettingsContent(state, actions) with no
  Hilt/Context dependency.
- SettingsContentState / SettingsActions bundle the collaborators, mirroring
  PlayerScreen's PlayerActions pattern. cloudVoicesActuallySending moved onto
  SettingsContentState as a computed property (was an inline call-site
  expression) so it's independently testable.
- SettingsContentTest.kt (10 tests): the vaults empty/non-empty states, the
  three-way Support Development branch (F-Droid external link / Play
  no-products / Play subscribe), the remove-vault confirmation dialog, and
  cloudVoicesActuallySending's three-way AND. Existing 67 tests pass
  unchanged (evidence of preservation per the Phase 7 recipe). Two of the new
  assertions (cloudVoicesActuallySending's AND, the remove-vault callback
  wiring) were mutation-checked by hand: flipping AND to OR and dropping the
  callback each turned exactly the expected tests red.
- SettingsScreenshotTest.kt (3 tests, Dark/Light/Sepia) — first per-screen
  Roborazzi baseline in the repo (previously only core:ui's generic theme
  sampler existed). Needed adding the roborazzi plugin/deps to
  feature/settings/build.gradle.kts, which had never had them.
- Recording the first baseline caught a real, pre-existing bug: the reading
  theme filter-chip Row has no wrap or scroll, so with AppReadingTheme's 5th
  entry (System, #349) the System chip was squeezed to chip width and broke
  mid-word into 'Syst'/'em' in every theme. Fixed with horizontalScroll;
  re-recorded baselines confirm the fix, and the pre-fix baseline caught the
  regression when I ran the suite before fixing it (3 verify failures, all
  and only the screenshot tests).

feature:settings coverage was 58.4% before this file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…y states (Phase 7, partial)

ReaderScreen.kt is a Phase 7 target (246 missed lines, 0%) but does NOT fit
the PlayerScreen/SettingsScreen thin-wrapper-plus-pure-content template:
epubViewModel/markdownViewModel are obtained via sibling hiltViewModel()
calls specifically so their instances are shared with the ViewModelStoreOwner
EpubReaderScreen/MarkdownReaderScreen use downstream (see the code comment
this file already had). Pulling that into a pure content composable risks
silently breaking that sharing -- exactly the a-real-behaviour-change-
slipping-in-unnoticed risk Phase 7 already calls out. This needs a
deliberate design pass, not a mechanical extraction, so it is left alone here.

selectReaderBottomBar/readAloudSupported (the file's other pure top-level
functions) already have dedicated tests. ReaderMiniPlayerBar and
ReaderReadAloudMiniBar were the remaining genuinely pure, untested pieces --
widened from private to internal and covered here for their state-dependent
icon/text display (Play vs Pause, Resume vs Pause reading).

Click/callback-wiring assertions were attempted but dropped: an extended
isolation investigation found performClick() silently invokes nothing on
either bar specifically when rendered with its real, distinct Material icon
set together (SkipPrevious/FastRewind/Pause/PlayArrow/SkipNext/Stop/
Headphones) -- every icon works fine individually, and a same-icon-repeated
reconstruction of the identical layout also clicks fine, so this isn't
believed to be a production bug (the component is unchanged, shipped code),
but a genuine, unexplained Robolectric/Compose test-harness interaction not
worth further time right now. Recorded here rather than shipped as a flaky
or silently-weakened assertion.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Android overall 46.9% -> 50.4% after SettingsScreenKt (done) and
ReaderScreenKt (re-scoped, partial). See PRD Sec 1b for the per-target
writeup, including why ReaderScreenKt needs a design pass rather than the
mechanical wrapper/content split, and a heads-up to check
EpubReaderScreenKt/PdfReaderScreenKt for the same sibling-hiltViewModel
sharing shape before assuming the template applies to them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 24, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was opened outside the automated pipeline (author isn't libravault-pipeline-bot[bot]) and doesn't link an issue (no Closes #N-style line in its body), so there's no acceptance criteria for qa-agent.yml to verify against — it would otherwise sit with no risk/status label and nothing downstream would pick it up (see issue #223's actual history, and issue #343 for this issue-less case specifically). This deterministic backstop (pr-intake.yml) classified its risk and applied status:needs-review to route it straight to principal review.

@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@github-actions

Copy link
Copy Markdown
Contributor

Principal review — verdict: human-merge

Outcome: human-merge — purely on the risk:high label (correctly earned: .github/workflows/** touched, plus new **/src/test/screenshots/** baselines). No CONFIRMED findings against the diff itself; the change is sound and I verified its substantive claims directly rather than taking them on faith.

What I verified myself (not just read)

  • Risk label freshness: re-ran .github/scripts/classify_pr_risk.py origin/dev HEAD locally — confirms risk:high via .github/workflows/ios-app-build.yml matching sensitive_paths, and no commits landed after the label was last applied (09:40:33Z, after the final commit at 09:38:44Z). Label is authoritative and current.

  • The CI checkout-bug claim: pulled the last 20 jvm-tests.yml runs via gh run list and the actual failing log via gh run view --log. Confirmed independently: every push-triggered run failed at "Detect Changed Paths" with fatal: not a git repository (or any of the parent directories): .git, every pull_request-triggered run passed. The actions/checkout@v4 fix is correctly placed as the first step in both changes jobs, before dorny/paths-filter@v3.

  • The SettingsScreen → thin-wrapper/SettingsContent split: read the full diff against origin/dev. It's a faithful mechanical extraction — every callback and state value maps 1:1 to what viewModel.x/x used to be, including the cloudVoicesActuallySending AND (subscriptionActive && cloudVoicesConsent && engineType == CLOUD) and the Subscribe/Tip click handlers. The removed DocumentsContract import was already dead in the pre-PR file, not a behavior change.

  • Tests actually pass, not just "claimed green": ran ./gradlew :feature:settings:testFdroidDebugUnitTest :feature:reader:testDebugUnitTest myself (BUILD SUCCESSFUL, ~3m37s) and inspected the JUnit XML output directly:

    • SettingsContentTest: 10/10 pass, 0 skipped
    • SettingsScreenshotTest: 3/3 pass, 0 skipped
    • ReaderMiniPlayerBarTest: 4/4 pass, 0 skipped
    • feature:settings module total: 80 tests, 0 failures/errors/skips — matches the PR's "67 existing + 10 new SettingsContentTest + 3 SettingsScreenshotTest" claim exactly.
    • feature:reader module total: 234 tests, 0 failures/errors/skips.
    • None of these tests are vacuous — they assert both the positive and negative case (e.g. assertIsDisplayed() and assertDoesNotExist() for the alternate state), which is exactly the pattern AGENTS.md's "label that exists but is useless" trap warns against.
  • Screenshot baselines: identify/file-checked all three new PNGs — valid, correctly-sized (822×1670), genuinely distinct dark/light/sepia captures, not empty or corrupt placeholders.

  • This PR's own CI: confirmed green end-to-end after polling — Unit & Integration Tests (JVM) pass (14m43s), Build Android App pass, Build & Test iOS (Simulator) pass, all CircleCI fallback jobs (jvm-tests, keystore-hardware-test, tts-audio-test) pass.

Incidental finding (filed, not blocking this PR)

While pulling CI evidence I hit a separate, pre-existing bug of the exact same shape this PR fixes, but in a different, untouched workflow: .github/workflows/circleci-dispatch.yml's dispatch job never checks out the repo, so gh pr comment/gh pr edit --remove-label fail with the identical fatal: not a git repository error (verified against the live run this PR's own circleci-job label triggered: https://github.com/LibraVault/reader/actions/runs/32712895635). The CircleCI pipeline itself triggers fine — only the follow-up gh calls fail, including "remove the triggering label," so the job reports failure and the label is never cleaned up. This file isn't part of #512's diff, so it doesn't change this PR's verdict, but it's a real, permanent finding — filed as #513 with the reproduction evidence.

Sanity checks

  • No status:blocked on this PR or its context.
  • No new networking dependency introduced (Roborazzi is test-only tooling).
  • No .github/agent-policy.yml / .claude/agents/** self-modification.
  • Both sensitive-path triggers for risk:high (workflow files, screenshot baselines) are explicitly called out in the PR description, as required.

@github-actions github-actions Bot added status:needs-human-merge Principal review done, requires human merge decision and removed status:needs-review QA passed, awaiting principal-review-agent labels Aug 24, 2026
… PR #517 is canonical

Filing issue #514 for the paths-filter bug (found during the 08-24 test
coverage review) triggered the dev-agent pipeline to pick it up
concurrently and ship a minimal, standalone fix (PR #517, already green)
faster than this session could land its own bundled version of the same
change. Reverting jvm-tests.yml/ios-app-build.yml back to origin/dev here to
avoid two competing fixes for the same two lines; #517 is now the PR that
closes #514. docs/TEST_COVERAGE_PRD.md's write-up of the bug stays (real,
useful analysis) but now points at #517 instead of claiming this branch
fixed it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

⏭️ iOS Simulator Build & Unit Tests - skipped
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@libravault-xyz libravault-xyz removed the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 24, 2026
@libravault-xyz
libravault-xyz merged commit 2f2ed85 into dev Aug 24, 2026
8 checks passed
@libravault-xyz
libravault-xyz deleted the fix/test-coverage-plan-followup branch August 24, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge status:needs-human-merge Principal review done, requires human merge decision

Projects

None yet

1 participant