Skip to content

fix: Settings no longer shows the CLI as installed after uninstall#1154

Merged
hatayama merged 3 commits into
v3-betafrom
feature/hatayama/fix-cli-uninstall-status
May 17, 2026
Merged

fix: Settings no longer shows the CLI as installed after uninstall#1154
hatayama merged 3 commits into
v3-betafrom
feature/hatayama/fix-cli-uninstall-status

Conversation

@hatayama
Copy link
Copy Markdown
Owner

@hatayama hatayama commented May 17, 2026

Summary

  • Settings now waits for the installed CLI launcher to finish uninstalling itself before refreshing the displayed CLI status.
  • Removed the stale C# uninstall path that directly deleted the native CLI binary, so uninstall behavior stays owned by the CLI.

User Impact

  • Before this change, pressing Uninstall CLI on Windows could leave Settings showing CLI: v3.0.0-beta.9 even after uloop -v no longer resolved in the terminal.
  • After this change, the Settings status refresh happens after the launcher self-removal completes, so the UI no longer recaches a stale installed CLI state.

Changes

  • Delegate uninstall to the installed launcher and wait for the target executable to disappear before reporting success to the UI refresh flow.
  • Remove the old direct binary deletion helpers and tests from the C# installer path.
  • Add focused EditMode coverage for successful deferred removal and timeout reporting.

Remove the stale C# uninstall path that deleted the native CLI binary directly. Settings now delegates uninstall to the installed launcher and waits until the deferred self-removal has finished before refreshing CLI status, avoiding a stale installed display after Windows uninstall.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request refactors the native CLI installer's uninstall flow from synchronous legacy PATH-removal helpers to an asynchronous polling mechanism. UninstallAsync now waits for the install target to be removed after running the uninstall command, and path construction uses platform-specific separators instead of Path.Combine. All legacy uninstall and PATH-management methods and their test coverage are removed.

Changes

Async uninstall target removal

Layer / File(s) Summary
Platform-specific path separator infrastructure
Packages/src/Editor/Infrastructure/CLI/NativeCliInstaller.cs
Platform-specific file path separator constants (Windows and POSIX) and a centralized GetFilePathSeparator helper are introduced to support subsequent path construction logic.
Async uninstall target polling implementation and tests
Packages/src/Editor/Infrastructure/CLI/NativeCliInstaller.cs, Assets/Tests/Editor/NativeCliInstallerTests.cs
UninstallAsync is refactored to perform an uninstall command and then call WaitForUninstallTargetRemovalAsync to poll until the target is removed, with timeout and cancellation support. GetGlobalCliInstallPath is updated to construct paths using the platform-specific separator. Two new async test methods validate the success path (deferred removal) and the failure/timeout path.
Legacy uninstall and PATH-management removal
Packages/src/Editor/Infrastructure/CLI/NativeCliInstaller.cs, Assets/Tests/Editor/NativeCliInstallerTests.cs
All synchronous uninstall methods (UninstallGlobalCli, RemoveInstallDirectoryFromUserPath, BuildPathWithoutInstallDirectory, ShouldRemoveInstallDirectoryFromPath), related path-manipulation logic, failure-formatting helpers, and directory-cleanup utilities are removed. Corresponding test cases for Windows PATH updates, Windows global CLI deletion, and install-directory removal conditionals are deleted.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1135: Upgrades the uninstall flow with async/command-driven architecture and extends it with target-removal waiting behavior in the same NativeCliInstaller class.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: Settings no longer shows stale CLI installation status after uninstall, which directly aligns with the primary objective of waiting for uninstall completion before refreshing the UI.
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 The pull request description clearly explains the changes: waiting for CLI launcher self-removal before refreshing status, removing old direct binary deletion helpers, and adding new async timeout tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/hatayama/fix-cli-uninstall-status

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 and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

hatayama added 2 commits May 17, 2026 21:16
Replace personal-looking usernames in path fixtures with ExampleUser placeholders so installer and CLI tests keep their platform coverage without embedding local developer names.
Replace product-like project names in path fixtures with generic sample project names so the tests do not embed local or customer-looking project identifiers.
@hatayama hatayama merged commit 090f0a3 into v3-beta May 17, 2026
8 checks passed
@hatayama hatayama deleted the feature/hatayama/fix-cli-uninstall-status branch May 17, 2026 12:44
@github-actions github-actions Bot mentioned this pull request May 17, 2026
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.

1 participant