Skip to content

Commit 9098b71

Browse files
Merge branch 'main' into antonis/bump-path-to-regexp
2 parents a731395 + d4ebf2b commit 9098b71

8 files changed

Lines changed: 193 additions & 42 deletions

File tree

.cursor/BUGBOT.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# PR Review Guidelines for Cursor Bot
2+
3+
**Scope & intent**
4+
5+
- High-level review guidance for the entire Sentry React Native SDK monorepo.
6+
- Optimize for **signal over noise**: only comment when there's material correctness, security/privacy, performance, or API-quality impact.
7+
- If you find anything to flag, mention that you flagged this in the review because it was mentioned in this rules file.
8+
- Do not flag the issues below if they appear only in tests.
9+
10+
**Reviewer style**
11+
12+
- Be concise. Quote exact lines/spans and propose a minimal fix (tiny diff/code block).
13+
- If something is subjective, ask a brief question rather than asserting.
14+
- Prefer principles over nitpicks; avoid noisy style-only comments that don't impact behavior.
15+
16+
---
17+
18+
## 0) Critical Issues to Flag
19+
20+
> Use a clear prefix like **CRITICAL:** in the review comment title.
21+
22+
### A. Security & Privacy
23+
24+
- **Secrets / credentials exposure**: Keys, tokens, DSNs, endpoints, or auth data in code, logs, tests, configs, or example apps.
25+
- **PII handling**: New code that logs or sends user-identifiable data without clear intent and controls. These must be gated behind the `sendDefaultPii` flag.
26+
- **Unsafe logging**: Request/response bodies, full URLs with query secrets, file paths or device identifiers logged by default.
27+
- **File/attachments**: Large or sensitive payloads attached by default; lack of size limits or backoff.
28+
- **Debug code shipped**: Diagnostics, sampling overrides, verbose logging, or feature flags accidentally enabled in production defaults.
29+
30+
### B. Public API & Stability
31+
32+
- **Breaking changes**: Signature/behavior changes, renamed/removed symbols, altered nullability/defaults, or event/telemetry shape changes **without** deprecation/migration notes.
33+
- **Behavioral compatibility**: Silent changes to defaults, sampling, or feature toggles that affect existing apps.
34+
- **Native bridge compatibility**: Changes to native module method signatures (iOS `RCT_EXPORT_METHOD` / Android `@ReactMethod`) must be backward-compatible or versioned, as they affect all consumers including Expo and bare React Native apps.
35+
36+
### C. Dependency Updates
37+
38+
- **Native SDK updates**: For PRs prefixed with `chore(deps):` updating native SDKs (e.g., `chore(deps): bump sentry-cocoa to v9.x.x`, `chore(deps): bump sentry-android to v8.x.x`):
39+
- Read the PR description which should contain the changelog.
40+
- Review mentioned changes for potential compatibility issues in the current codebase.
41+
- Flag breaking API changes, deprecated features being removed, new requirements, or behavioral changes that could affect existing integrations.
42+
- Check if version bumps require corresponding changes in the native bridge code (Objective-C/Swift on iOS, Java/Kotlin on Android).
43+
- **JavaScript dependency updates**: For PRs updating JS/TS dependencies, check for breaking API changes that affect the SDK's public surface or internal usage.
44+
45+
---
46+
47+
## 1) General Software Quality
48+
49+
**Clarity & simplicity**
50+
51+
- Prefer straightforward control flow, early returns, and focused functions.
52+
- Descriptive names; avoid unnecessary abbreviations.
53+
- Keep public APIs minimal and intentional.
54+
55+
**Correctness & safety**
56+
57+
- Add/update tests with behavioral changes and bug fixes.
58+
- Handle error paths explicitly; never let a Sentry instrumentation error crash the host app.
59+
- Avoid global mutable state; prefer immutability and clear ownership.
60+
61+
**DRY & cohesion**
62+
63+
- Remove duplication where it reduces complexity; avoid over-abstraction.
64+
- Keep modules cohesive; avoid reaching across layers for convenience.
65+
66+
**Performance (pragmatic)**
67+
68+
- Prefer linear-time approaches; avoid unnecessary allocations/copies.
69+
- Don't micro-optimize prematurely—call out obvious hotspots or regressions.
70+
- Be mindful of main-thread work in React Native; offload heavy work to native threads where possible.
71+
72+
---
73+
74+
## 2) TypeScript/JavaScript-Specific
75+
76+
**Idioms & language features**
77+
78+
- Use optional chaining (`?.`) and nullish coalescing (`??`) over manual null checks.
79+
- Avoid `any`; prefer `unknown` with explicit narrowing.
80+
- Use `async/await` over raw Promises for readability.
81+
- Follow the existing single-quote string style and 120-character line limit.
82+
83+
**Safety & async**
84+
85+
- Wrap `NativeModules` calls in try/catch; native bridges can throw.
86+
- Ensure Promises are handled; avoid unhandled rejections.
87+
- Check that `NativeModules.RNSentry` exists before calling methods (module may not be linked).
88+
89+
**Tree-shakeability**
90+
91+
- Avoid patterns that defeat tree shaking (e.g., side-effectful top-level code).
92+
- Use named exports; avoid re-exporting entire namespaces unnecessarily.
93+
- Instantiate optional integrations lazily (inside guarded branches).
94+
95+
---
96+
97+
## 3) React Native Bridge (Native Modules)
98+
99+
**iOS (Objective-C / Swift)**
100+
101+
- New `RCT_EXPORT_METHOD` / `RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD` must have a corresponding JS implementation.
102+
- Prefer `RCTPromiseResolveBlock`/`RCTPromiseRejectBlock` over synchronous returns for non-trivial work.
103+
- Wrap native calls in `@try/@catch` and reject the promise with a meaningful error code.
104+
- Nullability annotations (`nullable`/`nonnull`) must be consistent with JS-side expectations.
105+
- New Objective-C classes must use the `RNSentry` prefix.
106+
107+
**Android (Java / Kotlin)**
108+
109+
- New `@ReactMethod` entries must have a corresponding JS implementation.
110+
- Use `Promise` for async operations; call `promise.resolve()` or `promise.reject()` exactly once.
111+
- Avoid blocking the JS thread; offload heavy work to background threads.
112+
- Add `@Nullable` / `@NonNull` annotations consistently.
113+
- New classes must live under `io.sentry.react.*`.
114+
115+
**TurboModules / New Architecture**
116+
117+
- Changes to the native module spec (`NativeSentry.ts` or equivalent) must be reflected in both the legacy and new architecture implementations.
118+
- Verify that new methods are added to the codegen spec so they work with TurboModules.
119+
120+
---
121+
122+
## 4) SDK-Specific (high-level)
123+
124+
**Tracing & spans**
125+
126+
- Any span started must be **closed** (including on error paths).
127+
- For _automated_ instrumented spans, always set:
128+
- `sentry.origin`
129+
- `sentry.op` using a standard operation where applicable (see [Sentry's list of standard ops](https://develop.sentry.dev/sdk/telemetry/traces/span-operations/)).
130+
131+
**Structured logs**
132+
133+
- For _automated_ instrumented structured logs, always set `sentry.origin`.
134+
135+
**Initialization & error paths**
136+
137+
- Wrap dangerous or failure-prone paths (especially during `Sentry.init`) in `try/catch`, add actionable context, and ensure fallbacks keep the app usable.
138+
- Never let SDK initialization failure crash the host application.
139+
140+
**Replay & sensitive data**
141+
142+
- Any new UI instrumentation must respect the masking/unmasking API.
143+
- Default to masking sensitive views; opt-in to unmasking.
144+
145+
---
146+
147+
## Quick reviewer checklist
148+
149+
- [ ] **CRITICAL:** No secrets/PII/logging risks introduced; safe defaults preserved.
150+
- [ ] **CRITICAL:** Public API/telemetry stability maintained or properly deprecated with docs.
151+
- [ ] **CRITICAL:** For dependency updates (`chore(deps):`), changelog reviewed for breaking changes or compatibility issues.
152+
- [ ] Native bridge methods (iOS & Android) are consistent with JS-side calls and handle errors safely.
153+
- [ ] TurboModule/New Architecture spec updated if native module interface changed.
154+
- [ ] Spans started are always closed; automated spans/logs include `sentry.origin` (+ valid `sentry.op` for spans).
155+
- [ ] Dangerous init paths guarded; app remains usable on failure.
156+
- [ ] `NativeModules.RNSentry` existence checked before use; async bridge calls wrapped in try/catch.
157+
- [ ] Tests/docs/CHANGELOG updated for behavior changes.

.github/workflows/e2e-v2.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
platform: ["ios", "android"]
4949
include:
5050
- platform: ios
51-
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:12"]
51+
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
5252
name: iOS
5353
appPlain: performance-tests/test-app-plain.ipa
5454
- platform: android
55-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
55+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
5656
name: Android
5757
appPlain: performance-tests/TestAppPlain/android/app/build/outputs/apk/release/app-release.apk
5858
steps:
@@ -199,13 +199,13 @@ jobs:
199199
# Use Xcode 16 for older RN versions
200200
- platform: ios
201201
rn-version: '0.71.19'
202-
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:12"]
202+
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:10"]
203203
# Use Xcode 26 for newer RN versions (0.83.0)
204204
- platform: ios
205205
rn-version: '0.84.0'
206-
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:12"]
206+
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
207207
- platform: android
208-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
208+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
209209
exclude:
210210
# exclude JSC for new RN versions (keeping the matrix manageable)
211211
- rn-version: '0.84.0'
@@ -334,7 +334,7 @@ jobs:
334334
rn-version: '0.84.0'
335335
runs-on: macos-26
336336
- platform: android
337-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
337+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
338338

339339
steps:
340340
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

.github/workflows/sample-application-expo.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343
build-type: ['dev', 'production']
4444
include:
4545
- platform: ios
46-
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:12"]
46+
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:10"]
4747
- platform: android
48-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
48+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
4949
- platform: web
50-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
50+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
5151
exclude:
5252
- platform: 'android'
5353
ios-use-frameworks: 'dynamic-frameworks'

.github/workflows/sample-application.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ jobs:
5252
build-type: ['dev', 'production']
5353
include:
5454
- platform: ios
55-
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:12"]
55+
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:10"]
5656
- platform: macos
57-
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:12"]
57+
runs-on: ["ghcr.io/cirruslabs/macos-sequoia-xcode:16.4", "runner_group_id:10"]
5858
- platform: android
59-
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:12"]
59+
runs-on: ["ghcr.io/cirruslabs/ubuntu-runner-amd64:22.04", "runner_group_id:10"]
6060
exclude:
6161
- platform: 'android'
6262
ios-use-frameworks: 'dynamic-frameworks'

.github/workflows/testflight.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
upload_to_testflight:
1717
name: Build and Upload React Native Sample to Testflight
18-
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:12"]
18+
runs-on: ["ghcr.io/cirruslabs/macos-tahoe-xcode:26.2.0", "runner_group_id:10"]
1919
needs: [diff_check]
2020
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
2121
steps:

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@
6161
"resolutions": {
6262
"appium-chromedriver@npm:5.6.73/@xmldom/xmldom": "0.8.10",
6363
"express@npm:4.19.2/path-to-regexp": "0.1.12",
64+
"fast-xml-parser": "^5.3.6",
6465
"form-data": "4.0.4",
66+
"qs": "^6.14.2",
67+
"lodash": "^4.17.23",
6568
"tar-fs": "^3.1.1",
6669
"tar": "^7.5.7"
6770
},

packages/core/scripts/sentry-xcode.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
5757
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "output: sentry-cli - " $0}'
5858
else
5959
if [ "$SENTRY_ALLOW_FAILURE" == true ]; then
60+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "warning: sentry-cli - " $0}'
6061
echo "warning: sentry-cli - Source maps upload failed, but continuing build because SENTRY_ALLOW_FAILURE=true"
61-
echo "warning: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
6262
else
63+
echo "$SENTRY_XCODE_COMMAND_OUTPUT" | awk '{print "error: sentry-cli - " $0}'
6364
echo "error: sentry-cli - To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true"
64-
echo "error: sentry-cli - $SENTRY_XCODE_COMMAND_OUTPUT"
6565
exitCode=1
6666
fi
6767
fi

