Skip to content

Generalize frontend version warning to all comfy* requirements.txt entries#13875

Merged
Kosinkadink merged 5 commits into
masterfrom
glary/comfy-version-warnings-minimal
May 14, 2026
Merged

Generalize frontend version warning to all comfy* requirements.txt entries#13875
Kosinkadink merged 5 commits into
masterfrom
glary/comfy-version-warnings-minimal

Conversation

@christian-byrne
Copy link
Copy Markdown
Contributor

@christian-byrne christian-byrne commented May 13, 2026

PR Created by the Glary-Bot Agent


Frontend PR: Comfy-Org/ComfyUI_frontend#12167. These can go in any order, purely additive change to the API.

Summary

Generalizes the startup version check so every comfy* package pinned in requirements.txt (currently comfyui-frontend-package, comfyui-workflow-templates, comfyui-embedded-docs, comfy-kitchen, comfy-aimdo) gets the same console warning that previously only fired for the frontend, and exposes the discovered list via the existing /system_stats endpoint so the frontend can render a toast.

Changes

  • app/frontend_management.pycheck_frontend_version() and get_installed_frontend_version() are folded into a single generalized check_comfy_packages_versions(). The frontend is itself a comfy* package, so there is no skip in the loop. New get_comfy_package_versions() returns [{name, installed, required}, ...] for every comfy* line in requirements.txt, and FrontendManager.get_comfy_package_versions() is the thin classmethod wrapper matching the existing get_required_frontend_version / get_required_templates_version pattern. Version comparison uses packaging.version.parse (already present in comfy_api/internal/api_registry.py) so PEP 440 versions like 0.3.0.post1 and 1.0.0rc1 compare correctly instead of throwing. Warning remediation uses the generic get_missing_requirements_message() so the text no longer mentions "frontend" when it fires for a non-frontend package.
  • server.py/system_stats gains one additive field, comfy_package_versions: [{name, installed, required}, ...]. Every existing field (required_frontend_version, installed_templates_version, required_templates_version) is preserved.
  • openapi.yaml — schema for the new field.
  • tests-unit/app_test/frontend_manager_test.py — the two existing tests that patched check_frontend_version are retargeted mechanically to check_comfy_packages_versions. No new test cases.

Behavior

  • All packages up to date → per-package <pkg> version: <x.y.z> info log, no warnings.
  • One or more comfy* packages outdated → existing per-package WARNING WARNING WARNING / Installed <name> version X is lower than the recommended version Y block fires once per outdated package.
  • /system_stats always returns the full list so the frontend can show a toast for any mismatch without re-querying.

Verification

  • 18/18 existing unit tests pass.
  • Smoke-tested live: with pins bumped to 9.99.99, both comfyui-frontend-package and comfy-kitchen emit the existing WARNING block once each; remediation text is now the generic pip install -r requirements.txt message; /system_stats returns the new list with correct installed / required per entry.
  • parse_version exported from app/frontend_management.py is unchanged (still used by server.py:1078).

Drafted from Slack discussion in #dev-core-engine.

…tries

