Skip to content

fix: Setup no longer reports optional npm cleanup failures#1452

Merged
hatayama merged 6 commits into
v3-betafrom
fix/silent-legacy-npm-uninstall-failure
Jul 1, 2026
Merged

fix: Setup no longer reports optional npm cleanup failures#1452
hatayama merged 6 commits into
v3-betafrom
fix/silent-legacy-npm-uninstall-failure

Conversation

@hatayama

@hatayama hatayama commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Setup no longer prints manual cleanup instructions when optional removal of an older npm-installed command cannot finish.
  • Windows setup still warns when a persisted PATH entry would make new shells resolve the older command instead of the native CLI.

User Impact

  • Users upgrading to the native CLI no longer see a confusing legacy npm cleanup failure message for an optional cleanup step.
  • If an older command still shadows the native CLI for future Windows shells, Setup continues to show PATH guidance instead of silently claiming everything is ready.

Changes

  • Removed legacy npm cleanup failure output from the POSIX and PowerShell installers while keeping the successful cleanup message.
  • Kept Windows path-shadowing detection based on persisted Machine and User PATH entries.
  • Updated installer regression tests to match the quieter cleanup behavior.
  • Bumped the dispatcher release version because installer files are dispatcher release inputs.

Verification

  • go test ./internal/install -run TestCommandForWindowsConfiguresUserPathAndLegacyCleanup
  • scripts/test-install-release-filter.sh
  • go test ./internal/install
  • scripts/check-go-cli.sh
  • go run ./cmd/check-dispatcher-version-bump --base origin/v3-beta --head HEAD
  • autoreview --mode branch --base origin/v3-beta

hatayama added 2 commits July 2, 2026 00:21
Keep the success message when the installer removes the old npm package, but avoid surfacing optional cleanup failures during native CLI setup. Update installer tests and docs to match the quieter behavior.
Keep legacy npm cleanup failures quiet while still checking the persisted Machine and User PATH that new Windows shells will use. This avoids reporting setup success when a remaining legacy shim shadows the native CLI.
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 26 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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

Plan: Pro

Run ID: f85582e3-1ef9-498a-93e5-fbb76f47bbe5

📥 Commits

Reviewing files that changed from the base of the PR and between a4e82ea and 0b21cdf.

⛔ Files ignored due to path filters (1)
  • scripts/install.ps1 is excluded by none and included by none
📒 Files selected for processing (3)
  • cli/internal/install/command.go
  • cli/internal/install/command_test.go
  • scripts/test-install-release-filter.sh
📝 Walkthrough

Walkthrough

This PR removes manual npm-uninstall guidance messages from the Windows PowerShell and POSIX installer scripts, replacing them with silent early returns on failure. It reworks Windows PATH-shadowing detection to resolve uloop commands from Machine+User PATH, updates associated Go and shell tests, and bumps the dispatcher contract version.

Changes

Legacy npm cleanup silencing

Layer / File(s) Summary
Windows PowerShell legacy cleanup and PATH shadowing
cli/internal/install/command.go, cli/internal/install/command_test.go
Removes Write-LegacyNpmManualRemoval and its call sites, removes Test-PersistedUloopCommandResolvesToExpectedPath, and rewrites Report-PathShadowing to resolve uloop from combined Machine+User PATH before printing shadowing output and invoking cleanup. Tests are updated to expect the new $NpmArgs/$NpmCommand.Source flow, fewer Write-LegacyNpmMultilineArgumentWarning occurrences, and persisted-PATH-based shadowing checks.
POSIX legacy cleanup silencing
cli/internal/install/posix_install.go, scripts/install.sh, scripts/test-install-release-filter.sh, cli/internal/install/command_test.go
Removes the print_legacy_npm_manual_removal helper and its invocations from generated and standalone POSIX scripts; try_remove_legacy_npm_package now returns silently instead of printing manual npm uninstall guidance on missing prefix, missing npm, or failed uninstall. Tests are renamed/rewritten to assert absence of manual-removal messaging, and a new PowerShell test validates persisted PATH-based uloop shadowing detection.
Dispatcher contract version bump
cli/dispatcher-contract.json
Updates dispatcherVersion from 3.0.1-beta.8 to 3.0.1-beta.9.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant InstallScript
  participant ReportPathShadowing
  participant GetFirstUloopCommandFromPath
  participant InvokeAllLegacyNpmPackageRemoval

  InstallScript->>ReportPathShadowing: run at end of install
  ReportPathShadowing->>GetFirstUloopCommandFromPath: resolve uloop from Machine+User PATH
  GetFirstUloopCommandFromPath-->>ReportPathShadowing: resolved path
  ReportPathShadowing->>InstallScript: print shadowing message if mismatched
  InstallScript->>InvokeAllLegacyNpmPackageRemoval: invoke cleanup | Out-Null
Loading

Possibly related PRs

  • hatayama/unity-cli-loop#1032: Both PRs modify legacy npm cleanup/install script behavior including manual-removal guidance suppression in scripts/install.sh and installer generation paths.
  • hatayama/unity-cli-loop#1169: Both PRs touch the Windows PowerShell install/uninstall flow around legacy npm cleanup and PATH/persisted uloop command shadowing logic.
  • hatayama/unity-cli-loop#1187: Both PRs change generated installer behavior around legacy npm uloop-cli cleanup messages in POSIX install scripts.
