Skip to content

test: coverage ratchet + renderer hooks + main-process backfill - #47

Merged
AhmedFr merged 19 commits into
mainfrom
feat/test-coverage
Aug 3, 2026
Merged

AhmedFr merged 19 commits into
mainfrom
feat/test-coverage

Conversation

@AhmedFr

@AhmedFr AhmedFr commented Jul 29, 2026 •

Copy link
Copy Markdown
Owner

Implements docs/superpowers/specs/2026-07-29-testing-coverage-design.md:

  • vitest 3 (vitest 4 needs vite 6; electron-vite pins vite 5) + @vitest/coverage-v8; coverage ratchet (auto-updating thresholds) enforced in CI
  • two vitest projects (node / jsdom) + typed window.clean bridge mock (compile-checked against CleanApi)
  • tests for all 11 renderer hooks
  • main-process backfill: project-actions deletion safety, scanner fixture-tree integration, scheduler, threshold notifier, small pure utils

UI component tests intentionally absent (Storybook owns UI). E2E deferred per spec.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Quality Improvements

    • Added comprehensive automated coverage for project scanning, scheduling, notifications, updates, settings, licensing, package management, and other core workflows.
    • Improved validation of renderer behavior, event handling, cleanup, and error scenarios.
  • Chores

    • Continuous integration now enforces coverage thresholds and reports results in build summaries.
    • Coverage artifacts are excluded from version control.
  • Documentation

    • Added testing guidance covering coverage expectations, supported test environments, and recommended testing practices.

AhmedFr and others added 15 commits July 29, 2026 15:07
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…acks)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clean-my-node-modules Ready Ready Preview Aug 3, 2026 12:09pm

@coderabbitai

coderabbitai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AhmedFr, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3f7371bf-debf-4efe-8c0f-c7ecf5c8b795

📥 Commits

Reviewing files that changed from the base of the PR and between 8a2144e and 1305036.

📒 Files selected for processing (8)
  • CLAUDE.md
  • STATUS.html
  • src/main/actions/project-actions.test.ts
  • src/main/lib/abbreviate-home.test.ts
  • src/main/lib/abbreviate-home.ts
  • src/main/notifications/threshold-notifier.test.ts
  • src/renderer/src/hooks/useDocker.test.ts
  • vitest.config.ts
📝 Walkthrough

Walkthrough

The PR upgrades Vitest coverage tooling, configures separate Node and renderer test projects, adds CI coverage enforcement and summaries, introduces typed renderer bridge mocks, and adds broad main-process and React hook test coverage. Testing guidance and project status records are updated.

Changes

Coverage and testing