yarn.lock

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20114,14 +20114,14 @@ __metadata:
2011420114
languageName: node
2011520115
linkType: hard
2011620116

20117-
"fast-xml-parser@npm:^4.0.12, fast-xml-parser@npm:^4.2.4, fast-xml-parser@npm:^4.4.1":
20118-
version: 4.4.1
20119-
resolution: "fast-xml-parser@npm:4.4.1"
20117+
"fast-xml-parser@npm:^5.3.6":
20118+
version: 5.3.7
20119+
resolution: "fast-xml-parser@npm:5.3.7"
2012020120
dependencies:
20121-
strnum: "npm:^1.0.5"
20121+
strnum: ^2.1.2
2012220122
bin:
2012320123
fxparser: src/cli/cli.js
20124-
checksum: f440c01cd141b98789ae777503bcb6727393296094cc82924ae9f88a5b971baa4eec7e65306c7e07746534caa661fc83694ff437d9012dc84dee39dfbfaab947
20124+
checksum: 0bb307bc63a01c079ae28b6b62eeea0007d787e6ab47dfca493f40305f78aeedea2906b2632bf0eb9d4d868e748c77c70393a808441fb5949c9d2e6f8f2825f0
2012520125
languageName: node
2012620126
linkType: hard
2012720127

@@ -24574,10 +24574,10 @@ __metadata:
2457424574
languageName: node
2457524575
linkType: hard
2457624576

