Skip to content
Merged
85 changes: 64 additions & 21 deletions .agents/skills/verify-pr/SKILL.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ appId: io.sentry.reactnative.sample
visible: 'Status: Done'
timeout: 30000
- takeScreenshot: turbo-module-done
- back
# Tapping the active tab pops its stack; `back` is Android-only.
- tapOn:
id: 'errors-tab-icon'
- runFlow: ../steps/native-crash-and-relaunch.yml
5 changes: 4 additions & 1 deletion .agents/skills/verify-pr/references/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| Source maps upload | `export SENTRY_DISABLE_AUTO_UPLOAD=true` for release builds. The local token can't upload, and verification doesn't need it. |
| Sentry | The Sentry MCP with read access to `sentry-sdks`. `sentry-cli` can't read events (no `api` command, `org:ci` token). |

Start an emulator if none is running: `emulator -avd Pixel_8 -no-snapshot-save &`, then `adb wait-for-device`.
Start an emulator if none is running: `emulator -avd Pixel_8 -no-snapshot-save &`, then `adb wait-for-device`. If another session's emulator (e.g. an ATD image) is already running, boot `Pixel_8` next to it and pass `-s <serial>` to `adb` and `--device <serial>` to Maestro.

## Build

Expand All @@ -21,6 +21,9 @@ yarn build-android-release # → samples/react-native/app.apk (New Architectur
yarn build-android-debug # needs Metro: `yarn start`
```

- These scripts **drop extra arguments**: `-P…` flags never reach Gradle. For Gradle properties, call `./gradlew :app:assembleRelease -P…` in `samples/react-native/android` directly.
- Debug builds load JS from port 8081 on the host (`10.0.2.2:8081`); `adb reverse` doesn't change that on an emulator. If another Metro holds 8081, build with `-PreactNativeDevServerPort=<port>` and `yarn start --port <port>`, or use a release build.

- `*-legacy` variants build the Old Architecture. Verify on the architecture the claim is about; when it's both, run both.
- Build time depends on the Gradle cache: ~5–6 min with a cold cache, 15–40 s with a warm one, including after a native-only change.
- JS SDK changes: `cd packages/core && yarn build` first, on both sides.
Expand Down
9 changes: 7 additions & 2 deletions .agents/skills/verify-pr/references/evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ Choose the signal that differs between the two runs, and write the expectation f
| Logs | Log entries of each run | `search_logs` (recipe below). Delivery alone may not separate the runs: in the #6967 run, a native `Sentry.logger()` call was delivered with logs disabled |
| Spans, transactions, measurements | The transaction of each run | `search_traces` / `get_trace_details`; add the run id as a tag before the transaction starts |
| Profiles | Profile chunks of each run | `search_profiles` by time window; open from the transaction |
| Replays, attachments | The replay or attachment on the run's event | the event's `replays.attached` field / `get_event_attachment` |
| Screenshots, view hierarchy, other attachments | The attachment on each run's event, read back from Sentry — not the device's own screenshot | `get_event_attachment` with the event id (lists them), then with the `attachmentId` (returns the image). Save both images with the report |
| Masking (screenshots, replay) | A **probe** the mask must hide: a view that is neither text nor an image (so default masking leaves it alone) in two contrasting colors (a redaction is one flat color) | as above; describe what each run's image shows |
| Replays | The replay on the run's event | the event's `replays.attached` field; `get_replay_details` for the timeline |
| Replay recording content (touches, frames) | The rrweb events in each segment. The MCP's replay timeline shows only breadcrumbs (e.g. `tap`), not recorded touch positions | Android with `debug: true`: logcat holds each segment's full rrweb JSON (touches are `type 3`, `source 2`). Android Spotlight doesn't forward replay envelopes |
| A JS-thread block or hang | The hang event; a device-log line the scenario prints after the block | screenshots show only the tap |
| Option mapping, native init | The **resolved option on device**, logged by the scenario (e.g. `ScopesAdapter.getInstance().getOptions().getLogs().isEnabled()`); the option's effect in Sentry is secondary | logcat, or put the value in the message/tag the run sends. Mind the sample's init path (SKILL.md step 1.3) |
| Performance (startup, allocation) | Usually not checkable end to end on an emulator | Say so and mark **Inconclusive** rather than measuring noise |

Expand Down Expand Up @@ -53,4 +57,5 @@ Org `sentry-sdks`, region `https://us.sentry.io`, project `sentry-react-native`.
- **Discover can't tell missing from empty.** A `tags[x]` column shows `""` for both. In the event detail, a tag the SDK sent as `""` appears with `value: null` (ingestion dropped it); a tag never sent is absent.
- **Processing errors aren't visible through the MCP.** The event's `errors` list (e.g. "Discarded invalid value") isn't returned. Use indirect evidence (a `null` tag value) and say so in the report. Reading it needs a token with `event:read`.
- **Stale events.** The sample keeps unsent envelopes across launches. Use a fresh run id per attempt and launch with `clearState: true`.
- **Grouping.** Both runs' events may land in the same, long-lived issue (e.g. `SENTRY-REACT-NATIVE-28E` for `Sentry.nativeCrash()`). Link the **events**, not the issue.
- **Grouping.** Both runs' events may land in the same, long-lived issue, and the same scenario groups differently per platform (`Sentry.nativeCrash()` is a Java `RuntimeException` on Android and an `EXC_BAD_ACCESS` on iOS). Link the **events**, not the issue.
- **Attachment download URLs carry a token** (`os_auth=`). Copy the image next to the report and never paste the URL into a report: the repos are public.
78 changes: 78 additions & 0 deletions .agents/skills/verify-pr/references/ios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# iOS: setup, build, run

