Repository navigation
feat(storage): delete vectors by key from a vector index - #858
Merged
Merged
Conversation
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.
Summary
A caller can delete vectors by key from a vector index:
storage.Vectors.From(bucket).Index(name).DeleteVectorsAsync(keys). This is the first operation onIVectorIndex, so the index scope now carries its bucket name, index name and the vector transport.Capability:
storage.vector_buckets.delete_vectors, Delete Vectors. No capability spec exists for this group.Public API
New public types: none.
Behavior
POST {storage}/vector/DeleteVectorswith body{"vectorBucketName","indexName","keys":[…]}. Requires a service-role key.keysis required. The bucket and index names come from the scope, whichFromandIndexalready check. The SDK fills in no defaults.keys(ArgumentNullException). The service judges an empty batch, empty keys, key length and the batch limit (validation belongs to the service). Whitespace keys are valid vector keys.SupabaseStorageException):InvalidRequest: empty batch, empty key, too many keys.NotFoundException: the bucket or index is missing.Reason.NotAuthorized: the caller is not the service role.FeatureNotEnabled: the vector service is not configured.Deviations from supabase-js
Tests
VectorDeletionTestsNotFoundException; an empty batch gives the service's 400InvalidRequest. Run against the local stack's pgvector-backed vector service.DeleteVectorsContractTestsNotAuthorized, route not found); cancellation; dynamic headersDeleteVectorsApprovalTestsDeleteVectorsschemaDeleteVectorsTestskeysthrowsArgumentNullExceptionbefore any I/OChanged-line coverage: 100% (21 lines). Mutation: 5/5 on changed lines killed, 0 survivors (13/13 across the mutated files).
Notes
VECTOR_ENABLED=true, pgvector provider), soconfig.tomlis unchanged. The E2E seeds the bucket and vectors, and checks the deletion, over plain HTTP (CreateVectorBucket,PutVectors,GetVectors), because those capabilities are not in the SDK yet. Each test uses a unique bucket name and tears it down.NotFoundException. Existing docs and tests on master useS3VectorNotFoundException/S3VectorBucketNotEmpty, which are the service's enum member names rather than its wire values. Fixing them is a separate follow-up.