fix: respect --home precedence when uninstalling models

Draft
MU
1mo ago
+133-22

Fix: respect --home when selecting models for uninstall

Summary

wally uninstall could select the model store from RUNANYWHERE_HOME even when
an explicit --home pointed elsewhere. Confirming uninstall could therefore
delete models from the wrong store.

This completes the override handling added in
PR #133.

Changes

  • Use the existing home resolver: --home takes priority over RUNANYWHERE_HOME.
  • Keep the search inside a configured home, even if it has no model directory.
    Only use kit/platform fallback discovery when neither override is set.
  • Preserve both supported layouts: RunAnywhere/Models and Models.
  • Add cross-platform regression coverage and restore test environment variables
    after each test, including on failure.

No SDK, dependency pin, confirmation, or deletion-mechanism changes.

Validation

  • Before the fix: three regression tests failed; two existing/compatibility cases passed.
  • After the fix: all five model-directory tests passed; all 12 maintenance tests
    passed on Windows with the pinned Rust 1.93.1 toolchain.
  • Full library run: 356 passed, two unrelated symlink tests failed because
    Windows denied symlink creation (OS error 1314) in cmd_models and cmd_rm.
  • Formatting, contract consistency, version consistency, and test-ledger checks passed.
  • cargo clippy --release --locked --all-targets -- -D warnings is blocked by
    three pre-existing Windows dead-code warnings in src/harness/path_reload.rs.

Targeted test command (after CMake configuration and build-environment setup):

cargo test --release --locked --lib commands::cmd_maintenance::tests

Local test linking used a temporary import library under ignored build/ for the
installed Git OpenSSL DLL. Without it, the existing Windows kit fails to link
OPENSSL_thread_stop. The original linker settings were restored after testing;
the workaround is not part of the PR.

The agent-sync check reports the checkout's existing CLAUDE.md regular-file
issue; it requires a symlink to AGENTS.md. No agent files were changed.

Full CTest, smoke/e2e, and macOS verification have not been run for this change.


Summary by cubic

Fixes wally uninstall selecting the model store from RUNANYWHERE_HOME even when an explicit --home pointed elsewhere. --home now takes precedence, and any override confines the search to that base, so confirming an uninstall can no longer delete models from the wrong store.

  • Preserves both RunAnywhere/Models and Models layouts.
  • Falls back to kit/platform discovery only when neither --home nor RUNANYWHERE_HOME is set.
  • Adds regression tests covering both layouts and the fallback behavior, and restores test environment variables after each test, including on failure.

Summary by CodeRabbit

  • Bug Fixes
    • Model-store lookup now prioritizes --home, then RUNANYWHERE_HOME, and uses the platform default only when neither is set.
    • When --home is supplied, missing model stores are reported within that location without falling back to other directories.