Skip to content

docs(test): Phase 6 — regenerate the test plan and add real guardrails - #275

Merged
libravault-xyz merged 2 commits into
devfrom
docs/phase6-test-guidance
Aug 18, 2026
Merged

libravault-xyz merged 2 commits into
devfrom
docs/phase6-test-guidance

Conversation

@libravault-xyz

Copy link
Copy Markdown
Collaborator

Phase 6 of docs/TEST_COVERAGE_PRD.md — the final phase. Runs in parallel with #274 (Phase 5 remainder); no file overlap.

TEST_PLAN.md was wrong in ways nobody had noticed

Two claims were provably false by the time anyone read them:

  • core/database was marked "✅ 100% COMPLETE (logic-bearing migrations)". Four of six migrations had no test, and the one that did asserted SQL substrings against a mock. Fixed in Phase 3.
  • feature/library was marked "🔴 DEFERRED — requires extensive DI/context setup". Its display logic turned out to be extractable to pure functions with no DI at all, and now has 23 unit tests.

And the "Future Testing Priorities" list recommended writing tests for a donation state machine that had already been deleted — pollUntilPaid, createDonationInvoice, hasAnySettledInvoice all went in PRs #163/#172 when the donation flow became an external link. Verified by grep: none of those symbols exist.

A stale priority list quietly sends people to work that cannot be done. That's the specific failure this phase exists to stop.

The hand-written per-module narrative is replaced by a pointer to measured Kover data, which CI already prints on every run. Prose goes stale within a week; the numbers can't.

Coverage table refreshed to 41.6% (dev @ efb1b89), up from 40.1% at first measurement, with movement attributed per module to Phases 3–5.

AGENTS.md now carries the decisions, not just the conventions

  • A "choosing a test type" table — pure JVM / Robolectric / Roborazzi / instrumented / Test Lab — with the governing rule: going lower is not thrift if the level cannot observe the property. Both traps that cost real time this cycle are named: an assertion at a level that cannot fail, and a generic label sweep that passes on "A-" / "Show".
  • "Prove a new test can fail" — break it on purpose, confirm red, restore. With three concrete examples of tests that passed while asserting nothing, all of which looked correct in review.
  • Coverage expectations — what's gated, what's report-only and why a repo-wide ratchet is deliberately avoided, and why not to chase the overall percentage.

A guardrail that actually runs

scripts/check-test-plan-modules.py fails CI if a module in settings.gradle.kts is absent from TEST_PLAN.md, or if the plan names a module that no longer exists.

It is deliberately the weakest check that still works. It gates completeness, not accuracy — gating a doc on being true would mean regenerating it on every PR, which trains people to bypass the check. What it prevents is a new module arriving with no tests and no mention while the plan still reads as though it covers the repo.

Runs first in jvm-tests.yml: pure Python, no Gradle, so drift is reported in seconds rather than after the ~11-minute test run.

Verified in both directions (undocumented module; phantom core:licensing reference). It also caught a bug in its own first draft — a regex requiring a colon reported app as undocumented while app sat in the coverage table.

Note

Touches .github/workflows/jvm-tests.yml, so this is risk:high under agent-policy.yml and wants a human read of that step. It adds one step and changes nothing about how tests run.

Closes the PRD's Phase 6.

Phase 6 of docs/TEST_COVERAGE_PRD.md, the final phase.

## TEST_PLAN.md was wrong in ways nobody had noticed

Two claims were provably false by the time anyone read them:

 - core/database was marked "✅ 100% COMPLETE (logic-bearing
   migrations)". Four of six migrations had NO test, and the one that
   did asserted SQL substrings against a mock. Fixed in Phase 3.
 - feature/library was marked "🔴 DEFERRED — requires extensive
   DI/context setup". Its display logic turned out to be extractable to
   pure functions with no DI at all, and now has 23 unit tests.

And the "Future Testing Priorities" list recommended writing tests for
a donation state machine that had ALREADY BEEN DELETED — pollUntilPaid,
createDonationInvoice and hasAnySettledInvoice all went in PRs
#163/#172 when the donation flow became an external link. A stale
priority list quietly sends people to work that cannot be done.

The hand-written per-module narrative is replaced by a pointer to
measured Kover data, which CI prints on every run. Prose would go stale
again within a week; the numbers cannot.

Coverage table refreshed to 41.6% (dev @ efb1b89), from 40.1% at first
measurement, with the movement attributed per module to Phases 3-5.

## AGENTS.md now carries the decisions, not just the conventions

 - A "choosing a test type" table: pure JVM / Robolectric / Roborazzi /
   instrumented / Test Lab, with the rule that going lower is not thrift
   if the level cannot observe the property. Both traps that cost real
   time are named: an assertion at a level that cannot fail, and a
   generic label sweep that passes on "A-" / "Show".
 - "Prove a new test can fail" — break it on purpose, confirm red,
   restore. Three concrete examples of tests that passed while asserting
   nothing, all of which looked correct in review.
 - Coverage expectations: what is gated, what is report-only and why a
   repo-wide ratchet is deliberately avoided, and not to chase the
   overall percentage.

## A guardrail that actually runs

scripts/check-test-plan-modules.py fails CI if a module in
settings.gradle.kts is absent from TEST_PLAN.md, or if the plan names a
module that no longer exists.

Deliberately the weakest check that still works. It gates COMPLETENESS,
not accuracy: gating a doc on being true would mean regenerating it on
every PR, which trains people to bypass the check. What it prevents is a
new module arriving with no tests and no mention while the plan still
reads as if it covers the repo.

Runs first in jvm-tests.yml — pure Python, no Gradle, so drift is
reported in seconds rather than after the ~11-minute test run. Verified
in both directions (undocumented module, and a phantom core:licensing
reference), and it caught a bug in its own first draft: a regex
requiring a colon reported `app` as undocumented while it sat in the
coverage table.
@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

Review finding on my own change. The check was placed first for fast
feedback, but a failing step ends the job — so a stale doc would hide
every test and coverage result behind it.

Someone who adds a module and forgets the table would see a red X and
learn nothing about whether their tests pass. That is precisely how a
check teaches people to route around it, which defeats the point of
adding one.

Moved to last with `if: always()`: both signals now always arrive, and
the doc is still checked when the tests themselves fail. It is still a
hard gate in a required job, so the agent pipeline cannot auto-merge
past it — a separate advisory job would have been ignored entirely,
since auto-merge only waits on required checks.
@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

@libravault-xyz
libravault-xyz merged commit ea34e8e into dev Aug 18, 2026
7 checks passed
@libravault-xyz
libravault-xyz deleted the docs/phase6-test-guidance branch August 18, 2026 10:18
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.

1 participant