Skip to content

feat: update X-Client-Info to use structured semicolon-delimited metadata#1479

Draft
grdsdev wants to merge 3 commits intomainfrom
claude/admiring-lamarr-2d3bb3
Draft

feat: update X-Client-Info to use structured semicolon-delimited metadata#1479
grdsdev wants to merge 3 commits intomainfrom
claude/admiring-lamarr-2d3bb3

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented Apr 28, 2026

Summary

  • Consolidates platform and runtime metadata into the X-Client-Info header using semicolon-delimited key=value pairs
  • Removes the four standalone X-Supabase-Client-* headers in favor of inline structured metadata
  • Applies consistently across all sub-clients: auth, postgrest, storage, functions, and the main client

New format:

X-Client-Info: supabase-py/<component> v<version>; platform=<OS>; platform-version=<release>; runtime=python; runtime-version=<python-version>

Why: Adding new headers is a breaking change for supabase-js in Edge Functions because users must explicitly allow headers in CORS config. Since X-Client-Info is already allowed everywhere, embedding metadata there avoids that problem — matching the approach used in supabase-swift.

Changes

  • auth (_async, _sync): Replaced 5-header dict with structured X-Client-Info
  • postgrest (_async, _sync): Same
  • storage (_async, _sync): Same
  • functions (_async, _sync): Same
  • supabase/lib/client_options.py: Added platform/runtime metadata to default header
  • Tests: Added structured-format and no-separate-headers tests; updated existing tests that asserted the old plain format

Testing

New tests added (all passing)

  • TestXClientInfo::test_structured_metadata_format — verifies regex pattern match
  • TestXClientInfo::test_no_separate_platform_headers — verifies removed headers are absent
  • Functions, storage, postgrest (async + sync) each have equivalent coverage

Test results

  • postgrest: 182 passed
  • functions: 67 passed, 1 skipped
  • storage: 39 passed (integration tests require running server, unchanged)
  • supabase: 33 passed, 12 xfailed, 86 xpassed

Acceptance Criteria

  • X-Client-Info contains platform, platform-version, runtime, runtime-version as semicolon-delimited key=value pairs
  • Separate X-Supabase-Client-* headers are removed
  • Applied to all sub-clients (auth, postgrest, storage, functions, main)
  • All unit tests pass

Linear Issue

Closes: SDK-904


🤖 Generated with Claude Code /take

grdsdev and others added 2 commits April 28, 2026 05:01
…data

Consolidate platform and runtime metadata into the X-Client-Info header
using semicolon-delimited key=value pairs instead of separate standalone
headers.

New format:
  X-Client-Info: supabase-py/<component> v<version>; platform=<OS>; platform-version=<release>; runtime=python; runtime-version=<python-version>

This avoids adding new headers that would be breaking changes in Edge
Functions (where CORS allowed-headers must be explicitly listed), while
keeping all metadata within the already-allowed X-Client-Info header.

Removes: X-Supabase-Client-Platform, X-Supabase-Client-Platform-Version,
         X-Supabase-Client-Runtime, X-Supabase-Client-Runtime-Version

Linear: SDK-904

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@grdsdev grdsdev marked this pull request as draft April 28, 2026 08:08
Python 3.14 reports version strings like '3.14.0b4', which broke
[\d.]+ matches. Use \S+ to accept any non-whitespace version string.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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