Files
malkuthro-ComfyUI-Koolook/.github/workflows/ci.yml
T
malkuthroandClaude Fable 5 c6a155a033 fix(web): generation-agnostic Comfy draft-quota guard (#237)
* fix(web): generation-agnostic Comfy draft-quota guard

"Failed to save workflow draft" toasts returned on ComfyUI frontend
1.44+ because draft storage moved to new localStorage key names
(per-workspace V1 keys, then a V2 index+payload scheme) that the old
exact-name guard embedded in ltx_director.js never matched - and the
1.44 V2 layer latches a session-wide storage-unavailable flag after one
failed save+evict cycle, re-toasting on every edit until reload.

Move the guard to its own global extension, web/koolook_draft_guard.js:

- match draft keys by prefix (Comfy.Workflow.Draft) across all known
  generations, with unknown future keys as last-resort evictions
- rescue quota failures inside localStorage.setItem (evict the oldest
  draft across generations, retry) before Comfy's own catch sees the
  error, so the save succeeds and the latch never trips
- boot prune: drop the suffixed-V1 dead weight the frontend's V1->V2
  migration never deletes, scope corrupt-key cleanup to the offending
  key, drop oversized entries, enforce a total draft budget
- ship the guard with dev-sync-audio so a scoped sync cannot strand a
  dev install guard-less

Behavior is covered by tests/js/test_draft_guard.mjs (12 scenarios,
wired into CI next to the existing node smoke test); static integration
contracts live in tests/sidebar/test_draft_guard.py.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(web): address deep-review findings on the draft guard

- latch the "still full" hint toast once per session so a genuinely
  full origin cannot re-toast on repeated failing autosave attempts;
  regression assertion added to the exhaustion scenario
- document the bounded-eviction termination contract and the
  post-rethrow storage-unavailable latch at the wrapper, plus the
  budget's V1-blob-only (1.5M) -> all-generations (2M) scope widening
  (also now stated in the CHANGELOG entry)
- version-robust wording for the suffixed-V1 cleanup rationale: the
  shipped 1.44 migration leaves the keys behind (verified against the
  installed 1.44.19 dist - no removeItem exists there), later
  frontends clean up on successful migration, and an interrupted
  migration can leak the keys on any version
- comment the intentional best-effort swallow in the toast helper

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 13:29:25 +02:00

104 lines
2.9 KiB
YAML

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
permissions:
contents: read
jobs:
lint-smoke:
name: Lint & Smoke
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install lint tools
run: pip install ruff==0.6.9
- name: Ruff check
run: ruff check .
- name: Compile all (syntax smoke)
run: python -m compileall -q -x '(\.venv|forks|upscaler_FIX/github_repos|nuke_CAM_exporter)' .
- name: Run JS smoke tests
run: |
node tests/js/test_ai_pipeline_preview.mjs
node tests/js/test_draft_guard.mjs
security-gate:
name: Security Gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install bandit
run: pip install bandit==1.7.10
- name: Bandit scan
run: bandit -r . -x ./.venv,./forks,./upscaler_FIX,./nuke_CAM_exporter -ll
preflight:
name: Pre-flight Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Run pre-flight (static + dispatch + workflow fixtures)
# manager-meta is skipped on PRs because the upstream node-map drift
# is owned by an external repo (ltdrdata/ComfyUI-Manager) and is
# tracked separately via issue #44. Re-enable by removing --skip
# once that issue is resolved upstream.
run: python tools/preflight_release.py --skip manager-meta -v
pytest:
name: Pytest
runs-on: ${{ matrix.os }}
strategy:
# Keep both lanes reporting even when one fails — a Windows-only
# failure with a green ubuntu lane is exactly the signal this
# matrix exists to surface.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install test deps
# Install the deps directly — this project is a ComfyUI custom node,
# not a pip-installable package, so ``pip install .[test]`` tries to
# build a wheel and fails on flat-layout discovery of ``web/`` and
# ``forks/``. The pyproject's ``[project.optional-dependencies]
# test`` block is the spec; CI mirrors it explicitly. ``aiohttp`` is
# a runtime dep of ``koolook_routes`` and must be importable even
# when only a pure helper is under test. ``Pillow`` backs the
# audio-card metadata tests.
run: pip install "pytest>=8" "aiohttp>=3.9" "Pillow>=10"
- name: Run pytest
run: pytest -q