Skip to content

Commit a12c5a6

Browse files
authored
Merge pull request #17039 from getsentry/prepare-release/9.40.0
meta(changelog): Update changelog for 9.40.0
2 parents 5c90322 + d4ab7c0 commit a12c5a6

File tree

288 files changed

+3818
-915
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

288 files changed

+3818
-915
lines changed

.cursor/environment.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Sentry JavaScript SDK Development",
3+
"install": "curl https://get.volta.sh | bash && export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && yarn install",
4+
"start": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1",
5+
"terminals": [
6+
{
7+
"name": "Development",
8+
"command": "export VOLTA_HOME=\"$HOME/.volta\" && export PATH=\"$VOLTA_HOME/bin:$PATH\" && export VOLTA_FEATURE_PNPM=1 && echo 'Volta setup complete. Node version:' && node --version && echo 'Yarn version:' && yarn --version",
9+
"description": "Main development terminal with Volta environment configured"
10+
}
11+
]
12+
}

.cursor/rules/sdk_dependency_upgrades.mdc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Use this rule if you are looking to upgrade a dependency in the Sen
33
globs:
44
alwaysApply: false
55
---
6+
67
# Yarn v1 Dependency Upgrades
78

89
## Upgrade Process
@@ -45,10 +46,12 @@ Avoid upgrading top-level dependencies (defined in `package.json`), especially i
4546
**STOP UPGRADE IMMEDIATELY** if upgrading any dependency with `opentelemetry` in the name and the new version or any of its dependencies uses forbidden OpenTelemetry versions.
4647

4748
**FORBIDDEN VERSION PATTERNS:**
49+
4850
- `2.x.x` versions (e.g., `2.0.0`, `2.1.0`)
4951
- `0.2xx.x` versions (e.g., `0.200.0`, `0.201.0`)
5052

