fix(doctor): exclude checkpoints/embeddings from duplicate filename detection (#934)

Duplicate filename detection is only relevant for LoRAs, which use
basename-only syntax (<lora:name:strength>). Checkpoints and diffusion
models reference files via relative paths with extensions, so filename
conflicts there are false positives — there is no resolution ambiguity.

Both _log_duplicate_filename_summary() and DoctorHandler's
_check_filename_conflicts() now skip scanners with model_type != 'lora'.
This commit is contained in:
Will Miao
2026-05-18 13:57:28 +08:00
parent 4ff5774e34
commit 031d5e4f40
3 changed files with 13 additions and 2 deletions

View File

@@ -636,6 +636,8 @@ async def test_log_duplicate_filename_summary_logs_warning(tmp_path: Path, caplo
root = tmp_path / "loras"
root.mkdir()
scanner = DummyScanner(root)
# Duplicate filename detection is only active for LoRAs
scanner.model_type = "lora"
# Simulate duplicate filenames in the hash index
scanner._hash_index.add_entry("aaa111", str(root / "model.safetensors"))
@@ -646,7 +648,7 @@ async def test_log_duplicate_filename_summary_logs_warning(tmp_path: Path, caplo
assert len(caplog.records) >= 1
log_msg = caplog.records[-1].message
assert "Duplicate filename conflict detected" in log_msg
assert "1 dummy filename(s)" in log_msg
assert "1 lora filename(s)" in log_msg
assert "2 files total" in log_msg