Skip to content

feat(storage): delete an analytics bucket - #829

Merged
Tr00d merged 3 commits into
masterfrom
feat/storage.analytics.delete_analytics_bucket
Nov 23, 2026
Merged

Tr00d merged 3 commits into
masterfrom
feat/storage.analytics.delete_analytics_bucket

Conversation

@Tr00d

@Tr00d Tr00d commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

A caller can delete an empty analytics (Iceberg) bucket through storage.Analytics.DeleteBucketAsync.

Capability: storage.analytics.delete_analytics_bucket - Delete Analytics Bucket. No capability spec exists; the contract is taken from the storage route source (src/http/routes/iceberg/bucket.ts).

Public API

// IStorageClient<TBucket, TFileObject>, Client
IStorageAnalyticsApi Analytics { get; }

// IStorageAnalyticsApi (Supabase.Storage.Interfaces)
Task DeleteBucketAsync(string name, CancellationToken cancellationToken = default);
var storage = new Client(url, headers);
await storage.Analytics.DeleteBucketAsync("analytics-data");

IStorageAnalyticsApi is the home for the sibling analytics capabilities (create, list, and a catalog-scoped surface for namespaces and tables).

Behavior

  • DELETE {storage}/iceberg/bucket/{name}, service-role key, no body. A 200 {"message":"Successfully deleted"} acknowledgement is discarded.
  • The name is escaped as a single path segment. ArgumentException before I/O for a null, empty/whitespace, . or .. name. The SDK does no bucket-name format validation; the service owns it.
  • Failures throw SupabaseStorageException: 404 -> Reason.NotFound, 401 -> NotAuthorized, 500 -> Internal, anything else (including feature-not-enabled) -> its status with Reason.Unknown.
  • Headers are read at call time (dynamic GetHeaders and the access-token hook apply); the cancellation token reaches the HTTP call; the call goes through the existing instrumentation.
  • The Iceberg routes use an error envelope ({"error":{"message","type","code"}}) with no top-level statusCode. The shared error path took 0 as the status for such a body, so Reason could never be NotFound. It now falls back to the HTTP status when the body carries no positive statusCode. This is a one-line change in Helpers.MakeRequestAsync; it also applies to other members that receive a body with no statusCode (their StatusCode was 0 and is now the HTTP status).

Deviations from supabase-js

  • Failures throw instead of { data, error }; the acknowledgement is not returned.
  • The name is escaped as one path segment (supabase-js interpolates it raw). No client-side name validation on this call.

Tests

Tier Class Pins
Contract StorageAnalyticsApiContractTests method, path, headers, empty body, escaping, call-time headers, cancellation, each failure mapping, status fallback
Unit DeleteAnalyticsBucketPathTests checks before the wire

No approval snapshot: the request has no body.

Changed-line coverage: 100% (21 lines). Mutation: all mutants on changed lines killed (or timed out), 0 survivors.

Notes

  • No E2E ran against a real service: the local stack does not serve the Iceberg routes (ICEBERG_ENABLED is off by default and supabase/config.toml has no switch). The non-empty-bucket, missing-bucket, non-service-role and feature-not-enabled responses are pinned from the route source, not observed. In particular, what the service answers for a bucket that is not empty is unconfirmed.
  • supabase/config.toml is unchanged.

@Tr00d
Tr00d marked this pull request as ready for review November 23, 2026 15:45
@Tr00d
Tr00d merged commit fab777e into master Nov 23, 2026
7 checks passed
@Tr00d
Tr00d deleted the feat/storage.analytics.delete_analytics_bucket branch November 23, 2026 15:53
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