mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-10-09 11:02:12 -03:00
chore(libraries): deprecate multi-library support ahead of removal
Warn at startup (log + dismissible startup message) when settings.json contains more than one library, marking the feature as deprecated while keeping it fully functional. Removal is planned for one of the next releases, at which point all libraries' folder paths will be merged into a single library. Multiple folder roots within one library remain fully supported and unaffected. - SettingsManager: add _warn_if_multi_library() invoked from _migrate_to_library_registry - Settings UI: label the Active Library selector as deprecated and note the removal plan in its help text (en.json) - Docs: add deprecation banners to multi_library_design.md and library-switching.md - Remove dead code: SettingsManager.update_active_library_paths had no call sites
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import copy
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from concurrent.futures import Future
|
||||
|
||||
@@ -133,6 +134,58 @@ def test_existing_folder_paths_seed_default_library(tmp_path, monkeypatch):
|
||||
assert manager.get_startup_messages() == []
|
||||
|
||||
|
||||
def test_multi_library_configuration_triggers_deprecation_warning(
|
||||
tmp_path, monkeypatch, caplog
|
||||
):
|
||||
initial = {
|
||||
"libraries": {
|
||||
"default": {"folder_paths": {"loras": ["/loras-a"]}},
|
||||
"archive": {"folder_paths": {"loras": ["/loras-b"]}},
|
||||
},
|
||||
"active_library": "default",
|
||||
}
|
||||
|
||||
with caplog.at_level(logging.WARNING, logger="py.services.settings_manager"):
|
||||
manager = _create_manager_with_settings(tmp_path, monkeypatch, initial)
|
||||
|
||||
assert any(
|
||||
"Multi-library support is deprecated" in record.getMessage()
|
||||
for record in caplog.records
|
||||
)
|
||||
deprecation = [
|
||||
message
|
||||
for message in manager.get_startup_messages()
|
||||
if message["code"] == "multi-library-deprecated"
|
||||
]
|
||||
assert len(deprecation) == 1
|
||||
assert deprecation[0]["severity"] == "warning"
|
||||
assert deprecation[0]["dismissible"] is True
|
||||
assert "archive" in deprecation[0]["message"]
|
||||
|
||||
|
||||
def test_single_library_configuration_has_no_deprecation_warning(
|
||||
tmp_path, monkeypatch, caplog
|
||||
):
|
||||
initial = {
|
||||
"libraries": {
|
||||
"default": {"folder_paths": {"loras": ["/loras-a"]}},
|
||||
},
|
||||
"active_library": "default",
|
||||
}
|
||||
|
||||
with caplog.at_level(logging.WARNING, logger="py.services.settings_manager"):
|
||||
manager = _create_manager_with_settings(tmp_path, monkeypatch, initial)
|
||||
|
||||
assert not any(
|
||||
"Multi-library support is deprecated" in record.getMessage()
|
||||
for record in caplog.records
|
||||
)
|
||||
assert not any(
|
||||
message["code"] == "multi-library-deprecated"
|
||||
for message in manager.get_startup_messages()
|
||||
)
|
||||
|
||||
|
||||
def test_environment_variable_overrides_settings(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(SettingsManager, "_save_settings", lambda self: None)
|
||||
monkeypatch.setenv("CIVITAI_API_KEY", "secret")
|
||||
|
||||
Reference in New Issue
Block a user