Simulator only. Real devices are out of scope for now.

## Setup

| Need | How |
|---|---|
| Simulator | `xcrun simctl list devices available`; boot one: `xcrun simctl boot <udid> && xcrun simctl bootstatus <udid> -b`. Note the UDID; Maestro needs it when an Android emulator is also running. |
| JDK 17 | Maestro needs it on iOS too: `export JAVA_HOME=<jdk17>; export PATH=$JAVA_HOME/bin:$PATH`. |
| Pods | Installed for the build you make (next section). |
| Source maps / dSYM upload | `export SENTRY_DISABLE_AUTO_UPLOAD=true`. |
| Sentry | The Sentry MCP with read access to `sentry-sdks`. |

## Pods

The installed Pods are whatever the last person built, and they must match the tracked Xcode project's linkage. A mismatch fails at link time: `ld: library 'Pods-sentryreactnativesample' not found`. Reinstall them before the first build of every run, even if a build worked last time:

```bash
cd samples/react-native
yarn pod-install-release-static # New Architecture, release, static frameworks
```

- Other combinations: `yarn pod-install-<debug|release>-<static|dynamic>[-legacy]` (see `samples/react-native/AGENTS.md`).
- Takes ~30 s with a warm CocoaPods cache.
- **Exits with code 2 even on success**: its last line greps for `$RN_SENTRY_POD_NAME`, which is usually unset. Check the log for `Pod installation complete!` instead.
- It rewrites two tracked files, `ios/sentryreactnativesample.xcodeproj/project.pbxproj` and `ios/sentryreactnativesample/PrivacyInfo.xcprivacy`. Keep them during the run; restore them at the end (SKILL.md step 6).
- Reverting a native SDK change needs no reinstall: `RNSentry` is a local `:path` pod, so Xcode picks up the source change.

## Build

From `samples/react-native`:

```bash
SENTRY_DISABLE_AUTO_UPLOAD=true yarn build-ios-release # → samples/react-native/sentryreactnativesample.app
```

- ~2.5 min the first time after a Pods install; ~45 s incremental after a native-only or sample JS change.
- The build log is `samples/react-native/ios/xcodebuild.log`. On failure, grep it for `error:` and `ld:`.
- Run builds in the background and wait for them; don't poll.

## Install and launch

```bash
xcrun simctl install <udid> samples/react-native/sentryreactnativesample.app
```

Launch through Maestro (`steps/launch.yml`), which passes the run tags as launch arguments. The bundle id is the same as on Android, `io.sentry.reactnative.sample`, so the shared steps work unchanged.

**Native crashes** are only captured without a debugger attached. Maestro and `simctl launch` don't attach one; running from Xcode does, and the debugger stops on the crash instead of Sentry.

## Drive the UI with Maestro

```bash
maestro --device <udid> test \
-e VERIFY_PR=<N> -e VERIFY_COMMIT=<sha> -e VERIFY_RUN_ID=<id> \
--test-output-dir <out-dir> \
<out-dir>/<run-id>.yml
```

Differences from Android:

- Maestro prints `${VAR}` unexpanded in launch arguments and `runFlow` env values, as on Android; the values are still applied. Confirm in the device log (`verify.run_id`).

