Conversation
VectorBucketScope.list_indexes sent next_token and max_results as snake_case body keys. The /vector/ListIndexes endpoint only reads nextToken and maxResults and ignores unknown properties, so both values were silently dropped: the page size was always the server default and a next_token request returned the first page again, making the usual pagination loop never terminate. Use the wire names, as every other vector request in the module already does. Applies to the async client and its generated sync twin. Fixes supabase#1632
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.
What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
Fixes #1632
VectorBucketScope.list_indexes()builds its request body with snake_case keys:The Storage
/vector/ListIndexesendpoint only readsmaxResultsandnextToken(schema), and it ignores unknown properties, so both values are silently dropped:max_resultshas no effect; the page size is always the server default (500).next_tokenhas no effect, so asking for the next page returns the first page again. The usualwhile page.nextToken:loop overListVectorIndexesResponse.nextToken— the SDK's own response field — never terminates once a bucket has more than one page of indexes.prefixhappens to be spelled the same in both conventions, which is why it works.What is the new behavior?
The body uses the wire names
nextToken/maxResults, matching every other vector request in the module (list_buckets(),VectorIndexScope.list()) and the camelCase response model. The Python keyword arguments are unchanged, so this is not an API change.The async client and its generated sync twin had the same line; both are updated. I confirmed the sync edit is exactly what
run-unasync.pygenerates from the async fix (differing only in line wrapping thatruff formatsettles), and kept the diff to that single line rather than committing the unrelated regeneration churn.Tests
test_async_list_indexes_sends_camel_case_paginationandtest_sync_list_indexes_sends_camel_case_paginationinsrc/storage/tests/test_client.pydrivelist_indexes()through a real client over anhttpx.MockTransportand assert the exact JSON body sent to/vector/ListIndexes. Both fail onmain(body hasnext_token/max_results) and pass here. There was no prior test coverage for the vectors client.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— success, 33 source files.uv run ruff check --fix/uv run ruff format— clean.git diff --check— clean.tests/_asyncandtests/_syncare integration tests that need the storage stack frommake storage.start-infra(Docker + Supabase CLI), which was not running here. They error withhttpx.ConnectError— 50 errors both onmainand with this change (66 → 68 passed, the difference being the two new tests).Additional context
None.