Skip to content

Commit 216248f

Browse files
authored
Merge branch 'develop' into fix/vercel-ai-conversation-id-from-openai-conversation
2 parents 3bd8e50 + 4565408 commit 216248f

452 files changed

Lines changed: 5366 additions & 2242 deletions

File tree

Some content is hidden

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

‎.agents/skills/triage-issue/SKILL.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ If any of these alternative interpretations apply, capture them in the triage re
7373

7474
### Step 3: Codebase Research
7575

76-
Search for relevant code using Grep/Glob. Find error messages, function names, and stack trace paths in the local repo.
76+
Search for relevant code using Grep/Glob. Find error messages, function names, and stack trace paths in the local repo. Bundler plugin code lives in `packages/bundler-plugins`.
7777

7878
Cross-repo searches (only when clearly relevant):
7979

80-
- Bundler issues: `gh api search/code -X GET -f "q=<term>+repo:getsentry/sentry-javascript-bundler-plugins"`
8180
- Docs issues: `gh api search/code -X GET -f "q=<term>+repo:getsentry/sentry-docs"`
8281

8382
**Shell safety:** Strip shell metacharacters from issue-derived search terms before use in commands.

‎.agents/skills/triage-issue/assets/triage-report.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
### Cross-Repo Findings
3131

32-
- **bundler-plugins:** <findings or "no matches">
3332
- **sentry-docs:** <findings or "no matches">
3433

3534
### Recommended Next Steps

