chore: propagate main into development - #57
Merged
Merged
Conversation
Adds Vitest + React Testing Library (replacing the node:test runner), a codecov.yml/GitHub workflow enforcing 85% project+patch coverage, and a local scripts/check-patch-coverage.mjs + /fix-patch-coverage command so patch-coverage gaps can be caught before pushing instead of failing CI. Backfills unit/component tests for the previously untested action layer, auth/session logic, proxy, and 16 components to bring real coverage from ~12% to 99.4% lines / 90.6% branches. Bundles the .github/workflows/ci.yml and codecov.yml workflow changes into this PR (rather than committing them straight to main per the usual CI-file convention) because they depend on the accompanying package.json/vitest.config.ts changes — landing them on main first would break main's CI until this PR merges down through development. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
## Summary
- Adds Vitest + React Testing Library, replacing the `node:test` runner.
Server/action/lib tests run in plain Node (jose's `Uint8Array` checks
break under jsdom's separate realm); component tests opt into jsdom
per-file via a `// @vitest-environment jsdom` docblock.
- Adds `codecov.yml` + `.github/workflows/codecov.yml` gating project
**and** patch coverage at 85%, mirroring the Charon setup. `ci.yml`'s
test step now runs `npm run test:coverage` so the 85% floor is enforced
even before the Codecov GitHub App/secret are wired up on this repo.
- Adds `scripts/check-patch-coverage.mjs` (`npm run coverage:patch`) — a
dependency-free Node script that diffs `coverage/lcov.info` against a
git baseline to report patch coverage locally, plus
`.claude/commands/fix-patch-coverage.md` (Hestia's equivalent of
Charon's `/fix-patch-coverage`) to close gaps before pushing.
- Backfills real unit/component tests for the previously-untested action
layer (`chores`, `rewards`, `reminders`, `members`, `household`,
`profile`, `auth`), `auth/session.ts`, `auth/current-user.ts`,
`proxy.ts`, and 16 components. Real coverage goes from ~12% to **99.4%
lines / 90.6% branches / 100% functions**.
- Server-logic tests run against a real in-memory SQLite DB (migrated
fresh per test file) with `next/headers`, `next/cache`, and
`next/navigation` mocked in `src/test/setup.ts` — `redirect()` throws
`Error("NEXT_REDIRECT:<path>")`, asserted on directly rather than mocked
away.
- `page.tsx`/`layout.tsx` route entrypoints, `db/schema.ts`,
`db/index.ts`, and `instrumentation.ts` are excluded from the coverage
mandate (thin composition/declarative/bootstrap code, exercised by
`e2e/household-flow.spec.ts` instead) — same ignore list in
`codecov.yml`, `vitest.config.ts`, and the patch-coverage script.
**Note on workflow files:** this PR includes changes to
`.github/workflows/ci.yml` and adds `.github/workflows/codecov.yml`,
rather than committing those straight to `main` per the repo's usual
convention. They depend on the accompanying
`package.json`/`vitest.config.ts` changes in this same PR — landing them
on `main` first would break `main`'s CI until this merges down through
`development`. Flagging this explicitly since it's a deviation from the
documented workflow-files-go-to-main rule.
**Still needed from a maintainer** (can't be done from here): install
the Codecov GitHub App on this repo and add a `CODECOV_TOKEN` repository
secret for `.github/workflows/codecov.yml` to actually upload — until
then, the `codecov` job will fail at the upload step
(tests/coverage/build all still pass regardless).
## Test plan
- [x] `npm run test:coverage` — 172 tests pass, 99.41% lines / 90.61%
branches / 100% functions / 99.09% statements (threshold: 85% lines)
- [x] `npm run lint` — clean
- [x] `npm run build` — clean, TypeScript passes
- [x] `node scripts/check-patch-coverage.mjs` — manually verified it
correctly flags an uncovered synthetic change and correctly reports
clean when reverted
- [ ] Install Codecov GitHub App + add `CODECOV_TOKEN` secret
(maintainer action, see note above)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Wikid82
marked this pull request as ready for review
August 10, 2026 18:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated PR carrying commits pushed directly to
main(hotfixes, CI-generatedcommits) down into
development. nightly is intentionally skipped — it picksthese up via the daily development sync instead.
Triggered by push 4eba452 to main.