Skip to content
This repository was archived by the owner on Aug 7, 2026. It is now read-only.

feat: add structured X-Client-Info header metadata - #2

Merged
Tr00d merged 5 commits into
masterfrom
guillaumefaas/sdk-1235-fix-telemetry-x-client-info
Jul 14, 2026
Merged

Tr00d merged 5 commits into
masterfrom
guillaumefaas/sdk-1235-fix-telemetry-x-client-info

Conversation

@Tr00d

@Tr00d Tr00d commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Context

Supabase is consolidating client metadata into the existing X-Client-Info header rather than adding new headers, which would be a breaking change for Edge Function users who must explicitly allowlist headers in their CORS config.

Closes #255

Changes

Extends Util.GetAssemblyVersion in core-csharp to append semicolon-delimited metadata after the library token:

supabase-csharp/1.0.0; platform=Windows; platform-version=10.0.0; runtime=dotnet; runtime-version=8.0

Parameters included:

  • platform — Windows, Linux, macOS, or browser (Blazor WASM)
  • platform-version — OS version, omitted for browser
  • runtime — always dotnet
  • runtime-version — e.g. 8.0.27
  • framework — maui, unity, or blazor when detectable; omitted otherwise

Framework detection scans loaded assemblies with explicit priority (MAUI wins over Blazor in hybrid apps). All parameters follow the spec: omitted entirely when the value cannot be determined, never set to empty or unknown.

All SDKs pick this up automatically since they all call Util.GetAssemblyVersion.

Tests

Adds a CoreTests project (first test project in core-csharp) with 7 tests covering format integrity, required fields, valid platform values, and framework absence in a plain dotnet environment.

Tr00d added 2 commits July 13, 2026 14:10
Extends GetAssemblyVersion to append platform, runtime, and framework
metadata to the X-Client-Info header per the consolidated SDK spec.

Adds a CoreTests project with coverage for format correctness, required
fields, and framework detection in a plain dotnet environment.
@Tr00d
Tr00d marked this pull request as ready for review July 13, 2026 12:22

@QuintinWillison QuintinWillison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. 💪 - just one small thought...

Comment thread Core/Util.cs Resolved
Comment thread Core/Util.cs Resolved
Comment thread Core/Util.cs Resolved
spydon added a commit to supabase/supabase-flutter that referenced this pull request Jul 14, 2026
)

## What

Normalizes the platform name reported in the `platform=` segment of the
`X-Client-Info` header so it uses the same casing across all Supabase
SDKs.

Previously the Flutter SDK sent the raw `Platform.operatingSystem`
value, which is always lowercase (`macos`, `ios`, `android`, `linux`,
`windows`). Swift reports properly cased names (`macOS`, `iOS`,
`Android`, `Linux`, `Windows`). This mismatch made it harder to
aggregate stats per platform independently of framework/language.

## Changes

- Added `normalizePlatformName` in `supabase_common` backed by a lookup
map that maps each `Platform.operatingSystem` value to the shared,
Swift-aligned casing. Unknown values pass through unchanged so any new
platform still shows up in stats.
- `conditionalPlatform` (the `dart:io` implementation) now runs
`Platform.operatingSystem` through `normalizePlatformName`. This is the
single source used by both the `supabase` (pure Dart) and
`supabase_flutter` packages, so both are covered.
- Updated tests accordingly.

Only the platforms `dart:io` can actually report are mapped. visionOS,
watchOS, and tvOS aren't Flutter targets, and the alignment discussion
concluded those three aren't valuable to track.

## Context

Follows the casing agreement in supabase-community/core-csharp#2
([discussion](supabase-community/core-csharp#2 (comment))).
@Tr00d
Tr00d merged commit 8124025 into master Jul 14, 2026
1 check passed
@Tr00d
Tr00d deleted the guillaumefaas/sdk-1235-fix-telemetry-x-client-info branch July 14, 2026 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement structured X-Client-Info header

4 participants