Skip to content

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

Merged
Wibias merged 2 commits into
lidge-jun:devfrom
luvs01:agent/fix-winsw-uninstall-failure
Aug 10, 2026
Merged

fix(service): propagate native uninstall failures#1351
Wibias merged 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

Warning

Review limit reached

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

Next review available in: 4 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ad2be149-a14a-45c8-bb9b-d9cb6b8080ff

📥 Commits

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

📒 Files selected for processing (2)
  • src/service.ts
  • tests/uninstall.test.ts
📝 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

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

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.

4/4 boxes ticked.

This pull request is already Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently. If no CodeRabbit review appears, comment @coderabbitai review to request one.
Maintainers: @lidge-jun @Ingwannu @Wibias

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.

@luvs01
luvs01 force-pushed the agent/fix-winsw-uninstall-failure branch from c77b920 to c84bada Compare August 9, 2026 23:25
@Wibias
Wibias marked this pull request as ready for review August 9, 2026 23:47
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@github-actions[bot] Acknowledged. The PR gate reports that PR #1351 is ready for review.

The prior request also requires exact-head CI checks after the rebase. Confirm that GitHub reports those checks as successful for commit c84badac70a83d2d99103cb60e6f06eb94eb3ae7 before merge.

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Rate Limit Exceeded

@github-actions[bot] have exceeded the limit for the number of chat messages per hour. Please wait 48 minutes and 21 seconds before sending another message.

@Wibias
Wibias merged commit cee4207 into lidge-jun:dev Aug 10, 2026
33 of 35 checks passed

Wibias commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the focused fix here — especially preserving install-state metadata on scheduler/WinSW removal failures and adding regressions for both failure paths. Nice hardening of the Windows uninstall lifecycle. 🙏

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

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants