Skip to content

feat(storage): delete a vector index - #836

Merged
Tr00d merged 1 commit into
masterfrom
feat/storage.vector_buckets.delete_index
Nov 23, 2026
Merged

Tr00d merged 1 commit into
masterfrom
feat/storage.vector_buckets.delete_index

Conversation

@Tr00d

@Tr00d Tr00d commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

A caller can delete a vector index from a vector bucket through storage.Vectors.From(bucket).

Capability: storage.vector_buckets.delete_index — Delete Vector Index. No capability spec exists for it.

Public API

// IStorageVectorBucketApi
IVectorBucket From(string vectorBucketName);

// IVectorBucket (new)
Task DeleteIndexAsync(string indexName, CancellationToken cancellationToken = default);
await storage.Vectors.From("embeddings-prod").DeleteIndexAsync("docs-v1");

From sends nothing; it scopes later operations to the bucket. IVectorBucket is the home for the other index and vector operations.

Behavior

  • Operation: POST {storage}/vector/DeleteIndex, body {"vectorBucketName": "...", "indexName": "..."}, service-role key.
  • Input: both names are required. From throws ArgumentException for a blank bucket name and DeleteIndexAsync for a blank index name (null, empty or whitespace), before any I/O. Name formats are not validated client-side; the service owns them.
  • Output: none. An empty 200 body is success.
  • Failures throw SupabaseStorageException with StatusCode, Content, Code and Reason set: 404 S3VectorNotFoundException (bucket or index missing), 400 for a rejected name, 401/403 for a non-service-role caller (Reason.NotAuthorized), 500 InternalError, and the 404 the service answers when the vector service is not enabled.
  • State: none.

Deviations from supabase-js

  • Throws SupabaseStorageException instead of returning { data, error }; returns nothing instead of {}.
  • Flat DeleteIndexAsync(indexName) on the bucket scope, as in supabase-js from(bucket), rather than from(bucket).index(name).

Tests

Tier Class Pins
Contract DeleteVectorIndexContractTests method, path, body, headers, no request on From, each failure mapping, cancellation, dynamic headers
Contract DeleteVectorIndexApprovalTests exact request body
Unit DeleteVectorIndexTests blank bucket and index name checks, no request sent

Changed-line coverage: 100% (34 lines). Mutation: 15/15 killed on changed lines, 0 survivors.

Notes

No E2E ran against a real service: the local stack does not serve the vector routes. The failure responses are pinned from the storage route source, not observed on a live service.

The request mechanics that delete-bucket and delete-index share (URL, headers, POST, name check) moved to Storage/Common/VectorService.cs. StorageVectorBucketApi now delegates to it; behavior is unchanged.

The wire body is a plain class because the Storage package has no PolySharp, so records and init do not compile there.

@Tr00d
Tr00d marked this pull request as ready for review November 23, 2026 15:55
@Tr00d
Tr00d merged commit 3308c10 into master Nov 23, 2026
7 checks passed
@Tr00d
Tr00d deleted the feat/storage.vector_buckets.delete_index branch November 23, 2026 15:55
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