Skip to content

fix(storage): send camelCase sort params in analytics list - #1636

Open
hsusul wants to merge 1 commit into
supabase:mainfrom
hsusul:fix/storage-analytics-list-sort
Open

hsusul wants to merge 1 commit into
supabase:mainfrom
hsusul:fix/storage-analytics-list-sort

Conversation

@hsusul

@hsusul hsusul commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix.

What is the current behavior?

Fixes #1635

StorageAnalyticsClient.list() builds its query string with snake_case sort keys:

params = dict(
    limit=limit,
    offset=offset,
    sort_column=sort_column,
    sort_order=sort_order,
    search=search,
)

GET /iceberg/bucket only reads sortColumn and sortOrder (server schema), and it ignores unknown query keys. Both options are therefore silently dropped, and list(sort_column="created_at", sort_order="desc") returns buckets in the default order. limit, offset and search work only because they are spelled the same in both conventions.

What is the new behavior?

The query string uses sortColumn / sortOrder, matching the server schema and storage-js (StorageAnalyticsClient.listBuckets). The Python keyword arguments are unchanged, so this is not an API change.

The async client and its generated sync twin had the same lines, and both are updated.

Related: #1632 / #1633 fix the same snake_case/camelCase mismatch in the vectors list_indexes() request body. That is a different endpoint and module, so this is a separate PR.

Tests

test_async_analytics_list_sends_camel_case_sort_params and test_sync_analytics_list_sends_camel_case_sort_params in src/storage/tests/test_client.py call list() on a real client over an httpx.MockTransport and assert the exact query parameters sent to /iceberg/bucket. Both fail on main (the query has sort_column / sort_order) and pass here. The analytics client had no test coverage before.

Validation

  • uv run --package storage3 pytest tests/test_client.py tests/test_utils.py tests/test_exceptions.py: 32 passed.
  • uv run --package storage3 --group mypy mypy src/storage3 tests: no issues in 33 source files.
  • uv run ruff check --fix / uv run ruff format: clean.
  • git diff --check: clean.

tests/_async and tests/_sync are integration tests that need the storage stack from make storage.start-infra (Docker + Supabase CLI), which was not running. They fail with httpx.ConnectError: 50 errors on main and 50 with this change, and the only difference in the passed count is the two new tests.

StorageAnalyticsClient.list sent sort_column and sort_order as query
parameters. GET /iceberg/bucket only reads sortColumn and sortOrder and
ignores unknown keys, so both options were silently dropped and buckets
always came back in the default order.

Use the wire names, matching the server schema and storage-js. Applies
to the async client and its generated sync twin.

Fixes supabase#1635
@hsusul
hsusul requested review from a team and o-santi as code owners September 11, 2026 18:16
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.

storage3 analytics list() ignores sort_column and sort_order

1 participant