Skip to content

Coverage scope: decide on full-lib measurement vs. current activated-surface convention #540

@TaprootFreak

Description

@TaprootFreak

Context

Today the coverage floor gate measures the activated surface only:

  • lib/packages/** (services, repositories, signers, utils)
  • lib/screens/**/cubit(s)/** and lib/screens/**/bloc/**

*.g.dart (Drift codegen) is explicitly removed from the scoped tracefile. Widget files (lib/screens/**/*_page.dart, lib/widgets/**) are exercised via testWidgets specs but not counted in line coverage — see README.md "Coverage scope" and docs/testing.md "Tier 0".

Current scoped coverage: 90.8 % (post wave 1 uplift, PR #538/#539).

Question

Is the activated-surface scope the final long-term convention, or should it eventually be widened to cover the rest of lib/ (widgets, routes, themes, bootstrap, generated localizations)?

Trade-offs

Pro full-lib measurement

  • Single number to point at
  • Catches UI files that have zero render-level test (today these are invisible in the gate)
  • Forces every new screen to ship at least a smoke testWidgets spec

Contra

  • ~50 % of widget code is layout (padding, sizing, theming) — line coverage there says "rendered once", not "behaviour verified". Mixing it with cubit/service coverage dilutes the signal.
  • lib/main.dart and routing entrypoints never execute under flutter test
  • lib/generated/ (localization codegen) would need the same coverage:ignore-style exclusion as *.g.dart
  • Headline % would drop ~15-20 pp on the first measurement, so the floor would need a one-off lowering — easy to misread as a regression

Options

  1. Keep activated surface (status quo) — accept that "98 %" means "98 % of behaviour-bearing code", not "98 % of lib/". Tracks well with the Tier model in docs/testing.md.
  2. Add a second, advisory metric — measure full lib/ (with *.g.dart + lib/generated/** excluded) and surface it in the CI summary, but keep the floor gate on the activated surface. Best of both worlds, more YAML.
  3. Switch the gate to full lib/ — broaden scope, accept the dilution, raise widget-test discipline.

Recommendation: option 2 if anyone wants the wider visibility, otherwise option 1.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions