Skip to content

Make uninstall remove all managed data#41

Merged
nmbrthirteen merged 3 commits into
nmbrthirteen:mainfrom
teethatkamsai:codex/uninstall-cleans-all
Jul 5, 2026
Merged

Make uninstall remove all managed data#41
nmbrthirteen merged 3 commits into
nmbrthirteen:mainfrom
teethatkamsai:codex/uninstall-cleans-all

Conversation

@teethatkamsai

@teethatkamsai teethatkamsai commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Changes podcli uninstall to fully remove the managed podcli installation by default, including runtime files, models, cached data, and the managed user data folder.

Changes

  • Make native podcli uninstall remove the full managed podcli folder by default.
  • Keep --purge accepted as a compatibility alias.
  • Remove %LOCALAPPDATA%\podcli\bin from the Windows user PATH during uninstall.
  • Show PATH cleanup in --dry-run.
  • Update uninstall tests for the new default behavior.
  • Add install.ps1 -Uninstall -Purge support and keep PATH cleanup there too.

Validation

  • install.ps1 parses cleanly.
  • go test ./internal/paths ./internal/update
  • Full go test ./... was attempted but is blocked by existing missing embedded assets and an unrelated provision symlink test.

Summary by CodeRabbit

  • New Features
    • Uninstall now removes podcli managed data under the home directory by default, with updated uninstall guidance; --purge remains for compatibility.
    • On Windows, uninstall also removes the app’s entry from the current user PATH.
  • Bug Fixes
    • Improved Windows uninstall cleanup for installed shortcuts/links, with clearer warnings on PATH cleanup failures.
    • Checksum verification messaging now more clearly indicates when verification is skipped.
  • Style
    • Normalized installer/help/status text punctuation and completion messaging for consistency across platforms.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The uninstall flow now treats --purge as compatibility-only in the Go CLI, adds Windows user PATH removal, and aligns install.ps1 uninstall behavior with -Purge and registry-backed PATH updates. Several CLI, update, provision, proc, and installer strings were also normalized.

Changes

Uninstall and installer behavior

Layer / File(s) Summary
Go CLI uninstall flow
cli/main.go, cli/uninstall_test.go
--purge no longer changes uninstall targets; uninstall plan, final messaging, help text, and the test now reflect removing the home directory by default.
Windows PATH removal
cli/main.go
Uninstall now removes the bin directory from the current user's PATH and includes the PowerShell-backed registry edit helper.
install.ps1 uninstall and PATH handling
install.ps1
Adds -Purge, changes uninstall target selection, updates PATH cleanup/insertion to use registry helpers, and revises checksum/completion messaging.

Estimated code review effort: 4 (Complex) | ~45 minutes

Status text normalization

Layer / File(s) Summary
Status text normalization
backend/cli.py, backend/utils/proc.py, cli/internal/provision/provision.go, cli/internal/update/update.go, cli/main.go, install.sh
Adjusts banner spacing and many user-facing/status strings, including setup, doctor, presence, update, provisioning, subprocess logging, and shell installer messages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • nmbrthirteen/podcli#33: Both PRs modify podcli uninstall behavior, including purge handling and uninstall helper/tests in cli/main.go and cli/uninstall_test.go.
  • nmbrthirteen/podcli#35: Both PRs touch the Windows uninstall path in cli/main.go, changing how removed files or directories are selected.
  • nmbrthirteen/podcli#25: Both PRs modify cli/internal/update/update.go, overlapping in the self-update flow and its user-facing messages.

Suggested reviewers: nmbrthirteen

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: uninstall now removes all managed data by default.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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.

@teethatkamsai teethatkamsai force-pushed the codex/uninstall-cleans-all branch from 94a00af to 5e13098 Compare July 5, 2026 10:10
@teethatkamsai

Copy link
Copy Markdown
Contributor Author

â is mojibake: the terminal decoded a Unicode em dash (—) with the wrong encoding, so Done — run: podcli displayed as Done â run: podcli.

I made the small patch by replacing that output with plain ASCII:
Done - run: podcli

I also changed the related uninstall messages to use - instead of Unicode punctuation, so PowerShell/terminal encoding won’t garble them.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
install.ps1 (1)

16-42: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Align PowerShell uninstall with the CLI defaultpodcli uninstall removes the full managed home by default, but install.ps1 -Uninstall only deletes bin/runtime/models/tools unless -Purge is passed. That makes the same uninstall action behave differently across entry points; if parity is intended, default the PowerShell path to $homeDir and keep -Purge as compatibility only.

🤖 Prompt for 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.

In `@install.ps1` around lines 16 - 42, The uninstall flow in install.ps1 is
inconsistent with the CLI default because the $Purge branch only controls
deletion of $homeDir while the non-Purge path currently keeps user data by
deleting only bin/runtime/models/tools. Update the uninstall logic in the same
block that builds $targets so that the default -Uninstall behavior matches
podcli uninstall by removing the full managed home via $homeDir, and treat
-Purge as a compatibility option rather than the default behavior.
🤖 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 `@cli/main.go`:
- Around line 423-441: The removeFromWindowsUserPath logic rewrites the user
Path with SetEnvironmentVariable(..., 'User'), which can change expandable
entries like %SOMEVAR%\bin into a non-expandable value. Update the PowerShell
path editing in removeFromWindowsUserPath to preserve the original registry
value type instead of rewriting as REG_SZ, and make the matching change in
install.ps1 so both PATH update paths handle expandable entries consistently.

---

Outside diff comments:
In `@install.ps1`:
- Around line 16-42: The uninstall flow in install.ps1 is inconsistent with the
CLI default because the $Purge branch only controls deletion of $homeDir while
the non-Purge path currently keeps user data by deleting only
bin/runtime/models/tools. Update the uninstall logic in the same block that
builds $targets so that the default -Uninstall behavior matches podcli uninstall
by removing the full managed home via $homeDir, and treat -Purge as a
compatibility option rather than the default behavior.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64f103d0-9a0b-4a09-9665-dac11ae514ba

📥 Commits

Reviewing files that changed from the base of the PR and between d34d2ef and 5e13098.

📒 Files selected for processing (4)
  • cli/main.go
  • cli/uninstall_test.go
  • install.ps1
  • install.sh

Comment thread cli/main.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
install.ps1 (1)

35-66: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Align install.ps1 -Uninstall with podcli uninstall
podcli uninstall already removes the full managed folder and treats --purge as compatibility-only, but this script still keeps runtime, models, tools, and user data unless -Purge is passed. Make the default path remove $homeDir so both entry points behave the same.

🤖 Prompt for 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.

In `@install.ps1` around lines 35 - 66, The uninstall flow in install.ps1
currently diverges from podcli uninstall by only deleting binDir and leaving
runtime, models, tools, and user data unless -Purge is set. Update the uninstall
branch in the script’s Uninstall/Purge handling so the default target set
removes the full managed $homeDir, matching podcli uninstall behavior, and keep
-Purge only as compatibility behavior if needed. Ensure the PATH cleanup and
status messages still use Get-UserPathEntry, Test-PathEntryEquals, and the
existing removal loop.
🧹 Nitpick comments (2)
install.ps1 (2)

14-24: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Empty catch block silently swallows registry errors.

Static analysis flags the empty catch {} at Line 18. While falling back to ExpandString on failure to read the value kind is reasonable, silently swallowing the exception makes future debugging (e.g. permission errors) harder.

🔧 Suggested fix
   $kind = [Microsoft.Win32.RegistryValueKind]::ExpandString
-  try { $kind = $key.GetValueKind('Path') } catch {}
+  try { $kind = $key.GetValueKind('Path') } catch { Write-Verbose "Could not read Path value kind: $($_.Exception.Message)" }
🤖 Prompt for 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.

In `@install.ps1` around lines 14 - 24, The empty catch in Get-UserPathEntry is
swallowing registry lookup errors, making failures hard to diagnose. Update the
try/catch around $key.GetValueKind('Path') so the exception is handled
explicitly by logging, annotating, or otherwise preserving the error details
while still falling back to Microsoft.Win32.RegistryValueKind.ExpandString when
the kind cannot be read. Keep the change localized to Get-UserPathEntry and
preserve the existing return shape with Key, Kind, and Value.