🚥 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 matches the main change: suppressing optional npm cleanup failure reporting during setup.
Description check ✅ Passed The description is directly aligned with the installer cleanup and Windows PATH-shadowing changes in the changeset.
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
  • Commit unit tests in branch fix/silent-legacy-npm-uninstall-failure

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.

@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

Caution

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

⚠️ Outside diff range comments (2)
README.md (1)

97-102: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

The manual uninstall example can miss the shadowing install.

The condition here is specifically “the old npm command still shadows the native CLI”. In that case the shadowing shim may belong to a different npm prefix, which is why the installer code now infers --prefix from the resolved uloop path. Telling readers to run plain npm uninstall -g uloop-cli can remove a different global install and leave the shadowing shim untouched. Please point readers to the exact uloop path from which/Get-Command, or mention uninstalling from the matching prefix instead.

🤖 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 `@README.md` around lines 97 - 102, The manual uninstall guidance for the
native CLI can miss the actual shadowing shim, so update the README instructions
tied to the native install/uninstall flow to tell users to uninstall from the
same npm prefix as the resolved uloop command. Reference the existing “old npm
command still shadows the native CLI” guidance and make the example point to the
exact uloop path from which/Get-Command, or explicitly say to run npm uninstall
with the matching --prefix instead of a plain global uninstall.
README_ja.md (1)

96-101: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

This manual uninstall example can target the wrong npm prefix.

Because this section is now about the case where the old npm command still shadows the native CLI, the stale shim may belong to a different global prefix. The installer code handles that by inferring the prefix from the resolved uloop path, but npm uninstall -g uloop-cli does not. Please adjust the Japanese guidance to tell users to remove the exact uloop they resolved, or to uninstall from the matching prefix.

🤖 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 `@README_ja.md` around lines 96 - 101, The Japanese uninstall guidance should
not hardcode npm uninstall -g uloop-cli because it can point at the wrong global
prefix when the old shim is shadowing the native CLI. Update the README_ja.md
instructions to tell users to remove the exact resolved uloop command/path they
found, or to uninstall from the matching npm prefix inferred from that resolved
path, so the guidance aligns with the installer 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/internal/install/command.go`:
- Around line 293-309: `Report-PathShadowing` is passing raw Machine/User PATH
values into `Get-FirstUloopCommandFromPath`, so quoted or slash-terminated
entries may fail path probing and hide the shadowing warning. Update the PATH
scanning logic to normalize each split segment with `$NormalizePath` before
checking for `uloop*`, and keep the existing comparison against
`$ExpectedUloopPath` and legacy-path warning flow intact.

---

Outside diff comments:
In `@README_ja.md`:
- Around line 96-101: The Japanese uninstall guidance should not hardcode npm
uninstall -g uloop-cli because it can point at the wrong global prefix when the
old shim is shadowing the native CLI. Update the README_ja.md instructions to
tell users to remove the exact resolved uloop command/path they found, or to
uninstall from the matching npm prefix inferred from that resolved path, so the
guidance aligns with the installer behavior.

In `@README.md`:
- Around line 97-102: The manual uninstall guidance for the native CLI can miss
the actual shadowing shim, so update the README instructions tied to the native
install/uninstall flow to tell users to uninstall from the same npm prefix as
the resolved uloop command. Reference the existing “old npm command still
shadows the native CLI” guidance and make the example point to the exact uloop
path from which/Get-Command, or explicitly say to run npm uninstall with the
matching --prefix instead of a plain global uninstall.
🪄 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: 1f4c74be-ca1b-4383-9233-8312721884fb

📥 Commits

Reviewing files that changed from the base of the PR and between addc572 and 9242799.

⛔ Files ignored due to path filters (1)
  • scripts/install.ps1 is excluded by none and included by none
📒 Files selected for processing (7)
  • README.md
  • README_ja.md
  • cli/internal/install/command.go
  • cli/internal/install/command_test.go
  • cli/internal/install/posix_install.go
  • scripts/install.sh
  • scripts/test-install-release-filter.sh
💤 Files with no reviewable changes (1)
  • cli/internal/install/posix_install.go

Comment thread cli/internal/install/command.go
Leave the README wording unchanged because the installer behavior change should stay scoped to setup output and tests.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found and verified against the latest diff

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread cli/internal/install/command.go
Comment thread cli/internal/install/command.go

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

hatayama added 2 commits July 2, 2026 01:01
Advance the dispatcher release version because this PR changes dispatcher release inputs in the installer scripts.
Normalize persisted Machine and User PATH entries before probing for uloop shims, and remove the unused aggregate cleanup result now that cleanup failures are intentionally silent.

@cubic-dev-ai cubic-dev-ai 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.

1 issue found across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread scripts/install.ps1
Keep normalized drive-root PATH entries usable for uloop shadow detection by restoring the trailing slash before filesystem probing.
@hatayama hatayama merged commit 4aa729d into v3-beta Jul 1, 2026
10 checks passed
@hatayama hatayama deleted the fix/silent-legacy-npm-uninstall-failure branch July 1, 2026 16:21
This was referenced Jul 1, 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