Skip to content

fix(update): check version exists before confirming uninstall#4774

Open
euxaristia wants to merge 1 commit intoclockworklabs:masterfrom
euxaristia:fix/version-uninstall-missing-error
Open

fix(update): check version exists before confirming uninstall#4774
euxaristia wants to merge 1 commit intoclockworklabs:masterfrom
euxaristia:fix/version-uninstall-missing-error

Conversation

@euxaristia
Copy link
Copy Markdown

Summary

Prevents spacetime version uninstall <ver> from showing a confirmation prompt when the version isn't installed, which previously resulted in a cryptic "No such file or directory (os error 2)" error after the user confirmed.

Changes

Bug fix

  • Check if the version directory exists before showing the y/N prompt
  • Return a clear error message: v{version} is not installed

Tests (4 unit tests)

  • test_uninstall_nonexistent_version_errors_before_prompt — confirms error fires before prompt for missing versions
  • test_uninstall_current_version_errors — confirms you can't uninstall the active version
  • test_uninstall_current_keyword_errors — confirms the literal string "current" is rejected
  • test_uninstall_existing_version_with_yes — confirms normal uninstall flow works

Verification

cargo check -p spacetimedb-update
cargo clippy -p spacetimedb-update -- -D warnings
cargo test -p spacetimedb-update uninstall

Reproduction

Before this fix:

$ spacetime version uninstall 2.0.3
Uninstall v2.0.3? yes
Error: No such file or directory (os error 2)

After this fix:

$ spacetime version uninstall 2.0.3
Error: v2.0.3 is not installed

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@bfops
Copy link
Copy Markdown
Collaborator

bfops commented Apr 27, 2026

Hi @euxaristia, thanks for opening a PR. Is there a reason for the changes in crates/bindings-cpp-ffi?

@euxaristia
Copy link
Copy Markdown
Author

Sorry that was mistakenly included. I think I made a separate PR for those changes already. I'll remove the bindings noise from this PR soon.

Previously, `spacetime version uninstall <ver>` would show a y/N
confirmation prompt even when the version wasn't installed, then fail
with a cryptic "No such file or directory (os error 2)" after the user
confirmed.

Now the command checks if the version directory exists before prompting,
and returns a clear error: "v{ver} is not installed".

Added 4 unit tests covering:
- Nonexistent version errors before prompt
- Current version cannot be uninstalled
- "current" keyword cannot be uninstalled
- Successful uninstall removes the version directory

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@euxaristia euxaristia force-pushed the fix/version-uninstall-missing-error branch from f700e85 to bbdc3b7 Compare April 28, 2026 02:57
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.

2 participants