Skip to content

Fix update command for curl-installed Orca - #4

Merged
echoVic merged 1 commit into
mainfrom
fix-install-aware-updates
Jun 23, 2026
Merged

Fix update command for curl-installed Orca#4
echoVic merged 1 commit into
mainfrom
fix-install-aware-updates

Conversation

@echoVic

@echoVic echoVic commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • choose the TUI update command based on the active install method instead of always running npm
  • rerun the curl installer for direct-binary launches, targeting the current executable directory
  • download the installer to a temp file before executing it so curl failures do not look successful
  • document PATH behavior when switching from curl installs to npm installs

Verification

  • rustfmt --edition 2024 --check src/cli.rs
  • cargo test --bin orca
  • cargo test -p orca-runtime update_check
  • cargo check --bin orca
  • git diff --check

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

    • Updated README to clarify update behavior for npm-managed and curl-installed binaries
    • Added migration guidance for users switching from curl to npm installations
  • Bug Fixes

    • Improved update flow to properly support multiple installation methods

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Introduces an UpdateAction enum and UpdateCommand builder in src/cli.rs to dispatch between npm-managed and standalone curl-based upgrade strategies at runtime. The TUI update prompt and upgrade execution path are updated to use the dynamically selected command. Unit tests and README documentation are added accordingly.

Changes

Multi-strategy Update Flow

Layer / File(s) Summary
UpdateAction and UpdateCommand abstractions
src/cli.rs
Introduces UpdateAction (NpmGlobalLatest vs StandaloneInstaller) and UpdateCommand builder. Runtime detection uses ORCA_MANAGED_BY_NPM; standalone path infers INSTALL_DIR from the current executable and builds a mktemp+curl+sh command.
TUI prompt wiring and upgrade execution
src/cli.rs
upgrade_command_display() now returns a String passed as the "Update now" row detail text. run_upgrade_command() executes the program and args from the selected UpdateAction's command() instead of a hard-coded npm invocation.
Unit tests and README docs
src/cli.rs, README.md
Unit tests cover npm action selection, standalone INSTALL_DIR inference, and structural properties of the installer command (mktemp/curl presence, ORCA_NON_INTERACTIVE, no pipe-to-shell). README describes method-specific update behavior and PATH ordering guidance for curl-to-npm migration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A rabbit hopped and checked the trail,
npm or curl? Both shall prevail!
UpdateAction picks the right way,
mktemp and curl save the day.
No pipe-to-shell, just safe and neat —
🐇 the upgrade dance is now complete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix update command for curl-installed Orca' directly addresses the main objective of the PR, which is to fix the update command functionality for Orca installations installed via curl.
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.

✏️ 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 fix-install-aware-updates

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.

@coderabbitai coderabbitai 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.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91e119c7-d035-4402-b16b-88bd14de2b13

📥 Commits

Reviewing files that changed from the base of the PR and between abd9146 and e074b83.

📒 Files selected for processing (2)
  • README.md
  • src/cli.rs

Comment thread src/cli.rs
Comment on lines +98 to +99
if get_env("ORCA_MANAGED_BY_NPM").is_some() {
UpdateAction::NpmGlobalLatest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

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.

Suggested change
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.

@echoVic
echoVic merged commit e62e2d4 into main Jun 23, 2026
1 check passed
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