Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/v1-scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ Nothing else gates V1. When that sentence is true end to end, V1 is done.
- **Model Manager outdated-weight cleanup, 2026-09-04:** although the Model
Manager UI remains deferred, it gained the outdated-weight notice and
`Delete outdated` as the agreed handling for a rembg namespace move (issue
#22). Bulk re-download is deliberately not part of it.
#22). Bulk re-download returned in #29 with confirmation, cancellation, batch
progress and per-model deletion after verification.

---

Expand Down
2 changes: 1 addition & 1 deletion scripts/guardrails-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"long_functions": 2
},
"src/matteloop/jobs/models/session.py": {
"lines": 432,
"lines": 439,
"long_functions": 1
},
"src/matteloop/jobs/render.py": {
Expand Down
13 changes: 10 additions & 3 deletions src/matteloop/jobs/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ def prepare(self, model_id: str, extras: dict[str, object]) -> PreparationResult
self._active_result = result
return result

def fetch(self, model_id: str, progress: ProgressCallback | None = None) -> Path:
def fetch(
self,
model_id: str,
progress: ProgressCallback | None = None,
cancelled: CancellationCheck | None = None,
) -> Path:
"""Download and verify one weight without starting a session for it.

prepare() also launches the segmentation client, which is wrong for
Expand All @@ -209,7 +214,7 @@ def fetch(self, model_id: str, progress: ProgressCallback | None = None) -> Path
spec,
self._cache_root,
self._progress if progress is None else progress,
self._cancelled,
self._cancelled if cancelled is None else cancelled,
)

def remove(self, model_id: str) -> bool:
Expand Down Expand Up @@ -270,12 +275,14 @@ def remove(self, model_id: str) -> bool:
)
raise mapped from cause

def remove_obsolete_versions(self) -> int:
def remove_obsolete_versions(self, model_id: str | None = None) -> int:
with self._lock:
self._require_open()
removed = 0
for version in self._catalog.obsolete_rembg_versions:
version_path = self._cache_root / version
if model_id is not None:
version_path = version_path / self._catalog.get(model_id).id
if not version_path.is_dir() or version_path.is_symlink():
continue
shutil.rmtree(version_path)
Expand Down
Loading
Loading