From 9139cba223e5d81faf7e7f5a8262003f9a9b5f2c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 20:57:06 +0000 Subject: [PATCH 1/2] Initial plan From 8be87875f2787135fa115db368549ac5f7648227 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:00:34 +0000 Subject: [PATCH 2/2] fix: add empty-ID guard to delete_model to prevent wiping engine models directory Agent-Logs-Url: https://github.com/BrainBehaviorAnalyticsLab/voxkit-desktop/sessions/0cce5a70-83a5-4c00-b1e8-19f85cb895d1 Co-authored-by: BeckettFrey <83560790+BeckettFrey@users.noreply.github.com> --- src/voxkit/storage/models.py | 4 ++++ tests/storage/test_models.py | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/voxkit/storage/models.py b/src/voxkit/storage/models.py index eb5089d..6aa9b58 100644 --- a/src/voxkit/storage/models.py +++ b/src/voxkit/storage/models.py @@ -401,8 +401,12 @@ def delete_model(engine_id: str, model_id: str) -> Tuple[bool, str]: Notes: - This operation is irreversible - Removes the entire model directory tree + - Validates that engine_id and model_id are not empty before proceeding """ + if not engine_id or not model_id: + return False, "Engine ID and Model ID cannot be empty." + print(f"Attempting to delete model: engine_id={engine_id}, model_id={model_id}") model_path = _get_model_root(engine_id, model_id) diff --git a/tests/storage/test_models.py b/tests/storage/test_models.py index d975fb7..8cb7846 100644 --- a/tests/storage/test_models.py +++ b/tests/storage/test_models.py @@ -297,6 +297,29 @@ def test_delete_model_invalid_engine(self, monkeypatch): assert success is False assert "not found" in msg + def test_delete_model_empty_ids(self, monkeypatch): + from voxkit.storage import models + from voxkit.storage.models import delete_model + + monkeypatch.setattr(models, "get_storage_root", mock_get_storage_root) + + engine_id = ENGINE_IDS[0] + + # Empty model_id + success, msg = delete_model(engine_id=engine_id, model_id="") + assert success is False + assert "cannot be empty" in msg + + # Empty engine_id + success, msg = delete_model(engine_id="", model_id="some_model_id") + assert success is False + assert "cannot be empty" in msg + + # Both empty + success, msg = delete_model(engine_id="", model_id="") + assert success is False + assert "cannot be empty" in msg + class TestGetModelMetadata: def test_get_model_metadata_success(self, monkeypatch): from voxkit.storage import models