Skip to content

Conversation

@s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Jan 23, 2026

Adds the missing platform in the envelope item header.

Related: getsentry/sentry-docs#16135

Closes https://linear.app/getsentry/issue/JS-1540/ui-profiling-add-platform-to-profile-chunk-item-header (internal Linear)

@linear
Copy link

linear bot commented Jan 23, 2026

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

isChunkFormat?: boolean;
}

export function validateProfileItemHeader(header: Record<string, unknown>): void {
Copy link
Member

Choose a reason for hiding this comment

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

really sorry for the nitpicking here but I'm curious on your thoughts: I don't particularly like the pattern of these "validator" functions. Here's why:

  • I have to jump when debugging tests to get to the actual assertions
  • the stack traces when the test fails point to this validator instead of the failed test. Not ideal when the validator is used in a lot of places

Also specifically for this case: We only check that the header includes some properties but we don't assert on its entire content.

I get that the larger validateProfile helper, encapsulates a lot more assertions. Making it more justified. But for this case, with only two assertions, I'd personally avoid DRY and directly add the assertions; or even change it to just one expect(header).toEqual(...) for extra robustness.

Feel free to ignore/overrule me here :D I might be missing a reason for this.

Copy link
Member Author

@s1gr1d s1gr1d Jan 23, 2026

Choose a reason for hiding this comment

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

I used this validator function here to make sure that when testing the headers, this set of assertions is used - so not a crazy reason that would overrule your concerns :D

Yes, it would make sense to just change it to this one-line assertion. The function only makes sense for the very large chunk-testing part.

Changed it to: expect(itemHeader).toEqual({ type: 'profile_chunk', platform: 'javascript' });

@s1gr1d s1gr1d enabled auto-merge (squash) January 23, 2026 12:12
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my review!

@s1gr1d s1gr1d merged commit 6432b00 into develop Jan 23, 2026
163 of 164 checks passed
@s1gr1d s1gr1d deleted the sig/profiling-header-item branch January 23, 2026 12:21
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.

4 participants