Skip to content

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

Open
euxaristia wants to merge 2 commits intoclockworklabs:masterfrom
euxaristia:fix/version-uninstall-missing-error
Open

fix(update): check version exists before confirming uninstall#4774
euxaristia wants to merge 2 commits 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

euxaristia and others added 2 commits April 10, 2026 01:17
Rewrite the core C++ type registration and FFI dispatch layer from
crates/bindings-cpp in Rust. The new crate provides:

- ModuleTypeRegistration: full SATS type registration with circular
  reference detection, error module generation, and BSATN serialization
- FFI dispatch: __describe_module__, __call_reducer__, __call_view__,
  __call_view_anon__, __call_procedure__ with proper Identity/ConnectionId
  reconstruction and BytesSource/BytesSink I/O
- Preinit functions: __preinit__01_clear_global_state and
  __preinit__99_validate_types matching the C++ originals

Replaces ~1,414 lines of C++ with ~1,139 lines of Rust (19% reduction)
plus 96 unit tests (100% coverage). Clippy-clean and fmt-clean.
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>
@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.

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