Skip to content

Commit 3366bdf

Browse files
antonisclaude
andcommitted
chore(tooling): Add a pre-build gate and open-PR handling to verify-pr
From running the skill on open PRs (#7042, #7030): a "Not verifiable this way" verdict decided before any build (build-only claims, triggers a simulator can't produce, native APIs missing from the pinned SDK, low disk), guidance for feature PRs and open PRs, checks for node_modules, run tagging and spec codegen, release builds by default, and evidence for replay recording content and JS-thread blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5c70962 commit 3366bdf

4 files changed

Lines changed: 42 additions & 9 deletions

File tree

‎.agents/skills/verify-pr/SKILL.md‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Android emulator and iOS simulator. Real devices and CI are out of scope for now
2323
| **Not reproduced** | No symptom without the change, so the fix proves nothing on this setup. |
2424
| **Failed** | Symptom still present with the change. |
2525
| **Inconclusive** | An event didn't arrive in time, the build/run broke, or the evidence is indirect. Say which. |
26+
| **Not verifiable this way** | Decided in step 1, before any build: the claim isn't observable on a simulator/emulator, or the change can't be built yet. Say why and what would verify it instead. |
2627

27-
Prefer **Inconclusive** over a guess.
28+
Prefer **Inconclusive** over a guess, and **Not verifiable this way** over a run that can't separate the two sides.
2829

2930
## 1. Plan
3031

@@ -43,10 +44,33 @@ Write down, before touching anything:
4344

4445
If you can't state the evidence that would separate the two runs, stop and ask; the run would prove nothing.
4546

47+
### Gate: can this be verified on a device?
48+
49+
Answer these before building. Any "no" ends the run with **Not verifiable this way** for that platform; write the report with the reason.
50+
51+
- **Is the claim about runtime behavior?** Build fixes, dependency bumps, Metro/bundler config, type-only changes, and performance claims don't produce a difference in Sentry events. A run can only show nothing broke; say so instead of running.
52+
- **Can the trigger happen on a simulator/emulator?** For example, MetricKit reports, real-device hardware, OS-scheduled background work, and store-only behavior can't.
53+
- **Do the bundled native SDKs have the APIs the PR calls?** Check the pinned versions (`packages/core/RNSentry.podspec` `sentry_cocoa_version`, `packages/core/android/build.gradle` `sentryAndroidVersion`) against where the API was released. A PR waiting on a native bump can't be built on that platform yet.
54+
- **Is there enough disk?** `df -h /System/Volumes/Data` — stop under ~15 GB free. Clean iOS and Android sample builds together take ~13 GB.
55+
56+
### Feature PRs
57+
58+
A feature has no symptom; verify its **presence**:
59+
60+
- "Without" is still the PR's SDK change reversed. Keep the PR's own sample changes (a new option, a new button) on both sides, so only the SDK differs.
61+
- If the sample calls a new API that doesn't exist without the change, guard the call (`?.method?.()`) on the "without" side only, and say so.
62+
- An opt-in option can be checked more cheaply with one build and the option off, but that doesn't show the default is unchanged; prefer the reversed build.
63+
4664
## 2. Without the change
4765

4866
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.
4967

68+
Before the first build:
69+
70+
- `node_modules` must match the checkout: `node -p "require('react-native/package.json').version"` in `samples/react-native` equals the pinned version in its `package.json`; otherwise `yarn install`.
71+
- The run-tagging code (`samples/react-native/src/verifyRun.ts` and the `tagVerifyRun()` call in `App.tsx`) must be in the tree. A PR branched before it landed doesn't have it: copy both from `main`, and list them under sample changes.
72+
- If the PR's head doesn't contain this skill, copy `flows/steps/` out of the repo before checking the head out, and point `runFlow` at the copy.
73+
5074
```bash
5175
# merged PR — save the merge commit's SDK changes (no tests/changelog), then reverse them
5276
git show <merge-sha> -- packages/core \
@@ -62,7 +86,9 @@ git apply -R --check <out-dir>/pr<N>.patch && git apply -R <out-dir>/pr<N>.patch
6286

6387
Keep the patch in a file; a shell variable holding the command breaks under zsh ("No valid patches in input").
6488

65-
- First check the files the PR touched haven't changed on your checkout since: `git diff <merge-sha> HEAD -- <files>` is empty, or the revert won't be the PR's exact before-state. Note it in the report either way.
89+
- Merged PRs: first check the files the PR touched haven't changed on your checkout since: `git diff <merge-sha> HEAD -- <files>` is empty, or the revert won't be the PR's exact before-state. Note it in the report either way.
90+
- Open PRs: you build the head itself. Say which base it's on; if it needs something `main` has (e.g. a native bump), apply the PR's patch onto `main` instead and say so.
91+
- **Spec changes** (`NativeRNSentry.ts`, `*NativeComponent.ts`): check the generated code matches each side (iOS: grep `samples/react-native/ios/build/generated/ios/ReactCodegen/RNSentrySpec*.h` for the method; reinstall Pods if it's stale). A stale spec makes the "with" run silently skip the new method and look like Failed.
6692
- When `git apply -R --check` fails, fall back to the parent commit: `git checkout <merge-sha>^` (detached), `yarn install && yarn build`, build there, then return. Slower; record that you did it.
6793
- 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.
6894
- **JS changes** (`packages/core/src/`) need that `yarn build` on **both** sides.
@@ -74,13 +100,14 @@ Keep the patch in a file; a shell variable holding the command breaks under zsh
74100
Setup, build, install, and drive commands are in [references/android.md](references/android.md) and [references/ios.md](references/ios.md). The short version:
75101

76102
- 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`.
103+
- Prefer **release** builds. Debug builds load JS from whatever Metro is on port 8081 (another session's, if one is running), and the all-ABI debug APK may not fit on the emulator.
77104
- 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`.
78105
- Maestro needs JDK 17 on both platforms. With an emulator and a simulator both running, pass `--device <id>`.
79106
- 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.
80107
- 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.
81108
- Pass the run tags as launch arguments (next step). Relaunch after a crash so the event is sent.
82109
- Logs and other batched data are sent later: keep the app running ~20 s after the flow before looking them up.
83-
- Capture a screenshot at the step that shows the scenario ran, and keep the device log (Android: `adb logcat -d`; iOS: `xcrun simctl spawn <udid> log show --last 5m --predicate 'process == "sentryreactnativesample"'`).
110+
- Capture proof that the scenario ran: a screenshot of its result, or a device-log line when the screen can't show it (a blocked JS thread shows only the tap). Keep the device log from the run's start (Android: `adb logcat -c` before, `adb logcat -d` after; iOS: `xcrun simctl spawn <udid> log show --start "<run start>" --predicate 'process == "sentryreactnativesample"'`), and grep it by the run's own id.
84111

85112
## 4. Tag
86113

@@ -108,13 +135,14 @@ Compare against the expectation from step 1. Unexpected extra differences go in
108135

109136
## 6. Report
110137

111-
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.
138+
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). Running as a subagent that can't write report files: return the full report text instead, and the parent saves it. 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.
112139

113140
Finally:
114141

115142
- Restore the SDK sources with `git checkout -- packages/core` (this also restores `replay-stubs.jar`), or return from the detached parent checkout.
116143
- 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.
117-
- Shut down any simulator or emulator you booted (`xcrun simctl shutdown <udid>`, `adb emu kill`).
144+
- Shut down any simulator or emulator you booted (`xcrun simctl shutdown <udid>`, `adb -s <serial> emu kill`), and stop any Metro or helper server you started. Leave devices and servers you didn't start alone.
145+
- Remove the large build outputs you created if disk is short: `samples/react-native/{ios/DerivedData,ios/build,android/app/build,app.apk,sentryreactnativesample.app}` (all git-ignored).
118146
- Report `git status`.
119147

120148
## Recording what you learn

‎.agents/skills/verify-pr/references/android.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| Source maps upload | `export SENTRY_DISABLE_AUTO_UPLOAD=true` for release builds. The local token can't upload, and verification doesn't need it. |
1111
| Sentry | The Sentry MCP with read access to `sentry-sdks`. `sentry-cli` can't read events (no `api` command, `org:ci` token). |
1212

13-
Start an emulator if none is running: `emulator -avd Pixel_8 -no-snapshot-save &`, then `adb wait-for-device`.
13+
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.
1414

1515
## Build
1616

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

24+
- These scripts **drop extra arguments**: `-P…` flags never reach Gradle. For Gradle properties, call `./gradlew :app:assembleRelease -P…` in `samples/react-native/android` directly.
25+
- 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.
26+
2427
- `*-legacy` variants build the Old Architecture. Verify on the architecture the claim is about; when it's both, run both.
2528
- 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.
2629
- JS SDK changes: `cd packages/core && yarn build` first, on both sides.

‎.agents/skills/verify-pr/references/evidence.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ Choose the signal that differs between the two runs, and write the expectation f
1313
| Profiles | Profile chunks of each run | `search_profiles` by time window; open from the transaction |
1414
| 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 |
1515
| 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 |
16-
| Replays | The replay on the run's event | the event's `replays.attached` field |
16+
| Replays | The replay on the run's event | the event's `replays.attached` field; `get_replay_details` for the timeline |
17+
| 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 |
18+
| A JS-thread block or hang | The hang event; a device-log line the scenario prints after the block | screenshots show only the tap |
1719
| 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) |
1820
| Performance (startup, allocation) | Usually not checkable end to end on an emulator | Say so and mark **Inconclusive** rather than measuring noise |
1921

‎.agents/skills/verify-pr/references/report-template.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Keep it short. Fill every section; write "none" rather than dropping one.
44

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

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

1212
## Check made

0 commit comments

Comments
 (0)