5153
When upgrading OpenTelemetry dependencies:
54+
5255
1. Check the dependency's `package.json` after upgrade
5356
2. Verify the package itself doesn't use forbidden version patterns
5457
3. Verify none of its dependencies use `@opentelemetry/*` packages with forbidden version patterns
@@ -153,6 +156,7 @@ yarn info <package-name> versions
153156
```
154157

155158
The `yarn info` command provides detailed dependency information without requiring installation, making it particularly useful for:
159+
156160
- Verifying OpenTelemetry packages don't introduce forbidden version patterns (`2.x.x` or `0.2xx.x`)
157161
- Checking what dependencies a package will bring in before upgrading
158162
- Understanding package version history and compatibility

.cursor/rules/sdk_development.mdc

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
1212
**CRITICAL**: All changes must pass these checks before committing:
1313

1414
1. **Always run `yarn lint`** - Fix all linting issues
15-
2. **Always run `yarn test`** - Ensure all tests pass
15+
2. **Always run `yarn test`** - Ensure all tests pass
1616
3. **Always run `yarn build:dev`** - Verify TypeScript compilation
1717

1818
## Development Commands
1919

2020
### Build Commands
21+
2122
- `yarn build` - Full production build with package verification
2223
- `yarn build:dev` - Development build (transpile + types)
2324
- `yarn build:dev:watch` - Development build in watch mode (recommended)
@@ -26,13 +27,11 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
2627
- `yarn build:bundle` - Build browser bundles only
2728

2829
### Testing
29-
- `yarn test` - Run all tests (excludes integration tests)
30-
- `yarn test:unit` - Run unit tests only
31-
- `yarn test:pr` - Run tests affected by changes (CI mode)
32-
- `yarn test:pr:browser` - Run affected browser-specific tests
33-
- `yarn test:pr:node` - Run affected Node.js-specific tests
30+
31+
- `yarn test` - Run all unit tests
3432

3533
### Linting and Formatting
34+
3635
- `yarn lint` - Run ESLint and Prettier checks
3736
- `yarn fix` - Auto-fix linting and formatting issues
3837
- `yarn lint:es-compatibility` - Check ES compatibility
@@ -42,12 +41,17 @@ You are working on the Sentry JavaScript SDK, a critical production SDK used by
4241
This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for details.
4342

4443
### Key Rules
44+
4545
- **All PRs target `develop` branch** (NOT `master`)
4646
- `master` represents the last released state
4747
- Never merge directly into `master` (except emergency fixes)
4848
- Avoid changing `package.json` files on `develop` during pending releases
49+
- Never update dependencies, package.json content or build scripts unless explicitly asked for
50+
- When asked to do a task on a set of files, always make sure that all occurences in the codebase are covered. Double check that no files have been forgotten.
51+
- Unless explicitly asked for, make sure to cover all files, including files in `src/` and `test/` directories.
4952

5053
### Branch Naming
54+
5155
- Features: `feat/descriptive-name`
5256
- Releases: `release/X.Y.Z`
5357

@@ -56,27 +60,33 @@ This repository uses **Git Flow**. See [docs/gitflow.md](docs/gitflow.md) for de
5660
This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
5761

5862
### Core Packages
63+
5964
- `packages/core/` - Base SDK with interfaces, type definitions, core functionality
60-
- `packages/types/` - Shared TypeScript type definitions (active)
65+
- `packages/types/` - Shared TypeScript type definitions - this is deprecated, never modify this package
6166
- `packages/browser-utils/` - Browser-specific utilities and instrumentation
67+
- `packages/node-core/` - Node Core SDK which contains most of the node-specific logic, excluding OpenTelemetry instrumentation.
6268

6369
### Platform SDKs
70+
6471
- `packages/browser/` - Browser SDK with bundled variants
65-
- `packages/node/` - Node.js SDK with server-side integrations
72+
- `packages/node/` - Node.js SDK. All general Node code should go into node-core, the node package itself only contains OpenTelemetry instrumentation on top of that.
6673
- `packages/bun/`, `packages/deno/`, `packages/cloudflare/` - Runtime-specific SDKs
6774

6875
### Framework Integrations
76+
6977
- Framework packages: `packages/{framework}/` (react, vue, angular, etc.)
7078
- Client/server entry points where applicable (nextjs, nuxt, sveltekit)
7179
- Integration tests use Playwright (Remix, browser-integration-tests)
7280

7381
### User Experience Packages
82+
7483
- `packages/replay-internal/` - Session replay functionality
7584
- `packages/replay-canvas/` - Canvas recording for replay
7685
- `packages/replay-worker/` - Web worker support for replay
7786
- `packages/feedback/` - User feedback integration
7887

7988
### Development Packages (`dev-packages/`)
89+
8090
- `browser-integration-tests/` - Playwright browser tests
8191
- `e2e-tests/` - End-to-end tests for 70+ framework combinations
8292
- `node-integration-tests/` - Node.js integration tests
@@ -88,41 +98,55 @@ This is a Lerna monorepo with 40+ packages in the `@sentry/*` namespace.
8898
## Development Guidelines
8999

90100
### Build System
101+
91102
- Uses Rollup for bundling (`rollup.*.config.mjs`)
92103
- TypeScript with multiple tsconfig files per package
93104
- Lerna manages package dependencies and publishing
94105
- Vite for testing with `vitest`
95106

96107
### Package Structure Pattern
108+
97109
Each package typically contains:
110+
98111
- `src/index.ts` - Main entry point
99112
- `src/sdk.ts` - SDK initialization logic
100113
- `rollup.npm.config.mjs` - Build configuration
101114
- `tsconfig.json`, `tsconfig.test.json`, `tsconfig.types.json`
102115
- `test/` directory with corresponding test files
103116

104117
### Key Development Notes
118+
105119
- Uses Volta for Node.js/Yarn version management
106120
- Requires initial `yarn build` after `yarn install` for TypeScript linking
107121
- Integration tests use Playwright extensively
108-
- Native profiling requires Python <3.12 for binary builds
122+
- Never change the volta, yarn, or package manager setup in general unless explicitly asked for
123+
124+
### Notes for Background Tasks
125+
126+
- Make sure to use [volta](https://volta.sh/) for development. Volta is used to manage the node, yarn and pnpm version used.
127+
- Make sure that [PNPM support is enabled in volta](https://docs.volta.sh/advanced/pnpm). This means that the `VOLTA_FEATURE_PNPM` environment variable has to be set to `1`.
128+
- Yarn, Node and PNPM have to be used through volta, in the versions defined by the volta config. NEVER change any versions unless explicitly asked to.
109129

110130
## Testing Single Packages
131+
111132
- Test specific package: `cd packages/{package-name} && yarn test`
112133
- Build specific package: `yarn build:dev:filter @sentry/{package-name}`
113134

114135
## Code Style Rules
136+
115137
- Follow existing code conventions in each package
116138
- Check imports and dependencies - only use libraries already in the codebase
117139
- Look at neighboring files for patterns and style
118140
- Never introduce code that exposes secrets or keys
119141
- Follow security best practices
120142

121143
## Before Every Commit Checklist
144+
122145
1. ✅ `yarn lint` (fix all issues)
123146
2. ✅ `yarn test` (all tests pass)
124147
3. ✅ `yarn build:dev` (builds successfully)
125148
4. ✅ Target `develop` branch for PRs (not `master`)
126149

127150
## Documentation Sync
128-
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.
151+
152+
**IMPORTANT**: When editing CLAUDE.md, also update .cursor/rules/sdk_development.mdc and vice versa to keep both files in sync.

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
es2017: true,
1010
},
1111
parserOptions: {
12-
ecmaVersion: 2018,
12+
ecmaVersion: 2020,
1313
},
1414
extends: ['@sentry-internal/sdk'],
1515
ignorePatterns: [

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,78 @@
44

55
- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott
66

7+
## 9.40.0
8+
9+
### Important Changes
10+
11+
- **feat(browser): Add debugId sync APIs between web worker and main thread ([#16981](https://github.com/getsentry/sentry-javascript/pull/16981))**
12+
13+
This release adds two Browser SDK APIs to let the main thread know about debugIds of worker files:
14+
15+
- `webWorkerIntegration({worker})` to be used in the main thread
16+
- `registerWebWorker({self})` to be used in the web worker
17+
18+
```js
19+
// main.js
20+
Sentry.init({...})
21+
22+
const worker = new MyWorker(...);
23+
24+
Sentry.addIntegration(Sentry.webWorkerIntegration({ worker }));
25+
26+
worker.addEventListener('message', e => {...});
27+
```
28+
29+
```js
30+
// worker.js
31+
Sentry.registerWebWorker({ self });
32+
33+
self.postMessage(...);
34+
```
35+
36+
- **feat(core): Deprecate logger in favor of debug ([#17040](https://github.com/getsentry/sentry-javascript/pull/17040))**
37+
38+
The internal SDK `logger` export from `@sentry/core` has been deprecated in favor of the `debug` export. `debug` only exposes `log`, `warn`, and `error` methods but is otherwise identical to `logger`. Note that this deprecation does not affect the `logger` export from other packages (like `@sentry/browser` or `@sentry/node`) which is used for Sentry Logging.
39+
40+
```js
41+
import { logger, debug } from '@sentry/core';
42+
43+
// before
44+
logger.info('This is an info message');
45+
46+
// after
47+
debug.log('This is an info message');
48+
```
49+
50+
- **feat(node): Add OpenAI integration ([#17022](https://github.com/getsentry/sentry-javascript/pull/17022))**
51+
52+
This release adds official support for instrumenting OpenAI SDK calls in with Sentry tracing, following OpenTelemetry semantic conventions for Generative AI. It instruments:
53+
54+
- `client.chat.completions.create()` - For chat-based completions
55+
- `client.responses.create()` - For the responses API
56+
57+
```js
58+
// The integration respects your `sendDefaultPii` option, but you can override the behavior in the integration options
59+
60+
Sentry.init({
61+
dsn: '__DSN__',
62+
integrations: [
63+
Sentry.openAIIntegration({
64+
recordInputs: true, // Force recording prompts
65+
recordOutputs: true, // Force recording responses
66+
}),
67+
],
68+
});
69+
```
70+
71+
### Other Changes
72+
73+
- feat(node-core): Expand `@opentelemetry/instrumentation` range to cover `0.203.0` ([#17043](https://github.com/getsentry/sentry-javascript/pull/17043))
74+
- fix(cloudflare): Ensure errors get captured from durable objects ([#16838](https://github.com/getsentry/sentry-javascript/pull/16838))
75+
- fix(sveltekit): Ensure server errors from streamed responses are sent ([#17044](https://github.com/getsentry/sentry-javascript/pull/17044))
76+
77+
Work in this release was contributed by @0xbad0c0d3 and @tommy-gilligan. Thank you for your contributions!
78+
779
## 9.39.0
880

981
### Important Changes

0 commit comments

Comments
 (0)