Skip to content

feat: add missing HTTP headers for client platform and runtime detection #1505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

grdsdev
Copy link
Contributor

@grdsdev grdsdev commented Jul 15, 2025

Summary

Add missing HTTP headers for client platform and runtime detection with simplified logic that only includes headers when detection is reliable.

New Headers Added

  • X-Supabase-Client-Platform: OS detection (macOS, Windows, Linux, iOS, Android)
  • X-Supabase-Client-Platform-Version: Platform version
  • X-Supabase-Client-Runtime: Runtime environment (node, deno, bun)
  • X-Supabase-Client-Runtime-Version: Runtime version

Key Features

  • Simple detection without regex pattern matching
  • Headers omitted when detection fails (no "unknown" values)
  • Backward compatible with existing X-Client-Info header
  • Comprehensive unit tests added

Test plan

  • All existing tests pass
  • New unit tests cover all detection functions
  • Tests verify conditional header inclusion

🤖 Generated with Claude Code

grdsdev and others added 2 commits July 15, 2025 14:26
- Add X-Supabase-Client-Platform header with platform detection (macOS, Windows, Linux, iOS, Android)
- Add X-Supabase-Client-Platform-Version header with OS version detection
- Add X-Supabase-Client-Runtime header with runtime detection (node, deno, bun, web)
- Add X-Supabase-Client-Runtime-Version header with runtime version detection
- Add comprehensive unit tests for all new header functionality
- Maintain backward compatibility with existing X-Client-Info header

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove regex pattern matching for platform/runtime version detection
- Only include headers when platform/runtime can be reliably detected
- Return null instead of 'unknown' when detection fails
- Simplify platform detection to only handle exact matches
- Update tests to handle conditional header presence
- Maintain backward compatibility with X-Client-Info header

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@coveralls
Copy link

coveralls commented Jul 15, 2025

Pull Request Test Coverage Report for Build 16300970139

Details

  • 34 of 54 (62.96%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-4.4%) to 68.536%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/lib/constants.ts 34 54 62.96%
Totals Coverage Status
Change from base Build 16262051403: -4.4%
Covered Lines: 142
Relevant Lines: 185

💛 - Coveralls

…t Client Hints API

- Replace deprecated navigator.platform with navigator.userAgentData
- Use navigator.userAgentData.platform for platform detection
- Use navigator.userAgentData.platformVersion for version detection
- Maintain backward compatibility with process.platform for Node.js
- All tests continue to pass with new implementation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
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.

2 participants