Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/skills/_shared/references/CONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Gotrue/

- **A type belongs to the use case that uses it.** Public inputs and outputs, internal wire DTOs, mapping and validation used by one use case go in its folder.
- **Promote only what is shared.** A type moves to `Common/` when a second use case needs it, never ahead of time; the PR that adds the second use case makes the move.
- **A product with several domains gets one folder per domain.** Storage has file, vector and analytics buckets: each domain is a folder (`FileBuckets/`, `VectorBuckets/`, `AnalyticsBuckets/`) holding its use cases and its own `Common/`. The product's `Common/` keeps only what two domains share. A sub-domain reached through another domain's entry point nests inside it (the Iceberg catalog, reached from an analytics bucket, is `AnalyticsBuckets/Iceberg/`). A domain's shipped code stays where it is until the v9 migration, so a domain may sit partly at the package root and partly in its folder.
- **No shared type serving several use cases through a mode switch.** One wire body per use case beats one body with `ForCreation`/`ForChanges` factories: each use case can then change without touching the other. Put the shared mapping in a helper in `Common/` instead.
- **Namespaces follow folders** (`Supabase.Gotrue.CreateCustomProvider`, `Supabase.Gotrue.Common`), so a use case's public types sit in their own namespace. Never name a folder after a type in scope; it would shadow the type (`CS0118`).
- **A use case with no types of its own needs no folder.** Its tests still get one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;

namespace Storage.Tests.CreateAnalyticsBucket;
namespace Storage.Tests.AnalyticsBuckets.CreateBucket;

/// <summary>
/// Pins the exact bytes <c>Analytics.CreateBucketAsync</c> puts on the wire; the approved body must match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.CreateAnalyticsBucket;
namespace Storage.Tests.AnalyticsBuckets.CreateBucket;

/// <summary>
/// Contract tests for creating an analytics bucket: the request the client puts on the wire and how each
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;

namespace Storage.Tests.CreateAnalyticsBucket;
namespace Storage.Tests.AnalyticsBuckets.CreateBucket;

/// <summary>
/// Unit tests for the only check <c>Analytics.CreateBucketAsync</c> makes before the wire. The name format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage.DeleteAnalyticsBucket;
using Supabase.Storage.AnalyticsBuckets.DeleteBucket;

namespace Storage.Tests.Analytics;
namespace Storage.Tests.AnalyticsBuckets.DeleteBucket;

/// <summary>
/// Unit tests for the checks made before the wire when deleting an analytics bucket. The name format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Collections.Generic;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.Common;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.Common;

/// <summary>
/// Unit tests for building the identifier of a namespace and of its tables: which arguments it refuses and how two
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.Common;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.Common;

/// <summary>
/// Unit tests for how primitive Iceberg types compare. Their wire names are pinned by the create-table approval tests.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.Common;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.Common;

/// <summary>
/// Unit tests for the identifier of a table: how it reads, how two identifiers compare and the path it addresses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage.Common;
using Supabase.Storage.CreateNamespace;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateNamespace;

namespace Storage.Tests.CreateNamespace;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateNamespace;

/// <summary>
/// Pins the exact bytes <c>CreateNamespaceAsync</c> puts on the wire; the approved bodies must match the service's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.CreateNamespace;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateNamespace;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.CreateNamespace;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateNamespace;

/// <summary>
/// Contract tests for creating a namespace: the POST request the catalog puts on the wire (method, path, body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.CreateNamespace;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateNamespace;

namespace Storage.Tests.CreateNamespace;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateNamespace;

/// <summary>
/// Unit tests for the checks made before the wire when creating a namespace, and for the defaults of its options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage.Common;
using Supabase.Storage.CreateTable;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateTable;

namespace Storage.Tests.CreateTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateTable;

/// <summary>
/// Pins the exact bytes <c>CreateTableAsync</c> puts on the wire; the approved bodies must match the Iceberg REST
Expand Down Expand Up @@ -114,5 +114,5 @@ private static IReadOnlyList<IcebergField> PrimitiveFields()
}

private static string Created() =>
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CreateTable", "Data", "TableCreated.json"));
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AnalyticsBuckets", "Iceberg", "CreateTable", "Data", "TableCreated.json"));
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.CreateTable;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateTable;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.CreateTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateTable;

/// <summary>
/// Contract tests for creating a table: the POST request the catalog puts on the wire (method, path, body, headers),
Expand Down Expand Up @@ -327,7 +327,7 @@ private static Func<EquivalencyAssertionOptions<T>, EquivalencyAssertionOptions<
.ComparingByValue<IcebergPrimitiveType>().ComparingByValue<IcebergTransform>();

private static string Fixture(string name) =>
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "CreateTable", "Data", name));
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AnalyticsBuckets", "Iceberg", "CreateTable", "Data", name));

private static string Envelope(string message, string type, int code) =>
$"{{\"error\":{{\"message\":{JsonSerializer.Serialize(message)},\"type\":\"{type}\",\"code\":{code}}}}}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.CreateTable;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.CreateTable;

namespace Storage.Tests.CreateTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.CreateTable;

/// <summary>
/// Unit tests for the checks made before the wire when creating a table, and for the defaults of its options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.DeleteNamespace;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.DeleteNamespace;

/// <summary>
/// Contract tests for deleting a namespace: the DELETE request the catalog puts on the wire (method, path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.DeleteNamespace;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.DeleteNamespace;

/// <summary>
/// Unit tests for the checks made before the wire when deleting a namespace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.DeleteTable;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.DeleteTable;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.DeleteTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.DeleteTable;

/// <summary>
/// Contract tests for deleting a table: the DELETE request the catalog puts on the wire (method, path, table and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.DeleteTable;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.DeleteTable;

namespace Storage.Tests.DeleteTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.DeleteTable;

/// <summary>
/// Unit tests for the checks made before the wire when deleting a table, and for the defaults of its options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.ListNamespaces;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using Supabase.Storage.ListNamespaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.ListNamespaces;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.ListNamespaces;

/// <summary>
/// Contract tests for listing namespaces: the GET request the catalog puts on the wire (method, path, query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.ListTables;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using Supabase.Storage.ListTables;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.ListTables;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.ListTables;

/// <summary>
/// Contract tests for listing the tables of a namespace: the GET request the catalog puts on the wire (method, path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
using FluentAssertions.Execution;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.ListTables;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.ListTables;

namespace Storage.Tests.ListTables;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.ListTables;

/// <summary>
/// Unit tests for the checks made before the wire when listing the tables of a namespace, and for the defaults of its
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Interfaces;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.LoadTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.LoadTable;

/// <summary>
/// Contract tests for loading a table: the GET request the catalog puts on the wire (method, path, table and namespace
Expand Down Expand Up @@ -153,7 +153,7 @@ public void LoadTableAsync_ShouldNotResumeOnTheCallersContext()
}

private static string Fixture(string name) =>
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LoadTable", "Data", name));
File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AnalyticsBuckets", "Iceberg", "LoadTable", "Data", name));

private static string Envelope(string message, string type, int code) =>
$"{{\"error\":{{\"message\":{JsonSerializer.Serialize(message)},\"type\":\"{type}\",\"code\":{code}}}}}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.LoadTable;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.LoadTable;

/// <summary>
/// Unit tests for the checks made before the wire when loading a table: a missing table, and a name that would
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Storage.Tests.Support;
using Supabase.Storage;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;
using Supabase.Storage.Exceptions;
using Supabase.Storage.Common;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;

namespace Storage.Tests.NamespaceExists;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.NamespaceExists;

/// <summary>
/// Contract tests for checking that a namespace exists: the HEAD request the catalog puts on the wire
Expand Down Expand Up @@ -152,7 +152,7 @@ public void NamespaceExistsAsync_ShouldNotResumeOnTheCallersContext()
.Should().BeTrue("the SDK never resumes on the caller's synchronization context");
}

private Supabase.Storage.Interfaces.IIcebergCatalog Catalog() => this.client.Analytics.From("analytics-data");
private Supabase.Storage.AnalyticsBuckets.Iceberg.IIcebergCatalog Catalog() => this.client.Analytics.From("analytics-data");

private void Respond(string path, int status, string body) =>
this.server.Given(Request.Create().WithPath(path).UsingHead())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Supabase.Storage;
using Supabase.Storage.Common;
using Supabase.Storage.AnalyticsBuckets.Iceberg.Common;

namespace Storage.Tests.NamespaceExists;
namespace Storage.Tests.AnalyticsBuckets.Iceberg.NamespaceExists;

/// <summary>
/// Unit tests for the checks made before the wire when scoping to a catalog and checking a namespace. The
Expand Down
Loading