Source: Linters/SAST tools


85-89: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Defensive byte[] check on .Content is likely dead code but harmless.

Invoke-WebRequest -UseBasicParsing normally returns .Content as a [string] for text/plain responses like checksums.txt; the -is [byte[]] branch is unlikely to trigger in practice, though it's a harmless safety net.

🤖 Prompt for 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.

In `@install.ps1` around lines 85 - 89, The `$sums` handling in the `try` block
uses a defensive `.Content -is [byte[]]` branch that is effectively dead code
for `Invoke-WebRequest` responses from `checksums.txt`. Simplify the
`Invoke-WebRequest`/`$sums` logic by removing the unnecessary byte-array
conversion path and keep the content handling as a plain string in
`install.ps1`.
🤖 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 `@install.ps1`:
- Around line 52-60: The PATH update in the user PATH handling block is only
writing to the registry, so Explorer may keep using a stale environment block.
After each successful Path SetValue call in install.ps1, broadcast
WM_SETTINGCHANGE so new terminals launched from Explorer pick up the updated
PATH; use the existing Get-UserPathEntry / $pathEntry.Key.SetValue flow and keep
the current remove/update logic unchanged.

---

Outside diff comments:
In `@install.ps1`:
- Around line 35-66: The uninstall flow in install.ps1 currently diverges from
podcli uninstall by only deleting binDir and leaving runtime, models, tools, and
user data unless -Purge is set. Update the uninstall branch in the script’s
Uninstall/Purge handling so the default target set removes the full managed
$homeDir, matching podcli uninstall behavior, and keep -Purge only as
compatibility behavior if needed. Ensure the PATH cleanup and status messages
still use Get-UserPathEntry, Test-PathEntryEquals, and the existing removal
loop.

---

Nitpick comments:
In `@install.ps1`:
- Around line 14-24: The empty catch in Get-UserPathEntry is swallowing registry
lookup errors, making failures hard to diagnose. Update the try/catch around
$key.GetValueKind('Path') so the exception is handled explicitly by logging,
annotating, or otherwise preserving the error details while still falling back
to Microsoft.Win32.RegistryValueKind.ExpandString when the kind cannot be read.
Keep the change localized to Get-UserPathEntry and preserve the existing return
shape with Key, Kind, and Value.
- Around line 85-89: The `$sums` handling in the `try` block uses a defensive
`.Content -is [byte[]]` branch that is effectively dead code for
`Invoke-WebRequest` responses from `checksums.txt`. Simplify the
`Invoke-WebRequest`/`$sums` logic by removing the unnecessary byte-array
conversion path and keep the content handling as a plain string in
`install.ps1`.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 98a9698f-4998-41fd-af9f-05e83c7b6757

📥 Commits

Reviewing files that changed from the base of the PR and between 5e13098 and 9959425.

📒 Files selected for processing (7)
  • backend/cli.py
  • backend/utils/proc.py
  • cli/internal/provision/provision.go
  • cli/internal/update/update.go
  • cli/main.go
  • install.ps1
  • install.sh
✅ Files skipped from review due to trivial changes (4)
  • backend/cli.py
  • cli/internal/update/update.go
  • install.sh
  • cli/internal/provision/provision.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • cli/main.go

Comment thread install.ps1
@nmbrthirteen

Copy link
Copy Markdown
Owner

CodeRabbit follow-up (install.ps1:60, WM_SETTINGCHANGE): deferring as a minor. The important fix landed — PATH is written with its original registry type preserved (DoNotExpandEnvironmentNames + original GetValueKind), so no %VAR% corruption. Not broadcasting WM_SETTINGCHANGE only means already-open terminals/Explorer pick up the change on next login rather than instantly — the standard expectation for PATH edits, and for uninstall it's just a stale entry to a removed dir. Adding untested SendMessageTimeout P/Invoke from a non-Windows dev box is higher-risk than the propagation delay it fixes; can be a follow-up.

@nmbrthirteen nmbrthirteen merged commit 62681a6 into nmbrthirteen:main Jul 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants