Skip to content
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

ref(core)!: Remove backwards compatible SentryCarrier type #14697

Merged
merged 6 commits into from
Dec 16, 2024

Conversation

mydea
Copy link
Member

@mydea mydea commented Dec 13, 2024

I do not really think this is breaking or has any impact on any user code, but to be on the safe side, we can remove this in v9.

The one actual breaking thing is to also move the encodePolyfill / decodePolyfill code to the versioned carrier - this was before still on the global, making this a bit harder than necessary. In v9, this will have to be set on the versioned carrier the same as other things - cc @krystofwoldrich

@mydea mydea requested a review from Lms24 December 13, 2024 10:01
@mydea mydea self-assigned this Dec 13, 2024
Copy link
Contributor

github-actions bot commented Dec 13, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 23.19 KB -0.18% -42 B 🔽
@sentry/browser - with treeshaking flags 21.89 KB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing) 35.69 KB -0.12% -43 B 🔽
@sentry/browser (incl. Tracing, Replay) 72.94 KB -0.05% -34 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 63.35 KB -0.01% -2 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 77.35 KB -0.06% -44 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 89.74 KB -0.05% -38 B 🔽
@sentry/browser (incl. Feedback) 39.94 KB -0.09% -33 B 🔽
@sentry/browser (incl. sendFeedback) 27.79 KB -0.16% -43 B 🔽
@sentry/browser (incl. FeedbackAsync) 32.58 KB -0.11% -36 B 🔽
@sentry/react 25.9 KB -0.02% -4 B 🔽
@sentry/react (incl. Tracing) 38.55 KB -0.02% -6 B 🔽
@sentry/vue 27.41 KB -0.1% -27 B 🔽
@sentry/vue (incl. Tracing) 37.55 KB -0.07% -25 B 🔽
@sentry/svelte 23.36 KB -0.16% -38 B 🔽
CDN Bundle 24.35 KB -0.07% -16 B 🔽
CDN Bundle (incl. Tracing) 37.38 KB -0.04% -15 B 🔽
CDN Bundle (incl. Tracing, Replay) 72.48 KB -0.02% -12 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 77.85 KB -0.01% -7 B 🔽
CDN Bundle - uncompressed 71.52 KB -0.04% -25 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 110.83 KB -0.03% -25 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 224.88 KB -0.02% -25 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 238.09 KB -0.02% -25 B 🔽
@sentry/nextjs (client) 38.8 KB -0.04% -14 B 🔽
@sentry/sveltekit (client) 36.22 KB -0.06% -20 B 🔽
@sentry/node 162.66 KB -0.02% -32 B 🔽
@sentry/node - without tracing 98.84 KB -0.02% -15 B 🔽
@sentry/aws-serverless 126.57 KB -0.02% -21 B 🔽

View base workflow run

import { SDK_VERSION } from './version';

interface SentryCarrier {
Copy link
Member Author

Choose a reason for hiding this comment

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

this type was basically duplicated here - this comes from the days of core vs utils separation, I believe 😬

export function getGlobalSingleton<T>(name: keyof SentryCarrier, creator: () => T, obj?: unknown): T {
const gbl = (obj || GLOBAL_OBJ) as InternalGlobal;
const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});
export function getGlobalSingleton<Prop extends keyof SentryCarrier>(
Copy link
Member Author

Choose a reason for hiding this comment

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

Made this more type safe and actually inferring types correctly for passed in stuff!

Copy link

codecov bot commented Dec 13, 2024

❌ 12 Tests Failed:

Tests completed Failed Passed Skipped
572 12 560 281
View the top 3 failed tests by shortest run time
loader/onLoad/customInit/test.ts always calls onLoad init correctly
Stack Traces | 0.192s run time
test.ts:9:11 always calls onLoad init correctly
loader/onLoad/onLoadLate/test.ts late onLoad call is handled
Stack Traces | 30s run time
test.ts:6:11 late onLoad call is handled
loader/noOnLoad/unhandeledPromiseRejectionHandler/test.ts unhandled promise rejection handler works
Stack Traces | 30s run time
test.ts:6:11 unhandled promise rejection handler works

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@mydea mydea force-pushed the fn/cleanup-old-carrier-code branch from 30d32a5 to 753d1f0 Compare December 16, 2024 07:57
@mydea mydea changed the base branch from v9 to develop December 16, 2024 07:57
@mydea mydea force-pushed the fn/cleanup-old-carrier-code branch from 753d1f0 to 5860651 Compare December 16, 2024 08:09
I do not really think this is breaking or has any impact on any user code, but to be on the safe side, we can remove this in v9.
@mydea mydea force-pushed the fn/cleanup-old-carrier-code branch from d37b8c9 to 6cbe609 Compare December 16, 2024 09:58
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.

Nice cleanup, thanks!

Comment on lines +77 to +78
const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});
const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});
Copy link
Member

Choose a reason for hiding this comment

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

l: we could call getSentryCarrier(obj) here to save some bytes, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

actually no 😬 I had that first but it broke loader tests. This is why I added the comment below - if we'd call that, it would already set the version, which would lead to stuff thinking the SDK is set up, when it isn't. We store e.g. the default global/isolation scope on there even before the SDK is setup, so we need to ensure the version is not set here yet!

Copy link
Member Author

Choose a reason for hiding this comment

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

(on the plus side, the loader tests are good! xD)

Copy link
Member

Choose a reason for hiding this comment

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

ah sorry, I should have read the comment 🤦 thanks!

@mydea mydea merged commit bf323b1 into develop Dec 16, 2024
158 checks passed
@mydea mydea deleted the fn/cleanup-old-carrier-code branch December 16, 2024 13:42
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