mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-27 05:54:08 -03:00
feat(sidecars): surface storage location and cover excluded models in migration
After migrating to centralized sidecar storage users had no indication where their files went, and portable-mode installs silently placed the sidecar root inside the plugin folder where a reinstall or git clean would delete it. - Migration now also covers models excluded from the library view and returns the resolved sidecar root in its result payload - get_settings exposes the resolved sidecar root, whether it is the default, and whether it lives inside the installation folder - New POST /api/lm/sidecars/open-location endpoint opens (or copies) the sidecar storage folder - Settings UI always shows the effective storage path with an open-folder button, and warns when the root is inside the installation folder (portable-mode hazard) - Migration confirmation shows the destination; on completion a result dialog summarizes moved/skipped/conflict counts with the storage location and an open-folder action - Ignore /sidecars/ at the repository root so portable-mode sidecars are never committed Refs #1045
This commit is contained in:
@@ -283,3 +283,39 @@ class TestSettingsValidation:
|
||||
settings = get_settings_manager()
|
||||
settings.set("sidecar_storage_path", None)
|
||||
assert settings.get("sidecar_storage_path") == ""
|
||||
|
||||
|
||||
class TestDescribeSidecarRoot:
|
||||
def test_configured_root(self, tmp_path: Path):
|
||||
settings = get_settings_manager()
|
||||
root = tmp_path / "sidecars-custom"
|
||||
settings.set("sidecar_storage_path", str(root))
|
||||
|
||||
info = sidecar_paths.describe_sidecar_root()
|
||||
|
||||
assert info["root"] == os.path.abspath(str(root))
|
||||
assert info["is_default"] is False
|
||||
assert info["inside_repo"] is False
|
||||
|
||||
def test_default_root_marks_is_default(self):
|
||||
settings = get_settings_manager()
|
||||
settings.set("sidecar_storage_path", "")
|
||||
|
||||
info = sidecar_paths.describe_sidecar_root()
|
||||
|
||||
assert info["root"].endswith(os.sep + "sidecars")
|
||||
assert info["is_default"] is True
|
||||
|
||||
def test_inside_repo_detection(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
||||
monkeypatch.setattr(
|
||||
sidecar_paths, "_installation_root", lambda: str(tmp_path / "repo")
|
||||
)
|
||||
settings = get_settings_manager()
|
||||
settings.set(
|
||||
"sidecar_storage_path", str(tmp_path / "repo" / "sidecars")
|
||||
)
|
||||
|
||||
assert sidecar_paths.describe_sidecar_root()["inside_repo"] is True
|
||||
|
||||
settings.set("sidecar_storage_path", str(tmp_path / "elsewhere"))
|
||||
assert sidecar_paths.describe_sidecar_root()["inside_repo"] is False
|
||||
|
||||
Reference in New Issue
Block a user