Skip to content

fix(self): update atomacially to avoid bricking on failure#180

Merged
QaidVoid merged 2 commits into
mainfrom
fix/self-update
Jul 7, 2026
Merged

fix(self): update atomacially to avoid bricking on failure#180
QaidVoid merged 2 commits into
mainfrom
fix/self-update

Conversation

@QaidVoid

@QaidVoid QaidVoid commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Self-updates now download to a temporary staging file before replacing the current app, making updates safer and more reliable.
    • Update integrity can now be checked against a published checksum when available.
  • Bug Fixes

    • Reduced the risk of breaking the installed binary during updates.
    • If checksum data can’t be retrieved, updates still continue with a warning instead of failing outright.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59f999e4-1630-4e18-baf0-be4c1aae88ab

📥 Commits

Reviewing files that changed from the base of the PR and between d8d3b3d and 959767a.

📒 Files selected for processing (1)
  • crates/soar-cli/src/self_actions.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/soar-cli/src/self_actions.rs

📝 Walkthrough

Walkthrough

The self-update flow now stages downloads in a temporary .update.part file, optionally checks a matching .b3sum checksum asset, removes failed downloads, and atomically renames the staged file into place after a successful update.

Changes

Self-update staging and verification

Layer / File(s) Summary
Staged download, checksum verification, and atomic replace
crates/soar-cli/src/self_actions.rs
Self-update downloads into a .update.part staging file, optionally verifies it against a checksum fetched by the new fetch_expected_checksum helper, removes the staging file on download failure, and uses fs::rename to atomically replace the executable on success; warn is added to tracing imports for missing checksum handling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SelfUpdate
  participant SHARED_AGENT
  participant Filesystem

  SelfUpdate->>Filesystem: download binary to .update.part
  SelfUpdate->>SHARED_AGENT: fetch .b3sum checksum asset
  SHARED_AGENT-->>SelfUpdate: checksum body or failure
  alt checksum fetch failed
    SelfUpdate->>SelfUpdate: warn and skip verification
  end
  alt download failed
    SelfUpdate->>Filesystem: remove staging file
  else download succeeded
    SelfUpdate->>Filesystem: rename staging file to executable
  end
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making self-updates atomic to reduce bricking risk on failure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/self-update

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploying soar-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 959767a
Status: ✅  Deploy successful!
Preview URL: https://ec3e0f8f.soar-docs.pages.dev
Branch Preview URL: https://fix-self-update.soar-docs.pages.dev

View logs

@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

🤖 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 `@crates/soar-cli/src/self_actions.rs`:
- Around line 165-174: The checksum lookup in self_actions.rs currently
conflates a missing .b3sum asset with a published checksum that fails to fetch,
so the update can continue without verification. Update the logic around the
asset lookup and fetch_expected_checksum call to distinguish “no checksum asset
exists” from “checksum asset exists but could not be retrieved,” and in the
latter case abort the update instead of just warning. Use the existing
asset.name() lookup and expected_checksum handling in the update flow to fail
closed when a published checksum is unreachable.
🪄 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: 9deb88c3-0f44-4fa2-9474-7d73533284db

📥 Commits

Reviewing files that changed from the base of the PR and between eac6e48 and d8d3b3d.

📒 Files selected for processing (1)
  • crates/soar-cli/src/self_actions.rs

Comment thread crates/soar-cli/src/self_actions.rs Outdated
@QaidVoid QaidVoid merged commit c4afeb3 into main Jul 7, 2026
9 checks passed
@QaidVoid QaidVoid deleted the fix/self-update branch July 7, 2026 03:15
@QaidVoid QaidVoid mentioned this pull request Jul 7, 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