Skip to content

Commit 33c0d25

Browse files
authored
Merge branch 'develop' into routing-to-different-dsn
2 parents 6baf564 + ad0f2a0 commit 33c0d25

6 files changed

Lines changed: 71 additions & 28 deletions

File tree

.cursor/BUGBOT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ Do not flag the issues below if they appear in tests.
5858
- Flag usage of `expect.objectContaining` and other relaxed assertions, when a test expects something NOT to be included in a payload but there's no respective assertion.
5959
- Flag usage of conditionals in one test and recommend splitting up the test for the different paths.
6060
- Flag usage of loops testing multiple scenarios in one test and recommend using `(it)|(test).each` instead.
61+
62+
## Platform-safe code
63+
64+
- When any `setTimeout` or `setInterval` timers are started in a code path that can end up in server runtime packages (e.g. `@sentry/core` or `@sentry/node`), flag if neither `timeout.unref()` nor `safeUnref()` are called.
65+
Not unref'ing a timer can keep CLI-like applications or node scripts from exiting immediately, due to the process waiting on timers started by the SDK.

packages/core/src/scope.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ export class Scope {
755755
* @returns {string} The id of the captured event.
756756
*/
757757
public captureEvent(event: Event, hint?: EventHint): string {
758-
const eventId = hint?.event_id || uuid4();
758+
const eventId = event.event_id || hint?.event_id || uuid4();
759759

760760
if (!this._client) {
761761
DEBUG_BUILD && debug.warn('No client configured on scope - will not capture event!');

packages/core/test/lib/scope.test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import { Scope } from '../../src/scope';
1111
import type { Breadcrumb } from '../../src/types-hoist/breadcrumb';
1212
import type { Event } from '../../src/types-hoist/event';
13+
import { uuid4 } from '../../src/utils/misc';
1314
import { applyScopeDataToEvent } from '../../src/utils/scopeData';
1415
import { getDefaultTestClientOptions, TestClient } from '../mocks/client';
1516
import { clearGlobalScope } from '../testutils';
@@ -1009,6 +1010,54 @@ describe('Scope', () => {
10091010
scope,
10101011
);
10111012
});
1013+
1014+
it('should return event_id from event object when provided', () => {
1015+
const fakeCaptureEvent = vi.fn(() => 'mock-event-id');
1016+
const fakeClient = {
1017+
captureEvent: fakeCaptureEvent,
1018+
} as unknown as Client;
1019+
const scope = new Scope();
1020+
scope.setClient(fakeClient);
1021+
1022+
const customEventId = uuid4();
1023+
const eventId = scope.captureEvent({ event_id: customEventId });
1024+
1025+
expect(eventId).toBe(customEventId);
1026+
expect(fakeCaptureEvent).toHaveBeenCalledWith(
1027+
expect.objectContaining({ event_id: customEventId }),
1028+
expect.objectContaining({ event_id: customEventId }),
1029+
scope,
1030+
);
1031+
});
1032+
1033+
it('should prefer event.event_id over hint.event_id', () => {
1034+
const fakeCaptureEvent = vi.fn(() => 'mock-event-id');
1035+
const fakeClient = {
1036+
captureEvent: fakeCaptureEvent,
1037+
} as unknown as Client;
1038+
const scope = new Scope();
1039+
scope.setClient(fakeClient);
1040+
1041+
const eventEventId = uuid4();
1042+
const hintEventId = uuid4();
1043+
const eventId = scope.captureEvent({ event_id: eventEventId }, { event_id: hintEventId });
1044+
1045+
expect(eventId).toBe(eventEventId);
1046+
expect(fakeCaptureEvent).toHaveBeenCalledWith(
1047+
expect.objectContaining({ event_id: eventEventId }),
1048+
expect.objectContaining({ event_id: eventEventId }),
1049+
scope,
1050+
);
1051+
});
1052+
1053+
it('should return event_id from event object when no client is configured', () => {
1054+
const scope = new Scope();
1055+
1056+
const customEventId = uuid4();
1057+
const eventId = scope.captureEvent({ event_id: customEventId });
1058+
1059+
expect(eventId).toBe(customEventId);
1060+
});
10121061
});
10131062

