Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Nov 6, 2025

Fixes #1107.

This PR significantly improves SDK categorization by incorporating multiple signals beyond just the SDK name.

Why these changes?
Modern meta-frameworks (e.g., Next.js, Astro) can generate events from both client (browser) and server (Node.js) environments. Relying solely on the SDK name is insufficient to accurately distinguish these origins.

This PR enhances the categorizeSDK logic to use a more robust priority order:

  1. Sender User-Agent: Extracts the User-Agent from the incoming HTTP request, providing a strong signal for browser vs. server origin.
  2. Event Runtime Tags: Checks event.tags.runtime for "browser" indication.
  3. Platform & Server-Specific Signals: Examines event.contexts.runtime.name, event.server_name, and event.platform for server-side indicators.
  4. SDK Name: Falls back to the existing SDK name-based categorization.

This allows for more accurate classification of events, especially for meta-frameworks, ensuring that events from the browser part of a Next.js app are correctly labeled as "browser" and those from the server part as "server".


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Nov 6, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@BYK BYK deployed to Preview November 6, 2025 22:41 — with GitHub Actions Active
@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
spotlightjs Skipped Skipped Nov 6, 2025 10:54pm

@cursor cursor bot marked this pull request as ready for review November 6, 2025 22:49
@cursor cursor bot deployed to Preview November 6, 2025 22:50 Active
@BYK BYK requested a review from betegon November 6, 2025 22:53
Copy link
Member

@betegon betegon left a comment

Choose a reason for hiding this comment

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

Image

Incredible stuff

@BYK BYK merged commit b3a654a into main Nov 7, 2025
20 checks passed
@BYK BYK deleted the cursor/improve-sdk-categorization-implementation-9ea5 branch November 7, 2025 13:14
cursor bot pushed a commit that referenced this pull request Nov 7, 2025
Merged commits:
- b3a654a: Improve SDK categorization implementation (#1110)
- 43318aa: ci: Fix notarization env var swap (#1109)

Key changes from main:
- Enhanced SDK categorization using multiple signals (User-Agent, runtime tags,
  platform, server-specific signals) for better browser vs server detection
- Fixed notarization environment variables in CI
- Updated formatters to use improved categorization logic

Conflict resolutions:
- Kept our consolidated package structure (ui/, sidecar/, electron/)
- Maintained separate build configs (vite.config.ts for UI library,
  vite.ui.config.ts for static assets, tsc for sidecar)
- Preserved path aliases and electron app description
- Removed TypeScript types from bin/run.js since it's a JS file
- Fixed duplicate RAW_TYPES import in envelopesSlice.ts
- Added core dump files to .gitignore

All SDK categorization improvements have been merged into our
consolidated structure.
BYK pushed a commit that referenced this pull request Nov 10, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.


# Releases
## @spotlightjs/[email protected]

### Minor Changes

- Docker compose support for Spotlight run command
([#1108](#1108))

- Added support for Last-Event-Id in SSE stream
([#1104](#1104))

- Change tool names: change `.` for `_` and remove `spotlight` preffix
([#1114](#1114))

- Improved human formatter readability
([#1112](#1112))

### Patch Changes

- Fix breaking error when event type is not supported
([#1111](#1111))

- Fix SDK categorization for Next.js by using User-Agent headers to
distinguish browser from server events
([#1110](#1110))

## @spotlightjs/[email protected]

### Patch Changes

- Updated dependencies
\[[`0942c8a`](0942c8a),
[`bce012e`](bce012e),
[`7624030`](7624030),
[`15a7f41`](15a7f41),
[`13da542`](13da542),
[`b3a654a`](b3a654a)]:
    -   @spotlightjs/[email protected]
    -   @spotlightjs/[email protected]

## @spotlightjs/[email protected]

### Patch Changes

- Fix SDK categorization for Next.js by using User-Agent headers to
distinguish browser from server events
([#1110](#1110))

- Updated dependencies
\[[`0942c8a`](0942c8a),
[`bce012e`](bce012e),
[`7624030`](7624030),
[`15a7f41`](15a7f41),
[`13da542`](13da542),
[`b3a654a`](b3a654a)]:
    -   @spotlightjs/[email protected]
    -   @spotlightjs/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.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.

NextJS in human formatter is showing up as "server"

4 participants