shields icon indicating copy to clipboard operation
shields copied to clipboard

feat(comfyui): Add ComfyUI Registry service, tests, fixture and docs

Open neverbiasu opened this issue 1 month ago • 6 comments

Summary Add ComfyUI Registry badges (downloads, version, stars) with a resilient fetcher, tests, fixture and docs.

What this PR does

  • Implements service: comfyui-registry.service.js
    • Routes: /comfyui/:node/downloads, /comfyui/:node/version, /comfyui/:node/stars
    • Respects upstream Cache-Control max-age, supports ETag conditional GET (304), and uses a conservative fallback TTL when max-age=0 and no ETag.
    • Inflight request coalescing and retry with exponential backoff on network/5xx errors.
    • Version badge uses the node identifier as the label (e.g. comfyui-image-captioner).
  • Tests + fixture: comfyui-registry.spec.js, comfyui_node.json
  • Docs: comfyui-registry.md (usage & implementation notes)
  • Removed root-level legacy placeholders to avoid duplicate exports.

Testing (local)

  • Focused unit tests: NODE_CONFIG_ENV=test npx mocha comfyui-registry.spec.js --timeout 5000 -> 3 passing locally
  • Configurable fallback TTL: set COMFYUI_FALLBACK_TTL (seconds) for testing behavior when upstream returns max-age=0 without ETag.

Notes for reviewers

  • Please check caching/ETag logic and error mapping (404 -> NotFound, 401/403 -> Inaccessible).
  • Verify doc examples and the new short-route contract.
  • No PRD/DEV/TODO drafts are included in this PR by request.

Changelog entry

  • Added: ComfyUI Registry badges (downloads, version, stars) with caching and ETag revalidation.

neverbiasu avatar Nov 09 '25 20:11 neverbiasu

Warnings
:warning:

Found badge URL that may not follow our standard route abbreviations.
Please ensure you've reviewed our conventions

:warning:

Found badge URL that may not follow our standard route abbreviations.
Please ensure you've reviewed our conventions

Messages
:book: :sparkles: Thanks for your contribution to Shields, @neverbiasu!
:book:

Thanks for contributing to our documentation. We :heart: our documentarians!

Generated by :no_entry_sign: dangerJS against 063c84e3165ce3e3a77488902c3ac1017de152a4

github-actions[bot] avatar Nov 09 '25 20:11 github-actions[bot]

@PyvesB Hii, could you review my code.

neverbiasu avatar Nov 10 '25 02:11 neverbiasu

Hello @neverbiasu 👋🏻 What is the rationale for adding a cache layer for this badge? We typically cache at the CDN layer, which has the advantage of being shared across all running Shields.io instances and completely bypasses any processing.

PyvesB avatar Nov 13 '25 21:11 PyvesB

Hii, @PyvesB. Thx for your suggestions. I will try to use it.

neverbiasu avatar Nov 14 '25 00:11 neverbiasu

I'd suggest following our tutorial and generally speaking keeping things as simple as possible: https://github.com/badges/shields/blob/master/doc/TUTORIAL.md

By the way, do you have any information on the API's rate limits?

PyvesB avatar Nov 14 '25 08:11 PyvesB

@PyvesB Thx for the suggestions, I have rewrite in the format mentioned in TUTOTIAL.md. I didn't know the API's rate limits but I can ask the backend dev of ComfyUI and answer it later.

neverbiasu avatar Nov 14 '25 19:11 neverbiasu