From 033d42e95d44d8b09c73c805097f3c63ffe90e2b Mon Sep 17 00:00:00 2001 From: xmarre Date: Thu, 19 Mar 2026 14:58:29 +0100 Subject: [PATCH] Prepare Comfy registry publishing and tighten config validation --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ comfyui_spectrum_zimage/config.py | 7 +++++-- nodes.py | 2 +- pyproject.toml | 11 ++++++++++- tests/smoke_runtime.py | 3 ++- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..999b814 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish to Comfy registry + +on: + workflow_dispatch: + push: + branches: + - main + - master + paths: + - "pyproject.toml" + +permissions: + issues: write + +jobs: + publish-node: + name: Publish Custom Node to registry + runs-on: ubuntu-latest + if: ${{ github.repository_owner == 'xmarre' }} + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Publish Custom Node + uses: Comfy-Org/publish-node-action@v1 + with: + personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} diff --git a/comfyui_spectrum_zimage/config.py b/comfyui_spectrum_zimage/config.py index e30384d..a4b11d4 100644 --- a/comfyui_spectrum_zimage/config.py +++ b/comfyui_spectrum_zimage/config.py @@ -34,8 +34,11 @@ class SpectrumConfig: raise ValueError("warmup_steps must be >= 0.") if int(self.tail_actual_steps) < 0: raise ValueError("tail_actual_steps must be >= 0.") - if int(self.max_history) < max(8, int(self.degree) + 1): - raise ValueError("max_history must be at least max(8, degree + 1).") + min_history = max(8, int(self.degree) + 1) + if int(self.max_history) < min_history: + raise ValueError( + f"max_history ({int(self.max_history)}) must be at least max(8, degree + 1) = {min_history}." + ) return self def to_dict(self) -> dict: diff --git a/nodes.py b/nodes.py index dff46f0..b0a93f8 100644 --- a/nodes.py +++ b/nodes.py @@ -17,7 +17,7 @@ class SpectrumApplyZImage: "flex_window": ("FLOAT", {"default": 0.75, "min": 0.0, "max": 8.0, "step": 0.05}), "warmup_steps": ("INT", {"default": 5, "min": 0, "max": 32, "step": 1}), "tail_actual_steps": ("INT", {"default": 3, "min": 0, "max": 32, "step": 1}), - "max_history": ("INT", {"default": 128, "min": 8, "max": 512, "step": 1}), + "max_history": ("INT", {"default": 128, "min": 17, "max": 512, "step": 1}), "debug": ("BOOLEAN", {"default": False}), } } diff --git a/pyproject.toml b/pyproject.toml index 4b96657..c2cd934 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + [project] name = "comfyui-spectrum-zimage-proper" description = "Faithful Z-Image-focused ComfyUI port of Spectrum spectral feature forecasting." @@ -13,8 +17,13 @@ classifiers = [ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", ] +[project.urls] +Repository = "https://github.com/xmarre/ComfyUI-Spectrum-ZImage-Proper" +Documentation = "https://github.com/xmarre/ComfyUI-Spectrum-ZImage-Proper/wiki" +"Bug Tracker" = "https://github.com/xmarre/ComfyUI-Spectrum-ZImage-Proper/issues" + [tool.comfy] -PublisherId = "local" +PublisherId = "xmarre" DisplayName = "ComfyUI-Spectrum-ZImage-Proper" Icon = "" includes = [] diff --git a/tests/smoke_runtime.py b/tests/smoke_runtime.py index 6275cb3..34e40be 100644 --- a/tests/smoke_runtime.py +++ b/tests/smoke_runtime.py @@ -111,10 +111,11 @@ def test_forecast_fallback_reconciles_bookkeeping() -> None: runtime.observe_actual_feature(run_id, 5, torch.randn(1, 8, 4)) runtime.finalize_solver_step(run_id, 5, used_forecast=False) + assert runtime.stats.forecast_disabled is True + assert runtime.stats.disable_reason == "predicted feature shape did not match the current solver-step input" assert runtime.stats.forecasted_count == 0 assert runtime.stats.actual_forward_count == 6 assert runtime.num_consecutive_cached_steps == 0 - assert decision["actual_forward"] is True assert runtime.curr_ws == before_window runtime.end_run(run_id)