24577-
"lodash@npm:4.17.21, lodash@npm:^4.0.0, lodash@npm:^4.17.11, lodash@npm:^4.17.12, lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.2.1":
24578-
version: 4.17.21
24579-
resolution: "lodash@npm:4.17.21"
24580-
checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7
24577+
"lodash@npm:^4.17.23":
24578+
version: 4.17.23
24579+
resolution: "lodash@npm:4.17.23"
24580+
checksum: 7daad39758a72872e94651630fbb54ba76868f904211089721a64516ce865506a759d9ad3d8ff22a2a49a50a09db5d27c36f22762d21766e47e3ba918d6d7bab
2458124581
languageName: node
2458224582
linkType: hard
2458324583

@@ -28975,21 +28975,12 @@ __metadata:
2897528975
languageName: node
2897628976
linkType: hard
2897728977

28978-
"qs@npm:6.11.0":
28979-
version: 6.11.0
28980-
resolution: "qs@npm:6.11.0"
28981-
dependencies:
28982-
side-channel: ^1.0.4
28983-
checksum: 6e1f29dd5385f7488ec74ac7b6c92f4d09a90408882d0c208414a34dd33badc1a621019d4c799a3df15ab9b1d0292f97c1dd71dc7c045e69f81a8064e5af7297
28984-
languageName: node
28985-
linkType: hard
28986-
28987-
"qs@npm:6.13.0":
28988-
version: 6.13.0
28989-
resolution: "qs@npm:6.13.0"
28978+
"qs@npm:^6.14.2":
28979+
version: 6.15.0
28980+
resolution: "qs@npm:6.15.0"
2899028981
dependencies:
28991-
side-channel: ^1.0.6
28992-
checksum: e9404dc0fc2849245107108ce9ec2766cde3be1b271de0bf1021d049dc5b98d1a2901e67b431ac5509f865420a7ed80b7acb3980099fe1c118a1c5d2e1432ad8
28982+
side-channel: ^1.1.0
28983+
checksum: 65e797e3747fa1092e062da7b3e0684a9194e07ccab3a9467d416d2579d2feab0adf3aa4b94446e9f69ba7426589a8728f78a10a549308c97563a79d1c0d8595
2899328984
languageName: node
2899428985
linkType: hard
2899528986

@@ -32577,10 +32568,10 @@ __metadata:
3257732568
languageName: node
3257832569
linkType: hard
3257932570

32580-
"strnum@npm:^1.0.5":
32581-
version: 1.0.5
32582-
resolution: "strnum@npm:1.0.5"
32583-
checksum: 651b2031db5da1bf4a77fdd2f116a8ac8055157c5420f5569f64879133825915ad461513e7202a16d7fec63c54fd822410d0962f8ca12385c4334891b9ae6dd2
32571+
"strnum@npm:^2.1.2":
32572+
version: 2.1.2
32573+
resolution: "strnum@npm:2.1.2"
32574+
checksum: 755e8327ee68201d700169ceee097ea52da7b675f4521442a8dbd1517021f89a91399213c446d1bf3d1123ca1896a76f0ff076d04c88ffe6056e78828ce6f60a
3258432575
languageName: node
3258532576
linkType: hard
3258632577

0 commit comments

Comments
 (0)