The sdk-pr-review skill reads this file. It holds the rules of this repo: the safe path in this repo for each SDK rule, the checks for tests, the light pass, and what to skip. One bullet for each rule: what to flag, why it matters, and the safe path or the exception.
Change a rule when the review gets it wrong two times for the same reason. Add a rule only for a real miss or a repeated human comment.
These sections of the root AGENTS.md are checks: "Architecture", "Coding Standards", "Testing", and "Lazy Loading Is a Last Resort". The other sections are for authors only.
- For the
stringifyForCodeInjectionrule, log messages and booleandefinevalues are fine.
Data collection
- Flag
url.full,url.query,http.target, orrequest.query_stringset from a URL thatfilterCollectedUrl()(orfilterCollectedUrlQuery()for a bare query) did not filter. Pass theclientwhen one is in scope, sodataCollection.urlQueryParamsapplies. The lint rulesdk/no-unfiltered-url-attributescatches a direct write, so look for a URL that goes through a helper or a variable first, a deprecated alias next to a filtered attribute, and a URL on a breadcrumb or an event. A value that cannot hold a query (a bare path, a queue URL) is fine. - Flag a span name built from a raw URL. A span name never holds a query string: use
stripUrlQueryAndFragment(). - Flag a SQL statement that reaches telemetry without sanitization:
db.query.text,db.query.summary, the span name, and a breadcrumb.getSqlQueryAttributes()andsanitizeSqlQuery()from@sentry/server-utilssanitize, andgetSqlSpanName()names the span from the sanitized attributes. Check each place the statement lands, sanitize each statement of a batch before the join, and pass the dialect (toSqlDialect()). Redis command text is not SQL and has its own path. This is not gated ondataCollection.databaseQueryData. - Collected data goes through the
dataCollection.*options. Do not suggest a new, parallel option.
Errors and logs
sdk/require-exception-mechanismchecks thatmechanism.handledandmechanism.typeare set. Check that thetypevalue follows the rule insdk-rules.md.- Flag a direct
console.*call in SDK source. UseDEBUG_BUILD && debug.*for SDK diagnostics, andconsoleSandbox(() => console.warn(...))for a warning that the user must see. - Automatic structured logs set
sentry.originwith an origin that follows the span origin rule.
Spans and attributes
- Flag a hard-coded attribute name or span op when
@sentry/conventionsexports a constant for it. Use the constant from@sentry/conventions/attributesor@sentry/conventions/op. The same rule for tests is under "Tests". - A new attribute or op that is not in
@sentry/conventionsneeds a link to the conventions PR that adds it. Ask for the link. - Flag
span.setAttribute(s)right after the span starts when the value was known at the start. Pass it in theattributesoption ofstartSpan,startSpanManual,startInactiveSpan, orstartIdleSpan, becausetracesSamplerandignoreSpanssee only the start attributes.
Platform-safe code
- Flag a Node-only import (
fs,path,node:*, and similar) in code that ships to the browser, Cloudflare, Deno, Bun, or Vercel Edge, also through shared code in@sentry/coreor@sentry/browser-utils. Put it behind a Node-only entry point. - Flag a top-level side effect (a call, a write to module state, an IIFE) in a module that a browser entry point reaches, also through shared code in
@sentry/coreor@sentry/browser-utils. It stops tree-shaking of the browser bundle. A server-only entry point is fine. sdk/require-timer-unrefcatches a directsetTimeoutorsetInterval. Flag a timer through a stored reference or a helper that is not unref'd withsafeUnref(), and anoxlint-disablefor that rule whose reason does not hold. Such a timer keeps a CLI or script from exiting.- Flag a new package, or a new
exportsentry underpackages/, that can load on a server runtime when its package has no entry inCASESorBUILD_TIME_CASESindev-packages/bundler-tests/tests/runtime-entries.test.ts. Browser-only packages are fine. - Flag a new option on an incoming HTTP request integration (Node
httpIntegration, DenodenoHttpIntegrationanddenoServeIntegration, BunbunHttpServerIntegrationandbunServerIntegration, CloudflarehttpServerIntegration) that applies to more than one runtime and is not inServerRequestOptions(packages/core/src/integrations/http/server-request-options.ts).
Breaking changes
- A removed public export or a changed default needs an entry in
MIGRATION.md. A deprecated export needs@deprecatedin its JSDoc.CHANGELOG.mdis written at release time, so do not ask for an entry.
These rules apply to each test file: unit tests, and each test and test app in dev-packages/.
- Flag a hard-coded attribute name or span op when
@sentry/conventionsexports a constant for it, also in an E2E test or a test app. Use the constant from@sentry/conventions/attributesor@sentry/conventions/op. - A
fixPR has a unit, integration, or E2E test that fails without the fix. AfeatPR has at least one integration or E2E test. - Flag a test that passes without the change: it asserts only that nothing threw, or it checks a payload with
expect.objectContainingand has no assertion for the data that the change adds or removes. - Flag a test that waits for a request only after the action that sends it, or that depends on the order of envelopes that can arrive in any order, or that sleeps for a fixed time. Start the wait before the action, and wait on a concrete event. A short fixed wait that proves that something did not happen is fine.
- Flag a module that loads cold inside a timed test callback when it can load at collection or in a setup hook. It can use up the timeout. Keep imports whose load time is what the test checks.
- In
dev-packages/node-integration-tests/suites/, flag a test that checks the Node version or the runtime itself (process.versions,process.env.RUNTIME,ctx.skip(), or a condition inskipIf/runIf). Usetest.runIf(supports({ ... }))fromutils/index.ts. - Flag a new Cloudflare test or E2E app variant that wraps the worker by hand with
withSentry,instrumentDurableObjectWithSentry,instrumentAgentWithSentry, orinstrumentWorkflowWithSentry. UsesentryCloudflareVitePlugin()from@sentry/cloudflare/viteand aninstrument.server.tsthat default-exportsdefineCloudflareOptions(...). Tests of these wrappers, and apps that do not build with Vite, are fine.
At most 3 findings, each l and optional, each with proof:
- Reuse: an existing helper does the same. Give its path, for example in
packages/core/src/utils/orpackages/browser-utils/. A reuse with a path is allowed, though it is a refactor. - Dead or unnecessary logic: give the type or the caller that proves it.
- Redundant config in tests: an option set to its default, or a default integration added again.
- What Oxlint, Oxfmt, TypeScript, size-limit, and CI enforce. Bundle size is for the size-limit check.
- Naming, multiple loops over one array,
anyand type casts, other code smells, and option or API design. Put a design question for a human into the questions for the human reviewer. - Secrets, ReDoS, injection, and GitHub Actions security. Other review bots check them.
- The PR title format. CI checks it. A title type that does not match the change is still a finding.
- Markdown files, except the
MIGRATION.mdcheck above. - Generated files, lockfiles, and files under a
vendor/orvendored/folder. A lockfile change still counts when the description does not explain it.