Skip to content

[0.5] test(coverage): ratchet vitest thresholds from measured baseline - #211

Merged
h4yfans merged 3 commits into
mainfrom
debt/0.5-coverage-ratchet
Apr 15, 2026
Merged

[0.5] test(coverage): ratchet vitest thresholds from measured baseline#211
h4yfans merged 3 commits into
mainfrom
debt/0.5-coverage-ratchet

Conversation

@h4yfans

@h4yfans h4yfans commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Pin desktop vitest coverage thresholds to a measured baseline so the suite
passes today but any regression trips the ratchet.

  • Ran pnpm test:coverage on top of 75c466db to capture current v8 coverage
  • Set thresholds at floor(actual) per metric (see table)
  • Emit json-summary reporter and reportOnFailure: true so future agents can
    read apps/desktop/coverage/coverage-summary.json without re-running on a
    clean suite
  • Inline comment in vitest.config.ts documents the baseline, base commit,
    and target coverage so the next ratchet bump knows where to start

Coverage baseline

Base: 75c466db — measured 2026-04-15.

metric actual new threshold target
statements 37.49% 37% 80%
branches 28.58% 28% 70%
functions 34.60% 34% 75%
lines 38.36% 38% 80%

Ratchet verification

Bumped statements to 99 locally and re-ran coverage — vitest emitted the
expected threshold errors (ERROR: Coverage for lines (38.36%) does not meet global threshold (40%) etc.) and exited non-zero. Reverted to the pinned
values; final pnpm test:coverage exits with the only failure being the
known calendar-page.test.tsx:258 "Due draft" flake (unrelated, tracked
separately).

Test plan

  • pnpm install --frozen-lockfile
  • pnpm lint — 0 errors (warnings only)
  • pnpm --filter @memry/desktop typecheck:node
  • pnpm --filter @memry/desktop typecheck:web
  • pnpm typecheck:packages
  • pnpm test — 5686/5687 pass (the 1 failure is the pre-existing
    calendar-page.test.tsx:258 "Due draft" flake)
  • pnpm test:coverage — thresholds satisfied; only the calendar flake
    fails (does not trip coverage thresholds)

h4yfans added 3 commits April 15, 2026 20:09
Measure current v8 coverage on commit 75c466d and pin thresholds at
floor(actual) so the suite passes today but any regression trips the
ratchet. Also emit json-summary + reportOnFailure so baselines can be
pulled from coverage/coverage-summary.json on subsequent runs.

Baseline (2026-04-15):
  statements 37.49%  branches 28.58%  functions 34.60%  lines 38.36%

New thresholds: 37 / 28 / 34 / 38. Targets remain 80 / 70 / 75 / 80.
@h4yfans
h4yfans merged commit 8bf57a6 into main Apr 15, 2026
2 checks passed
@h4yfans
h4yfans deleted the debt/0.5-coverage-ratchet branch April 15, 2026 20:25
h4yfans added a commit that referenced this pull request May 6, 2026
[0.5] test(coverage): ratchet vitest thresholds from measured baseline
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