10141063
describe('setConversationId() / getScopeData()', () => {

packages/solid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@testing-library/dom": "^7.21.4",
7878
"@testing-library/jest-dom": "^6.4.5",
7979
"@testing-library/user-event": "^14.5.2",
80-
"solid-js": "^1.8.11",
80+
"solid-js": "^1.9.11",
8181
"vite": "^5.4.11",
8282
"vite-plugin-solid": "^2.11.6"
8383
},

packages/solidstart/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@solidjs/testing-library": "0.8.5",
7878
"@testing-library/jest-dom": "^6.4.5",
7979
"@testing-library/user-event": "^14.5.2",
80-
"solid-js": "^1.8.4",
80+
"solid-js": "^1.9.11",
8181
"vinxi": "^0.5.11",
8282
"vite": "^5.4.11",
8383
"vite-plugin-solid": "^2.11.6"

yarn.lock

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,9 +4779,9 @@
47794779
integrity sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==
47804780

47814781
"@isaacs/brace-expansion@^5.0.0":
4782-
version "5.0.0"
4783-
resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz#4b3dabab7d8e75a429414a96bd67bf4c1d13e0f3"
4784-
integrity sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==
4782+
version "5.0.1"
4783+
resolved "https://registry.yarnpkg.com/@isaacs/brace-expansion/-/brace-expansion-5.0.1.tgz#0ef5a92d91f2fff2a37646ce54da9e5f599f6eff"
4784+
integrity sha512-WMz71T1JS624nWj2n2fnYAuPovhv7EUhk69R6i9dsVyzxt5eM3bjwvgk9L+APE1TRscGysAVMANkB0jh0LQZrQ==
47854785
dependencies:
47864786
"@isaacs/balanced-match" "^4.0.1"
47874787

@@ -27709,26 +27709,16 @@ serialize-javascript@^6.0.0, serialize-javascript@^6.0.1, serialize-javascript@^
2770927709
dependencies:
2771027710
randombytes "^2.1.0"
2771127711

27712-
seroval-plugins@^1.3.2, seroval-plugins@^1.4.0:
27713-
version "1.4.0"
27714-
resolved "https://registry.yarnpkg.com/seroval-plugins/-/seroval-plugins-1.4.0.tgz#0bd453983a0a26039ca161a341c00eca7d42b19a"
27715-
integrity sha512-zir1aWzoiax6pbBVjoYVd0O1QQXgIL3eVGBMsBsNmM8Ukq90yGaWlfx0AB9dTS8GPqrOrbXn79vmItCUP9U3BQ==
27716-
27717-
seroval-plugins@~1.3.0:
27718-
version "1.3.3"
27719-
resolved "https://registry.yarnpkg.com/seroval-plugins/-/seroval-plugins-1.3.3.tgz#51bcacf09e5384080d7ea4002b08fd9f6166daf5"
27720-
integrity sha512-16OL3NnUBw8JG1jBLUoZJsLnQq0n5Ua6aHalhJK4fMQkz1lqR7Osz1sA30trBtd9VUDc2NgkuRCn8+/pBwqZ+w==
27712+
seroval-plugins@^1.3.2, seroval-plugins@^1.4.0, seroval-plugins@~1.5.0:
27713+
version "1.5.0"
27714+
resolved "https://registry.yarnpkg.com/seroval-plugins/-/seroval-plugins-1.5.0.tgz#c02ba5f41d50b8105d4d9d4c553a4d01cec4226a"
27715+
integrity sha512-EAHqADIQondwRZIdeW2I636zgsODzoBDwb3PT/+7TLDWyw1Dy/Xv7iGUIEXXav7usHDE9HVhOU61irI3EnyyHA==
2772127716

27722-
seroval@^1.3.2, seroval@^1.4.0, seroval@^1.4.1:
27717+
seroval@^1.3.2, seroval@^1.4.0, seroval@^1.4.1, seroval@~1.5.0:
2772327718
version "1.5.0"
2772427719
resolved "https://registry.yarnpkg.com/seroval/-/seroval-1.5.0.tgz#aba4cffbd0c4c8a4351358362acf40ee8d74d97b"
2772527720
integrity sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw==
2772627721

27727-
seroval@~1.3.0:
27728-
version "1.3.2"
27729-
resolved "https://registry.yarnpkg.com/seroval/-/seroval-1.3.2.tgz#7e5be0dc1a3de020800ef013ceae3a313f20eca7"
27730-
integrity sha512-RbcPH1n5cfwKrru7v7+zrZvjLurgHhGyso3HTyGtRivGWgYjbOmGuivCQaORNELjNONoK35nj28EoWul9sb1zQ==
27731-
2773227722
serve-index@^1.9.1:
2773327723
version "1.9.1"
2773427724
resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.9.1.tgz#d3768d69b1e7d82e5ce050fff5b453bea12a9239"
@@ -28279,14 +28269,14 @@ socks@^2.6.2, socks@^2.8.3:
2827928269
ip-address "^10.0.1"
2828028270
smart-buffer "^4.2.0"
2828128271

28282-
solid-js@^1.8.11, solid-js@^1.8.4:
28283-
version "1.9.7"
28284-
resolved "https://registry.yarnpkg.com/solid-js/-/solid-js-1.9.7.tgz#96ff7800648a30f22d29275264375589f3a725e9"
28285-
integrity sha512-/saTKi8iWEM233n5OSi1YHCCuh66ZIQ7aK2hsToPe4tqGm7qAejU1SwNuTPivbWAYq7SjuHVVYxxuZQNRbICiw==
28272+
solid-js@^1.9.11:
28273+
version "1.9.11"
28274+
resolved "https://registry.yarnpkg.com/solid-js/-/solid-js-1.9.11.tgz#1d36c755d10b7d5f7d016d2421c7e39b5b84f99e"
28275+
integrity sha512-WEJtcc5mkh/BnHA6Yrg4whlF8g6QwpmXXRg4P2ztPmcKeHHlH4+djYecBLhSpecZY2RRECXYUwIc/C2r3yzQ4Q==
2828628276
dependencies:
2828728277
csstype "^3.1.0"
28288-
seroval "~1.3.0"
28289-
seroval-plugins "~1.3.0"
28278+
seroval "~1.5.0"
28279+
seroval-plugins "~1.5.0"
2829028280

2829128281
solid-refresh@^0.6.3:
2829228282
version "0.6.3"
@@ -29076,7 +29066,6 @@ stylus@0.59.0, stylus@^0.59.0:
2907629066

2907729067
sucrase@^3.27.0, sucrase@^3.35.0, sucrase@getsentry/sucrase#es2020-polyfills:
2907829068
version "3.36.0"
29079-
uid fd682f6129e507c00bb4e6319cc5d6b767e36061
2908029069
resolved "https://codeload.github.com/getsentry/sucrase/tar.gz/fd682f6129e507c00bb4e6319cc5d6b767e36061"
2908129070
dependencies:
2908229071
"@jridgewell/gen-mapping" "^0.3.2"

0 commit comments

Comments
 (0)