Repository navigation
fix(assets): ask Comfy Cloud for the exact asset total in assets library ls and models search - #1148
Conversation
…rary ls` and `models search` Both commands report the server's `total` from GET /api/assets as an exact count. Send `capped_total=false` so Comfy Cloud keeps answering with the exact count rather than a capped one. The scan in `models search` counts its own matches and does not send it.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
james00012
left a comment
There was a problem hiding this comment.
Approve.
Reviewed at f9b35f7.
|
Thanks @james00012. The approval lists no findings, so nothing changes. |
TL;DR:
comfy assets library lsandcomfy models searchnow sendcapped_total=falseonGET /api/assets, so thetotalthey print stays an exact count.Why Comfy Cloud's
GET /api/assetstakes acapped_totalparameter. Withcapped_total=falsethe server returns the exacttotal. Without it, the server may return a capped count instead. Both commands print the server'stotalas an exact number. Comfy Cloud already accepts the parameter, so the output today is the same.Before and after
Before:
comfy --json assets library ls --where cloudsendsGET /api/assets?limit=20. It forwards whatevertotalthe server returns.After: it sends
GET /api/assets?limit=20&capped_total=false. Thetotalit forwards is the exact count.comfy models search --where cloudchanges the same way on its two one-page answers: no--text, and a single-word--textthat matches on the first page. Both report the server'stotalwithtotal_is_lower_bound: false. When search scans several pages, it counts its own matches, so the scan requests do not send the parameter.Calls left as they are
These
GET /api/assetscalls do not readtotal: the hash suggestions inassets library ensure, the model lookup inassets library upload,models show, and the model lookup inworkflow check. Job calls (/api/jobs) are unchanged.Tests
tests/comfy_cli/command/test_assets_library.py: newtest_asks_for_the_exact_total. It checks thatlssendscapped_total=false.tests/comfy_cli/command/models/test_search.py: newtest_one_page_answers_ask_for_the_exact_total(both one-page answers send it) andtest_a_scan_does_not_ask_for_the_exact_total(scan requests do not).Not run: the test suite and lint (CI runs them). No request was sent to Comfy Cloud with this build.
Rule bent: none.
Summary by CodeRabbit