chore: Simplify native CLI install path handling - #1620
Conversation
Move install path calculation, comparison, ownership checks, and environment reads into a focused resolver. Keep current-process PATH mutation in the installer so value resolution remains separate from state changes.
Place uninstall command assembly beside install command construction now that path resolution has a dedicated dependency. Restore process argument quoting to private visibility because it is again builder-internal.
📝 WalkthroughWalkthroughThis PR extracts CLI install-path computation logic from ChangesPath resolver extraction and consumer migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant NativeCliInstaller
participant NativeCliInstallPathResolver
participant NativeCliCommandBuilder
NativeCliInstaller->>NativeCliInstallPathResolver: GetInstallDirectoryForCurrentUser(platform)
NativeCliInstaller->>NativeCliCommandBuilder: BuildUninstallCommand(installDirectory, platform)
NativeCliCommandBuilder->>NativeCliInstallPathResolver: GetGlobalCliInstallPath(installDirectory, platform)
NativeCliInstaller->>NativeCliInstallPathResolver: DoesUserPathContainInstallDirectory(...)
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 |
There was a problem hiding this comment.
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 `@Packages/src/Editor/Infrastructure/CLI/NativeCliInstallPathResolver.cs`:
- Around line 28-59: `BuildPathWithInstallDirectory` is comparing raw PATH
entries against `installDirectory`, so entries with trailing separators or other
path formatting differences can slip through as duplicates. Update the
comparison logic in `NativeCliInstallPathResolver.BuildPathWithInstallDirectory`
to normalize both sides for equality the same way
`BuildPathWithoutInstallDirectory` does (via `NormalizePathForComparison` or
equivalent), while still appending the original entry text to preserve output
formatting. Add or adjust a test covering a PATH entry with a trailing separator
so the duplicate install directory is not prepended.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 67f8e950-ae7b-44eb-b909-262281db4888
⛔ Files ignored due to path filters (1)
Packages/src/Editor/Infrastructure/CLI/NativeCliInstallPathResolver.cs.metais excluded by none and included by none
📒 Files selected for processing (6)
Assets/Tests/Editor/NativeCliInstallerTests.csPackages/src/Editor/Infrastructure/CLI/CliInstallationDetector.csPackages/src/Editor/Infrastructure/CLI/CliPathSetupProfileResolver.csPackages/src/Editor/Infrastructure/CLI/NativeCliCommandBuilder.csPackages/src/Editor/Infrastructure/CLI/NativeCliInstallPathResolver.csPackages/src/Editor/Infrastructure/CLI/NativeCliInstaller.cs
There was a problem hiding this comment.
All reported issues were addressed across 7 files
You’re at about 90% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Summary
User Impact
Changes
NativeCliInstallPathResolver.NativeCliInstaller, maintaining a clear read/write boundary.NativeCliCommandBuilderafter path resolution becomes an independent dependency.QuoteProcessArgumentfrom internal to private visibility after all command construction becomes builder-internal; this is the only non-move production change.Verification
NativeCliInstallerTests: 32 passedReview Follow-up