- **`back` does nothing on iOS.** To return to a tab's root screen, tap its tab icon: `tapOn: { id: 'errors-tab-icon' }` (also `performance-tab-icon`, `playground-tab-icon`). Tapping the active tab pops its stack (seen on iOS; the shared example flow uses it on both platforms).
- **Tab labels can't be tapped by text.** Use the tab icon ids above.
- **The Playground tab's content is invisible to Maestro by text.** Its views sit inside a `TouchableWithoutFeedback`, which iOS exposes as one accessibility element. Target views there by `testID` (`id:` in Maestro); add a `testID` to any view the scenario needs to tap or scroll to.
- Native crash events are sent on the next launch, as on Android (`steps/native-crash-and-relaunch.yml`).

## On-device evidence

```bash
xcrun simctl io <udid> screenshot <out-dir>/<name>.png
xcrun simctl spawn <udid> log show --last 5m \
--predicate 'process == "sentryreactnativesample"' > <out-dir>/<run-id>.log
```

With `debug: true` (`sentry.options.json`), the log shows the native scope, e.g. `Setting tags in background queue: Optional(["turbo_module.name": "", "verify.run_id": ...])`, and each envelope's `Received response status code: 200`.
4 changes: 2 additions & 2 deletions .agents/skills/verify-pr/references/report-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Keep it short. Fill every section; write "none" rather than dropping one.

```markdown
# Verification: #<N> <PR title> — <Verified | Not reproduced | Failed | Inconclusive>
# Verification: #<N> <PR title> — <Verified | Not reproduced | Failed | Inconclusive | Not verifiable this way>

**Claim:** <one sentence: what was broken or missing, what should be true now>
**Platform:** Android <version> emulator (<AVD>), <New | Old> Architecture, <release | debug> build
**Platform:** <Android <version> emulator (<AVD>) | iOS <version> simulator (<device>)>, <New | Old> Architecture, <release | debug> build
**Scenario flow:** `<run-id>.yml` next to this report (or inline below), so the report stands alone

## Check made
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ The deep, task-specific guidance lives in `.agents/skills/` (registered in `agen
| `test-guidelines` | Writing, modifying, or reviewing Jest tests, fixtures, and mocks. |
| `review` | A three-axis (Standards / Spec / Correctness) pass on a branch or PR before opening or merging. |
| `diagnosing-bugs` | A hard bug, flaky test, CI hang, native crash, or perf regression — builds a red-capable loop before hypothesizing. |
| `verify-pr` | Verifying a PR end to end on an Android emulator against real Sentry — runs the sample without and with the change and writes a draft before/after report. |
| `verify-pr` | Verifying a PR end to end on an Android emulator or iOS simulator against real Sentry — runs the sample without and with the change and writes a draft before/after report. |

Warden's automated PR review and `agents.toml` also pull **remote** specialists (`security-review`, `gha-security-review`, `span-convention-review`, and more) — invoke those for depth beyond the local pass.

Expand Down
27 changes: 27 additions & 0 deletions samples/react-native/src/tabs/PlaygroundTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ const styles = StyleSheet.create({
borderColor: 'gray',
borderWidth: 1,
},
// Neither text nor an image, so only `Sentry.Mask` can mask it. Two colors,
// so a masked probe (one flat color) can't be mistaken for an unmasked one.
maskProbe: {
flexDirection: 'row',
height: 40,
},
maskProbeLeft: {
flex: 1,
backgroundColor: '#ff00ff',
},
maskProbeRight: {
flex: 1,
backgroundColor: '#00ff00',
},
});

const Separator = () => <View style={styles.separator} />;
Expand Down Expand Up @@ -178,6 +192,10 @@ export default function getPlaygroundTab() {
This is masked always because it's a child of a
Sentry.Mask
</Text>
<View style={styles.maskProbe}>
<View style={styles.maskProbeLeft} />
<View style={styles.maskProbeRight} />
</View>
<Sentry.Unmask>
{/* Sentry.Unmask does not override the Sentry.Mask from above in the hierarchy */}
<Text>
Expand All @@ -188,6 +206,15 @@ export default function getPlaygroundTab() {
</Sentry.Mask>
</Sentry.Unmask>
</View>
<Button
testID="capture-masked-exception-button"
title="Capture exception with masks"
onPress={() => {
Sentry.captureException(
new Error('Playground: screenshot masking'),
);
}}
/>
<Text>Text:</Text>
<Text>{'This is <Text>'}</Text>
<View style={styles.space} />
Expand Down
Loading