Skip to content

feat(supabase): consolidate client metadata into structured X-Client-Info header#986

Draft
grdsdev wants to merge 2 commits intomainfrom
claude/gracious-leakey-8dda1c
Draft

feat(supabase): consolidate client metadata into structured X-Client-Info header#986
grdsdev wants to merge 2 commits intomainfrom
claude/gracious-leakey-8dda1c

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented Apr 28, 2026

What

Consolidates the separate X-Supabase-Client-Platform and X-Supabase-Client-Platform-Version headers into a single structured X-Client-Info value using semicolon-delimited key=value pairs (same convention as Content-Type params):

X-Client-Info: supabase-swift/2.45.0; platform=iOS; platform-version=18.5.0; runtime=swift; runtime-version=5.10

Also adds two new fields that weren't previously sent: runtime (always swift) and runtime-version (detected at compile time via #if swift(...) chain).

Why

Adding a new header in supabase-js is a breaking change — when the JS client runs inside an Edge Function, users define their CORS allowed headers explicitly, so any new header we introduce gets blocked until users update their config. X-Client-Info is already present in every allowlist, so extending it as a structured value lets us add new metadata fields freely without touching CORS or coordinating across all client libs.

Changes

  • Sources/Helpers/Version.swift — adds runtimeVersion using a compile-time #if swift(...) chain, following the same debug/test override pattern as platform and platformVersion
  • Sources/Supabase/Constants.swift — builds the consolidated X-Client-Info value; removes the two standalone platform headers

Notes for reviewers

  • Data team sign-off is pending before merging — they need to confirm existing pipelines that rely on the standalone headers can migrate to parsing the new structured value
  • The format is easily parseable: split on ; , first segment is lib/version, rest are key=value pairs
  • Future metadata fields just need a single clientInfo += "; key=value" line, no new headers

Closes SDK-905

@grdsdev grdsdev requested a review from a team as a code owner April 28, 2026 07:50
grdsdev and others added 2 commits April 28, 2026 05:02
…Info header

Replace separate X-Supabase-Client-Platform and X-Supabase-Client-Platform-Version
headers with a single semicolon-delimited X-Client-Info value:

  supabase-swift/2.45.0; platform=iOS; platform-version=18.5.0; runtime=swift; runtime-version=5.10

This avoids the need to add new HTTP headers for future metadata fields. Adding a
new header in supabase-js is a breaking change because users must explicitly allow
headers in their CORS config when running in Edge Functions — X-Client-Info is
already in every allowlist.

Also adds runtime (always "swift") and runtime-version (detected at compile time
via #if swift(...) chain) which were not previously sent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ient-Info format

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@grdsdev grdsdev force-pushed the claude/gracious-leakey-8dda1c branch from b8cbc8e to 5ea65de Compare April 28, 2026 08:03
@grdsdev grdsdev marked this pull request as draft April 28, 2026 08:08
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