fix: Native uninstall now removes stale shell PATH setup - #1498
Conversation
Move the POSIX and Windows uninstall script bodies out of Go string literals so they can be linted and parsed as standalone script files. Extend CI, release-trigger detection, and shared-input stamping to cover the embedded uninstall templates alongside the existing installer templates.
📝 WalkthroughWalkthroughUninstall command generation for darwin and Windows is refactored to use embedded, placeholder-based script templates instead of inline generated strings. New uninstall scripts are embedded via go:embed, CI adds syntax validation for them, and release-automation stamping/trigger logic is extended to track the new dispatcher uninstall script files. ChangesUninstall script templating
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CommandForOS
participant posixUninstallArgs
participant windowsUninstallArgs
participant uninstallScriptTemplate
CommandForOS->>posixUninstallArgs: targetPath (darwin)
posixUninstallArgs->>uninstallScriptTemplate: load uninstall_darwin.sh
uninstallScriptTemplate-->>posixUninstallArgs: template text
posixUninstallArgs-->>CommandForOS: rendered sh args
CommandForOS->>windowsUninstallArgs: targetPath, currentPID (windows)
windowsUninstallArgs->>uninstallScriptTemplate: load uninstall_windows_delete.ps1
windowsUninstallArgs->>uninstallScriptTemplate: load uninstall_windows_launch.ps1
uninstallScriptTemplate-->>windowsUninstallArgs: rendered scripts
windowsUninstallArgs-->>CommandForOS: launch command args
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Add a regression check that the deferred Windows deletion command is encoded after template replacement, and include embedded dispatcher PowerShell templates in CodeRabbit review coverage.
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="cli/dispatcher/internal/uninstall/scripts/uninstall_darwin.sh">
<violation number="1" location="cli/dispatcher/internal/uninstall/scripts/uninstall_darwin.sh:4">
P2: Uninstall script doesn't clean up shell PATH entries that the install script adds. The macOS install script adds `$InstallDir` to shell profiles (`.bash_profile`, `.zshrc`, `config.fish`) via marker blocks, but this uninstall script only removes the binary. After uninstall, users are left with stale PATH entries pointing to a non-existent directory. The Windows uninstaller handles the equivalent cleanup (removes the install dir from User PATH), so this looks like an oversight in the macOS script. Consider adding shell profile cleanup logic — iterate over the same profile paths that `install_darwin.sh` writes to and strip the `PathBlockStart`/`PathBlockEnd` blocks.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Remove the uloop-managed shell profile marker blocks during native macOS uninstall so the POSIX path cleanup matches the Windows User PATH cleanup. Cover the behavior with a temp-home regression test that preserves unrelated profile content.
Summary
User Impact
Changes
Verification