Fix update command for curl-installed Orca - #4
Conversation
📝 WalkthroughWalkthroughIntroduces an ChangesMulti-strategy Update Flow
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 `@src/cli.rs`:
- Around line 98-99: The condition checking ORCA_MANAGED_BY_NPM in the get_env
call currently only verifies whether the environment variable exists using
is_some(), which means any value (including "0" or empty string) is treated as
npm-managed. Change this condition to explicitly check if the variable equals
the string "1", which is the actual sentinel value that the npm wrapper sets, so
that only npm-wrapped installations are routed through npm and standalone
installs are not incorrectly affected by stale or falsey environment variable
values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| if get_env("ORCA_MANAGED_BY_NPM").is_some() { | ||
| UpdateAction::NpmGlobalLatest |
There was a problem hiding this comment.
Treat only the npm wrapper sentinel as npm-managed.
Line 98 currently treats ORCA_MANAGED_BY_NPM=0 or an empty value as npm-managed. The npm wrapper sets this marker to "1", so matching that sentinel avoids routing standalone installs through npm because of a stale or falsey environment variable.
Proposed fix
- if get_env("ORCA_MANAGED_BY_NPM").is_some() {
+ if matches!(
+ get_env("ORCA_MANAGED_BY_NPM").as_deref(),
+ Some(value) if value == std::ffi::OsStr::new("1")
+ ) {
UpdateAction::NpmGlobalLatest📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if get_env("ORCA_MANAGED_BY_NPM").is_some() { | |
| UpdateAction::NpmGlobalLatest | |
| if matches!( | |
| get_env("ORCA_MANAGED_BY_NPM").as_deref(), | |
| Some(value) if value == std::ffi::OsStr::new("1") | |
| ) { | |
| UpdateAction::NpmGlobalLatest |
🤖 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 `@src/cli.rs` around lines 98 - 99, The condition checking ORCA_MANAGED_BY_NPM
in the get_env call currently only verifies whether the environment variable
exists using is_some(), which means any value (including "0" or empty string) is
treated as npm-managed. Change this condition to explicitly check if the
variable equals the string "1", which is the actual sentinel value that the npm
wrapper sets, so that only npm-wrapped installations are routed through npm and
standalone installs are not incorrectly affected by stale or falsey environment
variable values.
Summary
Verification
Note: full cargo fmt --check still reports unrelated pre-existing formatting drift outside this change (crates/orca-runtime/src/update_check.rs and crates/orca-tui files), so I checked the touched Rust file directly.
Summary by CodeRabbit
Documentation
Bug Fixes