Conversation
`cld admin resources -A -ff public_id` returned every field when the first response had no cursor. `handle_auto_pagination` returned before it applied the filter. Without `-A`, `-ff` was ignored with no message. - Apply the field filter to each list in a single-page response. - Log a warning when `-ff` is given without `-A`. - State in the `-ff` help text that it requires `-A`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TalLevAmi
marked this pull request as ready for review
September 26, 2026 16:15
const-cloudinary
requested changes
Sep 27, 2026
const-cloudinary
left a comment
Member
There was a problem hiding this comment.
Please see comment, this PR introduces regression
| fields_to_keep = normalize_list_params(filter_fields) | ||
|
|
||
| if cursor_field not in res: | ||
| # A single page: the pagination field is unknown, so filter every list in the response. |
Member
There was a problem hiding this comment.
This is not the best approach, when we have more than 1 list in response, irrelevant lists get completely emptied, like:
derived ✅ filtered, versions → [{}] ❌
or
derived ✅ filtered, info → [{}] ❌
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-ff/--filter_fieldsoncld adminworks only through auto-pagination. When all results fit on the first page,handle_auto_paginationreturned before it applied the filter, socld admin resources -A -ff public_id max_results=500printed every field. Without-A, the CLI accepted-ffand ignored it with no message.Brief Summary of Changes
handle_auto_pagination(cloudinary_cli/utils/api_utils.py) calculates the fields to keep before the early return. When the response has no cursor, it filters each list in the response. With one page, the pagination field is not known, so the code cannot select one list.handle_api_commandlogs-ff/--filter_fields has no effect without -A/--auto_paginate.when-ffis given without-A.-ffhelp text says that it requires-A.What does this PR address?
Are tests included?
Reviewer, please note:
-ffwork without-A. For a single-asset response, for exampleadmin resource, it is not clear which list to filter.whitelist_keyschanges only lists of dicts, so lists of strings (for exampletags) stay the same.Checklist:
Local test run: I ran the full suite on Python 3.8 with Click 8.1.8. The new tests pass, and they fail without the fix. 8 tests in
test_cli_agent.pyandtest_cli_config_oauth.pyfail withstderr not separately capturedon this branch and onmastertoo. These tests need Click 8.2, which needs Python 3.10 or later. CI must confirm the full result.🤖 Generated with Claude Code