Skip to content

test: close mutation coverage gaps for main.tsx, SelectDialog, NotificationToast; exclude real-agent-core-loaders.ts - #270

Merged
tbrandenburg merged 1 commit into
mainfrom
fix/mutation-gaps-main-tsx-select-dialog-notification-toast-agent-core-loaders
Aug 31, 2026
Merged

test: close mutation coverage gaps for main.tsx, SelectDialog, NotificationToast; exclude real-agent-core-loaders.ts#270
tbrandenburg merged 1 commit into
mainfrom
fix/mutation-gaps-main-tsx-select-dialog-notification-toast-agent-core-loaders

Conversation

@tbrandenburg

Copy link
Copy Markdown
Owner

Summary

Resolves 4 open mutation-gap issues.

Issue File Before After Resolution
#254 src/renderer/main.tsx 0% (0 tests) 100% (7/7 killed) new test file
#225 src/renderer/components/SelectDialog.tsx 0% (0 tests) 100% (17/17 killed) new test file (modeled on the existing ConfirmDialog.test.tsx sibling)
#224 src/renderer/components/NotificationToast.tsx 0% (0 tests) 100% (18/18 killed) new test file
#223 src/main/agent/test-support/real-agent-core-loaders.ts 0% (3 survived) N/A Stryker config exclusion, not a test — see rationale below

Why #223 got a config exclusion instead of a test

real-agent-core-loaders.ts is a test-support re-export helper that trivially forwards real @earendil-works/pi-agent-core symbols via a normal static import (so Vitest's ESM-aware transform can load them directly). It has zero independent branching logic of its own. Testing it would mean mocking @earendil-works/pi-agent-core just to assert the wrapper calls through, which defeats its entire purpose — letting tests exercise the REAL, unmocked library. This follows the exact precedent already established in stryker.config.mjs for src/main/index.ts/src/main/windows.ts (Electron bootstrap glue with no branching logic to mutate, verified via real packaged-app CDP checks instead of unit tests).

Follow-up issue filed

While investigating #223, found src/main/agent/test-support/real-coding-agent-loaders.ts has the identical trivial-re-export shape and will very likely need the same exclusion treatment. Filed as #269 rather than fixed here, since it's a distinct file outside this PR's assigned scope.

Validation commands run

npx vitest run src/renderer/main.test.tsx src/renderer/components/SelectDialog.test.tsx src/renderer/components/NotificationToast.test.tsx
# 3 files, 12 tests passed

npx vitest run
# 467 passed, 15 pre-existing failures in src/main/model/** (unrelated to this change,
# same failure set observed and confirmed unrelated in the prior mutation-gap PR #268)

npx stryker run --mutate "src/renderer/main.tsx"                          # 100.00%, 7/7 killed
npx stryker run --mutate "src/renderer/components/SelectDialog.tsx"       # 100.00%, 17/17 killed
npx stryker run --mutate "src/renderer/components/NotificationToast.tsx" # 100.00%, 18/18 killed
node -e "import('./stryker.config.mjs').then(m => console.log(m.default.mutate))"  # confirms exclusion present

npm run check          # typecheck clean (renderer + main + workspaces)
npx oxlint <the 3 new test files + stryker.config.mjs>   # 0 errors

Risks / follow-ups

Closes #254
Closes #225
Closes #224
Closes #223

…cationToast; exclude real-agent-core-loaders.ts

Adds dedicated unit tests for three renderer modules and one Stryker
config exclusion, resolving 4 open mutation-gap issues:

- main.tsx: 0% -> 100% (7/7 mutants killed). Tests the module's one real
  branch (throw when #root is missing) plus the createRoot/render happy
  path, with react-dom/client and ./App mocked to isolate the bootstrap
  logic.
- SelectDialog.tsx: 0% -> 100% (17/17 mutants killed). Modeled directly
  on the existing ConfirmDialog.test.tsx sibling pattern.
- NotificationToast.tsx: 0% -> 100% (18/18 mutants killed). Covers all
  three tone-class branches (error/warning/default) and dismissal.
- real-agent-core-loaders.ts: excluded from Stryker's mutate glob,
  following the existing index.ts/windows.ts precedent. This is a
  test-support re-export helper with no independent branching logic --
  it exists only to let Vitest's ESM-aware transform load real
  @earendil-works/pi-agent-core symbols directly. Testing it would mean
  mocking the real library just to assert a wrapper calls through, which
  defeats its purpose.

Closes #254, #225, #224, #223
@github-actions

Copy link
Copy Markdown

⚠️ Test duration budget warning

@tbrandenburg the test suite exceeded its duration budget:

  • [SOFT] /home/runner/work/pi-desktop/pi-desktop/src/main/settings/store.test.ts (node) took 2.33s (threshold: 1.0s)

@tbrandenburg
tbrandenburg merged commit 7a6b86b into main Aug 31, 2026
1 check passed
@tbrandenburg
tbrandenburg deleted the fix/mutation-gaps-main-tsx-select-dialog-notification-toast-agent-core-loaders branch August 31, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant