|
| 1 | +--- |
| 2 | +name: sdk-review |
| 3 | +description: "Review sentry-python changes for violations of Sentry SDK contracts: host-app safety, data-collection gates, supported versions, public API, and Python-specific rules." |
| 4 | +allowed-tools: Read Grep Glob |
| 5 | +--- |
| 6 | +Review only the changed code. Report a finding only if you can point to the exact line and show how it breaks a user's app, build or data. Most hunks break no SDK contract, so no findings is the normal result. Generic logic bugs belong to `code-review`; this skill only covers SDK contracts. |
| 7 | + |
| 8 | +## Core SDK rules (same in every SDK repo) |
| 9 | + |
| 10 | +1. **Never break the host app** (high). SDK code that can raise, block, or change the user's behavior: exceptions, return values, signatures, job or request flow. |
| 11 | +2. **Data collected without its gate** (high). Bodies, headers, cookies, user info, `gen_ai` inputs/outputs or DB results recorded without their data-collection option. Header and cookie names match case-insensitively. Gate on the `data_collection` option keys; don't ask for `send_default_pii` or `should_send_default_pii()` as the gate. Automatically collected header, cookie, query or body values must go through the denylist filter in `sentry_sdk/data_collection.py`; a new path that sends them raw is a finding. Data the user set explicitly (scope, span, `before_send`) is never gated or scrubbed: don't flag reading it back from the scope, but do flag new code that gates or rewrites it. |
| 12 | +3. **Supported versions** (high). Language, runtime, target or dependency APIs newer than the repo's declared minimum, used without a guard. Minimums come from `python_requires` and `_MIN_VERSIONS` in `sentry_sdk/integrations/__init__.py`. |
| 13 | +4. **Public API** (medium). Breaking public changes without a deprecation path, or internals exposed as public API. |
| 14 | + |
| 15 | +## Do not report (same in every SDK repo) |
| 16 | + |
| 17 | +- Style, naming, refactors, or anything the repo's linters, type checkers or analyzers catch. |
| 18 | +- Pre-existing code the diff does not change. |
| 19 | +- Behavior that matches the spec, Relay or other SDKs, or a trade-off the PR or its threads explain. |
| 20 | +- Follow-ups the PR says are handled in a stacked PR or the major branch. |
| 21 | +- Tests, samples and examples, unless they can't fail or they teach wrong SDK usage. |
| 22 | +- Edge cases that need misuse or very unlikely timing. |
| 23 | + |
| 24 | +## Python rules |
| 25 | + |
| 26 | +5. **Missing internal-exception guard** (high). New patch or hook code outside `capture_internal_exceptions()`, or code that reads framework objects that can be missing or `None` (for example an unmatched route). Never wrap the user's own call or provider iterator: its exceptions must still reach the caller. |
| 27 | +6. **Brittle monkeypatch** (medium). A patch spells out arguments instead of `*args, **kwargs`, or swallows or re-raises the user's exception differently. |
| 28 | +7. **Span or check-in not finished on every path** (medium). Exceptions, early returns, and streams closed early or never consumed. |
0 commit comments