Compare commits

...
Author SHA1 Message Date
Dr.Lt.Data b93836c527 Test that the registry request carries the form factor
The tests of this branch call `get_form_factor()` only. A request that
no longer used it, or that left `form_factor` out, passed them.

- Add a case that runs the fetch of the registry list on Linux with
  the marker of Desktop, and reads the address that is asked for
2026-12-03 09:31:59 +09:00
Dr.Lt.Data 6177db9272 Merge branch 'manager-v4' into desktop-linux-form-factor 2026-12-03 09:03:17 +09:00
Benjamin Lu 9c069c13c5 v4: Report desktop-linux form factor for Desktop installs on Linux
Desktop runs on Linux now, but get_form_factor mapped a Desktop install on
Linux to 'other', losing the platform in registry data.
2026-10-14 17:22:27 -07:00
3 changed files with 85 additions and 21 deletions
+3
View File
@@ -44,6 +44,9 @@ and this project adheres to [Semantic Versioning 2.0.0](https://semver.org/spec/
### Fixed
- Report the `desktop-linux` form factor to the registry for Desktop installs
on Linux, which previously reported `other`.
- aria2 does not download a file that is already there. With aria2 as the
downloader, an install of a model whose file was already in its folder
downloaded the model once more. aria2 saved the download next to the file
+24 -21
View File
@@ -20,6 +20,29 @@ lock = asyncio.Lock()
is_cache_loading = False
def get_form_factor():
"""Form factor reported to the registry, based on environment and platform."""
is_desktop = bool(os.environ.get('__COMFYUI_DESKTOP_VERSION__'))
system = platform.system().lower()
if is_desktop:
if system == 'windows':
return 'desktop-win'
if system == 'darwin':
return 'desktop-mac'
if system == 'linux':
return 'desktop-linux'
return 'other'
if system == 'windows':
return 'git-windows'
if system == 'darwin':
return 'git-mac'
if system == 'linux':
return 'git-linux'
return 'other'
async def get_cnr_data(cache_mode=True, dont_wait=True):
try:
return await _get_cnr_data(cache_mode, dont_wait)
@@ -39,12 +62,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
full_nodes = {}
# Determine form factor based on environment and platform
is_desktop = bool(os.environ.get('__COMFYUI_DESKTOP_VERSION__'))
system = platform.system().lower()
is_windows = system == 'windows'
is_mac = system == 'darwin'
is_linux = system == 'linux'
# Get ComfyUI version tag
if is_desktop:
@@ -53,22 +71,7 @@ async def _get_cnr_data(cache_mode=True, dont_wait=True):
else:
comfyui_ver = context.get_comfyui_tag() or 'unknown'
if is_desktop:
if is_windows:
form_factor = 'desktop-win'
elif is_mac:
form_factor = 'desktop-mac'
else:
form_factor = 'other'
else:
if is_windows:
form_factor = 'git-windows'
elif is_mac:
form_factor = 'git-mac'
elif is_linux:
form_factor = 'git-linux'
else:
form_factor = 'other'
form_factor = get_form_factor()
from comfyui_manager.glob import manager_core
verbose = manager_core.get_config().get('verbose', False)
+58
View File
@@ -0,0 +1,58 @@
"""Form factor the CNR client reports to the registry."""
import asyncio
import pytest
from _install_flags_testutil import import_context
@pytest.fixture
def cnr_utils():
import_context()
from comfyui_manager.common import cnr_utils
return cnr_utils
@pytest.mark.parametrize(
('system', 'desktop', 'expected'),
[
('Windows', True, 'desktop-win'),
('Darwin', True, 'desktop-mac'),
('Linux', True, 'desktop-linux'),
('FreeBSD', True, 'other'),
('Windows', False, 'git-windows'),
('Darwin', False, 'git-mac'),
('Linux', False, 'git-linux'),
('FreeBSD', False, 'other'),
],
)
def test_form_factor(cnr_utils, monkeypatch, system, desktop, expected):
monkeypatch.setattr(cnr_utils.platform, 'system', lambda: system)
if desktop:
monkeypatch.setenv('__COMFYUI_DESKTOP_VERSION__', '1.0.0')
else:
monkeypatch.delenv('__COMFYUI_DESKTOP_VERSION__', raising=False)
assert cnr_utils.get_form_factor() == expected
def test_the_registry_request_carries_the_form_factor(cnr_utils, monkeypatch):
from comfyui_manager.glob import manager_core
asked = []
async def get_data_with_cache(uri, **kwargs):
asked.append(uri)
return {'nodes': [], 'totalPages': 1}
monkeypatch.setattr(cnr_utils.manager_util, 'get_data_with_cache', get_data_with_cache)
monkeypatch.setattr(cnr_utils.manager_util, 'save_to_cache', lambda uri, data: None)
monkeypatch.setattr(manager_core, 'get_config', lambda: {})
monkeypatch.setattr(cnr_utils.time, 'sleep', lambda seconds: None)
monkeypatch.setattr(cnr_utils.platform, 'system', lambda: 'Linux')
monkeypatch.setenv('__COMFYUI_DESKTOP_VERSION__', '1.0.0')
asyncio.run(cnr_utils._get_cnr_data(cache_mode=False))
assert [uri.partition('&form_factor=')[2] for uri in asked] == ['desktop-linux']