The frontend is itself a comfy* package, so check_frontend_version() is
folded into check_comfy_packages_versions(), removing the duplication.
/system_stats gains a comfy_package_versions list (purely additive).
@christian-byrne christian-byrne marked this pull request as ready for review May 13, 2026 17:49
glary-bot Bot pushed a commit to Comfy-Org/ComfyUI_frontend that referenced this pull request May 13, 2026
The backend PR (Comfy-Org/ComfyUI#13875) emits comfy_package_versions
entries straight from importlib.metadata, which can be PEP 440 (e.g.
"0.3.0.post1", "1.0.0rc1", "0.4.0.dev0"). semver.valid() rejects
those, so the previous filter silently dropped them.

Replace the two valid()+gt() comparisons with a small isOutdated helper
that uses semver.coerce (strips the suffix to the nearest X.Y.Z) and
gt. Applied to both the frontend check and the per-package list so
behavior is consistent.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 57a77c26-ac0c-47f5-9f14-f6f6c8dac657

📥 Commits

Reviewing files that changed from the base of the PR and between 7fd1ab8 and f94b122.

📒 Files selected for processing (1)
  • server.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • server.py

📝 Walkthrough

Walkthrough

Refactors frontend version checking to scan all required comfy* packages instead of a single comfyui-frontend-package. Adds get_comfy_package_versions() (with module cache COMFY_PACKAGE_VERSIONS) and check_comfy_packages_versions() to enumerate and validate installed vs required versions using PEP 440 parsing; invalid versions are logged and skipped. Removes get_installed_frontend_version() and check_frontend_version(). Exposes package versions via FrontendManager.get_comfy_package_versions(), includes them in /system_stats responses and OpenAPI (SystemStatsResponse.comfy_package_versions), and updates unit tests to mock the new helpers.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: generalizing the frontend version warning to apply to all comfy* packages in requirements.txt, which is the core refactoring described in the changeset.
Description check ✅ Passed The description comprehensively covers the changes, including the motivation (generalizing version checks to all comfy* packages), file-by-file modifications, behavior changes, and verification steps—all directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@glary-bot
Copy link
Copy Markdown

glary-bot Bot commented May 13, 2026

Acknowledged — no actionable comments to address. Thanks for the review.

@Kosinkadink
Copy link
Copy Markdown
Member

Kosinkadink commented May 14, 2026

Not a blocker, but I'd prefer the result of get_comfy_package_versions() be cached. get_required_packages_versions() already caches its parse of requirements.txt via the PACKAGE_VERSIONS global, but get_comfy_package_versions() still re-invokes importlib.metadata.version() for every comfy* package on every /system_stats request. Installed versions don't change over the lifetime of the process, so a one-shot module-level cache (or functools.lru_cache) would make this effectively free instead of doing N metadata lookups per poll.

(This was written by amp at my request)

Mirrors the PACKAGE_VERSIONS cache in utils/install_util.py. Installed
package versions don't change over the lifetime of the process, so a
one-shot module-level cache makes /system_stats polling effectively free
instead of doing N importlib.metadata.version() lookups per call.
@glary-bot
Copy link
Copy Markdown

glary-bot Bot commented May 14, 2026

Not a blocker, but I'd prefer the result of get_comfy_package_versions() be cached.

Good call — done in 5777d75. Mirrored the exact PACKAGE_VERSIONS cache pattern from utils/install_util.py so it reads consistently: module-level COMFY_PACKAGE_VERSIONS = [] populated on first call, defensive .copy() on return so callers can't poison it. Existing clear_cache test fixture extended to reset it alongside PACKAGE_VERSIONS. Smoke-tested: 3 sequential /system_stats calls return the same cached 5-entry list with zero re-invocations of importlib.metadata.version() after the first. 18/18 existing tests still pass.

@Kosinkadink
Copy link
Copy Markdown
Member

lgtm. cc: @guill

@glary-bot
Copy link
Copy Markdown

glary-bot Bot commented May 14, 2026

Thanks @Kosinkadink! Standing by for @guill's review before flipping out of draft.

Copy link
Copy Markdown
Contributor

@rattus128 rattus128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Did original back and forth with glary offline.

@glary-bot
Copy link
Copy Markdown

glary-bot Bot commented May 14, 2026

Thanks @rattus128! PR is out of draft and has both approvals — ready to merge whenever.

xeinherjer-dev pushed a commit to xeinherjer-dev/ComfyUI_frontend that referenced this pull request May 14, 2026
…omfy-Org#12167)

*PR Created by the Glary-Bot Agent*

---

## Summary

Extend the existing frontend version-mismatch warning UI to consume the
new `comfy_package_versions` array now exposed by ComfyUI's
`/system_stats` endpoint. The backend ships installed/required versions
for every `comfy*` package pinned in `requirements.txt` (frontend,
workflow-templates, embedded-docs, kitchen, aimdo, …); the frontend now
surfaces one toast per outdated package, reusing the existing N=1
frontend-version warning shape.

Backend PR: Comfy-Org/ComfyUI#13875

## Changes

- `src/schemas/apiSchema.ts` — add `comfy_package_versions: Array<{name,
installed, required}>` to the `SystemStats` schema and export a
`ComfyPackageVersion` type. The field is `.optional()` so older backends
remain compatible.
- `src/platform/updates/common/versionCompatibilityStore.ts` — new
`outdatedComfyPackages` / `packageWarningMessages` computeds that mirror
the existing semver `gt` comparison (same `valid` guard). Skip
`comfyui-frontend-package` because the dedicated frontend warning above
already covers it (and uses the running bundle's version rather than the
installed pip version). Outdated packages are sorted by
`name`/`installed`/`required` before being folded into the dismissal
storage key so the key is stable across response orderings — a fresh
package bump re-shows the warning, but the same outdated set in a
different order does not.
- `src/platform/updates/common/useFrontendVersionMismatchWarning.ts` —
emit one toast per outdated package in addition to the existing frontend
toast, reusing the same i18n wrapper and the existing `hasShownWarning`
once-per-session guard.
- `src/locales/en/main.json` — new `g.comfyPackageOutdated` string.
- Unit tests — added coverage for outdated/skip/invalid-version paths,
dismissal-key inclusion, and stable ordering. Existing 21 store + 8
composable tests untouched and still passing.

CI suppression is unchanged: warnings still gate on
`versionCompatibilityStore.shouldShowWarning` (which respects the
`Comfy.VersionCompatibility.DisableWarnings` setting and the 7-day
dismissal cache), and unit tests continue to mock the store the same
way.

## Verification

- `pnpm vitest run` for the version-warning module: **31/31** passing.
- Targeted sweep across `src/platform/updates`,
`src/stores/systemStatsStore.test.ts`, `src/schemas`: **160/160**
passing.
- `pnpm typecheck`: clean.
- `pnpm lint`: 0 errors (3 pre-existing warnings in unrelated 3D test
files).
- `pnpm format`: applied, no incidental changes.
- **Manual Playwright run** against the real dev server with
`/api/system_stats` intercepted to return outdated package data —
produced exactly the expected toasts and correctly skipped
`comfyui-frontend-package` and the up-to-date `comfy-kitchen` entry.
Same run with all-up-to-date data produced zero toasts.

### Toasts produced (manual verification)

The fixture used: `required_frontend_version=99.99.99`, plus
`comfy_package_versions=[frontend-package (outdated, skipped),
workflow-templates 0.9.0→0.9.5 (outdated), embedded-docs 0.4.0→0.5.0
(outdated), comfy-kitchen 0.2.8→0.2.8 (up to date)]`.

## Screenshots

![Three version warning toasts displayed: outdated frontend (1.45.1 <
99.99.99), outdated workflow-templates (0.9.0 < 0.9.5), and outdated
embedded-docs (0.4.0 < 0.5.0). The skipped comfyui-frontend-package
entry and the up-to-date comfy-kitchen entry produced no extra
toasts.](https://pub-1fd11710d4c8405b948c9edc4287a3f2.r2.dev/sessions/986a510ae8e587d3ced862efffa622d9d476c40b9ac1423b89f56e85c0ce51c1/pr-images/1778562152770-11307c64-2863-41af-a42d-1c42fb332ca6.png)

![Zoomed view of the three Alert toasts in the top-right toast
stack.](https://pub-1fd11710d4c8405b948c9edc4287a3f2.r2.dev/sessions/986a510ae8e587d3ced862efffa622d9d476c40b9ac1423b89f56e85c0ce51c1/pr-images/1778562153211-df80e3b5-48d5-416e-a11f-3a6d25b6618c.png)

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-12167-feat-extend-version-warning-to-all-comfy_package_versions-entries-35e6d73d365081e7b993d0f06c9e5c98)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com>
@glary-bot
Copy link
Copy Markdown

glary-bot Bot commented May 14, 2026

Thanks @Kosinkadink!

@Kosinkadink Kosinkadink merged commit b112f68 into master May 14, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants