Skip to content

refactor(storage): page every Storage list the same way - #917

Open
Tr00d wants to merge 1 commit into
masterfrom
refactor/storage-page
Open

Tr00d wants to merge 1 commit into
masterfrom
refactor/storage-page

Conversation

@Tr00d

@Tr00d Tr00d commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

What

Every paged Storage list now returns one page type, Supabase.Storage.Common.Page<T>, and every list option pages with the same two names.

  • New Page<T> (Storage/Common/Page.cs): a sealed record with IReadOnlyList<T> Items (empty by default, never null) and string? NextPageToken (null means this is the last page).
  • Deleted VectorListPage<TItem>, IcebergNamespacePage and IcebergTablePage.
  • Return types: ListVectorBucketsAsync, ListIndexesAsync and ListVectorsAsync return Page<VectorBucketSummary>, Page<VectorIndexSummary> and Page<StoredVector>. ListNamespacesAsync and ListTablesAsync return Page<IcebergNamespace> and Page<IcebergTable>.
  • Options:
    • ListVectorBucketsOptions, ListVectorIndexesOptions, ListVectorsOptions: MaxResults → PageSize, NextToken → NextPageToken.
    • ListNamespacesOptions, ListTablesOptions: PageToken → NextPageToken.
    • All other option members are unchanged.
  • Docs: the <example> on all five list methods uses the same do/while loop. The old examples dropped the first page's items.

All of this surface is in PublicAPI.Unshipped.txt, so nothing shipped changes. PublicAPI.Shipped.txt is byte-identical.

Paging loop, before and after

Vectors, before:

var options = new ListVectorsOptions { MaxResults = 100 };
var page = await index.ListVectorsAsync(options);
while (page.NextToken is not null)
    page = await index.ListVectorsAsync(options with { NextToken = page.NextToken });

Iceberg, before (no paging loop was possible with the same shape: different page type, item property and option name):

var page = await catalog.ListTablesAsync(sales, new ListTablesOptions { PageSize = 50 });
foreach (var table in page.Tables) { /* ... */ }
// next page: new ListTablesOptions { PageToken = page.NextPageToken }

After, the same loop for both:

var options = new ListVectorsOptions { PageSize = 100 };
Page<StoredVector> page;
do
{
    page = await index.ListVectorsAsync(options);
    foreach (var vector in page.Items) { /* ... */ }
    options = options with { NextPageToken = page.NextPageToken };
}
while (page.NextPageToken is not null);
var options = new ListTablesOptions { PageSize = 50 };
Page<IcebergTable> page;
do
{
    page = await catalog.ListTablesAsync(sales, options);
    foreach (var table in page.Items) { /* ... */ }
    options = options with { NextPageToken = page.NextPageToken };
}
while (page.NextPageToken is not null);

The wire does not change

Only the C# names change. The internal bodies, responses and queries still use maxResults/nextToken for vectors, and pageSize/pageToken/next-page-token for Iceberg. No approval .verified.txt snapshot changed, and every contract-test URL assertion is unchanged.

Helper placement (CONVENTIONS §2)

  • PathSegment stays in Storage/Common/. FileBuckets/Common/BucketLifecyclePath no longer repeats its blank and relative-segment checks and calls it instead, so two domains use it. The request URL is unchanged. The ArgumentException message for a bad lifecycle bucket id now uses PathSegment's wording (A bucket id must be provided. / A bucket id cannot be a relative path segment.). The existing test pins only the A bucket id* prefix, so it still passes as is.
  • QueryString moved from Storage/Common/ to AnalyticsBuckets/Common/. ListAnalyticsBucketsQuery no longer repeats its Append/Parameter logic and calls it instead, so its users are the analytics bucket list and the Iceberg namespace and table lists. The output is byte-identical, including the trailing ? when no option is set. I kept that ? on purpose, so URLs stay exactly as they are.

What remains in Storage/Common/, and who uses it:

Type Used by
Page<T> vector buckets (bucket, index and vector lists) and the Iceberg catalog (namespace and table lists)
PathSegment analytics buckets (bucket names, Iceberg namespaces and tables) and file buckets (lifecycle path)

Out of scope

QueryVectorsAsync still uses QueryVectorsOptions.NextToken / VectorQueryResult.NextToken. It is a similarity query, not a list, and returns VectorQueryResult, not a page.

Verification

  • Changed-lines coverage: 37/37 (100%).
  • Stryker on the changed production files: 113 killed, 6 timeout, 0 survived (100%).
  • gate.sh packages/Storage: Build, Format, Inner loop (752 passed) and Public API declared all PASS. The result is INCOMPLETE locally because the Supabase stack was down (E2E/coverage skipped), so CI is the gate. As expected, the public-API diff signal reports REMOVED entries, all of them for unshipped members.

🤖 Generated with Claude Code

@Tr00d
Tr00d marked this pull request as ready for review November 26, 2026 13:26

This branch has not been deployed

No deployments
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.

1 participant