Skip to content

Encode unchecked multi-value filters as repeated query parameters - #125

Open
sylvesterkaczmarek wants to merge 1 commit into
nasa:developfrom
sylvesterkaczmarek:fix/unchecked-multivalue-query-encoding
Open

sylvesterkaczmarek wants to merge 1 commit into
nasa:developfrom
sylvesterkaczmarek:fix/unchecked-multivalue-query-encoding

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Fixes #123.

Expand both lists and tuples into repeated array query parameters, adding [] only when the stored key does not already end with it. Query.parameters stores unchecked iterable values as tuples under suffixed keys, but the URL builder previously recognized only lists. It therefore sent one Python tuple representation instead of the individual values.

The change also honors tuple sequences passed to VariableQuery.instance_format. The stored params representation, dedicated-method argument unpacking, scalar encoding, options, and pagination are unchanged. This is separate from the coordinate-formatting and header-propagation work in other open PRs.

Tests

Added 19 cases covering all five query classes, lists/tuples/iterators/sets, empty and singleton values, duplicates, numeric ranges, declared sequence arguments, and unchanged scalar/dedicated-method behavior. Tests of results, get, and hits use actual Requests prepared requests, replacing only Session.send. They verify repeated keys on both pagination requests and preserve the original query headers.

  • New cases against unchanged source: 17 failed, 2 passed.
  • Unchanged repository suite: 129 passed.
  • Complete tests directory after the fix: 148 passed, including the existing doctest collection, with 89% package statement coverage. Existing VCR fixtures were replayed with record_mode='none' to prohibit new recordings; no live CMR requests were made.
  • mypy cmr tests: passed using the repository-locked mypy 1.11.2 and requests stubs.
  • CI's fatal Flake8 selection (E9,F63,F7,F82) on the source and new tests: passed. The new test file also passes the broader Flake8 check with the repository's 127-character limit.
  • Python compilation and git diff --check: passed.

Tested on macOS with Python 3.12.11 against develop at 9f7648ccb925b9c0eb50241e35f15d6454e89505. Test replay uses VCR.py 8.3.0 with the locally resolved Requests/urllib3 versions; this is not a claim that the entire Poetry lockfile environment was recreated. No dependency/lockfile changes, live-service validation, or cross-platform/version matrix is included. Changelog and method documentation are updated.

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.

Unchecked multi-value query parameters are sent as a single tuple string

1 participant