Layer / File(s) Summary
Coverage configuration and CI
.github/workflows/ci.yml, .gitignore, package.json, vitest.config.ts
Vitest 3, V8 coverage, thresholds, separate Node/renderer projects, a coverage script, CI reporting, and ignored coverage output are configured.
Main-process behavior tests
src/main/actions/*, src/main/lib/*, src/main/notifications/*, src/main/scanner/*, src/main/scheduler/*, src/main/tray/*, src/main/windows/*
Tests cover project actions, path abbreviation, notifications, scanning, scheduling, PNG encoding, and development-mode detection.
Renderer bridge and hook tests
src/renderer/src/hooks/*, src/renderer/src/test/*
A typed CleanApi mock and lifecycle setup support tests for renderer hooks, bridge events, timers, state updates, and cleanup.
Testing documentation and status
CLAUDE.md, STATUS.html
Testing commands, coverage rules, test scope, and the landed coverage work are documented.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

Poem

A rabbit checks the lines with care,
While Vitest hops through code everywhere.
Bridges carry signals, timers chime,
CI guards the threshold line.
“More green tests!” the bunny sings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: coverage ratchet, renderer hook tests, and main-process test backfill.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/test-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/actions/project-actions.test.ts`:
- Around line 7-12: Update the execFile mock in the hoisted mocks and the
successful project-opening tests to capture invocation arguments, then assert
the VS Code launch command uses open -a "Visual Studio Code" with the expected
absolute path. Apply the same assertion to the additional success cases
referenced by the comment, while retaining the existing Finder-not-opened
checks.

In `@src/main/lib/abbreviate-home.test.ts`:
- Around line 8-10: Update abbreviateHome to abbreviate only an exact home path
or paths beginning with the home directory followed by a separator; preserve
unrelated paths such as “/Users/mean” unchanged, and add the requested boundary
test alongside “leaves non-home paths untouched.”

In `@src/main/notifications/threshold-notifier.test.ts`:
- Around line 14-16: Update the mock event registration method to store
callbacks only when _event equals "click", ensuring tests fail if production
subscribes to another event. Apply the same event filtering to the additional
mock registration block referenced by the comment.

In `@STATUS.html`:
- Around line 121-122: The “Test coverage” roadmap item in STATUS.html is marked
done before the PR is merged. Change its status from done to user or progress
while review and merge remain pending, then update it to done and remove the
outstanding review/merge action only after merge.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 58d6d681-25a9-41fa-8553-3f3069254c0d

📥 Commits

Reviewing files that changed from the base of the PR and between d0f85a2 and 8a2144e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (28)
  • .github/workflows/ci.yml
  • .gitignore
  • CLAUDE.md
  • STATUS.html
  • package.json
  • src/main/actions/project-actions.test.ts
  • src/main/lib/abbreviate-home.test.ts
  • src/main/notifications/threshold-notifier.test.ts
  • src/main/scanner/scanner.test.ts
  • src/main/scheduler/scan-scheduler.test.ts
  • src/main/tray/png-encode.test.ts
  • src/main/windows/window-utils.test.ts
  • src/renderer/src/hooks/useAutoHeight.test.ts
  • src/renderer/src/hooks/useDocker.test.ts
  • src/renderer/src/hooks/useLicense.test.ts
  • src/renderer/src/hooks/useLiveProjects/useLiveProjects.test.ts
  • src/renderer/src/hooks/usePackages.test.ts
  • src/renderer/src/hooks/usePackagesTab.test.ts
  • src/renderer/src/hooks/usePackagesTab.ts
  • src/renderer/src/hooks/usePnpmStore.test.ts
  • src/renderer/src/hooks/useProjects.test.ts
  • src/renderer/src/hooks/useScanProgress.test.ts
  • src/renderer/src/hooks/useSettings.test.ts
  • src/renderer/src/hooks/useToast.test.ts
  • src/renderer/src/hooks/useUpdater.test.ts
  • src/renderer/src/test/mock-clean-bridge.ts
  • src/renderer/src/test/setup.ts
  • vitest.config.ts
💤 Files with no reviewable changes (1)
  • src/renderer/src/hooks/usePackagesTab.ts

Comment thread src/main/actions/project-actions.test.ts
Comment thread src/main/lib/abbreviate-home.test.ts
Comment thread src/main/notifications/threshold-notifier.test.ts Outdated
Comment thread STATUS.html Outdated
…riance)

CI (Linux) measures slightly lower coverage than macOS because some
platform-dependent branches (path probing etc.) don't execute on Linux.
The committed thresholds were locked from macOS-local numbers, so CI was
failing on every PR. Lock thresholds to CI's own numbers instead and drop
autoUpdate: true, since a local macOS coverage run would otherwise rewrite
them back up to macOS values and re-break CI.
…ATUS nit

abbreviateHome abbreviated sibling paths sharing the home prefix
(/Users/mean with home /Users/me became ~an); now requires an exact
match or a /-boundary. Notification mock only records click handlers
so a wrong event subscription would fail the test. Coverage roadmap
item back to 'user' until the PR merges.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rerun green

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@AhmedFr
AhmedFr merged commit f42e5b4 into main Aug 3, 2026
5 checks passed
@AhmedFr
AhmedFr deleted the feat/test-coverage branch August 3, 2026 12:42

This branch was successfully deployed

1 active deployment
Preview — 13050365 Deployed Aug 3, 2026 by vercel[bot]
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