Skip to content

PvMetadataClient query ignores limit=0 (truthiness bug) #13

Description

@craigmcchesney

PvMetadataClient._build_query_pv_metadata_request() sets the request limit with a truthiness check:

if limit:
    request.limit = limit

This drops a caller-supplied limit=0, so a query intended to request zero (or the server-default) page size silently omits the field. The correct guard is is not None:

if limit is not None:
    request.limit = limit

The newer MachineConfigClient query builders already do this correctly (with a test_build_query_request_limit_zero_is_set regression test) — this was noted as a cross-PR follow-up during the #9 code review (PR #12). This issue tracks back-porting the same fix (and an equivalent limit=0 test) to pv_metadata_client.py for consistency.

Fix location: src/dp_python_lib/client/pv_metadata_client.py_build_query_pv_metadata_request.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions