From 5493ed5f38536a0e3e71c9c96090565ea1454679 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 17 Nov 2026 14:54:47 +0000 Subject: [PATCH] ci(risk): Grade PRs with sentry-java risk guidance and core-first diffs Co-Authored-By: Nelson Osacky --- .cursor/BUGBOT.md | 4 +++ .github/pr-risk.md | 42 +++++++++++++++++++++++++++++++ .github/workflows/pr-risk-jev.yml | 15 +++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/pr-risk.md diff --git a/.cursor/BUGBOT.md b/.cursor/BUGBOT.md index 4525d5ff82e..d8aec72d053 100644 --- a/.cursor/BUGBOT.md +++ b/.cursor/BUGBOT.md @@ -6,6 +6,10 @@ Read [`AGENTS.md`](../AGENTS.md) for build commands and contributing rules, and rule file in [`.cursor/rules/`](rules) for the area the diff touches (`api`, `options`, `scopes`, `offline`, `opentelemetry`, ...). +If the diff changes what this file counts as risky, ask the author to update +[`.github/pr-risk.md`](../.github/pr-risk.md) too. The PR Risk (Jev) workflow grades PRs with that +shorter summary. + ## Critical ### Never crash or hang the host application diff --git a/.github/pr-risk.md b/.github/pr-risk.md new file mode 100644 index 00000000000..eb3c5831590 --- /dev/null +++ b/.github/pr-risk.md @@ -0,0 +1,42 @@ +This is the Sentry Java/Android SDK. It runs inside customers' applications, on their threads, from +`Sentry.init` on the Android main thread to every captured event. A defect here crashes or hangs +someone else's app, and a released SDK version stays in shipped apps for months. Judge a change +by what it can do to the host application, not by its size. Read the points below as mechanisms +to look for in the code, not as labels by path. + +Credible paths to high risk: + +- Crashing or hanging the host app. Examples: a new broad catch (`Throwable`, `Exception`, ...) + outside a public API or cross-process boundary, a probe for an optional `compileOnly` dependency + guarded only by `ExceptionUtils.rethrowIfFatal` (it rethrows `LinkageError`), or an SDK-internal + failure that calls `captureException` and loops. +- Deadlocks and ANRs. Examples: a lock held while finishing a span or transaction, capturing an + event, logging through `options.getLogger()`, or invoking a user callback (these re-enter the + SDK), two locks taken in different orders, or blocking work on the Android main thread. +- New disk I/O, network calls, reflection, class loading or eager allocation on the init path. +- Changed defaults: a feature that is on without an option, a new default sample rate, or a + changed feature toggle or option default. New features must be opt-in. +- Removing or changing the signature of public API in `sentry`, `sentry-android-core` or an + integration without a deprecation, or a breaking change to `InternalSentrySdk`, which hybrid + SDKs (React Native, Flutter, Unity, ...) call. +- Collecting user-identifiable data (headers, cookies, bodies, query strings, IPs, user names, + device identifiers) without gating it on `options.isSendDefaultPii()`. +- Envelope, transport, caching, rate limiting or retry changes (`AsyncHttpTransport`, + `HttpConnection`, `RateLimiter`, `EnvelopeCache`). A mistake here can drop or flood all data for + every customer. +- Changing serialization or deserialization of `io.sentry.protocol` classes or envelope items. +- Raising `minSdk`, the Java level or a supported framework version, or bumping a dependency in a + version-matrix slot that should stay on an older major (for example `springKafka2` moving off + 2.x). +- Measuring durations with wall-clock time, or subtracting timestamps, in code that dates or orders + events, crashes, ANRs or sessions. + +Usually low when the code confirms it: + +- Changes only to tests, `sentry-samples`, the Android integration test build, docs, `CHANGELOG.md`, + `MIGRATION.md`, `.agents`/`.cursor` instructions, or CI that does not publish or sign releases. +- Generated `.api` files that only add entries; they mirror source changes elsewhere in the diff. +- Dependency bumps of test-only or sample-only dependencies. + +A small diff in the areas above can still be high, and a large diff of tests or samples can still +be low. diff --git a/.github/workflows/pr-risk-jev.yml b/.github/workflows/pr-risk-jev.yml index 48e7e8b7eb3..04ae1b7e0b3 100644 --- a/.github/workflows/pr-risk-jev.yml +++ b/.github/workflows/pr-risk-jev.yml @@ -36,6 +36,21 @@ jobs: pr-number: ${{ github.event.pull_request.number || inputs.pr_number }} expected-head-sha: ${{ github.event.pull_request.head.sha }} result-path: risk-pr-result.json + # Read from the base branch, so a PR cannot change the guidance it is graded by. + # Keep it in sync with .cursor/BUGBOT.md. + risk-guidance-path: .github/pr-risk.md + # Only used when the diff does not fit: core SDK code keeps its budget first, and tests, + # samples, generated API dumps and the changelog are cut first. + prioritize-paths: | + sentry/src/main/* + sentry-android-core/src/main/* + deprioritize-paths: | + */src/test/* + */src/androidTest/* + */api/*.api + sentry-samples/* + sentry-android-integration-tests/* + CHANGELOG.md - name: Publish risk label if: ${{ !cancelled() && steps.risk.outcome != 'skipped' }}