Commit f5e567e
fix(#187 AC#2 r3 follow-up): install idempotency + legacy partial migration
Three findings from Copilot's review of PR #249:
- **Install destroys good shared file on rename failure**: the previous
"unlink target → renameSync" sequence had a window where, if rename
threw or got cancelled mid-flight, the host was left with no GGUF
at all — even though a perfectly good copy had been deleted moments
before. Since the final path is now content-addressable (SHA-256
verified before this point), an existing target IS the model. New
install path: if target exists → just discard our partial, treat
as installed; otherwise renameSync directly without unlinking; if
the rename fails AND target now exists (race lost to another row),
treat as installed.
- **Legacy non-namespaced partials orphaned by migration**: PR #247
shipped with `<target>.partial`; PR #249 namespaces by row id.
Existing pre-#249 partials would sit on disk indefinitely. Added
unconditional cleanup at the top of runDownload — if a legacy
`<target>.partial` exists, delete it before the row's namespaced
partial is created.
- **Stale comment in cancelDownload**: docstring still mentioned
`<target_path>.partial`. Updated to the namespaced format.
Build clean. 25 route tests still passing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4e9d5f8 commit f5e567e
1 file changed
Lines changed: 40 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
245 | 255 | | |
246 | 256 | | |
247 | 257 | | |
| |||
414 | 424 | | |
415 | 425 | | |
416 | 426 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
428 | 455 | | |
429 | 456 | | |
430 | 457 | | |
| |||
0 commit comments