From ce96a0e5272d6bcdf732dd0fc1ff8a9d9c834a0c Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Wed, 03 Jun 2026 15:00:58 +0800
Subject: [PATCH] Fix Round 4 model download QA issues
---
privatevoice.src/internal/model/model_test.go | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/privatevoice.src/internal/model/model_test.go b/privatevoice.src/internal/model/model_test.go
index b85c5ad..f0e822c 100644
--- a/privatevoice.src/internal/model/model_test.go
+++ b/privatevoice.src/internal/model/model_test.go
@@ -377,6 +377,20 @@
}
}
+func TestDownloadProfileRemovesStalePartialDownload(t *testing.T) {
+ root := t.TempDir()
+ stalePath := filepath.Join(root, ".downloads", DefaultModelID, "old-run", "model_package")
+ writeTestFile(t, stalePath, "partial")
+
+ err := DownloadProfile(DefaultModelProfile(), []string{"://bad-url"}, root, nil)
+ if err == nil {
+ t.Fatal("expected download failure")
+ }
+ if _, statErr := os.Stat(filepath.Dir(stalePath)); !os.IsNotExist(statErr) {
+ t.Fatalf("stale download run still exists or stat failed: %v", statErr)
+ }
+}
+
func TestDownloadProfileFallsBackWhenPrimaryArchiveInvalid(t *testing.T) {
root := t.TempDir()
validArchive := tarArchive(t, map[string]string{
--
Gitblit v1.9.3