From bfc54db9042220fa7d1bc3be57f0e5a947dcda13 Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Fri, 7 Aug 2026 01:00:31 -0700 Subject: [PATCH 1/2] test(chat): add runtime vectordata compatibility canary --- .../PgVectorConnectorTests.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs index ed5c9fe9..2ca2d619 100644 --- a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs +++ b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs @@ -6,13 +6,12 @@ namespace EssentialCSharp.Chat.Tests; public class PgVectorConnectorTests { /// - /// Verifies that PostgresVectorStore.GetCollection does not throw a TypeLoadException, - /// which would indicate a version mismatch between Microsoft.SemanticKernel core and - /// Microsoft.SemanticKernel.Connectors.PgVector (e.g., missing vtable slots on - /// internal types like PostgresModelBuilder). + /// Verifies the runtime vector-data API shape is compatible with the currently resolved + /// Semantic Kernel connector assemblies. If this fails with MissingMethodException + /// (for example on VectorSearchOptions.get_OldFilter()), package versions are out of sync. /// [Test] - public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadException() + public async Task GetCollection_WithBookContentChunk_RuntimeVectorDataApiShapeIsCompatible() { // Arrange — no real DB connection is needed; connections are only opened for actual queries #pragma warning disable SKEXP0010 // PostgresVectorStore is experimental @@ -24,5 +23,20 @@ public async Task GetCollection_WithBookContentChunk_DoesNotThrowTypeLoadExcepti // Assert await Assert.That(collection).IsNotNull(); + + // Drive the same vector-search path used in production so binary-incompatible package + // combinations fail in tests before deployment. + await using var enumerator = collection + .SearchAsync( + new ReadOnlyMemory(new float[1536]), + 1, + options: new Microsoft.Extensions.VectorData.VectorSearchOptions + { + VectorProperty = x => x.TextEmbedding + }, + cancellationToken: CancellationToken.None) + .GetAsyncEnumerator(); + + await Assert.ThrowsAsync(async () => await enumerator.MoveNextAsync().AsTask()); } } From e17e79f5fb5a674e1441a2ff068202c3480cf52c Mon Sep 17 00:00:00 2001 From: Benjamin Michaelis Date: Fri, 7 Aug 2026 01:08:27 -0700 Subject: [PATCH 2/2] fix packages --- Directory.Packages.props | 2 +- .../EssentialCSharp.Chat.Common.csproj | 2 +- EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs | 4 ++-- EssentialCSharp.Chat/EssentialCSharp.Chat.csproj | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index da1d16b1..58b5af3b 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -47,7 +47,7 @@ - + diff --git a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj index 49e62c75..e367599d 100644 --- a/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj +++ b/EssentialCSharp.Chat.Shared/EssentialCSharp.Chat.Common.csproj @@ -8,7 +8,7 @@ - + diff --git a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs index 2ca2d619..c0523ef8 100644 --- a/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs +++ b/EssentialCSharp.Chat.Tests/PgVectorConnectorTests.cs @@ -1,5 +1,5 @@ using EssentialCSharp.Chat.Common.Models; -using Microsoft.SemanticKernel.Connectors.PgVector; +using CommunityToolkit.VectorData.PgVector; namespace EssentialCSharp.Chat.Tests; @@ -7,7 +7,7 @@ public class PgVectorConnectorTests { /// /// Verifies the runtime vector-data API shape is compatible with the currently resolved - /// Semantic Kernel connector assemblies. If this fails with MissingMethodException + /// CommunityToolkit connector assemblies. If this fails with MissingMethodException /// (for example on VectorSearchOptions.get_OldFilter()), package versions are out of sync. /// [Test] diff --git a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj index 01ea6026..33fc4920 100644 --- a/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj +++ b/EssentialCSharp.Chat/EssentialCSharp.Chat.csproj @@ -20,7 +20,7 @@ - +