‎.agents/skills/write-tests/SKILL.md‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,31 @@ it.each([
307307
### Test isolation
308308

309309
Tests must never depend on execution order or share mutable state. For this codebase, many tests
310-
need to reset global Sentry state:
310+
need to reset global Sentry state. Use whatever reset the existing tests in your package use (many
311+
packages have a `resetSdk()` or `cleanupOtel()` helper). Otherwise, pick one:
311312

312313
```typescript
313-
beforeEach(() => {
314-
clearGlobalScope();
315-
getCurrentScope().clear();
316-
getIsolationScope().clear();
317-
});
314+
// Unbind the client. Cheap, and enough for most tests that call `init()`.
315+
getCurrentScope().setClient(undefined);
316+
317+
// Reset the global, isolation, and current scopes, and the client bound to them.
318+
// `setupOnce` still does not run again, because installed integrations are tracked
319+
// outside the carrier.
320+
getMainCarrier().__SENTRY__ = undefined;
321+
322+
// Close and unbind the client. Also flushes, so it is slower.
323+
await Sentry.close();
318324
```
319325

326+
**Reset the client in every test that calls `init()`.** A second `init()` while a client is bound
327+
prints a "`Sentry.init()` was called more than once" warning. After the next major version, it will
328+
return the bound client instead of a new one, so a test without a reset gets the previous test's
329+
client and options. See `docs/repeated-init.md`.
330+
331+
To assert on that warning (or any `consoleSandbox` output), stub `originalConsoleMethods.warn` from
332+
`@sentry/core`. `consoleSandbox` calls the stored original method, so a spy on `console.warn` misses
333+
it once the console integration is set up.
334+
320335
### Grouping
321336

322337
1-2 levels of `describe` is usually enough. Deeper nesting makes tests harder to find and read.
@@ -526,6 +541,7 @@ Before you're done, verify each test against these criteria:
526541
- [ ] Description reads as a behavior specification (no "should", no "works correctly")
527542
- [ ] No dependency on other tests' execution or state
528543
- [ ] Mocks and spies are restored (via `beforeEach`)
544+
- [ ] Tests that call `init()` reset the bound client between tests
529545
- [ ] Edge cases covered: empty inputs, boundaries, error paths, null/undefined
530546
- [ ] Realistic test data (not `"foo"`, `"test"`, `123`)
531547
- [ ] No try/catch for error testing — `toThrow` / `rejects.toThrow` only

‎.cursor/BUGBOT.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Keep reviews high-signal. Prefer actionable, high-confidence findings over specu
7676
- Flag usage of the following APIs: `getCurrentScope()`, `getIsolationScope()`, `getClient()` if they are avoidable. Flag it with severity Low and acknowledge from the start that this is more a "is this necessary" check, rather than a rule violation.
7777
- Reason for flagging: Usage of these APIs is problematic for multi-client setups where either there is no "current" client/scope, or the wrong client might be used. Calling these APIs would create a current scope, thereby misleading any future calls to these APIs.
7878
- What to do instead: Use an existing reference to the scope or client. For example, this is possible in most `Integration` hooks.
79+
- Flag hard-coded attribute names and span ops (e.g. `'sentry.origin'`, `'sentry.op'`, `'http.request.method'`, `'db.system.name'`) when `@sentry/conventions` exports a constant for them. Use the constant from `@sentry/conventions/attributes` (e.g. `SENTRY_ORIGIN`, `SENTRY_OP`) or `@sentry/conventions/op` instead. Do not flag values that have no constant in `@sentry/conventions`.
7980
- Flag unnecessary `span.setAttribute(s)` calls: If data is already available at span start, it must be set via the `attributes` option of `startSpan`, `startSpanManual`, `startInactiveSpan` or `startIdleSpan` calls. This ensures that as much context as possible is available when `tracesSampler` or `ignoreSpans` SDK options are applied. If a `span.setAttribute(s)` call happens at a later time than right after span start and the attribute value can only be computed at that time, do not flag it.
8081

8182
### Code quality
@@ -92,6 +93,7 @@ Keep reviews high-signal. Prefer actionable, high-confidence findings over specu
9293
- 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.
9394
- Flag usage of conditionals in one test and recommend splitting up the test for the different paths.
9495
- Flag usage of loops testing multiple scenarios in one test and recommend using `(it)|(test).each` instead.
96+
- Apply the `@sentry/conventions` constants rule from above to test files too. Test assertions on span attributes and ops must use the constants, not string literals.
9597
- Flag tests that are likely to introduce flakes. In our case this usually means we wait for some telemetry requests sent from an SDK. Patterns to look out for:
9698
- Only waiting for a request, after an action is performed. Instead, start waiting, perform action, await request promise.
9799
- Race conditions when waiting on multiple requests. Ensure that waiting checks are unique enough and don't depend on a hard order when there's a chance that telemetry can be sent in arbitrary order.

‎.github/dependency-review-config.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ allow-ghsas:
3030
# 0.35.0, which is outside that range. Already present on develop via sharp 0.32.6
3131
# and 0.34.5, both of which are affected by the same advisory.
3232
- GHSA-f88m-g3jw-g9cj
33+
# axios, pinned exactly to 1.18.1 by nx (dev-only build tooling, not shipped).
34+
# Can be removed once nx pins axios >= 1.20.0.
35+
- GHSA-542g-h47m-68v8
36+
- GHSA-3pq3-5fj3-cg6v
37+
- GHSA-x97p-jq2g-jp4f
38+
- GHSA-mghh-pgcx-3jjj
39+
- GHSA-c29m-xwm3-cm6r
40+
- GHSA-r4gj-5m52-g5wh
41+
- GHSA-m8m8-qj5v-23w3
42+
# brace-expansion, pinned exactly to 5.0.8 by nx (dev-only build tooling, not shipped).
43+
# Can be removed once nx pins brace-expansion >= 5.0.11.
44+
- GHSA-rgw5-rvv9-x895
45+
- GHSA-6j4f-fj2g-mc7p
46+
- GHSA-qhr7-859c-m2p7

‎.github/workflows/triage-issue.yml‎

Lines changed: 0 additions & 98 deletions
This file was deleted.

‎AGENTS.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Uses **Git Flow** (see `docs/gitflow.md`).
7676
Runtime packages (`node`, `cloudflare`, ...) re-export from
7777
`@sentry/server-utils` rather than defining their own.
7878

79+
- `Sentry.init()` follows one rule for repeated calls: the first call wins. See
80+
`docs/repeated-init.md` before you add or change an `init()`.
81+
7982
## Linting & Formatting
8083

8184
- This project uses **Oxlint** and **Oxfmt** — NOT ESLint or Prettier

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090

9191
Work in this release was contributed by @Shubham-Padkonde and @tobias-schnabel. Thank you for your contributions!
9292

93+
- **feat(core)**: `Sentry.init()` now warns when it runs while a client is still active. For now, the new client still replaces the active client, but the active client is not closed, so state from both can mix. Call `Sentry.init()` once, or call `await Sentry.close()` before you call it again. `Sentry.close()` now unbinds the client it closes, so after `close()`, `getClient()` returns `undefined`, `isInitialized()` returns `false`, and a later `init()` sets up a new client. In `@sentry/cloudflare`, later requests no longer reuse the isolate's cached client once it is closed or closing. On the server, `@sentry/nextjs` and `@sentry/remix` now return the active client from a repeated `init()` call, not `undefined`.
94+
9395
## 11.2.0
9496

9597
### Important Changes

‎dev-packages/browser-integration-tests/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@
5959
"@babel/core": "^7.29.6",
6060
"@babel/preset-typescript": "^7.16.7",
6161
"@playwright/test": "~1.63.0",
62-
"@sentry/rrweb": "2.43.2",
62+
"@sentry/rrweb": "2.44.1",
6363
"@sentry/browser": "11.4.0",
6464
"@sentry/replay": "11.4.0",
6565
"@sentry/opentelemetry": "11.4.0",
66-
"@sentry/conventions": "0.25.0",
66+
"@sentry/conventions": "0.26.0",
6767
"@supabase/supabase-js": "2.109.0",
6868
"axios": "1.20.0",
6969
"babel-loader": "^10.1.1",

‎dev-packages/browser-integration-tests/suites/errors/fetch-enhance-messages-off/init.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import * as Sentry from '@sentry/browser';
33
window.Sentry = Sentry;
44

55
Sentry.init({
6-
traceLifecycle: 'static',
76
dsn: 'https://public@dsn.ingest.sentry.io/1337',
87
enhanceFetchErrorMessages: false,
98
});

0 commit comments

Comments
 (0)