From cafed16688dd85c23fe310c2c3cc5ba84ed00a0f Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:32:33 +0200 Subject: [PATCH 1/6] chore: template public API snapshot versions --- Directory.Build.targets | 56 +++++++++++++++++++++++++++++++ src/PostHog/PublicAPI.Shipped.txt | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Directory.Build.targets diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..5b14a49 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,56 @@ + + + + + + + + + + ", Version); +File.WriteAllText(OutputFile, text); + ]]> + + + + + + + <_PublicApiSnapshotOutputDir>$(IntermediateOutputPath)PublicApiSnapshots\ + + + + + + + + + + + + + + + + diff --git a/src/PostHog/PublicAPI.Shipped.txt b/src/PostHog/PublicAPI.Shipped.txt index 4d56fb0..d98f533 100644 --- a/src/PostHog/PublicAPI.Shipped.txt +++ b/src/PostHog/PublicAPI.Shipped.txt @@ -335,7 +335,7 @@ const PostHog.Api.PostHogProperties.RequestPath = "$request_path" -> string! const PostHog.Api.PostHogProperties.ResponseStatusCode = "$response_status_code" -> string! const PostHog.Api.PostHogProperties.SessionId = "$session_id" -> string! const PostHog.Api.PostHogProperties.UserAgent = "$user_agent" -> string! -const PostHog.Versioning.VersionConstants.Version = "2.7.1" -> string! +const PostHog.Versioning.VersionConstants.Version = "" -> string! override PostHog.Api.ApiErrorResult.Equals(object? obj) -> bool override PostHog.Api.ApiErrorResult.GetHashCode() -> int override PostHog.Api.ApiErrorResult.ToString() -> string! From 6f24c7a8b53fdef7f474236e5b61c1bcfe2f2e76 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:36:09 +0200 Subject: [PATCH 2/6] chore: support package-specific API version templates --- Directory.Build.targets | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 5b14a49..d454dd2 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -6,6 +6,7 @@ + @@ -16,13 +17,15 @@ if (!string.IsNullOrEmpty(directory)) Directory.CreateDirectory(directory); } -var text = File.ReadAllText(SourceFile).Replace("", Version); +var text = File.ReadAllText(SourceFile) + .Replace("", Version) + .Replace($"<{PackageId}.version>", Version); File.WriteAllText(OutputFile, text); ]]> - + @@ -33,10 +36,12 @@ File.WriteAllText(OutputFile, text); From cea0f18d57ee5bb74fbaf6ccc14994c95025f735 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:39:57 +0200 Subject: [PATCH 3/6] chore: add version API snapshots for all packages --- src/PostHog.AI/Generated/VersionConstants.cs | 17 +++++++++++++++++ src/PostHog.AI/PostHog.AI.csproj | 6 ++++++ src/PostHog.AI/PublicAPI.Shipped.txt | 2 ++ .../Generated/VersionConstants.cs | 17 +++++++++++++++++ .../PostHog.AspNetCore.csproj | 7 +++++++ src/PostHog.AspNetCore/PublicAPI.Shipped.txt | 2 ++ 6 files changed, 51 insertions(+) create mode 100644 src/PostHog.AI/Generated/VersionConstants.cs create mode 100644 src/PostHog.AspNetCore/Generated/VersionConstants.cs diff --git a/src/PostHog.AI/Generated/VersionConstants.cs b/src/PostHog.AI/Generated/VersionConstants.cs new file mode 100644 index 0000000..f52036c --- /dev/null +++ b/src/PostHog.AI/Generated/VersionConstants.cs @@ -0,0 +1,17 @@ +/* + GENERATED FILE! Do not directly modify this file. + This is generated by an MSBuild task in PostHog.AI.csproj +*/ + +namespace PostHog.AI.Versioning; + +/// +/// Provides the SDK version generated from the package version. +/// +public static class VersionConstants +{ + /// + /// The version of the PostHog.AI package. + /// + public const string Version = "0.1.2"; +} diff --git a/src/PostHog.AI/PostHog.AI.csproj b/src/PostHog.AI/PostHog.AI.csproj index 321a08e..bfdb2ab 100644 --- a/src/PostHog.AI/PostHog.AI.csproj +++ b/src/PostHog.AI/PostHog.AI.csproj @@ -21,4 +21,10 @@ + + + diff --git a/src/PostHog.AI/PublicAPI.Shipped.txt b/src/PostHog.AI/PublicAPI.Shipped.txt index 206349e..0f94ce3 100644 --- a/src/PostHog.AI/PublicAPI.Shipped.txt +++ b/src/PostHog.AI/PublicAPI.Shipped.txt @@ -13,6 +13,7 @@ PostHog.AI.PostHogAIExtensions PostHog.AI.PostHogAIFieldNames PostHog.AI.PostHogOpenAIHandler PostHog.AI.PostHogOpenAIHandler.PostHogOpenAIHandler(PostHog.IPostHogClient! postHogClient, Microsoft.Extensions.Logging.ILogger! logger) -> void +PostHog.AI.Versioning.VersionConstants const PostHog.AI.PostHogAIFieldNames.BaseUrl = "$ai_base_url" -> string! const PostHog.AI.PostHogAIFieldNames.CacheCreationInputTokens = "$ai_cache_creation_input_tokens" -> string! const PostHog.AI.PostHogAIFieldNames.CacheReadInputTokens = "$ai_cache_read_input_tokens" -> string! @@ -41,6 +42,7 @@ const PostHog.AI.PostHogAIFieldNames.Temperature = "$ai_temperature" -> string! const PostHog.AI.PostHogAIFieldNames.Tools = "$ai_tools" -> string! const PostHog.AI.PostHogAIFieldNames.TotalTokens = "$ai_total_tokens" -> string! const PostHog.AI.PostHogAIFieldNames.TraceId = "$ai_trace_id" -> string! +const PostHog.AI.Versioning.VersionConstants.Version = "" -> string! override PostHog.AI.PostHogOpenAIHandler.SendAsync(System.Net.Http.HttpRequestMessage! request, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! static PostHog.AI.PostHogAIContext.BeginScope(string? distinctId = null, string? traceId = null, string? sessionId = null, string? spanId = null, string? spanName = null, string? parentId = null, System.Collections.Generic.Dictionary? properties = null, System.Collections.Generic.Dictionary? groups = null, bool? privacyMode = null) -> System.IDisposable! static PostHog.AI.PostHogAIContext.Current.get -> PostHog.AI.PostHogAIContext? diff --git a/src/PostHog.AspNetCore/Generated/VersionConstants.cs b/src/PostHog.AspNetCore/Generated/VersionConstants.cs new file mode 100644 index 0000000..9e3a106 --- /dev/null +++ b/src/PostHog.AspNetCore/Generated/VersionConstants.cs @@ -0,0 +1,17 @@ +/* + GENERATED FILE! Do not directly modify this file. + This is generated by an MSBuild task in PostHog.AspNetCore.csproj +*/ + +namespace PostHog.AspNetCore.Versioning; + +/// +/// Provides the SDK version generated from the package version. +/// +public static class VersionConstants +{ + /// + /// The version of the PostHog.AspNetCore package. + /// + public const string Version = "2.6.3"; +} diff --git a/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj b/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj index 7bf875e..41099d0 100644 --- a/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj +++ b/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj @@ -22,4 +22,11 @@ + + + + diff --git a/src/PostHog.AspNetCore/PublicAPI.Shipped.txt b/src/PostHog.AspNetCore/PublicAPI.Shipped.txt index 47c35bc..c256dbd 100644 --- a/src/PostHog.AspNetCore/PublicAPI.Shipped.txt +++ b/src/PostHog.AspNetCore/PublicAPI.Shipped.txt @@ -1,5 +1,6 @@ #nullable enable PostHog.AspNetCore.PostHogRequestContextExtensions +PostHog.AspNetCore.Versioning.VersionConstants PostHog.Cache.HttpContextFeatureFlagCache PostHog.Cache.HttpContextFeatureFlagCache.GetAndCacheFeatureFlagsAsync(string! distinctId, System.Func!>!>! fetcher, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!>! PostHog.Cache.HttpContextFeatureFlagCache.GetAndCacheFlagsAsync(string! distinctId, System.Collections.Generic.IReadOnlyDictionary? personProperties, PostHog.GroupCollection? groups, System.Func!>! fetcher, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! @@ -44,6 +45,7 @@ PostHog.PostHogRequestContextOptions.UseTracingHeaders.get -> bool PostHog.PostHogRequestContextOptions.UseTracingHeaders.set -> void PostHog.Registration abstract PostHog.FeatureManagement.PostHogFeatureFlagContextProvider.GetDistinctId() -> string? +const PostHog.AspNetCore.Versioning.VersionConstants.Version = "" -> string! static PostHog.AspNetCore.PostHogRequestContextExtensions.Capture(this PostHog.IPostHogClient! client, string! eventName) -> bool static PostHog.AspNetCore.PostHogRequestContextExtensions.Capture(this PostHog.IPostHogClient! client, string! eventName, System.Collections.Generic.Dictionary? properties) -> bool static PostHog.AspNetCore.PostHogRequestContextExtensions.CaptureException(this PostHog.IPostHogClient! client, System.Exception! exception, System.Collections.Generic.Dictionary? properties = null) -> bool From bcfa07080d92f8cdc64cdb83cb15d3340f3fbfca Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:45:46 +0200 Subject: [PATCH 4/6] Revert "chore: add version API snapshots for all packages" This reverts commit cea0f18d57ee5bb74fbaf6ccc14994c95025f735. --- src/PostHog.AI/Generated/VersionConstants.cs | 17 ----------------- src/PostHog.AI/PostHog.AI.csproj | 6 ------ src/PostHog.AI/PublicAPI.Shipped.txt | 2 -- .../Generated/VersionConstants.cs | 17 ----------------- .../PostHog.AspNetCore.csproj | 7 ------- src/PostHog.AspNetCore/PublicAPI.Shipped.txt | 2 -- 6 files changed, 51 deletions(-) delete mode 100644 src/PostHog.AI/Generated/VersionConstants.cs delete mode 100644 src/PostHog.AspNetCore/Generated/VersionConstants.cs diff --git a/src/PostHog.AI/Generated/VersionConstants.cs b/src/PostHog.AI/Generated/VersionConstants.cs deleted file mode 100644 index f52036c..0000000 --- a/src/PostHog.AI/Generated/VersionConstants.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - GENERATED FILE! Do not directly modify this file. - This is generated by an MSBuild task in PostHog.AI.csproj -*/ - -namespace PostHog.AI.Versioning; - -/// -/// Provides the SDK version generated from the package version. -/// -public static class VersionConstants -{ - /// - /// The version of the PostHog.AI package. - /// - public const string Version = "0.1.2"; -} diff --git a/src/PostHog.AI/PostHog.AI.csproj b/src/PostHog.AI/PostHog.AI.csproj index bfdb2ab..321a08e 100644 --- a/src/PostHog.AI/PostHog.AI.csproj +++ b/src/PostHog.AI/PostHog.AI.csproj @@ -21,10 +21,4 @@ - - - diff --git a/src/PostHog.AI/PublicAPI.Shipped.txt b/src/PostHog.AI/PublicAPI.Shipped.txt index 0f94ce3..206349e 100644 --- a/src/PostHog.AI/PublicAPI.Shipped.txt +++ b/src/PostHog.AI/PublicAPI.Shipped.txt @@ -13,7 +13,6 @@ PostHog.AI.PostHogAIExtensions PostHog.AI.PostHogAIFieldNames PostHog.AI.PostHogOpenAIHandler PostHog.AI.PostHogOpenAIHandler.PostHogOpenAIHandler(PostHog.IPostHogClient! postHogClient, Microsoft.Extensions.Logging.ILogger! logger) -> void -PostHog.AI.Versioning.VersionConstants const PostHog.AI.PostHogAIFieldNames.BaseUrl = "$ai_base_url" -> string! const PostHog.AI.PostHogAIFieldNames.CacheCreationInputTokens = "$ai_cache_creation_input_tokens" -> string! const PostHog.AI.PostHogAIFieldNames.CacheReadInputTokens = "$ai_cache_read_input_tokens" -> string! @@ -42,7 +41,6 @@ const PostHog.AI.PostHogAIFieldNames.Temperature = "$ai_temperature" -> string! const PostHog.AI.PostHogAIFieldNames.Tools = "$ai_tools" -> string! const PostHog.AI.PostHogAIFieldNames.TotalTokens = "$ai_total_tokens" -> string! const PostHog.AI.PostHogAIFieldNames.TraceId = "$ai_trace_id" -> string! -const PostHog.AI.Versioning.VersionConstants.Version = "" -> string! override PostHog.AI.PostHogOpenAIHandler.SendAsync(System.Net.Http.HttpRequestMessage! request, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! static PostHog.AI.PostHogAIContext.BeginScope(string? distinctId = null, string? traceId = null, string? sessionId = null, string? spanId = null, string? spanName = null, string? parentId = null, System.Collections.Generic.Dictionary? properties = null, System.Collections.Generic.Dictionary? groups = null, bool? privacyMode = null) -> System.IDisposable! static PostHog.AI.PostHogAIContext.Current.get -> PostHog.AI.PostHogAIContext? diff --git a/src/PostHog.AspNetCore/Generated/VersionConstants.cs b/src/PostHog.AspNetCore/Generated/VersionConstants.cs deleted file mode 100644 index 9e3a106..0000000 --- a/src/PostHog.AspNetCore/Generated/VersionConstants.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* - GENERATED FILE! Do not directly modify this file. - This is generated by an MSBuild task in PostHog.AspNetCore.csproj -*/ - -namespace PostHog.AspNetCore.Versioning; - -/// -/// Provides the SDK version generated from the package version. -/// -public static class VersionConstants -{ - /// - /// The version of the PostHog.AspNetCore package. - /// - public const string Version = "2.6.3"; -} diff --git a/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj b/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj index 41099d0..7bf875e 100644 --- a/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj +++ b/src/PostHog.AspNetCore/PostHog.AspNetCore.csproj @@ -22,11 +22,4 @@ - - - - diff --git a/src/PostHog.AspNetCore/PublicAPI.Shipped.txt b/src/PostHog.AspNetCore/PublicAPI.Shipped.txt index c256dbd..47c35bc 100644 --- a/src/PostHog.AspNetCore/PublicAPI.Shipped.txt +++ b/src/PostHog.AspNetCore/PublicAPI.Shipped.txt @@ -1,6 +1,5 @@ #nullable enable PostHog.AspNetCore.PostHogRequestContextExtensions -PostHog.AspNetCore.Versioning.VersionConstants PostHog.Cache.HttpContextFeatureFlagCache PostHog.Cache.HttpContextFeatureFlagCache.GetAndCacheFeatureFlagsAsync(string! distinctId, System.Func!>!>! fetcher, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!>! PostHog.Cache.HttpContextFeatureFlagCache.GetAndCacheFlagsAsync(string! distinctId, System.Collections.Generic.IReadOnlyDictionary? personProperties, PostHog.GroupCollection? groups, System.Func!>! fetcher, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! @@ -45,7 +44,6 @@ PostHog.PostHogRequestContextOptions.UseTracingHeaders.get -> bool PostHog.PostHogRequestContextOptions.UseTracingHeaders.set -> void PostHog.Registration abstract PostHog.FeatureManagement.PostHogFeatureFlagContextProvider.GetDistinctId() -> string? -const PostHog.AspNetCore.Versioning.VersionConstants.Version = "" -> string! static PostHog.AspNetCore.PostHogRequestContextExtensions.Capture(this PostHog.IPostHogClient! client, string! eventName) -> bool static PostHog.AspNetCore.PostHogRequestContextExtensions.Capture(this PostHog.IPostHogClient! client, string! eventName, System.Collections.Generic.Dictionary? properties) -> bool static PostHog.AspNetCore.PostHogRequestContextExtensions.CaptureException(this PostHog.IPostHogClient! client, System.Exception! exception, System.Collections.Generic.Dictionary? properties = null) -> bool From fbcd3313f27b394250039b1a214491bbd344839e Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:45:46 +0200 Subject: [PATCH 5/6] Revert "chore: support package-specific API version templates" This reverts commit 6f24c7a8b53fdef7f474236e5b61c1bcfe2f2e76. --- Directory.Build.targets | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index d454dd2..5b14a49 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -6,7 +6,6 @@ - @@ -17,15 +16,13 @@ if (!string.IsNullOrEmpty(directory)) Directory.CreateDirectory(directory); } -var text = File.ReadAllText(SourceFile) - .Replace("", Version) - .Replace($"<{PackageId}.version>", Version); +var text = File.ReadAllText(SourceFile).Replace("", Version); File.WriteAllText(OutputFile, text); ]]> - + @@ -36,12 +33,10 @@ File.WriteAllText(OutputFile, text); From 531539da3b7bdaddb64cd6fedc3fc925b8feb38d Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 22 Jun 2026 08:50:51 +0200 Subject: [PATCH 6/6] fix: make public API template rendering portable --- Directory.Build.targets | 22 +++++++++++----------- sdk_compliance_adapter/Dockerfile | 1 + 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 5b14a49..c811f8f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,7 +1,7 @@ + AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.Core.dll"> @@ -25,32 +25,32 @@ File.WriteAllText(OutputFile, text); + Condition="Exists('$(MSBuildProjectDirectory)/PublicAPI.Shipped.txt') Or Exists('$(MSBuildProjectDirectory)/PublicAPI.Unshipped.txt')"> - <_PublicApiSnapshotOutputDir>$(IntermediateOutputPath)PublicApiSnapshots\ + <_PublicApiSnapshotOutputDir>$(IntermediateOutputPath)PublicApiSnapshots/ - - + + Condition="Exists('$(MSBuildProjectDirectory)/PublicAPI.Unshipped.txt')" /> - + - + + Condition="Exists('$(MSBuildProjectDirectory)/PublicAPI.Shipped.txt')" /> + Condition="Exists('$(MSBuildProjectDirectory)/PublicAPI.Unshipped.txt')" /> diff --git a/sdk_compliance_adapter/Dockerfile b/sdk_compliance_adapter/Dockerfile index e94d39a..ae9e4d4 100644 --- a/sdk_compliance_adapter/Dockerfile +++ b/sdk_compliance_adapter/Dockerfile @@ -3,6 +3,7 @@ WORKDIR /app # Copy the solution and project files COPY Directory.Build.props ./ +COPY Directory.Build.targets ./ COPY Directory.Packages.props ./ COPY src/PostHog/PostHog.csproj src/PostHog/ COPY src/PostHog/packages.lock.json src/PostHog/