Skip to content

test: add comprehensive test coverage for IPC, platform, and services#66

Merged
dbfx merged 5 commits intomainfrom
t3code/test-coverage-audit
Mar 24, 2026
Merged

test: add comprehensive test coverage for IPC, platform, and services#66
dbfx merged 5 commits intomainfrom
t3code/test-coverage-audit

Conversation

@dbfx
Copy link
Contributor

@dbfx dbfx commented Mar 24, 2026

Summary

  • Adds 48 test files with ~1,100 new tests covering previously untested critical areas of the codebase
  • Extends existing program-uninstaller tests from 27 → 103 cases
  • Total test suite grows from ~36 files / ~780 tests to 84 files / 1,887 tests — all passing

What's covered

Tier 1 — Security & Stability Critical

  • privacy-shield.ipc (76 tests): registry ops, task scheduler, service mgmt, scan/apply/revert, input validation
  • startup-manager.ipc (92 tests): startup item discovery, toggle/delete, boot trace, shell injection prevention
  • program-uninstaller (extended to 103 tests): uninstaller execution, registry cleanup, leftover scanning, error handling

Tier 2 — IPC Handlers (18 new test files)

  • browser-cleaner, app-cleaner, database-optimizer, file-shredder, disk-analyzer, debloater
  • registry-cleaner, service-manager, network-cleanup, recycle-bin, shortcut-cleaner, empty-folder-cleaner
  • software-updater, program-uninstaller IPC, uninstall-leftovers, cloud-agent IPC

Tier 3 — Platform-Specific Code (29 new test files)

  • macOS (11 files, 195 tests): browser, commands, elevation, malware, malware-paths, network, paths, privacy, security, services, startup
  • Linux (9 files, 149 tests): browser, commands, malware, malware-paths, paths, privacy, security, services, startup
  • Windows (9 files, 148 tests): browser, commands, elevation, malware, network, privacy, security, services, startup

Test plan

  • All 1,887 tests pass (npx vitest run)
  • No regressions to existing tests
  • Review test quality for security-critical handlers (privacy-shield, startup-manager)

🤖 Generated with Claude Code

…, and services

Adds 48 test files with ~1,100 new tests covering previously untested critical areas:

- **IPC handlers** (18 files): privacy-shield, startup-manager, browser-cleaner, app-cleaner,
  database-optimizer, file-shredder, disk-analyzer, debloater, registry-cleaner, service-manager,
  network-cleanup, recycle-bin, shortcut-cleaner, empty-folder-cleaner, software-updater,
  program-uninstaller, uninstall-leftovers, cloud-agent
- **Platform darwin** (11 files): browser, commands, elevation, malware, malware-paths, network,
  paths, privacy, security, services, startup
- **Platform linux** (9 files): browser, commands, malware, malware-paths, paths, privacy,
  security, services, startup
- **Platform win32** (9 files): browser, commands, elevation, malware, network, privacy,
  security, services, startup
- **Services**: extended program-uninstaller tests from 27 to 103 cases

Total test suite: 84 files, 1,887 tests all passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b22af16284

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

dbfx and others added 4 commits March 24, 2026 10:47
Replace hardcoded Unix path separators with path.join()/path.resolve() in
test assertions and fix two source files (linux/malware-paths.ts,
linux/startup.ts) that used hardcoded forward slashes for path construction.

Fixes 48 test failures on Windows CI:
- darwin: malware-paths (15), paths (1), startup (11)
- linux: malware-paths (7), paths (4), startup (3)
- IPC: browser-cleaner (3), debloater (3), program-uninstaller (1)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The 'component store corruption' check matched before
'No component store corruption detected' since the former is a substring
of the latter. Reorder the conditionals so the more specific check runs
first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The darwin malware-paths and startup modules used hardcoded '/' in path
prefix strings, causing tests to fail on Windows CI where path.resolve()
produces backslash separators. Use join() + sep for cross-platform path
construction, matching the fix already applied to the linux platform.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The startup module's path validation used raw homedir() and hardcoded
'/Library/LaunchAgents' in allowedDirs, but compared against
resolve(normalize(location)). On Windows, resolve() prepends the drive
letter, so the startsWith check always failed.

Fix: resolve(homedir()) for HOME, resolve() the global path constant,
and update the test to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dbfx dbfx merged commit a05762e into main Mar 24, 2026
8 checks passed
@dbfx dbfx deleted the t3code/test-coverage-audit branch March 24, 2026 09:07
dbfx added a commit that referenced this pull request Mar 24, 2026
…all tools

Windows PowerShell outputs UTF-16-LE and native tools (reg.exe, netsh,
pnputil, schtasks, sfc, dism) use the system's OEM code page (e.g.
CP1252). Node.js decodes stdout as UTF-8 by default, corrupting accented
characters like "Système" → garbled text in drive labels and elsewhere.

- Add exec-utf8.ts: central utility with psUtf8() for PowerShell and
  execNativeUtf8() for native tools (chcp 65001 + cmd.exe arg escaping)
- Wrap all PowerShell -Command calls with psUtf8() (25 files)
- Route all reg/schtasks/pnputil/netsh calls through execNativeUtf8()
- Fix SFC/DISM streaming with StringDecoder for multi-byte UTF-8 chunks
- Update ASCII-only regex patterns to Unicode-aware (\p{L}\p{N}/u) so
  accented display names are no longer silently rejected
- Harden execNativeUtf8 against cmd.exe shell injection by escaping
  metacharacters in dynamic arguments (registry names, task paths, etc.)

Closes #66

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant