From a186b3737d484e2147a4f557e40a11fda37bc36b Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 24 Nov 2026 14:37:57 +0100 Subject: [PATCH 1/6] chore(tooling): Add verify-pr skill for on-device PR verification Adds a local skill that verifies a PR end to end on an Android emulator: build the sample without and with the change, drive it with Maestro, find both runs' events in sentry-sdks through the Sentry MCP, and write a draft before/after report. The sample tags events with verify.pr, verify.commit and verify.run_id when launched with matching launch arguments, and does nothing otherwise. It also enables logs in sentry.options.json, so native Android matches the JS enableLogs setting. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/verify-pr/SKILL.md | 106 ++++++++++++++++++ .../turbo-module-calls-then-native-crash.yml | 17 +++ .../skills/verify-pr/flows/steps/launch.yml | 13 +++ .../flows/steps/native-crash-and-relaunch.yml | 16 +++ .../flows/steps/open-errors-screen-button.yml | 10 ++ .../skills/verify-pr/references/android.md | 76 +++++++++++++ .../skills/verify-pr/references/evidence.md | 56 +++++++++ .../verify-pr/references/report-template.md | 60 ++++++++++ AGENTS.md | 1 + agents.toml | 4 + samples/react-native/sentry.options.json | 1 + samples/react-native/src/App.tsx | 3 + samples/react-native/src/verifyRun.ts | 29 +++++ 13 files changed, 392 insertions(+) create mode 100644 .agents/skills/verify-pr/SKILL.md create mode 100644 .agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml create mode 100644 .agents/skills/verify-pr/flows/steps/launch.yml create mode 100644 .agents/skills/verify-pr/flows/steps/native-crash-and-relaunch.yml create mode 100644 .agents/skills/verify-pr/flows/steps/open-errors-screen-button.yml create mode 100644 .agents/skills/verify-pr/references/android.md create mode 100644 .agents/skills/verify-pr/references/evidence.md create mode 100644 .agents/skills/verify-pr/references/report-template.md create mode 100644 samples/react-native/src/verifyRun.ts diff --git a/.agents/skills/verify-pr/SKILL.md b/.agents/skills/verify-pr/SKILL.md new file mode 100644 index 0000000000..7ac35c7a4b --- /dev/null +++ b/.agents/skills/verify-pr/SKILL.md @@ -0,0 +1,106 @@ +--- +name: verify-pr +description: Verify a merged or open PR end to end the way a maintainer does — run the sample app on an Android emulator without the change and with it, find both runs' events in the shared `sentry-sdks` org, and write a before/after draft report. Use when asked to "verify PR #N", "check that the fix works on device", "reproduce the bug and confirm the fix", or to replay an older fix against real Sentry. Android only for now. +--- + +Verify one PR on a real Android emulator against real Sentry. The output is a **draft report** showing the claim's symptom **without** the change and its absence (or the feature's presence) **with** it, linked to both runs' Sentry events. + +Android only. iOS and CI are out of scope for now — say so and stop if the PR's claim is iOS-only. + +## Rules + +- **Draft only.** Save the report locally and show it. Never post it to GitHub, Linear, or Slack, and never change an issue or PR, unless the maintainer asks in this session. +- Every repo here is public: the report holds no customer names, emails, tokens, or DSNs. Event links into `sentry-sdks` are fine. +- Leave the working tree as you found it, except for scenario changes to the sample (step 1.3). Undo every SDK revert and list what you left behind. +- Don't run the root formatters (`oxfmt`) on `samples/react-native` files: they rewrite whole files the sample never formatted. Match the surrounding style by hand. +- Never edit the PR's code to make it pass. If the change doesn't do what it claims, that is the verdict. + +## Verdicts + +| Verdict | Meaning | +|---|---| +| **Verified** | Symptom seen without the change, gone (or feature present) with it. | +| **Not reproduced** | No symptom without the change, so the fix proves nothing on this setup. | +| **Failed** | Symptom still present with the change. | +| **Inconclusive** | An event didn't arrive in time, the build/run broke, or the evidence is indirect. Say which. | + +Prefer **Inconclusive** over a guess. + +## 1. Plan + +Read the PR and anything it links: `gh pr view --json title,body,mergeCommit,baseRefOid,headRefOid,files,comments`, plus the linked issue. + +Write down, before touching anything: + +1. **Claim** — one sentence: what was broken (or missing) and what should be true now. +2. **Platform** — confirm the claim affects Android. A change under `packages/core/ios/` only is out of scope. +3. **Scenario** — the user actions in `samples/react-native` that produce the symptom. Search the sample's screens (`src/Screens/`, `src/tabs/`) and [flows/scenarios/](flows/scenarios/) for one that already does it. Add a sample button only if none exists. Leave it in the working tree next to its flow and list it in the report; the maintainer decides whether it's committed. A flow must never point at a button that isn't in the tree. + - **How the sample starts the native SDK matters.** By default Android starts the native SDK from `samples/react-native/sentry.options.json` (`RNSentrySDK.init`), and JS `Sentry.init` runs with `autoInitializeNativeSdk: false`. Options set in `App.tsx` don't reach native Android. For native option claims, set the option in `sentry.options.json` (and say so in the report). Building with `SENTRY_DISABLE_NATIVE_START=true` to switch to JS init did **not** work in a release build (JS still saw it as off); don't rely on it. +4. **Evidence** — what you'll read in Sentry (or on device) to tell the two runs apart, and what each run should show. See [references/evidence.md](references/evidence.md). +5. **Build type** — release when the scenario needs a native crash (`Sentry.nativeCrash()` only crashes in release) or when the PR is about release behavior; otherwise debug is fine. + +If you can't state the evidence that would separate the two runs, stop and ask; the run would prove nothing. + +## 2. Without the change + +Build the "without" side from the current checkout with only the PR's SDK change reversed. This needs one clean build; the "with" side is then an incremental rebuild. + +```bash +# merged PR — reverse the merge commit's SDK changes, keep tests/changelog +git show -- packages/core \ + ':!packages/core/test' ':!packages/core/RNSentryAndroidTester' ':!packages/core/RNSentryCocoaTester' \ + | git apply -R --check && | git apply -R +# open PR — check out the head first, then reverse its diff against the base +git diff -- packages/core ':!packages/core/test' ... | git apply -R +``` + +- First check the files the PR touched haven't changed on your checkout since: `git diff HEAD -- ` is empty, or the revert won't be the PR's exact before-state. Note it in the report either way. +- When `git apply -R --check` fails, fall back to the parent commit: `git checkout ^` (detached), `yarn install && yarn build`, build there, then return. Slower; record that you did it. +- The sample bundles `packages/core/dist/`. Before the first sample build, run `yarn build` in `packages/core` if `dist/` is older than `HEAD` — even for native-only PRs. +- **JS changes** (`packages/core/src/`) need that `yarn build` on **both** sides. +- `yarn build` in `packages/core` rewrites the tracked `packages/core/android/libs/replay-stubs.jar`; the restore at the end covers it. + +## 3. Run + +Setup, build, install, and drive commands are in [references/android.md](references/android.md). The short version: + +- Full emulator image (e.g. `Pixel_8`), not an ATD image — ATD returns black screenshots. +- JDK 17, `SENTRY_DISABLE_AUTO_UPLOAD=true`, `yarn build-android-release` (or `-debug` + Metro). +- Drive the UI with **Maestro**. Build the scenario from the shared steps in [flows/steps/](flows/steps/) (`launch.yml` with the run tags, `open-errors-screen-button.yml`, `native-crash-and-relaunch.yml`). Reuse a flow from [flows/scenarios/](flows/scenarios/) when one fits; otherwise add one, named after what it exercises, not the PR, so the next PR touching the same area can reuse it. +- Pass the run tags as launch arguments (next step). Relaunch after a crash so the event is sent. +- Logs and other batched data are sent later: keep the app running ~20 s after the flow before looking them up. +- Capture a screenshot at the step that shows the scenario ran, and keep logcat: `adb logcat -d > /.logcat`. + +## 4. Tag + +The sample tags every event with these when they're passed as launch arguments (`samples/react-native/src/verifyRun.ts`); without them it tags nothing: + +| Launch argument | Tag | Value | +|---|---|---| +| `verifyPr` | `verify.pr` | PR number | +| `verifyCommit` | `verify.commit` | short sha of what the run built, with `^` for the "without" side (`^`) | +| `verifyRunId` | `verify.run_id` | unique per run: `pr--` | + +Use a fresh run id for every attempt, so a retry never picks up a previous attempt's event. Tags set from JS sync to the native scope, so native crash events carry them too. + +## 5. Check + +Look the evidence up in `sentry-sdks` (region `https://us.sentry.io`, project `sentry-react-native`) through the Sentry MCP. Repeat every ~30 s; give up after **5 minutes** → Inconclusive. The lookup per evidence type, link formats, and pitfalls are in [references/evidence.md](references/evidence.md). For error events: + +1. `search_errors` with `verify.run_id:` and `period: 1h`. +2. Open each hit with `get_sentry_resource` on its **issue-event URL** (`https://sentry-sdks.sentry.io/issues//events//`). A bare event id fails. +3. Read the event detail, not the Discover columns: Discover shows `""` for a missing tag and an empty one alike. + +Logs can't be searched by `verify.run_id`; put the run id in the log message (see evidence.md). + +Compare against the expectation from step 1. Unexpected extra differences go in the report. + +## 6. Report + +Write the report with [references/report-template.md](references/report-template.md) to a local file (scratchpad, or `samples/react-native/verify-reports/` if the maintainer wants it in the tree). Include the verdict, the claim, the exact scenario, both event links, screenshots, the sample diff if any, timings, and every problem hit. Then show it and ask before posting anywhere. + +Finally, restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout, and report `git status`. + +## Recording what you learn + +When a step needed a human, a retry, or a workaround, add it to the report's *Problems* list. When it will recur, fix the skill or the flow in the same session. diff --git a/.agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml b/.agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml new file mode 100644 index 0000000000..85c98ef5f3 --- /dev/null +++ b/.agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml @@ -0,0 +1,17 @@ +# Runs the sample TurboModule calls, which set and then clear the +# `turbo_module.*` scope tags, then crashes natively. Checks what a native +# event carries after a TurboModule call has finished (e.g. #7087). +appId: io.sentry.reactnative.sample +--- +- runFlow: ../steps/launch.yml +- runFlow: + file: ../steps/open-errors-screen-button.yml + env: + BUTTON: 'TurboModule Playground' +- tapOn: 'Run TurboModule calls' +- extendedWaitUntil: + visible: 'Status: Done' + timeout: 30000 +- takeScreenshot: turbo-module-done +- back +- runFlow: ../steps/native-crash-and-relaunch.yml diff --git a/.agents/skills/verify-pr/flows/steps/launch.yml b/.agents/skills/verify-pr/flows/steps/launch.yml new file mode 100644 index 0000000000..ffbbb6012b --- /dev/null +++ b/.agents/skills/verify-pr/flows/steps/launch.yml @@ -0,0 +1,13 @@ +# Clean launch with the run tags (see samples/react-native/src/verifyRun.ts). +# Pass VERIFY_PR, VERIFY_COMMIT and VERIFY_RUN_ID with `maestro test -e`. +appId: io.sentry.reactnative.sample +--- +- launchApp: + clearState: true + stopApp: true + arguments: + verifyPr: ${VERIFY_PR} + verifyCommit: ${VERIFY_COMMIT} + verifyRunId: ${VERIFY_RUN_ID} +- waitForAnimationToEnd: + timeout: 2000 diff --git a/.agents/skills/verify-pr/flows/steps/native-crash-and-relaunch.yml b/.agents/skills/verify-pr/flows/steps/native-crash-and-relaunch.yml new file mode 100644 index 0000000000..848d1be9dc --- /dev/null +++ b/.agents/skills/verify-pr/flows/steps/native-crash-and-relaunch.yml @@ -0,0 +1,16 @@ +# Crashes natively from the Errors tab, then relaunches without clearing +# state so the SDK sends the stored crash event. Needs a release build. +# "Native Crash" is near the top of the list, so scroll up to it. +appId: io.sentry.reactnative.sample +--- +- scrollUntilVisible: + element: 'Native Crash' + direction: UP + timeout: 10000 +- tapOn: 'Native Crash' +- launchApp: + clearState: false + stopApp: false +- waitForAnimationToEnd: + timeout: 5000 +- takeScreenshot: relaunched diff --git a/.agents/skills/verify-pr/flows/steps/open-errors-screen-button.yml b/.agents/skills/verify-pr/flows/steps/open-errors-screen-button.yml new file mode 100644 index 0000000000..9efc699af9 --- /dev/null +++ b/.agents/skills/verify-pr/flows/steps/open-errors-screen-button.yml @@ -0,0 +1,10 @@ +# Scrolls the Errors tab down to a button and taps it. Pass BUTTON. +# Maestro can't parameterize `direction`: when the list was already scrolled +# past the button (a pushed screen keeps the offset), scroll UP inline instead. +appId: io.sentry.reactnative.sample +--- +- scrollUntilVisible: + element: ${BUTTON} + direction: DOWN + timeout: 15000 +- tapOn: ${BUTTON} diff --git a/.agents/skills/verify-pr/references/android.md b/.agents/skills/verify-pr/references/android.md new file mode 100644 index 0000000000..1618010629 --- /dev/null +++ b/.agents/skills/verify-pr/references/android.md @@ -0,0 +1,76 @@ +# Android: setup, build, run + +## Setup + +| Need | How | +|---|---| +| JDK 17 | Gradle **and** Maestro need it. `export JAVA_HOME=; export PATH=$JAVA_HOME/bin:$PATH` (e.g. `~/.sdkman/candidates/java/17.0.9-tem`). The default JDK may be 11. | +| Emulator | A full image (`emulator -list-avds`, e.g. `Pixel_8`). **Not** an ATD image (`*_atd`): its screenshots are all black. `adb devices` must list exactly one device, or pass `-s`. | +| Maestro | `maestro --version`. Already used by the repo's e2e tests. | +| 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`. + +## Build + +From `samples/react-native`: + +```bash +yarn build-android-release # → samples/react-native/app.apk (New Architecture) +yarn build-android-debug # needs Metro: `yarn start` +``` + +- `*-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. +- Run builds in the background and wait for them to finish; don't poll. + +## Install and launch + +```bash +adb install -r samples/react-native/app.apk +adb shell am start -n io.sentry.reactnative.sample/.MainActivity \ + -e verifyPr -e verifyCommit -e verifyRunId +``` + +`adb shell monkey -p -c android.intent.category.LAUNCHER 1` doesn't start this app; use `am start`. +Use `adb uninstall io.sentry.reactnative.sample` before switching between debug and release (different signatures). + +## Drive the UI with Maestro + +```bash +maestro test \ + -e VERIFY_PR= -e VERIFY_COMMIT= -e VERIFY_RUN_ID= \ + --test-output-dir \ + .agents/skills/verify-pr/flows/scenarios/.yml +``` + +- Screenshots from `takeScreenshot: ` land in `/screenshots/.png`. +- Maestro matches text case-insensitively (Android upper-cases button labels) and scrolls with `scrollUntilVisible`. +- `scrollUntilVisible.direction` can't come from a variable. A pushed screen keeps the list's scroll offset when you go back, so scroll **UP** to buttons near the top after a `back`. +- After a crash, relaunch with `clearState: false` so the stored event is sent (`steps/native-crash-and-relaunch.yml`). +- Maestro's log prints `${VAR}` unexpanded in launch arguments and in `runFlow` env values (e.g. `Tap on "${BUTTON}"`); the values are still applied. Confirm in logcat (`grep '"verify.run_id"'`). +- Maestro has no plain sleep. When the evidence is batched (logs), wait in the shell after `maestro test` returns, with the app still running. + +## Fallback: uiautomator + +When Maestro can't run, drive the app with `adb`: + +```bash +adb shell uiautomator dump /sdcard/ui.xml && adb shell cat /sdcard/ui.xml # find a node's bounds by text +adb shell input tap +adb shell input swipe 540 600 540 1500 200 # scroll up +``` + +Match `text` or `content-desc` case-insensitively. The dumped text is also usable evidence when screenshots fail. + +## On-device evidence + +```bash +adb logcat -c # before the scenario +adb logcat -d > /.logcat # after it +adb exec-out screencap -p > /.png +``` + +The sample runs with `debug: true` (`sentry.options.json`), so logcat shows the Sentry scope and events as JSON (`D Sentry :` lines) — useful for checking the native scope before an event is sent. diff --git a/.agents/skills/verify-pr/references/evidence.md b/.agents/skills/verify-pr/references/evidence.md new file mode 100644 index 0000000000..aa5289061e --- /dev/null +++ b/.agents/skills/verify-pr/references/evidence.md @@ -0,0 +1,56 @@ +# Evidence: what to check and how to find it + +## Pick the evidence first + +Choose the signal that differs between the two runs, and write the expectation for each side before running. + +| Claim is about… | Evidence | How to look it up | +|---|---|---| +| Event content (tags, contexts, extras, stack trace, mechanism) | The error event of each run | `search_errors` by `verify.run_id`, then open the event (below) | +| A crash the change prevents | A crash event without the change; none with it, **plus** proof the scenario ran (screenshot, logcat line, a later event from the same run) | `search_errors` by run id; `adb logcat -d \| grep "FATAL EXCEPTION"` | +| 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` | +| 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 | + +An absence ("tag missing", "no crash") only counts when the same run also shows the scenario ran. + +## Sentry MCP sequence + +Org `sentry-sdks`, region `https://us.sentry.io`, project `sentry-react-native`. + +1. **Search** — `search_errors`: + ``` + organizationSlug: sentry-sdks + regionUrl: https://us.sentry.io + query: verify.run_id: + period: 1h + fields: ["id", "title", "issue", "timestamp", "tags[verify.commit]"] + ``` + Events usually show up within a minute of the relaunch. Repeat every ~30 s; after **5 minutes** with nothing, the run is Inconclusive (check logcat for `Envelope sent successfully` / rate limits first). +2. **Open** — `get_sentry_resource` with `url: https://sentry-sdks.sentry.io/issues//events//`. Looking up a bare event id (`resourceType: event`) fails with "No issue found". +3. **Read** the `tags` and `contexts` in the event detail. + +## Logs + +`search_logs` rejects `verify.run_id` ("Unknown attribute"), and a wildcard on the run id alone returned nothing. What worked: + +1. The scenario logs a message with a fixed prefix plus the run id, e.g. `verify-pr log ...`. +2. `search_logs` with `message:"**"`, `period: 1h`; pick the entry whose message holds the run id. +3. Wait ~20 s after the flow before the first lookup: logs are batched on device. + +## Links for the report + +| Evidence | Link | +|---|---| +| Error event | `https://sentry-sdks.sentry.io/issues//events//` | +| Log entry | `https://sentry-sdks.sentry.io/explore/logs/?project=-1&logsPinned=` | + +## Pitfalls + +- **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. diff --git a/.agents/skills/verify-pr/references/report-template.md b/.agents/skills/verify-pr/references/report-template.md new file mode 100644 index 0000000000..0f15c3f573 --- /dev/null +++ b/.agents/skills/verify-pr/references/report-template.md @@ -0,0 +1,60 @@ +# Report template + +Keep it short. Fill every section; write "none" rather than dropping one. + +```markdown +# Verification: # — + +**Claim:** +**Platform:** Android emulator (), Architecture, build +**Scenario flow:** `.agents/skills/verify-pr/flows/scenarios/.yml` + +## Check made + +1. +2. ... + +Expected: without the change ; with it . + +| | Without the change | With the change | +|---|---|---| +| Built from | `` with # reversed (or `^`) | `` | +| Run id | `` | `` | +| Evidence link (event / log / trace) | []() | []() | +| | | | + + + +### How the "without" side was built + +` / checked out `^`. Whether the touched files changed since the PR.> + +## Sample app changes + + + +## Screenshots + + + +## Timing + +| Step | Time | +|---|---| +| Plan | | +| Build without the change | | +| Run + evidence visible | | +| Build with the change | | +| Run + evidence visible | | +| **Total** | | + +Attempts: + +## Human intervention + + + +## Problems + + +``` diff --git a/AGENTS.md b/AGENTS.md index 754c2e7262..61fee713a2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -141,6 +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. | 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. diff --git a/agents.toml b/agents.toml index a8f2d9a7fc..e4a89b1c1f 100644 --- a/agents.toml +++ b/agents.toml @@ -106,3 +106,7 @@ source = "path:.agents/skills/diagnosing-bugs" [[skills]] name = "review" source = "path:.agents/skills/review" + +[[skills]] +name = "verify-pr" +source = "path:.agents/skills/verify-pr" diff --git a/samples/react-native/sentry.options.json b/samples/react-native/sentry.options.json index ea858566a8..87788530a7 100644 --- a/samples/react-native/sentry.options.json +++ b/samples/react-native/sentry.options.json @@ -1,6 +1,7 @@ { "dsn": "https://1df17bd4e543fdb31351dee1768bb679@o447951.ingest.sentry.io/5428561", "debug": true, + "enableLogs": true, "environment": "dev", "enableUserInteractionTracing": true, "enableAutoSessionTracking": true, diff --git a/samples/react-native/src/App.tsx b/samples/react-native/src/App.tsx index bdea5d6481..9d26b516e9 100644 --- a/samples/react-native/src/App.tsx +++ b/samples/react-native/src/App.tsx @@ -17,6 +17,7 @@ import getErrorsTab from './tabs/ErrorsTab'; import getPerformanceTab from './tabs/PerformanceTab'; import getPlaygroundTab from './tabs/PlaygroundTab'; import { logWithoutTracing, shouldUseAutoStart } from './utils'; +import { tagVerifyRun } from './verifyRun'; import NativePlatformSampleModule from '../tm/NativePlatformSampleModule'; import NativeSampleModule from '../tm/NativeSampleModule'; @@ -209,6 +210,8 @@ Sentry.init({ // No-op on the Old Architecture. enableTurboModuleTracking: true, }); +// Tags events with the `verify-pr` skill's run id, when launched with one. +tagVerifyRun(); function BottomTabsNavigator() { return ( diff --git a/samples/react-native/src/verifyRun.ts b/samples/react-native/src/verifyRun.ts new file mode 100644 index 0000000000..2546e90bfe --- /dev/null +++ b/samples/react-native/src/verifyRun.ts @@ -0,0 +1,29 @@ +import * as Sentry from '@sentry/react-native'; +import { LaunchArguments } from 'react-native-launch-arguments'; + +interface VerifyRunArgs { + verifyPr?: string; + verifyCommit?: string; + verifyRunId?: string; +} + +/** + * Tags every event with the verification run passed as launch arguments, so + * the `verify-pr` skill can find its events in Sentry. No-op without them. + * + * Android: `adb shell am start -n /.MainActivity -e verifyRunId ` + * Maestro: `launchApp: { arguments: { verifyRunId: } }` + */ +export function tagVerifyRun(): void { + const args = LaunchArguments.value(); + const tags: Record = { + 'verify.pr': args.verifyPr, + 'verify.commit': args.verifyCommit, + 'verify.run_id': args.verifyRunId, + }; + for (const [key, value] of Object.entries(tags)) { + if (value) { + Sentry.setTag(key, String(value)); + } + } +} From e59d280efe23f273a9ee8e0b17738854c7e11304 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 24 Nov 2026 14:55:44 +0100 Subject: [PATCH 2/6] chore(tooling): Write verify-pr scenarios per run, not into the skill Scenarios were one-off per PR and nothing runs them, so a shared folder would grow and rot. Move the #7087 flow to flows/examples/ as the worked example and regression check, write each run's flow next to its report, and promote to flows/steps/ only when a second run needs it. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/verify-pr/SKILL.md | 5 +++-- .../turbo-module-calls-then-native-crash.yml | 7 +++++-- .agents/skills/verify-pr/references/android.md | 5 ++++- .agents/skills/verify-pr/references/report-template.md | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) rename .agents/skills/verify-pr/flows/{scenarios => examples}/turbo-module-calls-then-native-crash.yml (63%) diff --git a/.agents/skills/verify-pr/SKILL.md b/.agents/skills/verify-pr/SKILL.md index 7ac35c7a4b..5322a8a610 100644 --- a/.agents/skills/verify-pr/SKILL.md +++ b/.agents/skills/verify-pr/SKILL.md @@ -34,7 +34,7 @@ Write down, before touching anything: 1. **Claim** — one sentence: what was broken (or missing) and what should be true now. 2. **Platform** — confirm the claim affects Android. A change under `packages/core/ios/` only is out of scope. -3. **Scenario** — the user actions in `samples/react-native` that produce the symptom. Search the sample's screens (`src/Screens/`, `src/tabs/`) and [flows/scenarios/](flows/scenarios/) for one that already does it. Add a sample button only if none exists. Leave it in the working tree next to its flow and list it in the report; the maintainer decides whether it's committed. A flow must never point at a button that isn't in the tree. +3. **Scenario** — the user actions in `samples/react-native` that produce the symptom. Search the sample's screens (`src/Screens/`, `src/tabs/`) for a way to trigger the symptom, and write the scenario for this run. Add a sample button only if none exists. Leave it in the working tree next to its flow and list it in the report; the maintainer decides whether it's committed. A flow must never point at a button that isn't in the tree. - **How the sample starts the native SDK matters.** By default Android starts the native SDK from `samples/react-native/sentry.options.json` (`RNSentrySDK.init`), and JS `Sentry.init` runs with `autoInitializeNativeSdk: false`. Options set in `App.tsx` don't reach native Android. For native option claims, set the option in `sentry.options.json` (and say so in the report). Building with `SENTRY_DISABLE_NATIVE_START=true` to switch to JS init did **not** work in a release build (JS still saw it as off); don't rely on it. 4. **Evidence** — what you'll read in Sentry (or on device) to tell the two runs apart, and what each run should show. See [references/evidence.md](references/evidence.md). 5. **Build type** — release when the scenario needs a native crash (`Sentry.nativeCrash()` only crashes in release) or when the PR is about release behavior; otherwise debug is fine. @@ -66,7 +66,8 @@ Setup, build, install, and drive commands are in [references/android.md](referen - Full emulator image (e.g. `Pixel_8`), not an ATD image — ATD returns black screenshots. - JDK 17, `SENTRY_DISABLE_AUTO_UPLOAD=true`, `yarn build-android-release` (or `-debug` + Metro). -- Drive the UI with **Maestro**. Build the scenario from the shared steps in [flows/steps/](flows/steps/) (`launch.yml` with the run tags, `open-errors-screen-button.yml`, `native-crash-and-relaunch.yml`). Reuse a flow from [flows/scenarios/](flows/scenarios/) when one fits; otherwise add one, named after what it exercises, not the PR, so the next PR touching the same area can reuse it. +- Drive the UI with **Maestro**. Compose the run's scenario from the shared steps in [flows/steps/](flows/steps/) (`launch.yml` with the run tags, `open-errors-screen-button.yml`, `native-crash-and-relaunch.yml`), using [flows/examples/](flows/examples/) as a pattern. Save the flow next to the report, not in the skill. +- Don't add flows or steps to the skill during a verification run. Promote something to `flows/steps/` only when a second run needs it, in a separate change. - Pass the run tags as launch arguments (next step). Relaunch after a crash so the event is sent. - Logs and other batched data are sent later: keep the app running ~20 s after the flow before looking them up. - Capture a screenshot at the step that shows the scenario ran, and keep logcat: `adb logcat -d > /.logcat`. diff --git a/.agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml b/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml similarity index 63% rename from .agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml rename to .agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml index 85c98ef5f3..5c86dbc500 100644 --- a/.agents/skills/verify-pr/flows/scenarios/turbo-module-calls-then-native-crash.yml +++ b/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml @@ -1,6 +1,9 @@ +# Worked example from the #7087 verification, and the skill's own regression +# check (run it after changing `flows/steps/`). Not a scenario to look up: +# write each run's scenario next to its report. +# # Runs the sample TurboModule calls, which set and then clear the -# `turbo_module.*` scope tags, then crashes natively. Checks what a native -# event carries after a TurboModule call has finished (e.g. #7087). +# `turbo_module.*` scope tags, then crashes natively. appId: io.sentry.reactnative.sample --- - runFlow: ../steps/launch.yml diff --git a/.agents/skills/verify-pr/references/android.md b/.agents/skills/verify-pr/references/android.md index 1618010629..7d5b440f41 100644 --- a/.agents/skills/verify-pr/references/android.md +++ b/.agents/skills/verify-pr/references/android.md @@ -43,9 +43,12 @@ Use `adb uninstall io.sentry.reactnative.sample` before switching between debug maestro test \ -e VERIFY_PR= -e VERIFY_COMMIT= -e VERIFY_RUN_ID= \ --test-output-dir \ - .agents/skills/verify-pr/flows/scenarios/.yml + /.yml # the run's own flow, saved next to the report ``` +- `runFlow` paths resolve relative to the flow file. A flow saved outside the skill must reach the shared steps by absolute path: `runFlow: /.agents/skills/verify-pr/flows/steps/launch.yml`. +- With more than one device running (an emulator and a simulator), pass `--device ` (`adb devices` / `xcrun simctl list devices booted`). + - Screenshots from `takeScreenshot: ` land in `/screenshots/.png`. - Maestro matches text case-insensitively (Android upper-cases button labels) and scrolls with `scrollUntilVisible`. - `scrollUntilVisible.direction` can't come from a variable. A pushed screen keeps the list's scroll offset when you go back, so scroll **UP** to buttons near the top after a `back`. diff --git a/.agents/skills/verify-pr/references/report-template.md b/.agents/skills/verify-pr/references/report-template.md index 0f15c3f573..c253b0e0ac 100644 --- a/.agents/skills/verify-pr/references/report-template.md +++ b/.agents/skills/verify-pr/references/report-template.md @@ -7,7 +7,7 @@ Keep it short. Fill every section; write "none" rather than dropping one. **Claim:** **Platform:** Android emulator (), Architecture, build -**Scenario flow:** `.agents/skills/verify-pr/flows/scenarios/.yml` +**Scenario flow:** `.yml` next to this report (or inline below), so the report stands alone ## Check made From c8b9751e3aae2065dff2aa611f3f70e9d7ed02ac Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 24 Nov 2026 15:07:56 +0100 Subject: [PATCH 3/6] chore(tooling): Add iOS simulator support to the verify-pr skill From verifying #7087 and #6974 on the iOS simulator: Pods setup and the files pod install rewrites, the iOS init path, Maestro differences (no `back`, tab icons and the Playground tab need ids), reading screenshot attachments back from Sentry, and a two-color probe for masking checks. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/verify-pr/SKILL.md | 28 ++++--- .../turbo-module-calls-then-native-crash.yml | 4 +- .../skills/verify-pr/references/evidence.md | 4 +- .agents/skills/verify-pr/references/ios.md | 76 +++++++++++++++++++ AGENTS.md | 2 +- 5 files changed, 99 insertions(+), 15 deletions(-) create mode 100644 .agents/skills/verify-pr/references/ios.md diff --git a/.agents/skills/verify-pr/SKILL.md b/.agents/skills/verify-pr/SKILL.md index 5322a8a610..4b83bb616c 100644 --- a/.agents/skills/verify-pr/SKILL.md +++ b/.agents/skills/verify-pr/SKILL.md @@ -1,11 +1,11 @@ --- name: verify-pr -description: Verify a merged or open PR end to end the way a maintainer does — run the sample app on an Android emulator without the change and with it, find both runs' events in the shared `sentry-sdks` org, and write a before/after draft report. Use when asked to "verify PR #N", "check that the fix works on device", "reproduce the bug and confirm the fix", or to replay an older fix against real Sentry. Android only for now. +description: Verify a merged or open PR end to end the way a maintainer does — run the sample app on an Android emulator or iOS simulator without the change and with it, find both runs' events in the shared `sentry-sdks` org, and write a before/after draft report. Use when asked to "verify PR #N", "check that the fix works on device", "reproduce the bug and confirm the fix", or to replay an older fix against real Sentry. Android and iOS (simulator). --- -Verify one PR on a real Android emulator against real Sentry. The output is a **draft report** showing the claim's symptom **without** the change and its absence (or the feature's presence) **with** it, linked to both runs' Sentry events. +Verify one PR on an Android emulator or iOS simulator against real Sentry. The output is a **draft report** showing the claim's symptom **without** the change and its absence (or the feature's presence) **with** it, linked to both runs' Sentry events. -Android only. iOS and CI are out of scope for now — say so and stop if the PR's claim is iOS-only. +Android emulator and iOS simulator. Real devices and CI are out of scope for now. Verify on every platform the PR's native changes touch (`packages/core/android/`, `packages/core/ios/`); a JS-only change needs one platform unless the claim is platform-specific. ## Rules @@ -33,11 +33,13 @@ Read the PR and anything it links: `gh pr view --json title,body,mergeCommit Write down, before touching anything: 1. **Claim** — one sentence: what was broken (or missing) and what should be true now. -2. **Platform** — confirm the claim affects Android. A change under `packages/core/ios/` only is out of scope. +2. **Platform** — which platforms the claim affects: Android, iOS, or both. Run each one. 3. **Scenario** — the user actions in `samples/react-native` that produce the symptom. Search the sample's screens (`src/Screens/`, `src/tabs/`) for a way to trigger the symptom, and write the scenario for this run. Add a sample button only if none exists. Leave it in the working tree next to its flow and list it in the report; the maintainer decides whether it's committed. A flow must never point at a button that isn't in the tree. - - **How the sample starts the native SDK matters.** By default Android starts the native SDK from `samples/react-native/sentry.options.json` (`RNSentrySDK.init`), and JS `Sentry.init` runs with `autoInitializeNativeSdk: false`. Options set in `App.tsx` don't reach native Android. For native option claims, set the option in `sentry.options.json` (and say so in the report). Building with `SENTRY_DISABLE_NATIVE_START=true` to switch to JS init did **not** work in a release build (JS still saw it as off); don't rely on it. + - **How the sample starts the native SDK matters.** By default both platforms start the native SDK from `samples/react-native/sentry.options.json` (`RNSentrySDK.init` / `[RNSentrySDK start]`), and JS `Sentry.init` runs with `autoInitializeNativeSdk: false`. Options set in `App.tsx` don't reach the native SDK. For native option claims, set the option in `sentry.options.json` (and say so in the report). + - iOS: the `sentryDisableNativeStart: true` launch argument switches to JS init (the iOS e2e tests use it). + - Android: building with `SENTRY_DISABLE_NATIVE_START=true` did **not** work in a release build (JS still saw it as off); don't rely on it. 4. **Evidence** — what you'll read in Sentry (or on device) to tell the two runs apart, and what each run should show. See [references/evidence.md](references/evidence.md). -5. **Build type** — release when the scenario needs a native crash (`Sentry.nativeCrash()` only crashes in release) or when the PR is about release behavior; otherwise debug is fine. +5. **Build type** — release when the scenario needs a native crash (Android: `Sentry.nativeCrash()` only crashes in release; iOS: a debugger catches the crash first, so never run the scenario from Xcode) or when the PR is about release behavior; otherwise debug is fine. If you can't state the evidence that would separate the two runs, stop and ask; the run would prove nothing. @@ -59,18 +61,20 @@ git diff -- packages/core ':!packages/core/test' ... | - The sample bundles `packages/core/dist/`. Before the first sample build, run `yarn build` in `packages/core` if `dist/` is older than `HEAD` — even for native-only PRs. - **JS changes** (`packages/core/src/`) need that `yarn build` on **both** sides. - `yarn build` in `packages/core` rewrites the tracked `packages/core/android/libs/replay-stubs.jar`; the restore at the end covers it. +- iOS: a native-only change is a ~45 s incremental rebuild on the "with" side; CocoaPods doesn't need reinstalling, because `RNSentry` is a local `:path` pod. ## 3. Run -Setup, build, install, and drive commands are in [references/android.md](references/android.md). The short version: +Setup, build, install, and drive commands are in [references/android.md](references/android.md) and [references/ios.md](references/ios.md). The short version: -- Full emulator image (e.g. `Pixel_8`), not an ATD image — ATD returns black screenshots. -- JDK 17, `SENTRY_DISABLE_AUTO_UPLOAD=true`, `yarn build-android-release` (or `-debug` + Metro). +- Android: full emulator image (e.g. `Pixel_8`), not an ATD image — ATD returns black screenshots. JDK 17, `SENTRY_DISABLE_AUTO_UPLOAD=true`, `yarn build-android-release`. +- iOS: a booted simulator, Pods installed for the build you make (`yarn pod-install-release-static`), `SENTRY_DISABLE_AUTO_UPLOAD=true`, `yarn build-ios-release`. +- Maestro needs JDK 17 on both platforms. With an emulator and a simulator both running, pass `--device `. - Drive the UI with **Maestro**. Compose the run's scenario from the shared steps in [flows/steps/](flows/steps/) (`launch.yml` with the run tags, `open-errors-screen-button.yml`, `native-crash-and-relaunch.yml`), using [flows/examples/](flows/examples/) as a pattern. Save the flow next to the report, not in the skill. - Don't add flows or steps to the skill during a verification run. Promote something to `flows/steps/` only when a second run needs it, in a separate change. - Pass the run tags as launch arguments (next step). Relaunch after a crash so the event is sent. - Logs and other batched data are sent later: keep the app running ~20 s after the flow before looking them up. -- Capture a screenshot at the step that shows the scenario ran, and keep logcat: `adb logcat -d > /.logcat`. +- Capture a screenshot at the step that shows the scenario ran, and keep the device log (Android: `adb logcat -d`; iOS: `xcrun simctl spawn log show --last 5m --predicate 'process == "sentryreactnativesample"'`). ## 4. Tag @@ -88,7 +92,7 @@ Use a fresh run id for every attempt, so a retry never picks up a previous attem Look the evidence up in `sentry-sdks` (region `https://us.sentry.io`, project `sentry-react-native`) through the Sentry MCP. Repeat every ~30 s; give up after **5 minutes** → Inconclusive. The lookup per evidence type, link formats, and pitfalls are in [references/evidence.md](references/evidence.md). For error events: -1. `search_errors` with `verify.run_id:` and `period: 1h`. +1. `search_errors` with `verify.run_id:` and `period: 1h`. Pass `fresh: true` on retries: a repeated query can return a cached empty result. 2. Open each hit with `get_sentry_resource` on its **issue-event URL** (`https://sentry-sdks.sentry.io/issues//events//`). A bare event id fails. 3. Read the event detail, not the Discover columns: Discover shows `""` for a missing tag and an empty one alike. @@ -100,7 +104,7 @@ Compare against the expectation from step 1. Unexpected extra differences go in Write the report with [references/report-template.md](references/report-template.md) to a local file (scratchpad, or `samples/react-native/verify-reports/` if the maintainer wants it in the tree). Include the verdict, the claim, the exact scenario, both event links, screenshots, the sample diff if any, timings, and every problem hit. Then show it and ask before posting anywhere. -Finally, restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout, and report `git status`. +Finally, restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout. On iOS, also restore what `pod install` rewrote: `git checkout -- samples/react-native/ios/sentryreactnativesample.xcodeproj samples/react-native/ios/sentryreactnativesample/PrivacyInfo.xcprivacy`. Report `git status`. ## Recording what you learn diff --git a/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml b/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml index 5c86dbc500..5232e8eb1e 100644 --- a/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml +++ b/.agents/skills/verify-pr/flows/examples/turbo-module-calls-then-native-crash.yml @@ -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 diff --git a/.agents/skills/verify-pr/references/evidence.md b/.agents/skills/verify-pr/references/evidence.md index aa5289061e..c6e5bd919e 100644 --- a/.agents/skills/verify-pr/references/evidence.md +++ b/.agents/skills/verify-pr/references/evidence.md @@ -11,7 +11,9 @@ 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 | | 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 | diff --git a/.agents/skills/verify-pr/references/ios.md b/.agents/skills/verify-pr/references/ios.md new file mode 100644 index 0000000000..df3a514825 --- /dev/null +++ b/.agents/skills/verify-pr/references/ios.md @@ -0,0 +1,76 @@ +# 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 && xcrun simctl bootstatus -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=; 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`. Install them for the build before the first build: + +```bash +cd samples/react-native +yarn pod-install-release-static # New Architecture, release, static frameworks +``` + +- Other combinations: `yarn pod-install--[-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 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 test \ + -e VERIFY_PR= -e VERIFY_COMMIT= -e VERIFY_RUN_ID= \ + --test-output-dir \ + /.yml +``` + +Differences from Android: + +- **`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 screenshot /.png +xcrun simctl spawn log show --last 5m \ + --predicate 'process == "sentryreactnativesample"' > /.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`. diff --git a/AGENTS.md b/AGENTS.md index 61fee713a2..4feccce830 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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. From e926088801928af610f61839b32b562fc9bdd387 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 24 Nov 2026 15:23:32 +0100 Subject: [PATCH 4/6] chore(tooling): Fold iOS acceptance-run findings into verify-pr Save the revert as a patch file, compare dist/ against packages/core/src, define verify.commit for both sides, reinstall Pods every iOS run, shut down booted devices, and keep attachment URLs out of reports. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/verify-pr/SKILL.md | 25 +++++++++++++------ .../skills/verify-pr/references/evidence.md | 3 ++- .agents/skills/verify-pr/references/ios.md | 4 ++- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.agents/skills/verify-pr/SKILL.md b/.agents/skills/verify-pr/SKILL.md index 4b83bb616c..7b4498de23 100644 --- a/.agents/skills/verify-pr/SKILL.md +++ b/.agents/skills/verify-pr/SKILL.md @@ -48,17 +48,23 @@ If you can't state the evidence that would separate the two runs, stop and ask; Build the "without" side from the current checkout with only the PR's SDK change reversed. This needs one clean build; the "with" side is then an incremental rebuild. ```bash -# merged PR — reverse the merge commit's SDK changes, keep tests/changelog +# merged PR — save the merge commit's SDK changes (no tests/changelog), then reverse them git show -- packages/core \ ':!packages/core/test' ':!packages/core/RNSentryAndroidTester' ':!packages/core/RNSentryCocoaTester' \ - | git apply -R --check && | git apply -R -# open PR — check out the head first, then reverse its diff against the base -git diff -- packages/core ':!packages/core/test' ... | git apply -R + > /pr.patch +# open PR — check out the head first, then save its diff against the base +git diff -- packages/core \ + ':!packages/core/test' ':!packages/core/RNSentryAndroidTester' ':!packages/core/RNSentryCocoaTester' \ + > /pr.patch + +git apply -R --check /pr.patch && git apply -R /pr.patch ``` +Keep the patch in a file; a shell variable holding the command breaks under zsh ("No valid patches in input"). + - First check the files the PR touched haven't changed on your checkout since: `git diff HEAD -- ` is empty, or the revert won't be the PR's exact before-state. Note it in the report either way. - When `git apply -R --check` fails, fall back to the parent commit: `git checkout ^` (detached), `yarn install && yarn build`, build there, then return. Slower; record that you did it. -- The sample bundles `packages/core/dist/`. Before the first sample build, run `yarn build` in `packages/core` if `dist/` is older than `HEAD` — even for native-only PRs. +- The sample bundles `packages/core/dist/`. Before the first sample build, run `yarn build` in `packages/core` if `dist/` is older than the last change to `packages/core/src` (`git log -1 --format=%cd -- packages/core/src`) — even for native-only PRs. - **JS changes** (`packages/core/src/`) need that `yarn build` on **both** sides. - `yarn build` in `packages/core` rewrites the tracked `packages/core/android/libs/replay-stubs.jar`; the restore at the end covers it. - iOS: a native-only change is a ~45 s incremental rebuild on the "with" side; CocoaPods doesn't need reinstalling, because `RNSentry` is a local `:path` pod. @@ -83,7 +89,7 @@ The sample tags every event with these when they're passed as launch arguments ( | Launch argument | Tag | Value | |---|---|---| | `verifyPr` | `verify.pr` | PR number | -| `verifyCommit` | `verify.commit` | short sha of what the run built, with `^` for the "without" side (`^`) | +| `verifyCommit` | `verify.commit` | short sha of the checkout you built (`git rev-parse --short HEAD`); for the "without" side add the reversed PR: `-` | | `verifyRunId` | `verify.run_id` | unique per run: `pr--` | Use a fresh run id for every attempt, so a retry never picks up a previous attempt's event. Tags set from JS sync to the native scope, so native crash events carry them too. @@ -104,7 +110,12 @@ Compare against the expectation from step 1. Unexpected extra differences go in Write the report with [references/report-template.md](references/report-template.md) to a local file (scratchpad, or `samples/react-native/verify-reports/` if the maintainer wants it in the tree). Include the verdict, the claim, the exact scenario, both event links, screenshots, the sample diff if any, timings, and every problem hit. Then show it and ask before posting anywhere. -Finally, restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout. On iOS, also restore what `pod install` rewrote: `git checkout -- samples/react-native/ios/sentryreactnativesample.xcodeproj samples/react-native/ios/sentryreactnativesample/PrivacyInfo.xcprivacy`. Report `git status`. +Finally: + +- Restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout. +- iOS: restore what `pod install` rewrote: `git checkout -- samples/react-native/ios/sentryreactnativesample.xcodeproj samples/react-native/ios/sentryreactnativesample/PrivacyInfo.xcprivacy`. The ignored `Pods/` then no longer match the tracked project, which is why every iOS run reinstalls Pods first. +- Shut down any simulator or emulator you booted (`xcrun simctl shutdown `, `adb emu kill`). +- Report `git status`. ## Recording what you learn diff --git a/.agents/skills/verify-pr/references/evidence.md b/.agents/skills/verify-pr/references/evidence.md index c6e5bd919e..7eb12875c7 100644 --- a/.agents/skills/verify-pr/references/evidence.md +++ b/.agents/skills/verify-pr/references/evidence.md @@ -55,4 +55,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. diff --git a/.agents/skills/verify-pr/references/ios.md b/.agents/skills/verify-pr/references/ios.md index df3a514825..18dad76da9 100644 --- a/.agents/skills/verify-pr/references/ios.md +++ b/.agents/skills/verify-pr/references/ios.md @@ -14,7 +14,7 @@ Simulator only. Real devices are out of scope for now. ## 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`. Install them for the build before the first build: +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 @@ -60,6 +60,8 @@ maestro --device test \ 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. From 5c709624767fd7854e15be4b17c8994884add0d4 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 24 Nov 2026 16:05:42 +0100 Subject: [PATCH 5/6] chore(sample): Add a screenshot masking probe to the Playground tab A two-color view inside the existing demo, plus a button that captures an exception with the demo on screen. The view is neither text nor an image, so only can hide it in the event's screenshot; a masked probe is one flat color. Used to verify #6974. Co-Authored-By: Claude Opus 5.5 --- .../react-native/src/tabs/PlaygroundTab.tsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/samples/react-native/src/tabs/PlaygroundTab.tsx b/samples/react-native/src/tabs/PlaygroundTab.tsx index 6bd49544a6..2934f02ccf 100644 --- a/samples/react-native/src/tabs/PlaygroundTab.tsx +++ b/samples/react-native/src/tabs/PlaygroundTab.tsx @@ -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 = () => ; @@ -178,6 +192,10 @@ export default function getPlaygroundTab() { This is masked always because it's a child of a Sentry.Mask + + + + {/* Sentry.Unmask does not override the Sentry.Mask from above in the hierarchy */} @@ -188,6 +206,15 @@ export default function getPlaygroundTab() { +