fix(npm-globals): skip .exe bins in postinstall check, remove @sourcegraph/amp - #2044
Conversation
|
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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.
Code Review
This pull request removes the '@sourcegraph/amp' dependency from 'package.json' and updates the global npm installer script to ignore '.exe' files when checking for native binaries. The reviewer suggested expanding this exclusion to other Windows-specific executable and script extensions like '.cmd', '.bat', and '.ps1' to avoid false positives on non-native binaries.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| for f in "$bin_dir"/*; do | ||
| [ -f "$f" ] || continue | ||
| case "$f" in *.js | *.cjs | *.mjs) continue ;; esac | ||
| case "$f" in *.js | *.cjs | *.mjs | *.exe) continue ;; esac |
There was a problem hiding this comment.
In addition to .exe files, many npm packages also include other Windows-specific wrapper scripts such as .cmd, .bat, and .ps1 in their bin directory. If any of these are present, they will be incorrectly detected as native macOS/Linux binaries, causing the postinstall script to be skipped. It is safer to skip all common Windows executable/script extensions.
| case "$f" in *.js | *.cjs | *.mjs | *.exe) continue ;; esac | |
| case "$f" in *.js | *.cjs | *.mjs | *.exe | *.cmd | *.bat | *.ps1) continue ;; esac |
There was a problem hiding this comment.
Performed full review of 2fdeefb...319bbfe
Analysis
• The binary detection heuristic in run_postinstall_if_needed relies on extension-based negative filtering (excluding .js, .exe, etc.), which remains fragile—extensionless scripts, shell wrappers (.sh), or metadata files could still be misclassified as native binaries. A more robust long-term approach would use explicit native binary format detection (magic headers, file command, or known native extensions like .node) instead of exclusion-based logic.
• Removing @sourcegraph/amp assumes no hidden transitive references, config dependencies, or external references (scripts, CI automation, documentation, shell aliases) pointing to the old package or binary name elsewhere in the codebase. If such references exist, users will encounter "command not found" errors post-deployment; verification of complete removal across all reference points is required before merging.
• The fix correctly addresses the cross-platform bug (.exe exclusion for macOS/Linux), but the change assumes this script will not run on Windows hosts. If executed on Windows in the future, ignoring .exe files could cause under-detection of native binaries; clarify platform constraints and document this assumption if the script's execution scope may expand.
Tip
Help
Slash Commands:
/review- Request a full code review/review latest- Review only changes since the last review/describe- Generate PR description. This will update the PR body or issue comment depending on your configuration/help- Get help with Mesa commands and configuration options
0 files reviewed | 0 comments | Edit Agent Settings • Read Docs
Mesa DescriptionTL;DRFixed npm-globals postinstall detection to ignore What changed?
Description generated by Mesa. Update settings |
Summary