Skip to content

fix(service): propagate native uninstall failures - #1351

Draft
luvs01 wants to merge 2 commits into
lidge-jun:devfrom
luvs01:agent/fix-winsw-uninstall-failure
Draft

fix(service): propagate native uninstall failures#1351
luvs01 wants to merge 2 commits into
lidge-jun:devfrom
luvs01:agent/fix-winsw-uninstall-failure

Conversation

@luvs01

@luvs01 luvs01 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Propagate an installed native WinSW service removal failure during the one-shot full uninstall instead of warning and continuing as if cleanup succeeded.
  • Preserve service install-state metadata when native removal fails, so the caller records the failure and does not delete remaining local configuration.
  • Add behavioral regressions for both scheduler and native removal failures, with install-state preservation.

The previous Windows path could swallow scheduler or native removal errors and delete install state while a service backend remained installed.

Verification

  • Bun 1.3.14: 9 focused service/uninstall test files — 218 passed, 1 platform-specific test skipped, 0 failed.
  • bun run typecheck — passed.
  • bun run privacy:scan — passed.
  • git diff --check origin/dev...HEAD — passed.
  • Independent focused review found no actionable P0-P3 findings.
  • The full repository suite is not claimed green locally; exact-head GitHub CI remains pending.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed. (No user-facing command or configuration contract changed.)
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • Bug Fixes
    • Native Windows service removal errors are now reported instead of being silently downgraded to warnings.
    • Installation state is preserved when service removal fails, preventing inconsistent uninstall results.
    • Scheduler cleanup continues to run before native service removal.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The uninstall flow now accepts injectable test hooks. Native WinSW removal errors propagate, scheduler cleanup runs first, and install state remains when native removal fails. Tests reset hooks and cover this behavior.

Changes

Uninstall lifecycle

Layer / File(s) Summary
Uninstall hooks and failure handling
src/service.ts
Lines 36 and 2455–2496 add the WinswStatus import, injectable uninstall hooks, and the test setter. Native WinSW removal failures now propagate before install-state removal.
Uninstall failure coverage
tests/uninstall.test.ts
Lines 1–5 and 14–15 add hook imports and cleanup. Lines 50–70 verify error propagation, cleanup ordering, and retained install state.

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

Possibly related PRs

Suggested reviewers: lidge-jun, invalid-email-address, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: native uninstall failures now propagate instead of being suppressed.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (2/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 2/4).

Review readiness checklist

  • ⬜ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

2/4 boxes ticked.

This PR stays in draft until every box above is ticked.

luvs01 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/service.ts`:
- Around line 2487-2490: Update the scheduler-removal flow around the
queryWindowsTask and uninstallWindowsTask hooks so the catch only handles a
confirmed absent task; do not swallow uninstallWindowsTask failures, and
propagate them before removeInstallState can run. Preserve successful removal
and explicitly already-absent behavior, then add a regression test verifying
removeInstallState is not called when uninstallWindowsTask throws.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f03f94b5-d154-4cfb-bfac-85e0a67f9d4b

📥 Commits

Reviewing files that changed from the base of the PR and between 4f746d1 and a892ca1.

📒 Files selected for processing (2)
  • src/service.ts
  • tests/uninstall.test.ts

Comment thread src/service.ts Outdated

Wibias commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Please rebase this PR onto the latest dev (e8ce2b93dd3ef8074d96dee407704c5dc06e2699) before merge, then rerun the exact-head CI checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants